wt.clients.beans
Class EffectivityPanel

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

public class EffectivityPanel
extends Container

This bean is used to create, update, or view effectivity for an EffectivityManageable object. The following is an example of how to use the EffectivityPanel:

   effectivityPanel1 = new wt.clients.beans.EffectivityPanel();
	try {
		effectivityPanel1.setMode("Edit");
	}
	catch(java.beans.PropertyVetoException e) { }
	effectivityPanel1.setBounds(0,0,415,75);
	effectivityPanel1.setFont(new Font("Dialog", Font.PLAIN, 11));
	effectivityPanel1.setForeground(new Color(0));
	effectivityPanel1.setBackground(new Color(12632256));
	gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.gridwidth = 2;
	gbc.weightx = 1.0;
	gbc.anchor = GridBagConstraints.NORTHWEST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets = new Insets(0,0,0,0);
	((GridBagLayout)panel1.getLayout()).setConstraints(effectivityPanel1, gbc);
	panel1.add(effectivityPanel1);

	 effectivityPanel1.addHelpListener(helpListener);
	 effectivityPanel1.setObject(em);
	 if (effectivityPanel1.isDirty()) {
	    effectivityPanel1.save();
	 }
  


Supported API: true.

Extendable: true.

See Also:
Serialized Form

Nested Class Summary
 class EffectivityPanel.ConfigItemListener
          This class listens for the user to select a ConfigurationItem and adds it to the configItemTextField.
(package private)  class EffectivityPanel.SymAction
           
(package private)  class EffectivityPanel.SymFocus
           
(package private)  class EffectivityPanel.SymText
           
 
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
(package private)  Button browseButton
           
(package private)  Label configItemField
           
(package private)  Label configItemLabel
           
(package private)  TextField configItemTextField
           
protected  ThreadGroup contextGroup
           
private  boolean dirty
           
static String EDIT_MODE
           
(package private)  Label endField
           
(package private)  Label endLabel
           
(package private)  TextField endTextField
           
(package private)  HelpContext helpContext
           
(package private)  HelpSystem helpSystem
           
private  String mode
           
private  Applet parentApplet
           
private  Frame parentFrame
           
private static ResourceBundle resource
           
private static String RESOURCE
           
(package private)  Label startField
           
(package private)  Label startLabel
           
(package private)  TextField startTextField
           
private  EffectivityTaskLogic taskLogic
           
(package private)  Label typeField
           
(package private)  Label typeLabel
           
static String VIEW_MODE
           
(package private)  Label viewConfigLabel
           
 
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
EffectivityPanel()
          This constructs an EffectivityPanel with the default mode of view.
 
Method Summary
 void addHelpListener(PropertyChangeListener pcl)
          Method addHelpListener adds the given listener to be notified of PropertyChangeEvents in the help system.
protected  void addViewFields()
          this adds the fields for view mode and removes the fields for edit mode

Supported API: true.
 Effectivity assignValues()
          This method will set the values of the Effectivity from the user's entry.
(package private)  void browseButton_ActionPerformed(ActionEvent event)
           
 void clear()
          This clears the fields

Supported API: true.
(package private)  void configItemTextField_EnterHit(ActionEvent event)
           
(package private)  void configItemTextField_FocusLost(FocusEvent event)
           
(package private)  void configItemTextField_TextValueChanged(TextEvent event)
           
protected  void createUI()
          This adds or removes fields based on the mode

Supported API: true.
protected  void createViewFields()
          this creates the fields for view mode

Supported API: true.
private  String display(String key, Object[] params)
          Returns the localized string to be displayed to the user given a key.
protected  void displayException(Exception e)
          This displays an exception to the user and prints out a stack trace.
(package private)  void endTextField_TextValueChanged(TextEvent event)
           
 Color getBackground()
          This will get the background color of this panel

Supported API: true.
private  WTContext getContext()
          Retrieves the WTContext associated with this dialog.
 Effectivity getEffectivity()
          This method returns the Effectivity currently assigned to the EffectivityManageable object.
 Font getFont()
          This will get the font color of this panel

Supported API: true.
 Color getForeground()
          This will get the foreground color of this panel

Supported API: true.
 HelpContext getHelpContext()
          This is a public accessor for the current HelpContext and can be used to stop the help for the bean when the client is closed.
 HelpSystem getHelpSystem()
          This is a public accessor for the current HelpSystem

Supported API: true.
 Dimension getMinimumSize()
          This overrides the minimum size for the bean.
 Dimension getMinimumSize(int rows, int cols)
          This overrides the minimum size for the bean.
 String getMode()
          This is the public accessor for the current mode of the bean.
 EffectivityManageable getObject()
          This is the public getter for the EffectivityManageable object for which the Effectivity is being edited or viewed.
 Effectivity getOldEffectivity()
          This is the public getter for the Effectivity that is deleted.
 Dimension getPreferredSize()
          This overrides the preferred size for the bean.
 Dimension getPreferredSize(int rows, int cols)
          This overrides the preferred size for the bean.
(package private)  Frame getTopLevelParent(Component component)
          This method gets the top level parent of the Component passed in and returns it if it is a Frame.
private  void initHelpSystem()
           
(package private)  void initializeHelp()
           
private  void initResources()
          Initializes resource bundles used by this class.
 boolean isDirty()
          Call this method to determine if the user has changed any of the fields on the bean.
protected  void localize()
          This sets the display text of the fields to the localized string from the resource bundle.
 void removeHelpListener(PropertyChangeListener pcl)
          Method removeHelpListener removes a listener which was being notified of PropertyChangeEvents in the help system.
protected  void removeViewFields()
          this removes the fields for view mode and adds the fields for edit mode

Supported API: true.
 void requestFocus()
          Invoking requestFocus on this panel will set the focus on the appropriate field in this panel.
protected  void resetForNewConfigItem()
           
 void save()
          This method will update the Effectivity with the user's input and persist it.
 void save(Enumeration effectivities, Enumeration old_effectivities)
          This method takes Enumerations of effectivities and will store the new Effectivities and remove the old.
 void setBackground(Color color)
          This will set the background color of this panel

Supported API: true.
private  void setContext(boolean context_on)
           
private  void setDirty(boolean d)
           
protected  void setEditValues()
          This sets the values of the fields for editing.
 void setEnabled(boolean b)
          This will set the state of each component within the bean to either enabled or disabled based on the boolean passed in.
protected  void setFieldState(boolean b, Container container)
          This sets the fields to either editable or enabled depending on the boolean and the type of component.
 void setFont(Font font)
          This will set the font color of this panel

Supported API: true.
 void setForeground(Color color)
          This will set the foreground color of this panel

Supported API: true.
 void setMode(String mode)
          This sets the mode of the bean to Edit or View and modifies the fields accordingly.
 void setObject(EffectivityManageable object)
          Use this method to set the EffectivityManageable object for which the Effectivity will be edited or viewed.
 void setObject(EffectivityManageable object, Effectivity new_effectivity)
          Use this method to assign an already created Effectivity to an EffectivityManageable.
 void setParentApplet(Applet applet)
          Set the Applet that started this panel

Supported API: true.
 void setParentFrame(Frame frame)
          Set the parent Frame that started this panel

Supported API: true.
protected  void setViewValues()
          This displays the values for the effectivity to the user

Supported API: true.
(package private)  void startTextField_TextValueChanged(TextEvent event)
           
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getAccessibleContext, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, 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, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, 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

resource

private static ResourceBundle resource

RESOURCE

private static String RESOURCE

helpSystem

HelpSystem helpSystem

helpContext

HelpContext helpContext

mode

private String mode

VIEW_MODE

public static String VIEW_MODE

EDIT_MODE

public static String EDIT_MODE

taskLogic

private EffectivityTaskLogic taskLogic

dirty

private boolean dirty

contextGroup

protected ThreadGroup contextGroup

parentApplet

private Applet parentApplet

parentFrame

private Frame parentFrame

configItemLabel

Label configItemLabel

configItemTextField

TextField configItemTextField

browseButton

Button browseButton

typeLabel

Label typeLabel

typeField

Label typeField

startLabel

Label startLabel

startTextField

TextField startTextField

endLabel

Label endLabel

endTextField

TextField endTextField

viewConfigLabel

Label viewConfigLabel

configItemField

Label configItemField

startField

Label startField

endField

Label endField
Constructor Detail

EffectivityPanel

public EffectivityPanel()
This constructs an EffectivityPanel with the default mode of view.

Supported API: true.

Method Detail

localize

protected void localize()
This sets the display text of the fields to the localized string from the resource bundle.

Supported API: true.


setMode

public void setMode(String mode)
             throws PropertyVetoException
This sets the mode of the bean to Edit or View and modifies the fields accordingly.

Supported API: true.

Throws:
PropertyVetoException

getMode

public String getMode()
This is the public accessor for the current mode of the bean.

Supported API: true.


getPreferredSize

public Dimension getPreferredSize()
This overrides the preferred size for the bean.

Supported API: true.


getPreferredSize

public Dimension getPreferredSize(int rows,
                                  int cols)
This overrides the preferred size for the bean.

Supported API: true.


getMinimumSize

public Dimension getMinimumSize()
This overrides the minimum size for the bean.

Supported API: true.


getMinimumSize

public Dimension getMinimumSize(int rows,
                                int cols)
This overrides the minimum size for the bean.

Supported API: true.


setForeground

public void setForeground(Color color)
This will set the foreground color of this panel

Supported API: true.


getForeground

public Color getForeground()
This will get the foreground color of this panel

Supported API: true.


setBackground

public void setBackground(Color color)
This will set the background color of this panel

Supported API: true.


getBackground

public Color getBackground()
This will get the background color of this panel

Supported API: true.


setFont

public void setFont(Font font)
This will set the font color of this panel

Supported API: true.


getFont

public Font getFont()
This will get the font color of this panel

Supported API: true.


setEnabled

public void setEnabled(boolean b)
This will set the state of each component within the bean to either enabled or disabled based on the boolean passed in.

Supported API: true.

Parameters:
b - - Sets all fields to enabled when true

clear

public void clear()
This clears the fields

Supported API: true.


initResources

private void initResources()
Initializes resource bundles used by this class.


display

private String display(String key,
                       Object[] params)
Returns the localized string to be displayed to the user given a key.

Parameters:
key - The string that represents the key in the BeansRB.
Returns:
A string to be displayed to the user.

displayException

protected void displayException(Exception e)
This displays an exception to the user and prints out a stack trace.

Supported API: true.


getTopLevelParent

Frame getTopLevelParent(Component component)
This method gets the top level parent of the Component passed in and returns it if it is a Frame. If not, it returns null.

Returns:
The top level Frame

initializeHelp

void initializeHelp()

initHelpSystem

private void initHelpSystem()

getHelpContext

public HelpContext getHelpContext()
This is a public accessor for the current HelpContext and can be used to stop the help for the bean when the client is closed.

Supported API: true.


getHelpSystem

public HelpSystem getHelpSystem()
This is a public accessor for the current HelpSystem

Supported API: true.


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

setFieldState

protected void setFieldState(boolean b,
                             Container container)
This sets the fields to either editable or enabled depending on the boolean and the type of component. It recurses through all of the fields in the passed container.

Supported API: true.


createUI

protected void createUI()
This adds or removes fields based on the mode

Supported API: true.


setViewValues

protected void setViewValues()
This displays the values for the effectivity to the user

Supported API: true.


setEditValues

protected void setEditValues()
This sets the values of the fields for editing.

Supported API: true.


addViewFields

protected void addViewFields()
this adds the fields for view mode and removes the fields for edit mode

Supported API: true.


removeViewFields

protected void removeViewFields()
this removes the fields for view mode and adds the fields for edit mode

Supported API: true.


createViewFields

protected void createViewFields()
this creates the fields for view mode

Supported API: true.


setObject

public void setObject(EffectivityManageable object)
               throws WTException
Use this method to set the EffectivityManageable object for which the Effectivity will be edited or viewed.

Supported API: true.

Throws:
WTException

setObject

public void setObject(EffectivityManageable object,
                      Effectivity new_effectivity)
               throws WTException
Use this method to assign an already created Effectivity to an EffectivityManageable.

Supported API: true.

Throws:
WTException

getObject

public EffectivityManageable getObject()
This is the public getter for the EffectivityManageable object for which the Effectivity is being edited or viewed.

Supported API: true.


assignValues

public Effectivity assignValues()
                         throws WTPropertyVetoException,
                                WTException
This method will set the values of the Effectivity from the user's entry.

Supported API: true.

Throws:
WTPropertyVetoException
WTException

save

public void save()
          throws WTPropertyVetoException,
                 WTException
This method will update the Effectivity with the user's input and persist it.

Supported API: true.

Throws:
WTPropertyVetoException
WTException

save

public void save(Enumeration effectivities,
                 Enumeration old_effectivities)
          throws WTException
This method takes Enumerations of effectivities and will store the new Effectivities and remove the old.

Supported API: true.

Throws:
WTException

setDirty

private void setDirty(boolean d)

isDirty

public boolean isDirty()
Call this method to determine if the user has changed any of the fields on the bean.

Supported API: true.


configItemTextField_TextValueChanged

void configItemTextField_TextValueChanged(TextEvent event)

startTextField_TextValueChanged

void startTextField_TextValueChanged(TextEvent event)

endTextField_TextValueChanged

void endTextField_TextValueChanged(TextEvent event)

getEffectivity

public Effectivity getEffectivity()
This method returns the Effectivity currently assigned to the EffectivityManageable object.

Supported API: true.


getOldEffectivity

public Effectivity getOldEffectivity()
This is the public getter for the Effectivity that is deleted.

Supported API: true.


getContext

private WTContext getContext()
Retrieves the WTContext associated with this dialog. If the parentApplet has been set, the parentApplet is used to retrieve the appropriate context.

Returns:
the WTContext associate with this dialog
See Also:
setParentApplet(java.applet.Applet), WTContext

setContext

private void setContext(boolean context_on)

setParentApplet

public void setParentApplet(Applet applet)
Set the Applet that started this panel

Supported API: true.


setParentFrame

public void setParentFrame(Frame frame)
Set the parent Frame that started this panel

Supported API: true.


browseButton_ActionPerformed

void browseButton_ActionPerformed(ActionEvent event)

requestFocus

public void requestFocus()
Invoking requestFocus on this panel will set the focus on the appropriate field in this panel.

Supported API: true.


configItemTextField_FocusLost

void configItemTextField_FocusLost(FocusEvent event)

configItemTextField_EnterHit

void configItemTextField_EnterHit(ActionEvent event)

resetForNewConfigItem

protected void resetForNewConfigItem()