wt.clients.beans.lifecycle
Class LifeCyclePanel

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

public class LifeCyclePanel
extends Panel

Class LifeCyclePanel is a Panel which supplies the functionality to assign a Life Cycle template to LifeCycleManaged objects. LifeCyclePanel provides create, update and view modes.

The create and update modes are comprised of an optional Life Cycle label, choicebox, and browse button for finding and selecting a Life Cycle template.

The view mode displays the values for the Life Cycle template and Life Cycle state associated with a LifeCycleManaged object. This mode displays a Life Cycle label, current Life Cycle template, life cycle state label, and current Life Cycle state of a LifeCycleManaged object. The following code demonstrates creating a LifeCyclePanel in view mode:


     LifeCycleManaged lcm_object;

	    Frame f = new Frame("LifeCyclePanel Test");

	    LifeCyclePanel lcp = new LifeCyclePanel();
	    f.setSize (300,100);
	    f.setLayout (new BorderLayout());

     f.add(lcp);
     lcp.setMode(VIEW_MODE);
     lcp.setObject(lcm_object);

     f.show();
 
The following code demonstrates assigning the Life Cycle template provided by the user into the LifeCycleManaged object.

     lcp.assign(lcm_object);

 


Supported API: true

Extendable: true

See Also:
Serialized Form

Nested Class Summary
(package private)  class LifeCyclePanel.SymAction
          This class listens for ActionEvents of the screen Components and calls the appropriate method for the action.
(package private)  class LifeCyclePanel.WorkThread
          The work thread for this Applet.
 
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  Class aClass
           
private  LifeCycleManaged anObject
           
(package private)  Button browseButton
           
private  boolean cardLayoutInitialized
           
private  String CREATE_CARD
           
static int CREATE_MODE
          Create Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object, a Life Cycle label is displayed to the left of the choice box.
(package private)  Choice createChoice
           
(package private)  Label createLabel
           
(package private)  Panel createPanel
           
private  String defaultTemplateChoice
           
private static String HELP_RESOURCE
           
private static String HELP_TARGET
          Defined constant String which defines the name of the browser window to launch online help in.
private  NFHelpContext helpContext
           
private  NFHelpSystem helpSystem
           
(package private) static int INIT_CHOICE_LIST
           
private  boolean initialized
           
private  boolean initReady
           
private  LayoutManager layout
           
private static String LIFE_CYCLE_TEMPLATE
           
private  Hashtable lifecycles
           
private  ResourceBundle messagesResource
           
static int NO_LABEL_CREATE_MODE
          No Label Create Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object.
static int NO_LABEL_UPDATE_MODE
          No Label Update Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object.
static int NO_LABEL_VIEW_MODE
          No Label View Mode displays the name of the Life Cycle template and Life Cycle state associated with a LifeCycleManaged object.
private  boolean notifyDone
           
(package private) static int PROCESS_BROWSE
           
private static String RESOURCE
           
private static String SYSTEM_DOMAIN
           
private  ThreadGroup theThreadGroup
           
static int UPDATE_MODE
          Update Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object.
private  boolean verbose
           
private  String VIEW_CARD
           
static int VIEW_MODE
          View Mode displays the name of the Life Cycle template and Life Cycle state associated with a LifeCycleManaged object.
(package private)  Label viewLabel
           
(package private)  Label viewLifeCycleValue
           
private  int viewMode
           
(package private)  Panel viewPanel
           
(package private)  Label viewStateLabel
           
(package private)  Label viewStateValue
           
 
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
LifeCyclePanel()
          Creates a LifeCyclePanel.
 
Method Summary
 void addHelpListener(PropertyChangeListener pcl)
          Method addHelpListener adds the given listener to be notified of PropertyChangeEvents in the help system.
 void addNotify()
          Notifies this component that it has been added to a container and if a peer is required, it should be created.
private  void addTemplate(LifeCycleTemplateMasterReference template_reference)
          Add a template to the choice list.
 void assign()
          Save the currently selected life cycle template in the LifeCycleManaged object previously set by setObject.
 void assign(LifeCycleManaged an_object)
          Save the currently selected Life Cycle choice in the specified LifeCycleManaged object.
(package private)  void browseButton_ActionPerformed(ActionEvent event)
          This method is called when the browse button has been pressed.
private  NFHelpContext getHelpContext()
          Returns the help context.
private  NFHelpSystem getHelpSystem()
          Get the help system.
 LayoutManager getLayout()
          Gets the layout manager for this container.
private  ResourceBundle getMessagesResource()
          getMessagesResource gets the ResourceBundle used for providing localized error-messages and feedback.
 int getMode()
          Return the current mode.
 Dimension getPreferredSize()
          Gets the preferred size of this component.
 LifeCycleTemplateReference getSelectedLifeCycleTemplate()
          Return the currently selected life cycle template reference.
private  LifeCycleTemplateReference getTemplate(LifeCycleManaged an_object)
          Get the life cycle reference associated with the specified object.
private  void initChoiceList()
          Spin off a thread to initialize the choice list.
private  void initValues()
          If an object has been set, set the text for life cycle value and state.
(package private)  boolean isInitialized()
           
private  void localize()
          Localizes the text in this container.
static void main(String[] args)
          A main test driver.
private  void processBrowse()
          Bring up a dialog window for selecting a lifecycle when the browse button is pressed.
private  void processInitChoiceList()
          Initialize the drop down list with available life cycle choices.
 void removeHelpListener(PropertyChangeListener pcl)
          Method removeHelpListener removes a listener which was being notified of PropertyChangeEvents in the help system.
 void removeNotify()
          Notifies this component that it has been removed from its container and if a peers exists, it destroys it.
 void setClass(Class a_class)
          Set the class used to obtain the list of life cycle choices.
 void setClassName(String a_class_name)
          Set the class name used to obtain the list of life cycle choices.
 void setDefaultChoice(String lctString)
          Manually override initial life cycle template selected in the drop down list.
 void setEnabled(boolean b)
          Enables components used by this Panel.
(package private)  void setInitialized(boolean initialized)
           
 void setLayout(LayoutManager mgr)
          Sets the layout manager for this container.
 void setMode(int mode)
          Set the mode to either create or view.
 void setObject(LifeCycleManaged an_object)
          Set the LifeCycleManged object.
 
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, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, 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

CREATE_MODE

public static final int CREATE_MODE
Create Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object, a Life Cycle label is displayed to the left of the choice box.

Supported API: true

See Also:
setMode(int), getMode(), Constant Field Values

VIEW_MODE

public static final int VIEW_MODE
View Mode displays the name of the Life Cycle template and Life Cycle state associated with a LifeCycleManaged object.

Supported API: true

See Also:
setMode(int), getMode(), Constant Field Values

NO_LABEL_CREATE_MODE

public static final int NO_LABEL_CREATE_MODE
No Label Create Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object. When using this mode the Life Cycle label is omitted from the display.

Supported API: true

See Also:
setMode(int), getMode(), Constant Field Values

NO_LABEL_VIEW_MODE

public static final int NO_LABEL_VIEW_MODE
No Label View Mode displays the name of the Life Cycle template and Life Cycle state associated with a LifeCycleManaged object. When using this mode the Life Cycle label is omitted from the display.

Supported API: true

See Also:
setMode(int), getMode(), Constant Field Values

UPDATE_MODE

public static final int UPDATE_MODE
Update Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object.

Supported API: true

See Also:
setMode(int), Constant Field Values

NO_LABEL_UPDATE_MODE

public static final int NO_LABEL_UPDATE_MODE
No Label Update Mode allows the user to assign a Life Cycle template to a LifeCycleManaged object. When using this mode the Life Cycle label is omitted from the display.

Supported API: true

See Also:
setMode(int), Constant Field Values

PROCESS_BROWSE

static final int PROCESS_BROWSE
See Also:
Constant Field Values

INIT_CHOICE_LIST

static final int INIT_CHOICE_LIST
See Also:
Constant Field Values

notifyDone

private boolean notifyDone

initReady

private boolean initReady

VIEW_CARD

private String VIEW_CARD

CREATE_CARD

private String CREATE_CARD

viewMode

private int viewMode

cardLayoutInitialized

private boolean cardLayoutInitialized

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

HELP_RESOURCE

private static final String HELP_RESOURCE
See Also:
Constant Field Values

LIFE_CYCLE_TEMPLATE

private static final String LIFE_CYCLE_TEMPLATE
See Also:
Constant Field Values

helpSystem

private NFHelpSystem helpSystem

helpContext

private NFHelpContext helpContext

verbose

private boolean verbose

lifecycles

private Hashtable lifecycles

layout

private LayoutManager layout

aClass

private Class aClass

anObject

private LifeCycleManaged anObject

defaultTemplateChoice

private String defaultTemplateChoice

theThreadGroup

private ThreadGroup theThreadGroup

initialized

private boolean initialized

messagesResource

private ResourceBundle messagesResource

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

SYSTEM_DOMAIN

private static String SYSTEM_DOMAIN

createPanel

Panel createPanel

createLabel

Label createLabel

createChoice

Choice createChoice

browseButton

Button browseButton

viewPanel

Panel viewPanel

viewLabel

Label viewLabel

viewLifeCycleValue

Label viewLifeCycleValue

viewStateLabel

Label viewStateLabel

viewStateValue

Label viewStateValue
Constructor Detail

LifeCyclePanel

public LifeCyclePanel()
Creates a LifeCyclePanel. The default mode is CREATE_MODE.

Supported API: true

Method Detail

removeNotify

public void removeNotify()
Notifies this component that it has been removed from its container and if a peers exists, it destroys it. This method should be called by Container.remove, and not by user code directly. If a help context has been created, it will be stopped.

Supported API: false


addNotify

public void addNotify()
Notifies this component that it has been added to a container and if a peer is required, it should be created.

Supported API: false


getPreferredSize

public Dimension getPreferredSize()
Gets the preferred size of this component.

Supported API: false


setLayout

public void setLayout(LayoutManager mgr)
Sets the layout manager for this container.

Supported API: false


getLayout

public LayoutManager getLayout()
Gets the layout manager for this container.

Supported API: false


localize

private void localize()
Localizes the text in this container.

Supported API: false


getMessagesResource

private ResourceBundle getMessagesResource()
getMessagesResource gets the ResourceBundle used for providing localized error-messages and feedback.

Supported API: false

See Also:
ResourceBundle

setEnabled

public void setEnabled(boolean b)
Enables components used by this Panel.

Supported API: false


getHelpContext

private NFHelpContext getHelpContext()
Returns the help context.

Supported API: false

Returns:
the help context.

initChoiceList

private void initChoiceList()
Spin off a thread to initialize the choice list.


initValues

private void initValues()
If an object has been set, set the text for life cycle value and state.


addTemplate

private void addTemplate(LifeCycleTemplateMasterReference template_reference)
Add a template to the choice list.


processInitChoiceList

private void processInitChoiceList()
Initialize the drop down list with available life cycle choices.


setClassName

public void setClassName(String a_class_name)
Set the class name used to obtain the list of life cycle choices. The class name must be a fully qualified class name for example wt.doc.WTDocument.

Supported API: true

Parameters:
a_class_name - a fully qualified class name.
See Also:
setClass(java.lang.Class)

setClass

public void setClass(Class a_class)
Set the class used to obtain the list of life cycle choices.

Supported API: true

Parameters:
a_class - the class of the object
See Also:
setClassName(java.lang.String)

getMode

public int getMode()
Return the current mode.

Supported API: true

Returns:
the current mode
See Also:
CREATE_MODE, VIEW_MODE, NO_LABEL_VIEW_MODE, NO_LABEL_CREATE_MODE, UPDATE_MODE, NO_LABEL_UPDATE_MODE

setMode

public void setMode(int mode)
Set the mode to either create or view.

Supported API: true

Parameters:
mode - either create or view
See Also:
CREATE_MODE, VIEW_MODE, NO_LABEL_VIEW_MODE, NO_LABEL_CREATE_MODE, UPDATE_MODE, NO_LABEL_UPDATE_MODE

getSelectedLifeCycleTemplate

public LifeCycleTemplateReference getSelectedLifeCycleTemplate()
Return the currently selected life cycle template reference.

Supported API: true

Returns:
the LifeCycleTemplateReference object.

setDefaultChoice

public void setDefaultChoice(String lctString)
Manually override initial life cycle template selected in the drop down list. This is not necessary when using setObject, as the default will be taken from the object. This should be called prior to calling setClass.

Supported API: true

Parameters:
lctString - a string representing the life cycle template to be the default choice

getTemplate

private LifeCycleTemplateReference getTemplate(LifeCycleManaged an_object)
Get the life cycle reference associated with the specified object.

Parameters:
an_object - the object whose life cycle will be returned
Returns:
the LifeCycleTemplateReference associated with the specified object.

setObject

public void setObject(LifeCycleManaged an_object)
Set the LifeCycleManged object. The object is used to initialize the Life Cycle choice list in create mode. In view mode the object is used to obtain the current values of the Life Cycle template name and Life Cycle state for display.

Supported API: true

Parameters:
an_object - the LifeCycleManged object.

assign

public void assign(LifeCycleManaged an_object)
Save the currently selected Life Cycle choice in the specified LifeCycleManaged object.

Supported API: true

Parameters:
an_object - the object to update with the currently selected Life Cycle value.

assign

public void assign()
Save the currently selected life cycle template in the LifeCycleManaged object previously set by setObject.

Supported API: true

See Also:
setObject(wt.lifecycle.LifeCycleManaged)

getHelpSystem

private NFHelpSystem getHelpSystem()
Get the help system.

Supported API: false

Returns:
the help system

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.

Supported API: true

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.

Supported API: true

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

processBrowse

private void processBrowse()
Bring up a dialog window for selecting a lifecycle when the browse button is pressed.


setInitialized

void setInitialized(boolean initialized)

isInitialized

boolean isInitialized()

browseButton_ActionPerformed

void browseButton_ActionPerformed(ActionEvent event)
This method is called when the browse button has been pressed.


main

public static void main(String[] args)
A main test driver.

Supported API: false