com.intel.gpe.gridbeans.plugins
Class GridBeanPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.intel.gpe.gridbeans.plugins.GridBeanPanel
All Implemented Interfaces:
IDataSet, IGridBeanPanel, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class GridBeanPanel
extends javax.swing.JPanel
implements IGridBeanPanel

The base implementation of an input or output GridBean panel.

Version:
$Id: GridBeanPanel.java,v 1.5 2005/12/22 09:20:32 lukichev Exp $
Author:
Alexander Lukichev
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  com.intel.gpe.client.application.Client parent
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
GridBeanPanel(com.intel.gpe.client.application.Client parent, java.lang.String name)
          Create the GridBean panel.
 
Method Summary
 java.awt.Component getComponent()
          Get the component to plug into the tabbed pane.
 IDataControl getControl(javax.xml.namespace.QName key)
          Get the control by its name
 java.lang.String getDescription(javax.xml.namespace.QName key)
          Get the description of the component.
 boolean getEnabled(javax.xml.namespace.QName key)
          Get the state of the component.
 java.lang.String getName()
          Implements IGridBeanPanel.getName()
 java.lang.Object getValue(javax.xml.namespace.QName key)
          Get the translated value of the component.
 boolean isValid(javax.xml.namespace.QName key, java.lang.StringBuffer buf)
          Check if the value of the component is valid.
 java.util.Set keySet()
          Get the set of the component names.
 void linkButton(javax.xml.namespace.QName key, javax.swing.JButton button)
          Helper method to bind a button
 void linkCheckBox(javax.xml.namespace.QName key, javax.swing.JCheckBox checkBox)
          Helper method to bind a check box
 void linkDataControl(javax.xml.namespace.QName key, IDataControl control)
          Bind the specifed control to the specified name
 void linkJobNameTextField(javax.xml.namespace.QName key, javax.swing.JTextField textField)
          Helper method to bind a text field containing the job identifier (name)
 void linkLabel(javax.xml.namespace.QName key, javax.swing.JLabel label)
          Helper method to bind a label
 void linkList(javax.xml.namespace.QName key, javax.swing.JList list)
          Helper method to bind a list
 void linkTextEditor(javax.xml.namespace.QName key, TextEditor editor)
          Helper method to bind a text editor
 void linkTextField(javax.xml.namespace.QName key, javax.swing.JTextField textField)
          Helper method to bind a text field
 void linkTextFieldWithLabel(javax.xml.namespace.QName key, javax.swing.JTextField textField, javax.swing.JLabel label)
          Helper method to bind a text field with a label
 void load(IGridBeanModel model, com.intel.gpe.client.application.Client client)
          Load data set component values from the GridBean model and the client object.
 void setDescription(javax.xml.namespace.QName key, java.lang.String descr)
          Set the description of the specified component
 void setEnabled(javax.xml.namespace.QName key, boolean enabled)
          Set the enabled state of the component
 void setPossibleValues(javax.xml.namespace.QName key, java.util.List values)
          Set the possible values for the specified component
 void setValue(javax.xml.namespace.QName key, java.lang.Object value)
          Set the value of the component.
 void setValueTranslator(javax.xml.namespace.QName key, IValueTranslator translator)
          Set the translator for the specified component
 void setValueValidator(javax.xml.namespace.QName key, IValueValidator validator)
          Set the validator for the specified component
 void store(IGridBeanModel model)
          Store the component values in the GridBean model.
 void updateValues(com.intel.gpe.client.application.Client client)
          This method is called whenever load(IGridBeanModel, Client) is called.
 void validate(ErrorSet errors)
          Validate the contents of the panel.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

parent

protected com.intel.gpe.client.application.Client parent
Constructor Detail

GridBeanPanel

public GridBeanPanel(com.intel.gpe.client.application.Client parent,
                     java.lang.String name)
Create the GridBean panel.

Parameters:
parent - The parent component (usually the main window)
name - The name of the panel. It is displayed as the name of the tab in the tabbed pane where the panel is inserted
Method Detail

getControl

public IDataControl getControl(javax.xml.namespace.QName key)
                        throws DataSetException
Get the control by its name

Parameters:
key - The name of the control
Throws:
DataSetException

getEnabled

public boolean getEnabled(javax.xml.namespace.QName key)
                   throws DataSetException
Description copied from interface: IDataSet
Get the state of the component.

Specified by:
getEnabled in interface IDataSet
Parameters:
key - The name of the component
Returns:
The enabled state of the component
Throws:
DataSetException

setEnabled

public void setEnabled(javax.xml.namespace.QName key,
                       boolean enabled)
                throws DataSetException
Description copied from interface: IDataSet
Set the enabled state of the component

Specified by:
setEnabled in interface IDataSet
Parameters:
key - The name of the component
enabled - The enabled state of the component
Throws:
DataSetException

keySet

public java.util.Set keySet()
Description copied from interface: IDataSet
Get the set of the component names.

Specified by:
keySet in interface IDataSet
Returns:
The set of the component names

getValue

public java.lang.Object getValue(javax.xml.namespace.QName key)
                          throws DataSetException,
                                 TranslationException
Description copied from interface: IDataSet
Get the translated value of the component.

Specified by:
getValue in interface IDataSet
Parameters:
key - The name of the component
Returns:
The translated value
Throws:
DataSetException
TranslationException - If translation failed

setValue

public void setValue(javax.xml.namespace.QName key,
                     java.lang.Object value)
              throws DataSetException,
                     TranslationException
Description copied from interface: IDataSet
Set the value of the component. The value is translated to the user's representation and then the GUI component is assigned with it.

Specified by:
setValue in interface IDataSet
Parameters:
key - The name of the component
value - The value
Throws:
DataSetException
TranslationException - If translation failed

setValueTranslator

public void setValueTranslator(javax.xml.namespace.QName key,
                               IValueTranslator translator)
                        throws DataSetException
Description copied from interface: IDataSet
Set the translator for the specified component

Specified by:
setValueTranslator in interface IDataSet
Parameters:
key - The name of the component
translator - The translator
Throws:
DataSetException

setValueValidator

public void setValueValidator(javax.xml.namespace.QName key,
                              IValueValidator validator)
                       throws DataSetException
Description copied from interface: IDataSet
Set the validator for the specified component

Specified by:
setValueValidator in interface IDataSet
Parameters:
key - The name of the component
validator - The validator
Throws:
DataSetException

setDescription

public void setDescription(javax.xml.namespace.QName key,
                           java.lang.String descr)
                    throws DataSetException
Description copied from interface: IDataSet
Set the description of the specified component

Specified by:
setDescription in interface IDataSet
Parameters:
key - The name of the component
descr - The description
Throws:
DataSetException

setPossibleValues

public void setPossibleValues(javax.xml.namespace.QName key,
                              java.util.List values)
                       throws DataSetException,
                              TranslationException
Description copied from interface: IDataSet
Set the possible values for the specified component

Specified by:
setPossibleValues in interface IDataSet
Parameters:
key - The name of the component
values - The list of the possible values
Throws:
DataSetException
TranslationException

linkDataControl

public void linkDataControl(javax.xml.namespace.QName key,
                            IDataControl control)
Bind the specifed control to the specified name

Parameters:
key - The name
control - The control

linkJobNameTextField

public void linkJobNameTextField(javax.xml.namespace.QName key,
                                 javax.swing.JTextField textField)
                          throws DataSetException
Helper method to bind a text field containing the job identifier (name)

Parameters:
key - The name of the control (usually "name")
textField - The text field
Throws:
DataSetException

linkList

public void linkList(javax.xml.namespace.QName key,
                     javax.swing.JList list)
Helper method to bind a list

Parameters:
key - The name of the control
list - The list

linkTextField

public void linkTextField(javax.xml.namespace.QName key,
                          javax.swing.JTextField textField)
Helper method to bind a text field

Parameters:
key - The name of the control
textField - The text field

linkLabel

public void linkLabel(javax.xml.namespace.QName key,
                      javax.swing.JLabel label)
               throws DataSetException
Helper method to bind a label

Parameters:
key - The name of the control
label - The label
Throws:
DataSetException

linkButton

public void linkButton(javax.xml.namespace.QName key,
                       javax.swing.JButton button)
                throws DataSetException
Helper method to bind a button

Parameters:
key - The name of the control
button - The button
Throws:
DataSetException

linkTextEditor

public void linkTextEditor(javax.xml.namespace.QName key,
                           TextEditor editor)
Helper method to bind a text editor

Parameters:
key - The name of the control
editor - The text editor

linkCheckBox

public void linkCheckBox(javax.xml.namespace.QName key,
                         javax.swing.JCheckBox checkBox)
Helper method to bind a check box

Parameters:
key - The name of the control
checkBox - The checkbox

linkTextFieldWithLabel

public void linkTextFieldWithLabel(javax.xml.namespace.QName key,
                                   javax.swing.JTextField textField,
                                   javax.swing.JLabel label)
                            throws DataSetException
Helper method to bind a text field with a label

Parameters:
key - The name of the control group
textField - The text field
label - The label
Throws:
DataSetException

getName

public java.lang.String getName()
Implements IGridBeanPanel.getName()

Specified by:
getName in interface IGridBeanPanel
Overrides:
getName in class java.awt.Component
Returns:
The name of the tab

getComponent

public java.awt.Component getComponent()
Description copied from interface: IGridBeanPanel
Get the component to plug into the tabbed pane.

Specified by:
getComponent in interface IGridBeanPanel
Returns:
The component to be plugged into the tabbed pane

load

public void load(IGridBeanModel model,
                 com.intel.gpe.client.application.Client client)
          throws DataSetException,
                 TranslationException
Description copied from interface: IDataSet
Load data set component values from the GridBean model and the client object.

Specified by:
load in interface IDataSet
Parameters:
model - The GridBean model
client - The client
Throws:
DataSetException
TranslationException - If translation of any value failed

store

public void store(IGridBeanModel model)
           throws DataSetException,
                  TranslationException
Description copied from interface: IDataSet
Store the component values in the GridBean model.

Specified by:
store in interface IDataSet
Parameters:
model - The GridBean model
Throws:
DataSetException
TranslationException - If translation of any value failed

updateValues

public void updateValues(com.intel.gpe.client.application.Client client)
This method is called whenever load(IGridBeanModel, Client) is called. Override it if you want to update the values of the panel depending on the state of the client object.

Parameters:
client - The client

validate

public void validate(ErrorSet errors)
Description copied from interface: IGridBeanPanel
Validate the contents of the panel.

Specified by:
validate in interface IGridBeanPanel
Parameters:
errors - The set of the encountered errors

isValid

public boolean isValid(javax.xml.namespace.QName key,
                       java.lang.StringBuffer buf)
                throws DataSetException
Description copied from interface: IDataSet
Check if the value of the component is valid.

Specified by:
isValid in interface IDataSet
Parameters:
key - The name of the component
buf - The reason of the failure of validation check is appended here
Returns:
true if the value of the specified component is valid
Throws:
DataSetException

getDescription

public java.lang.String getDescription(javax.xml.namespace.QName key)
                                throws DataSetException
Description copied from interface: IDataSet
Get the description of the component.

Specified by:
getDescription in interface IDataSet
Parameters:
key - The name of the component
Returns:
The description of the specified component
Throws:
DataSetException