wt.clients.beans.contentholder
Class WTContentHolder

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bywt.clients.beans.contentholder.WTContentHolder
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class WTContentHolder
extends Panel

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 );
  


Supported API: false

Extendable: false

See Also:
package, ReferenceHolder, setContentHolder(wt.content.ContentHolder), setContentReference(wt.clients.util.ReferenceHolder), Serialized Form

Nested 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.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values

multiListPanel

Panel multiListPanel

contentMultiList

WTMultiList contentMultiList

buttonPanel

Panel buttonPanel

addFileButtonPanel

Panel addFileButtonPanel

addFileButton

Button addFileButton

addAddressButtonPanel

Panel addAddressButtonPanel

addAddressButton

Button addAddressButton

removeButtonPanel

Panel removeButtonPanel

removeButton

Button removeButton

replaceButtonPanel

Panel replaceButtonPanel

replaceButton

Button replaceButton

getButtonPanel

Panel getButtonPanel

getButton

Button getButton

propertiesButtonPanel

Panel propertiesButtonPanel

propertiesButton

Button propertiesButton

buttonSeparator

symantec.itools.awt.shape.HorizontalLine buttonSeparator

globalButtonPanel

Panel globalButtonPanel

saveButton

Button saveButton

resetButton

Button resetButton

DEBUG

private static boolean DEBUG
Flag used to provide debugging messages.


SECONDARY_EXCLUDE

private static String SECONDARY_EXCLUDE

CREATE

public static final int CREATE
Defined constant used for setting the mode of this WTContentHolder

See Also:
Constant Field Values

UPDATE

public static final int UPDATE
Defined constant used for setting the mode of this WTContentHolder

See Also:
Constant Field Values

VIEW

public static final int VIEW
Defined constant used for setting the mode of this WTContentHolder

See Also:
Constant Field Values

INIT_CONTENT_ITEMS

protected static final int INIT_CONTENT_ITEMS
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

INIT_HELP

protected static final int INIT_HELP
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

CREATE_FILE

protected static final int CREATE_FILE
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

GET_FILE

protected static final int GET_FILE
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

SAVE_CONTENT

protected static final int SAVE_CONTENT
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

FILE_PROPERTIES

protected static final int FILE_PROPERTIES
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

URL_PROPERTIES

protected static final int URL_PROPERTIES
Defined constant used for specifying which ActionThread action to perform

See Also:
Constant Field Values

NAME

private static int NAME
Defined constant used for referencing the "Name" column in the content multilist


MODIFY_DATE

private static int MODIFY_DATE
Defined constant used for referencing the "Modified Date" column in the content multilist


ACTION

private static int ACTION
Defined constant used for referencing the "To-Do" column in the content multilist


ADD_FILE_

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.


REPLACE_FILE_

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.


NEW_FILE_

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.


HELP_TARGET

private static final String HELP_TARGET
Defined constant String which defines the name of the browser window to launch online help in.

See Also:
Constant Field Values

RESOURCES

private static final String RESOURCES
Defined constant used for referencing the ResourceBundle class for this WTContentHolder

See Also:
Constant Field Values

messagesResource

private static ResourceBundle messagesResource
The ResourceBundle containing localized error messages for this WTContentHolder


PREFERRED_BUTTON_WIDTH

private static int PREFERRED_BUTTON_WIDTH
Defined integer constant maintaining the preferred width of the buttons on the panel


PREF_NODE

protected static String PREF_NODE
Defined constants to use in retrieving preferences values


PREF_KEY_DOWNLOADOPTYPE

protected static String PREF_KEY_DOWNLOADOPTYPE

PREF_KEY_WORKSPACEPATH

protected static String PREF_KEY_WORKSPACEPATH

fileAccess

private FileAccess fileAccess
Variable to hold access to local filesystem


mode

private int mode
The current mode; Used to determine which actions to display in this panel


isDirty

private boolean isDirty
Flag used to indicate when changes have been made to this WTContentHolder that have not yet been saved


keyColumn

private static int keyColumn
Integer used for referencing the hidden column to maintain a hashmap key in the content multilist


contentHandle

private ReferenceHolder contentHandle
Reference (or pointer) to the ContentHolder being manipulated. From a Java language perspective, this is a reference to a reference to an object.


contentItems

private com.objectspace.jgl.HashMap contentItems
HashMap of the action ContentItems associated with the ContentHolder object.


transactionContainer

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


contentBatchContainer

private BatchContainer contentBatchContainer
Maintains the current state of the 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


iconCache

private IconCache iconCache
Cache of Images to be displayed in the list of ContentItems


parentApplet

private Applet parentApplet
The parent Applet used to provide context for this panel


parentFrame

private Frame parentFrame
The parent Frame used for launching other dialogs from this panel


helpSystem

private HelpSystem helpSystem
The HelpSystem managing access to online help, help status messages and tooltips for for this panel


helpContext

private HelpContext helpContext
The HelpContext provides the context for determining which help messages to retrieve from the Help ResourceBundle


intentToUpdate

private boolean intentToUpdate
Flag used to determine whether or not to set the INTENT_TO_CHANGE flag on ApplicationData items when uploaded and downloaded.


contextLock

private Object contextLock

waitingOnContext

private int waitingOnContext

contextGroup

private ThreadGroup contextGroup
ThreadGroup used in setting and getting the correct WTContext.

Constructor Detail

WTContentHolder

public WTContentHolder()
Default no-arg constructor

Method Detail

initResources

private void initResources()
initResources initializes the ResourceBundle used for providing localized error-messages and feedback.

See Also:
ResourceBundle

localize

private void localize()
Method localize translates the field labels and button labels of this panel according to the Locale of the client.

See Also:
initResources()

initMultiList

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.

See Also:
symantec.itools.awt.Multilist

main

public static void main(String[] args)

getMode

public int getMode()
Returns the current mode of this WTContentHolder. The mode indicates what actions are available in this WTContentHolder panel.

Returns:
int value of current mode -- valid values are CREATE, UPDATE and VIEW
See Also:
setMode(int)

setMode

public void setMode(int mode)
Sets the current mode of this 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

Parameters:
mode - int mode of WTContentHolder
See Also:
getMode()

getContentHolder

public ContentHolder getContentHolder()
Get the ContentHolder object which is the target of interactions with this WTContentHolder.

Returns:
ContentHolder
See Also:
setContentHolder(wt.content.ContentHolder), ContentHolder

getContentReference

public ReferenceHolder getContentReference()
Get the 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.

Returns:
ReferenceHolder
See Also:
setContentReference(wt.clients.util.ReferenceHolder), ReferenceHolder, ContentHolder

setContentHolder

public void setContentHolder(ContentHolder content_holder)
                      throws WTPropertyVetoException
Sets the 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.

Parameters:
content_holder - ContentHolder to which interactions with the WTContentHolder are applied.
Throws:
WTPropertyVetoException - if the given ContentHolder is not persistent
See Also:
getContentHolder(), setContentReference(wt.clients.util.ReferenceHolder)

setContentReference

public void setContentReference(ReferenceHolder content_handle)
                         throws WTPropertyVetoException
Sets the 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.

Parameters:
content_handle - ReferenceHolder containing a reference to the ContentHolder to which interactions with this WTContentHolder are applied.
Throws:
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
See Also:
getContentReference(), setContentHolder(wt.content.ContentHolder)

getParentApplet

public Applet getParentApplet()
Returns the parent Applet associated with this WTContentHolder panel.

Returns:
Applet parent
See Also:
setParentApplet(java.applet.Applet)

setParentApplet

public void setParentApplet(Applet parent_applet)
Sets the 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.

Parameters:
parent_applet - the Applet parent of this panel
See Also:
getParentApplet(), Applet, WTContext

setParentFrame

public void setParentFrame(Frame frame)
Sets the parent 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.

Parameters:
frame - the Frame parent
See Also:
getParentFrame(), setParentApplet(java.applet.Applet), Frame

getParentFrame

public Frame getParentFrame()
Gets the parent 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.

Returns:
the Frame parent
See Also:
setParentFrame(java.awt.Frame), setParentApplet(java.applet.Applet)

setMarkIntentToUpdate

public void setMarkIntentToUpdate(boolean update)
Sets whether or not this WTContentHolder should set the INTENT_TO_CHANGE flag on ApplicationData (files). If the given boolean is true, this WTContentHolder will set the INTENT_TO_CHANGE flag on ApplicationData items to true when an ApplicationData is downloaded and to false when an ApplicationData is uploaded. If the given boolean is false, this WTContentHolder will not modify the INTENT_TO_CHANGE flag on ApplicationData items.

Parameters:
update - if true, the INTENT_TO_CHANGE flag will be set when ApplicationData items are uploaded and downloaded.

isMarkIntentToUpdate

public 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.


allowAddActions

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.

Parameters:
enable - boolean indicating whether or not add actions are available.
See Also:
allowRemoveActions(boolean), allowUpdateActions(boolean), #allowPropertiesActions

allowRemoveActions

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.

Parameters:
enable - boolean indicating whether or not the remove action is available.
See Also:
allowAddActions(boolean), allowUpdateActions(boolean), #allowPropertiesActions

allowUpdateActions

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.

Parameters:
enable - boolean indicating whether or not the remove action is available.
See Also:
allowAddActions(boolean), allowRemoveActions(boolean), #allowPropertiesActions

allowPropertiesAction

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.

Parameters:
enable - boolean indicating whether or not the view properties and get actions are available.
See Also:
allowAddActions(boolean), allowRemoveActions(boolean), #allowUpdatedActions

initContentItems

private void initContentItems()
Method initContentItems retrieves the ContentItems associated with the ContentHolder. The ContentItems are retrieved and maintained in a HashMap.

See Also:
ContentItem, ContentHolder, HashMap

initContentTable

private void initContentTable()
Method initContentTable initializes the list of ContentItems associated with the ContentHolder.

See Also:
ContentItem, ContentHolder

getObjectKey

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.

Parameters:
content_item - the ContentItem for which to get a key
See Also:
ContentItem, ContentHolder, HashMap

isDirty

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.

Returns:
boolean value - if changes have been made to the ContentHolder that have not been saved, then true is returned. Otherwise, false is returned.

initializeIconCache

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.

See Also:
HashMap

propertiesButton_Action

void propertiesButton_Action(ActionEvent event)
Call-back method invoked in response to an ActionEvent on the Properties button. This method invokes processPropertiesCommand to display the properties of the selected ContentItem

See Also:
ActionEvent

processPropertiesCommand

private void processPropertiesCommand()
Method processPropertiesCommand displays the properties of the selected ContentItem.


addAddressButton_Action

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. This method invokes the processAddUrlCommand method to add a new URL.

Parameters:
event - The ActionEvent which resulted in this method being invoked.
See Also:
ActionEvent, processAddUrlCommand()

processAddUrlCommand

private void processAddUrlCommand()
Method 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.


displayAddressProperties

private void displayAddressProperties(URLData address)
Method 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.

Parameters:
address - The URL whose properties are to be displayed

displayFileProperties

private void displayFileProperties(ApplicationData file)

addFileButton_Action

void addFileButton_Action(ActionEvent event)

processAddFileCommand

private void processAddFileCommand()

getButton_Action

void getButton_Action(ActionEvent event)

processGetCommand

private void processGetCommand()

updateContentItems

private void updateContentItems()

addToList

private void addToList(int row,
                       ContentItem item)

getContext

private WTContext getContext()

handleCreateEvent

private void handleCreateEvent(ContentItem new_content)

handleUpdateEvent

private void handleUpdateEvent(ContentItem updated_content)

persistContentChanges

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.

Returns:
the updated ContentHolder
Throws:
PropertyVetoException - thrown if attempt to save content changes fails
WTException - thrown if attempt to save content changes fails
See Also:
isDirty

saveContentChanges

private void saveContentChanges()
                         throws PropertyVetoException,
                                WTException
Throws:
PropertyVetoException
WTException

formatDate

private String formatDate(Date time)

validateContentHolder

private boolean validateContentHolder()

removeButton_Action

void removeButton_Action(ActionEvent event)

processRemoveCommand

private void processRemoveCommand()

enablePanelActions

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.

Parameters:
enable - boolean value indicating whether the actions should be enabled (enable = true) or disabled ( enable = false)
See Also:
allowAddActions(boolean), allowRemoveActions(boolean), allowUpdateActions(boolean), #allowPropertiesActions

replaceButton_Action

void replaceButton_Action(ActionEvent event)

processReplaceCommand

private void processReplaceCommand()

setIntentToUpdate

private void setIntentToUpdate(Vector files,
                               boolean intention)

retrievePreferences

public WTPreferences retrievePreferences(String node)
Retrieve the preferences for the designated node

Parameters:
node - the string for the preference node desired
Returns:
the WTPreferences object for desired node

getPreferenceValue

public String getPreferenceValue(WTPreferences node,
                                 String key,
                                 String defaultValue)
Given node and key, return preference value

Parameters:
node - the preference node
key - the key of the desired value within that node
Returns:
value of that key in that preference node

createValidDefaultPath

public String createValidDefaultPath(String path)
Given a filepath, strip the filename and find out whether the directory path exists locally

Parameters:
path - the filepath
Returns:
path to a valid directory, or an empty string if path does not exist on local system

isDirectory

public boolean isDirectory(String path)

getFileAccess

private FileAccess getFileAccess()

getFile

private void getFile(ApplicationData appData)

getFiles

private void getFiles(Vector files)

dispatchRefreshEvent

private void dispatchRefreshEvent(int action,
                                  Object object)

getStandardIcon

private Image getStandardIcon(ContentItem content)

getStandardIcon

private Image getStandardIcon(Class a_class)

openURL

private void openURL(URLData url_data)
              throws MalformedURLException,
                     WTException
Throws:
MalformedURLException
WTException

addNotify

public void addNotify()

resetButton_Action

void resetButton_Action(ActionEvent event)

processResetCommand

private void processResetCommand()

saveButton_Action

void saveButton_Action(ActionEvent event)

processSaveCommand

private void processSaveCommand()

showMessageDialog

private void showMessageDialog(String message,
                               boolean modal)

getFilesToReplace

private Vector getFilesToReplace()

refresh

public void refresh()
Method 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.


enableGlobalButtons

public void enableGlobalButtons(boolean enable)
Method 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.

Parameters:
enable - if true, the Save and Reset buttons are enabled; if false, the buttons are disabled

showSaveButton

public void showSaveButton(boolean enable)
Method 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.

Parameters:
enable - if true, the Save button is visible; if false, the button is hidden

initializeHelp

private void initializeHelp()

addHelpListener

public void addHelpListener(PropertyChangeListener pcl)
Method 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.

Parameters:
pcl - The PropertyChangeListener to be notified of PropertyChangeEvents generated by the help system.
See Also:
removeHelpListener(java.beans.PropertyChangeListener), HelpSystem, HelpContext, PropertyChangeListener

removeHelpListener

public void removeHelpListener(PropertyChangeListener pcl)
Method 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.

Parameters:
pcl - the PropertyChangeListener to be removed as a listener of events generated by the help system of this panel.
See Also:
addHelpListener(java.beans.PropertyChangeListener), PropertyChangeListener

contentMultiList_itemStateChanged

void contentMultiList_itemStateChanged(ItemEvent event)

updateColors

private void updateColors(Color color)

addAddressButton_KeyPressed

void addAddressButton_KeyPressed(KeyEvent event)

addFileButton_KeyPressed

void addFileButton_KeyPressed(KeyEvent event)

shiftMultiListEntries

private void shiftMultiListEntries()

initButtonSizes

private void initButtonSizes()
Initializes the sizes of the buttons displayed on this panel. When the button labels are localized via the localize method, the width of the buttons could be affected, potentially causing the widths of the buttons to be different from one another.


contentMultiList_actionPerformed

void contentMultiList_actionPerformed(ActionEvent event)

replaceButton_KeyPressed

void replaceButton_KeyPressed(KeyEvent event)

getButton_KeyPressed

void getButton_KeyPressed(KeyEvent event)

saveButton_KeyPressed

void saveButton_KeyPressed(KeyEvent event)

resetButton_KeyPressed

void resetButton_KeyPressed(KeyEvent event)

propertiesButton_KeyPressed

void propertiesButton_KeyPressed(KeyEvent event)

removeButton_KeyPressed

void removeButton_KeyPressed(KeyEvent event)

getHelpContext

public HelpContext getHelpContext()
Retrieve the HelpContext being used to display help messages and online help.

Returns:
the HelpContext providing help for this panel

paint

public void paint(Graphics g)

uploadContentItems

private void uploadContentItems()
                         throws WTException
Throws:
WTException

createFileURLString

private String createFileURLString(String fileString)

getOIDString

private String getOIDString(ContentItem contentItem)

formatContentItem

private String formatContentItem(ContentItem contentItem)

locateFile

private WTContentHolder.FileInfo locateFile(ContentHolder contentHolder,
                                            ContentItem contentItem)