|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
wt.clients.beans.contentholder.WTContentHolder
WTContentHolder
is a JavaBean for manipulating objects
implementing the wt.content.ContentHolder
interface. This
class relies on being given a ContentHolder
object to
manipulate. The given ContentHolder
must be persistant
before any files or URLs can be associated with the ContentHolder. The
WTContentHolder
bean manipulates a content holding object
by being given either a ReferenceHandle
, which is a reference to a
ContentHolder
, or by being given the ContentHolder
object itself (see setContentReference( ReferenceHolder )
and
setContentHolder( ContentHolder )
).
Eg.
WTContentHolder content_holder = new WTContentHolder(); content_holder.setParentFrame( this ); content_holder.setParentApplet( my_parent_applet ); content_holder.setContentReference( my_content_reference ); add( "Center", content_holder );
package
,
ReferenceHolder
,
setContentHolder(wt.content.ContentHolder)
,
setContentReference(wt.clients.util.ReferenceHolder)
,
Serialized FormNested Class Summary | |
private class |
WTContentHolder.ActionThread
Inner class to provide support for asynchronous initialization and processing. |
(package private) class |
WTContentHolder.ContentHolderHandle
|
private class |
WTContentHolder.ContentItemEventHandler
Inner class used for listening to ContentItemEvents . |
(package private) class |
WTContentHolder.FileInfo
|
(package private) class |
WTContentHolder.SymAction
Class SymAction is an inner class which provides support
for listening to ActionEvents generated by the
buttons on this panel. |
(package private) class |
WTContentHolder.SymItem
|
(package private) class |
WTContentHolder.SymKey
|
(package private) class |
WTContentHolder.UploadListener
|
(package private) class |
WTContentHolder.WTComponentListener
|
Nested classes inherited from class java.awt.Panel |
Panel.AccessibleAWTPanel |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private static int |
ACTION
Defined constant used for referencing the "To-Do" column in the content multilist |
protected static String |
ADD_FILE_
Defined constant used for displaying an entry in the "To-Do" column of the multilist when a new file is to be added. |
(package private) Button |
addAddressButton
|
(package private) Panel |
addAddressButtonPanel
|
(package private) Button |
addFileButton
|
(package private) Panel |
addFileButtonPanel
|
(package private) Panel |
buttonPanel
|
(package private) symantec.itools.awt.shape.HorizontalLine |
buttonSeparator
|
private BatchContainer |
contentBatchContainer
Maintains the current state of the ContentItems as the
manipulations are applied to them. |
private ReferenceHolder |
contentHandle
Reference (or pointer) to the ContentHolder being manipulated. |
private com.objectspace.jgl.HashMap |
contentItems
HashMap of the action ContentItems associated with the
ContentHolder object. |
(package private) WTMultiList |
contentMultiList
|
private ThreadGroup |
contextGroup
ThreadGroup used in setting and getting the correct
WTContext . |
private Object |
contextLock
|
static int |
CREATE
Defined constant used for setting the mode of this WTContentHolder |
protected static int |
CREATE_FILE
Defined constant used for specifying which ActionThread
action to perform |
private static boolean |
DEBUG
Flag used to provide debugging messages. |
protected static int |
FILE_PROPERTIES
Defined constant used for specifying which ActionThread
action to perform |
private FileAccess |
fileAccess
Variable to hold access to local filesystem |
protected static int |
GET_FILE
Defined constant used for specifying which ActionThread
action to perform |
(package private) Button |
getButton
|
(package private) Panel |
getButtonPanel
|
(package private) Panel |
globalButtonPanel
|
private static String |
HELP_TARGET
Defined constant String which defines the name of the browser
window to launch online help in. |
private HelpContext |
helpContext
The HelpContext provides the context for determining which help messages to retrieve from the Help ResourceBundle |
private HelpSystem |
helpSystem
The HelpSystem managing access to online help, help status messages and tooltips for for this panel |
private IconCache |
iconCache
Cache of Images to be displayed in the list of
ContentItems |
protected static int |
INIT_CONTENT_ITEMS
Defined constant used for specifying which ActionThread
action to perform |
protected static int |
INIT_HELP
Defined constant used for specifying which ActionThread
action to perform |
private boolean |
intentToUpdate
Flag used to determine whether or not to set the INTENT_TO_CHANGE flag on ApplicationData items when uploaded and downloaded. |
private boolean |
isDirty
Flag used to indicate when changes have been made to this WTContentHolder
that have not yet been saved |
private static int |
keyColumn
Integer used for referencing the hidden column to maintain a hashmap key in the content multilist |
private static ResourceBundle |
messagesResource
The ResourceBundle containing localized error messages for this
WTContentHolder |
private int |
mode
The current mode; Used to determine which actions to display in this panel |
private static int |
MODIFY_DATE
Defined constant used for referencing the "Modified Date" column in the content multilist |
(package private) Panel |
multiListPanel
|
private static int |
NAME
Defined constant used for referencing the "Name" column in the content multilist |
protected static String |
NEW_FILE_
Defined constant displayed as the name of place-holder file in the multilist when the user invokes the 'Add File' action. |
private Applet |
parentApplet
The parent Applet used to provide context for this panel |
private Frame |
parentFrame
The parent Frame used for launching other dialogs from
this panel |
protected static String |
PREF_KEY_DOWNLOADOPTYPE
|
protected static String |
PREF_KEY_WORKSPACEPATH
|
protected static String |
PREF_NODE
Defined constants to use in retrieving preferences values |
private static int |
PREFERRED_BUTTON_WIDTH
Defined integer constant maintaining the preferred width of the buttons on the panel |
(package private) Button |
propertiesButton
|
(package private) Panel |
propertiesButtonPanel
|
(package private) Button |
removeButton
|
(package private) Panel |
removeButtonPanel
|
protected static String |
REPLACE_FILE_
Defined constant used for displaying an entry in the "To-Do" column of the multilist when a file is selected to be replaced. |
(package private) Button |
replaceButton
|
(package private) Panel |
replaceButtonPanel
|
(package private) Button |
resetButton
|
private static String |
RESOURCES
Defined constant used for referencing the ResourceBundle class for this
WTContentHolder |
protected static int |
SAVE_CONTENT
Defined constant used for specifying which ActionThread
action to perform |
(package private) Button |
saveButton
|
private static String |
SECONDARY_EXCLUDE
|
private TransactionContainer |
transactionContainer
Maintains all of the transactions (manipulations) made on the ContentHolder object -- provides for the saving of
multiple manipulations in one transaction to the server |
static int |
UPDATE
Defined constant used for setting the mode of this WTContentHolder |
protected static int |
URL_PROPERTIES
Defined constant used for specifying which ActionThread
action to perform |
private static String |
versionID
|
static int |
VIEW
Defined constant used for setting the mode of this WTContentHolder |
private int |
waitingOnContext
|
Fields inherited from class java.awt.Panel |
|
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
WTContentHolder()
Default no-arg constructor |
Method Summary | |
(package private) void |
addAddressButton_Action(ActionEvent event)
Method addAdressButton_Action is a call-back method that
is invoked in response to the 'Add URL' button being pressed. |
(package private) void |
addAddressButton_KeyPressed(KeyEvent event)
|
(package private) void |
addFileButton_Action(ActionEvent event)
|
(package private) void |
addFileButton_KeyPressed(KeyEvent event)
|
void |
addHelpListener(PropertyChangeListener pcl)
Method addHelpListener adds the given listener to be notified
of PropertyChangeEvents in the help system. |
void |
addNotify()
|
private void |
addToList(int row,
ContentItem item)
|
void |
allowAddActions(boolean enable)
allowAddActions controls whether or not the
ability to add files and add addresses is available in this
WTContentHolder . |
void |
allowPropertiesAction(boolean enable)
allowPropertiesActions controls whether or not the
ability to view properties of and retrieve ContentItems (i.e. |
void |
allowRemoveActions(boolean enable)
allowRemoveActions controls whether or not the
ability to remove ContentItems (i.e. |
void |
allowUpdateActions(boolean enable)
allowUpdateActions controls whether or not the
ability to replace ContentItems (i.e. |
(package private) void |
contentMultiList_actionPerformed(ActionEvent event)
|
(package private) void |
contentMultiList_itemStateChanged(ItemEvent event)
|
private String |
createFileURLString(String fileString)
|
String |
createValidDefaultPath(String path)
Given a filepath, strip the filename and find out whether the directory path exists locally |
private void |
dispatchRefreshEvent(int action,
Object object)
|
private void |
displayAddressProperties(URLData address)
Method displayAddressProperties launches a dialog
which displays the properties of the given URLData . |
private void |
displayFileProperties(ApplicationData file)
|
void |
enableGlobalButtons(boolean enable)
Method enableGlobalButtons provides support for
enabling and disabling the 'Save' and 'Refresh' buttons. |
void |
enablePanelActions(boolean enable)
enablePanelActions provides a means to enable and disable
the actions (buttons) available on the WTContentHolder
panel. |
private String |
formatContentItem(ContentItem contentItem)
|
private String |
formatDate(Date time)
|
(package private) void |
getButton_Action(ActionEvent event)
|
(package private) void |
getButton_KeyPressed(KeyEvent event)
|
ContentHolder |
getContentHolder()
Get the ContentHolder object which is the target of
interactions with this WTContentHolder . |
ReferenceHolder |
getContentReference()
Get the ReferenceHolder object which is holds the
reference to the ContentHolder which is the target of
interactions with this WTContentHolder . |
private WTContext |
getContext()
|
private void |
getFile(ApplicationData appData)
|
private FileAccess |
getFileAccess()
|
private void |
getFiles(Vector files)
|
private Vector |
getFilesToReplace()
|
HelpContext |
getHelpContext()
Retrieve the HelpContext being used to display help messages and online help. |
int |
getMode()
Returns the current mode of this WTContentHolder . |
private String |
getObjectKey(ContentItem content_item)
getObjectKey returns a String value which is
used as the key for placing ContentItems into and
getting ContentItems from the HashMap of
ContentItems associated with the ContentHolder . |
private String |
getOIDString(ContentItem contentItem)
|
Applet |
getParentApplet()
Returns the parent Applet associated with this
WTContentHolder panel. |
Frame |
getParentFrame()
Gets the parent Frame of the panel. |
String |
getPreferenceValue(WTPreferences node,
String key,
String defaultValue)
Given node and key, return preference value |
private Image |
getStandardIcon(Class a_class)
|
private Image |
getStandardIcon(ContentItem content)
|
private void |
handleCreateEvent(ContentItem new_content)
|
private void |
handleUpdateEvent(ContentItem updated_content)
|
private void |
initButtonSizes()
Initializes the sizes of the buttons displayed on this panel. |
private void |
initContentItems()
Method initContentItems retrieves the ContentItems
associated with the ContentHolder . |
private void |
initContentTable()
Method initContentTable initializes the list of
ContentItems associated with the ContentHolder . |
private void |
initializeHelp()
|
private void |
initializeIconCache()
initializeIconCache initializes a HashMap of icons associated
with file formats. |
private void |
initMultiList()
initMultiList initializes the multilist of ContentItems
to include a hidden column which maintains the key into the hashmap of
ContentItems associated with the ContentHolder . |
private void |
initResources()
initResources initializes the ResourceBundle used for
providing localized error-messages and feedback. |
boolean |
isDirectory(String path)
|
boolean |
isDirty()
isDirty returns a boolean value which indicates whether or not
any modifications have been made to the ContentHolder since
the last save. |
boolean |
isMarkIntentToUpdate()
Returns a boolean flag indicating whether or not the INTENT_TO_CHANGE flag on ApplicationData items is updated when an ApplicationData item is uploaded or downloaded. |
private void |
localize()
Method localize translates the field labels and button labels of this
panel according to the Locale of the client. |
private WTContentHolder.FileInfo |
locateFile(ContentHolder contentHolder,
ContentItem contentItem)
|
static void |
main(String[] args)
|
private void |
openURL(URLData url_data)
|
void |
paint(Graphics g)
|
ContentHolder |
persistContentChanges()
persistContentChanges persists changes made to the associated
ContentHolder . |
private void |
processAddFileCommand()
|
private void |
processAddUrlCommand()
Method processAddUrlCommand attempts to add a new URL to
the ContentHolder . |
private void |
processGetCommand()
|
private void |
processPropertiesCommand()
Method processPropertiesCommand displays the properties
of the selected ContentItem . |
private void |
processRemoveCommand()
|
private void |
processReplaceCommand()
|
private void |
processResetCommand()
|
private void |
processSaveCommand()
|
(package private) void |
propertiesButton_Action(ActionEvent event)
Call-back method invoked in response to an ActionEvent
on the Properties button. |
(package private) void |
propertiesButton_KeyPressed(KeyEvent event)
|
void |
refresh()
Method refresh refreshes the display of this
WTContentHolder . |
(package private) void |
removeButton_Action(ActionEvent event)
|
(package private) void |
removeButton_KeyPressed(KeyEvent event)
|
void |
removeHelpListener(PropertyChangeListener pcl)
Method removeHelpListener removes a listener which was being
notified of PropertyChangeEvents in the help system. |
(package private) void |
replaceButton_Action(ActionEvent event)
|
(package private) void |
replaceButton_KeyPressed(KeyEvent event)
|
(package private) void |
resetButton_Action(ActionEvent event)
|
(package private) void |
resetButton_KeyPressed(KeyEvent event)
|
WTPreferences |
retrievePreferences(String node)
Retrieve the preferences for the designated node |
(package private) void |
saveButton_Action(ActionEvent event)
|
(package private) void |
saveButton_KeyPressed(KeyEvent event)
|
private void |
saveContentChanges()
|
void |
setContentHolder(ContentHolder content_holder)
Sets the ContentHolder object which is the target of
interactions with the WTContentHolder . |
void |
setContentReference(ReferenceHolder content_handle)
Sets the ReferenceHolder object which contains the
ContentHolder that is the target of
interactions with this WTContentHolder . |
private void |
setIntentToUpdate(Vector files,
boolean intention)
|
void |
setMarkIntentToUpdate(boolean update)
Sets whether or not this WTContentHolder should set the INTENT_TO_CHANGE flag on ApplicationData (files). |
void |
setMode(int mode)
Sets the current mode of this WTContentHolder . |
void |
setParentApplet(Applet parent_applet)
Sets the Applet parent of this panel. |
void |
setParentFrame(Frame frame)
Sets the parent Frame of this panel. |
private void |
shiftMultiListEntries()
|
private void |
showMessageDialog(String message,
boolean modal)
|
void |
showSaveButton(boolean enable)
Method showSaveButton provides support for
showing and hiding the 'Save' button. |
private void |
updateColors(Color color)
|
private void |
updateContentItems()
|
private void |
uploadContentItems()
|
private boolean |
validateContentHolder()
|
Methods inherited from class java.awt.Panel |
getAccessibleContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String versionID
Panel multiListPanel
WTMultiList contentMultiList
Panel buttonPanel
Panel addFileButtonPanel
Button addFileButton
Panel addAddressButtonPanel
Button addAddressButton
Panel removeButtonPanel
Button removeButton
Panel replaceButtonPanel
Button replaceButton
Panel getButtonPanel
Button getButton
Panel propertiesButtonPanel
Button propertiesButton
symantec.itools.awt.shape.HorizontalLine buttonSeparator
Panel globalButtonPanel
Button saveButton
Button resetButton
private static boolean DEBUG
private static String SECONDARY_EXCLUDE
public static final int CREATE
WTContentHolder
public static final int UPDATE
WTContentHolder
public static final int VIEW
WTContentHolder
protected static final int INIT_CONTENT_ITEMS
ActionThread
action to perform
protected static final int INIT_HELP
ActionThread
action to perform
protected static final int CREATE_FILE
ActionThread
action to perform
protected static final int GET_FILE
ActionThread
action to perform
protected static final int SAVE_CONTENT
ActionThread
action to perform
protected static final int FILE_PROPERTIES
ActionThread
action to perform
protected static final int URL_PROPERTIES
ActionThread
action to perform
private static int NAME
private static int MODIFY_DATE
private static int ACTION
protected static String ADD_FILE_
protected static String REPLACE_FILE_
protected static String NEW_FILE_
private static final String HELP_TARGET
String
which defines the name of the browser
window to launch online help in.
private static final String RESOURCES
ResourceBundle
class for this
WTContentHolder
private static ResourceBundle messagesResource
ResourceBundle
containing localized error messages for this
WTContentHolder
private static int PREFERRED_BUTTON_WIDTH
protected static String PREF_NODE
protected static String PREF_KEY_DOWNLOADOPTYPE
protected static String PREF_KEY_WORKSPACEPATH
private FileAccess fileAccess
private int mode
private boolean isDirty
WTContentHolder
that have not yet been saved
private static int keyColumn
private ReferenceHolder contentHandle
ContentHolder
being manipulated.
From a Java language perspective, this is a reference to a reference to an
object.
private com.objectspace.jgl.HashMap contentItems
ContentItems
associated with the
ContentHolder
object.
private TransactionContainer transactionContainer
ContentHolder
object -- provides for the saving of
multiple manipulations in one transaction to the server
private BatchContainer contentBatchContainer
ContentItems
as the
manipulations are applied to them. Along with the
TransactionContainer
, this container provides for the
saving of multiple manipulations on the ContentItems
in
one transaction
private IconCache iconCache
Images
to be displayed in the list of
ContentItems
private Applet parentApplet
Applet
used to provide context for this panel
private Frame parentFrame
Frame
used for launching other dialogs from
this panel
private HelpSystem helpSystem
private HelpContext helpContext
ResourceBundle
private boolean intentToUpdate
private Object contextLock
private int waitingOnContext
private ThreadGroup contextGroup
ThreadGroup
used in setting and getting the correct
WTContext
.
Constructor Detail |
public WTContentHolder()
Method Detail |
private void initResources()
initResources
initializes the ResourceBundle
used for
providing localized error-messages and feedback.
ResourceBundle
private void localize()
localize
translates the field labels and button labels of this
panel according to the Locale
of the client.
initResources()
private void initMultiList()
initMultiList
initializes the multilist of ContentItems
to include a hidden column which maintains the key into the hashmap of
ContentItems
associated with the ContentHolder
.
This method also localizes the column labels of the multilist and attempts to
resize the columns of the multilist according to the width of this panel.
symantec.itools.awt.Multilist
public static void main(String[] args)
public int getMode()
WTContentHolder
. The mode
indicates what actions are available in this WTContentHolder
panel.
int
value of current mode -- valid values are
CREATE, UPDATE and VIEWsetMode(int)
public void setMode(int mode)
WTContentHolder
. The mode
indicates what actions are available in this WTContentHolder
panel. Valid modes are : WTContentHolder.VIEW - allows Properties
and Get. WTContentHolder.CREATE - allows Add File, Add Address, Remove and
Properties. WTContentHolder.UPDATE - allows Add File, Add Address,
Remove, Replace, Properties and Get
mode
- int
mode of WTContentHolder
getMode()
public ContentHolder getContentHolder()
ContentHolder
object which is the target of
interactions with this WTContentHolder
.
setContentHolder(wt.content.ContentHolder)
,
ContentHolder
public ReferenceHolder getContentReference()
ReferenceHolder
object which is holds the
reference to the ContentHolder
which is the target of
interactions with this WTContentHolder
.
Manipulating content via a ReferenceHolder
is useful
if other frames or dialogs also have their own copy of the
ContentHolder
object. For example, if this
WTContentHolder
panel is placed inside a Frame
that has its own copy of the ContentHolder
to be
manipulated, if both the frame and this WTContentHolder
manipulate the ContentHolder
via the ReferenceHolder
,
then both will be manipulating the same copy of the ContentHolder
object. This will prevent either component from having a stale copy
of the ContentHolder
object, and will keep both views of
the object in sync.
setContentReference(wt.clients.util.ReferenceHolder)
,
ReferenceHolder
,
ContentHolder
public void setContentHolder(ContentHolder content_holder) throws WTPropertyVetoException
ContentHolder
object which is the target of
interactions with the WTContentHolder
. Setting the
ContentHolder
causes this WTContentHolder
panel to be initialized with the ContentItems
of
the given ContentHolder
. If the given
ContentHolder
is not persistent, an exception will be
thrown.
content_holder
- ContentHolder to which interactions with the
WTContentHolder
are applied.
WTPropertyVetoException
- if the given ContentHolder is not
persistentgetContentHolder()
,
setContentReference(wt.clients.util.ReferenceHolder)
public void setContentReference(ReferenceHolder content_handle) throws WTPropertyVetoException
ReferenceHolder
object which contains the
ContentHolder
that is the target of
interactions with this WTContentHolder
. Using the
ReferenceHolder
as opposed to directly manipulating
the ContentHolder
provides support for multiple
objects having a reference to the same copy of the
ContentHolder
. After setting the ReferenceHolder
,
this method causes this WTContentHolder
panel to be
initialized with the ContentItems
of the given
ContentHolder
. If the given ReferenceHolder
contains a pointer to an object that is not a ContentHolder
,
or contains a pointer to a ContentHolder
that is not persistent,
an exception will be thrown.
content_handle
- ReferenceHolder containing a reference to the
ContentHolder
to which interactions with this
WTContentHolder
are applied.
WTPropertyVetoException
- if the given ReferenceHolder contains a
reference to an object that is not a ContentHolder
or
contains a reference to a non-persistent ContentHolder
getContentReference()
,
setContentHolder(wt.content.ContentHolder)
public Applet getParentApplet()
Applet
associated with this
WTContentHolder
panel.
Applet
parentsetParentApplet(java.applet.Applet)
public void setParentApplet(Applet parent_applet)
Applet
parent of this panel. Since the
containing parent of this WTContentHolder
may not
necessarily be an Applet
, the parenting
Applet
must be explicitly set. The parent
Applet
is used in getting the appropriate WTContext
and the corresponding AppletContext
.
parent_applet
- the Applet
parent of this panelgetParentApplet()
,
Applet
,
WTContext
public void setParentFrame(Frame frame)
Frame
of this panel. The parent
Frame
should be set if the WTContentHolder
panel is nested inside of a free-floating frame. If no parent frame
is given, but a parent applet has been set, then a frame will try to
be retrieved from the parent applet.
frame
- the Frame
parentgetParentFrame()
,
setParentApplet(java.applet.Applet)
,
Frame
public Frame getParentFrame()
Frame
of the panel. The parent
frame, if set, is used in displaying message dialogs. If the
parent frame has not been explicitly set, but the parent applet
has been explicitly set, this method will try to retrieve a
Frame
from the parent applet.
Frame
parentsetParentFrame(java.awt.Frame)
,
setParentApplet(java.applet.Applet)
public void setMarkIntentToUpdate(boolean update)
update
- if true, the INTENT_TO_CHANGE flag will be set
when ApplicationData items are uploaded and
downloaded.public boolean isMarkIntentToUpdate()
public void allowAddActions(boolean enable)
allowAddActions
controls whether or not the
ability to add files and add addresses is available in this
WTContentHolder
. If the given boolean
is false
, the buttons to add files and addresses are
removed from this panel. If the given boolean
is
true
, the buttons to add files and addresses are
visible in this panel. Note that the buttons are not simply
made enabled and disabled, but are rather made visible and invisible
in the panel.
enable
- boolean indicating whether or not add actions are available.allowRemoveActions(boolean)
,
allowUpdateActions(boolean)
,
#allowPropertiesActions
public void allowRemoveActions(boolean enable)
allowRemoveActions
controls whether or not the
ability to remove ContentItems
(i.e. files and
URLs) is available in this WTContentHolder
. If
the given boolean
is false
, the button
to remove files and URLs is removed from this panel. If the
given boolean
is true
, the button to remove
files and URLs is visible in this panel. Note that the button is
not simply made enabled and disabled, but is rather made visible and
invisible in the panel.
enable
- boolean indicating whether or not the remove action is available.allowAddActions(boolean)
,
allowUpdateActions(boolean)
,
#allowPropertiesActions
public void allowUpdateActions(boolean enable)
allowUpdateActions
controls whether or not the
ability to replace ContentItems
(i.e. files
and URLs) is available in this WTContentHolder
.
If the given boolean
is false
, the buttons
to update and replace files and addresses are removed from the panel.
If the given boolean
is true
, the buttons to
update and replace files and addresses are visible in the panel. Note
that the buttons are not simply made enabled and disabled, but are rather
made visible and invisible in the panel.
enable
- boolean indicating whether or not the remove action
is available.allowAddActions(boolean)
,
allowRemoveActions(boolean)
,
#allowPropertiesActions
public void allowPropertiesAction(boolean enable)
allowPropertiesActions
controls whether or not the
ability to view properties of and retrieve ContentItems
(i.e.
files and URLs) is available in this WTContentHolder
.
If the given boolean
is false
, the buttons
to view properties and get ContentItems are removed from the panel. If
the given boolean
is true
, the buttons to view
properties and get content items are visible in this panel. Note that
the buttons are not simply made enabled and disabled, but are rather
made visible and invisible in the panel.
enable
- boolean indicating whether or not the view properties and
get actions are available.allowAddActions(boolean)
,
allowRemoveActions(boolean)
,
#allowUpdatedActions
private void initContentItems()
initContentItems
retrieves the ContentItems
associated with the ContentHolder
. The ContentItems
are retrieved and maintained in a HashMap
.
ContentItem
,
ContentHolder
,
HashMap
private void initContentTable()
initContentTable
initializes the list of
ContentItems
associated with the ContentHolder
.
ContentItem
,
ContentHolder
private String getObjectKey(ContentItem content_item)
getObjectKey
returns a String
value which is
used as the key for placing ContentItems
into and
getting ContentItems
from the HashMap
of
ContentItems
associated with the ContentHolder
.
content_item
- the ContentItem for which to get a keyContentItem
,
ContentHolder
,
HashMap
public boolean isDirty()
isDirty
returns a boolean value which indicates whether or not
any modifications have been made to the ContentHolder
since
the last save. isDirty
could be used by the container of this
panel to determine whether or not to prompt the user to save his/her changes.
ContentHolder
that have not been saved, then true
is returned.
Otherwise, false
is returned.private void initializeIconCache()
initializeIconCache
initializes a HashMap of icons associated
with file formats. The HashMap is used for retrieving the icon associated
with a particular ContentItem
.
HashMap
void propertiesButton_Action(ActionEvent event)
ActionEvent
on the Properties button. This method invokes
processPropertiesCommand
to display the properties
of the selected ContentItem
ActionEvent
private void processPropertiesCommand()
processPropertiesCommand
displays the properties
of the selected ContentItem
.
void addAddressButton_Action(ActionEvent event)
addAdressButton_Action
is a call-back method that
is invoked in response to the 'Add URL' button being pressed. This
method invokes the processAddUrlCommand
method to add
a new URL.
event
- The ActionEvent
which resulted in this
method being invoked.ActionEvent
,
processAddUrlCommand()
private void processAddUrlCommand()
processAddUrlCommand
attempts to add a new URL to
the ContentHolder
. This method first validates that a
ContentHolder
has been supplied to this panel, and then
launches the AddressPropertiesDialog
to add a new URL.
private void displayAddressProperties(URLData address)
displayAddressProperties
launches a dialog
which displays the properties of the given URLData
.
If this panel is currently in a VIEW mode, the dialog launched
will be a read-only display of the URL's properties. Otherwise,
the dialog will allow the user to modify the URL's properties.
address
- The URL whose properties are to be displayedprivate void displayFileProperties(ApplicationData file)
void addFileButton_Action(ActionEvent event)
private void processAddFileCommand()
void getButton_Action(ActionEvent event)
private void processGetCommand()
private void updateContentItems()
private void addToList(int row, ContentItem item)
private WTContext getContext()
private void handleCreateEvent(ContentItem new_content)
private void handleUpdateEvent(ContentItem updated_content)
public ContentHolder persistContentChanges() throws PropertyVetoException, WTException
persistContentChanges
persists changes made to the associated
ContentHolder
. Manipulations of the ContentHolder
(i.e. adding files and URLs, updating properties, removing files and URLs) are
stored up (batched) until either this method is invoked, or the 'Save' button
contained in this panel is pressed. When persistContentChanges
is invoked, the stored manipulations are made persistent, and any pending
upload actions (resulting from the user either choosing to add a file or to
replace a file) are initiated.
This method provides a programmatic means for invoking the same actions that
occur when the user of this WTContentHolder
presses the 'Save'
button. The container in which this WTContentHolder
is placed
can programmatically determine when changes have been made to the content
(via isDirty
) and can programmatically persist these changes.
For example:
Frame my_frame = new Frame("Content"); WTContentHolder my_content_holder = new WTContentHolder(); ... my_frame.add( "Center", my_content_holder ); ... if( my_content_holder.isDirty() ) { if( promptUserToSaveContentChanges () ) { try { my_content_object = my_content_holder.persistContentChanges(); } catch (Exception e) { ... } } }
This method updates the ContentHolder
that is referenced by the
ReferenceHolder
and returns that updated ContentHolder
.
The return value of this method is only needed if the container of this
WTContentHolder
initialized this WTContentHolder
with
an actual ContentHolder
object and not a ReferenceHolder
.
After the content changes have been saved, the list of ContentItems
displayed by this panel is updated.
ContentHolder
PropertyVetoException
- thrown if attempt to save content
changes fails
WTException
- thrown if attempt to save content changes failsisDirty
private void saveContentChanges() throws PropertyVetoException, WTException
PropertyVetoException
WTException
private String formatDate(Date time)
private boolean validateContentHolder()
void removeButton_Action(ActionEvent event)
private void processRemoveCommand()
public void enablePanelActions(boolean enable)
enablePanelActions
provides a means to enable and disable
the actions (buttons) available on the WTContentHolder
panel. Note that this method is different from the allowXXXXActions
methods in that this method only enables/disables the buttons while the
allowXXXXActions
methods make the buttons visible/invisible.
enable
- boolean
value indicating whether the actions should
be enabled (enable = true
) or disabled (
enable = false
)allowAddActions(boolean)
,
allowRemoveActions(boolean)
,
allowUpdateActions(boolean)
,
#allowPropertiesActions
void replaceButton_Action(ActionEvent event)
private void processReplaceCommand()
private void setIntentToUpdate(Vector files, boolean intention)
public WTPreferences retrievePreferences(String node)
node
- the string for the preference node desired
public String getPreferenceValue(WTPreferences node, String key, String defaultValue)
node
- the preference nodekey
- the key of the desired value within that node
public String createValidDefaultPath(String path)
path
- the filepath
public boolean isDirectory(String path)
private FileAccess getFileAccess()
private void getFile(ApplicationData appData)
private void getFiles(Vector files)
private void dispatchRefreshEvent(int action, Object object)
private Image getStandardIcon(ContentItem content)
private Image getStandardIcon(Class a_class)
private void openURL(URLData url_data) throws MalformedURLException, WTException
MalformedURLException
WTException
public void addNotify()
void resetButton_Action(ActionEvent event)
private void processResetCommand()
void saveButton_Action(ActionEvent event)
private void processSaveCommand()
private void showMessageDialog(String message, boolean modal)
private Vector getFilesToReplace()
public void refresh()
refresh
refreshes the display of this
WTContentHolder
. The multilist is re-initialized
to set the column headings and sizes appropriately, and this
panel is repainted.
public void enableGlobalButtons(boolean enable)
enableGlobalButtons
provides support for
enabling and disabling the 'Save' and 'Refresh' buttons. Note
that the 'Save' and 'Refresh' buttons are not visible when
this WTContentHolder
is in VIEW mode.
enable
- if true
, the Save and Reset
buttons are enabled; if false
, the
buttons are disabledpublic void showSaveButton(boolean enable)
showSaveButton
provides support for
showing and hiding the 'Save' button. Note
that the 'Save' button is not visible when
this WTContentHolder
is in VIEW mode.
enable
- if true
, the Save
button is visible; if false
, the
button is hiddenprivate void initializeHelp()
public void addHelpListener(PropertyChangeListener pcl)
addHelpListener
adds the given listener to be notified
of PropertyChangeEvents
in the help system. Tool description
PropertyChangeEvents
are generated when the user mouses over
the buttons and list of ContentItems
in this panel. The
given listener will be notified of those events.
pcl
- The PropertyChangeListener
to be notified of
PropertyChangeEvents
generated by the help system.removeHelpListener(java.beans.PropertyChangeListener)
,
HelpSystem
,
HelpContext
,
PropertyChangeListener
public void removeHelpListener(PropertyChangeListener pcl)
removeHelpListener
removes a listener which was being
notified of PropertyChangeEvents
in the help system. If
the given listener is not currently a listener, no changes are made.
pcl
- the PropertyChangeListener
to be removed as a
listener of events generated by the help system of this panel.addHelpListener(java.beans.PropertyChangeListener)
,
PropertyChangeListener
void contentMultiList_itemStateChanged(ItemEvent event)
private void updateColors(Color color)
void addAddressButton_KeyPressed(KeyEvent event)
void addFileButton_KeyPressed(KeyEvent event)
private void shiftMultiListEntries()
private void initButtonSizes()
localize
method, the
width of the buttons could be affected, potentially causing the widths
of the buttons to be different from one another.
void contentMultiList_actionPerformed(ActionEvent event)
void replaceButton_KeyPressed(KeyEvent event)
void getButton_KeyPressed(KeyEvent event)
void saveButton_KeyPressed(KeyEvent event)
void resetButton_KeyPressed(KeyEvent event)
void propertiesButton_KeyPressed(KeyEvent event)
void removeButton_KeyPressed(KeyEvent event)
public HelpContext getHelpContext()
public void paint(Graphics g)
private void uploadContentItems() throws WTException
WTException
private String createFileURLString(String fileString)
private String getOIDString(ContentItem contentItem)
private String formatContentItem(ContentItem contentItem)
private WTContentHolder.FileInfo locateFile(ContentHolder contentHolder, ContentItem contentItem)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |