de.unihalle.informatik.Alida.dataio.provider.helpers
Class ALDOperatorParameterPanel

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 de.unihalle.informatik.Alida.dataio.provider.helpers.ALDOperatorParameterPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ALDOperatorParameterPanel
extends javax.swing.JPanel

Panel to configure an operator.

Author:
Birgit Moeller
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  boolean debug
          Local debug flag, not accessible from outside of the class.
private  Parameter.ExpertMode displayMode
          Mode for displaying parameters.
protected  ALDOperator operator
          The operator associated with this panel.
private  java.util.LinkedList<ALDOpParameterDescriptor> opParamDescrips
          List of all parameter descriptors associated with the operator.
private  ALDParameterPanel panelOptionalParams
          Sub-panel managing the configuration of optional parameters.
private  ALDParameterPanel panelRequiredParams
          Sub-panel managing the configuration of required parameters.
private  ALDParameterPanel panelSupplementalParams
          Sub-panel managing the configuration of supplemental parameters.
private  boolean topLevelCall
          Flag indicating if panel is used on top level or not.
 
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
ALDOperatorParameterPanel(ALDOperator op, Parameter.ExpertMode mode, boolean topLevel)
          Default constructor.
 
Method Summary
 void changeViewMode(Parameter.ExpertMode mode)
          Switches view mode of the panel.
private  ALDParameterPanel createInParameterPanel(java.lang.Boolean useRequired, java.lang.Boolean useSupplemental)
          Create a panel with an entry for each input parameter as requested.
protected  java.lang.Object getDefaultValue(java.lang.Boolean useRequired, java.lang.Boolean useSupplemental, ALDOpParameterDescriptor descr)
          Get the default for a paramter.
private  void initPanel()
          Inits the panel according to formerly specified descriptors.
protected  void registerDescriptor(java.util.LinkedList<ALDOpParameterDescriptor> paramDescriptors, ALDOpParameterDescriptor descr)
          Register a descriptor.
protected  void resetCreateInParameterPanel()
          Method for actions required prior to panel initialization.
 void setOperatorParameters()
          Retrieve parameter values from GUI and configure operator accordingly.
 void updateConfigPanel(ALDOperator op)
          Associate the panel with the given operator and update the GUI.
private  void updatePanel()
          Updates panel according to values in formerly specified operator.
 boolean validateOperatorParameters()
          Check if operator is ready to run.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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, getName, 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

debug

private boolean debug
Local debug flag, not accessible from outside of the class.


displayMode

private Parameter.ExpertMode displayMode
Mode for displaying parameters.

In standard mode the view is restricted to parameters annotated as standard, in advanced mode all annotated parameters of the operator are displayed in the GUI.


operator

protected ALDOperator operator
The operator associated with this panel.


opParamDescrips

private java.util.LinkedList<ALDOpParameterDescriptor> opParamDescrips
List of all parameter descriptors associated with the operator.


panelOptionalParams

private ALDParameterPanel panelOptionalParams
Sub-panel managing the configuration of optional parameters.


panelRequiredParams

private ALDParameterPanel panelRequiredParams
Sub-panel managing the configuration of required parameters.


panelSupplementalParams

private ALDParameterPanel panelSupplementalParams
Sub-panel managing the configuration of supplemental parameters.


topLevelCall

private boolean topLevelCall
Flag indicating if panel is used on top level or not.

Using the panel on top-level refers to usage with operators directly executed, while non-top-level use refers to usage with operators passed as parameters to other operators. In the second case no deep validation is done, i.e. required parameters are allowed to have null values.

Constructor Detail

ALDOperatorParameterPanel

public ALDOperatorParameterPanel(ALDOperator op,
                                 Parameter.ExpertMode mode,
                                 boolean topLevel)
Default constructor.

Parameters:
op - Operator associated with this panel.
mode - Display mode of the panel.
topLevel - If true, a top-level context is assumed.
Method Detail

changeViewMode

public void changeViewMode(Parameter.ExpertMode mode)
Switches view mode of the panel.

Parameters:
mode - Desired view mode.

createInParameterPanel

private ALDParameterPanel createInParameterPanel(java.lang.Boolean useRequired,
                                                 java.lang.Boolean useSupplemental)
Create a panel with an entry for each input parameter as requested.

The latter is determined via useRequired and useSupplemental.

Parameters:
useRequired - If non-null only parameters with a required flag are used; if null the required flag is ignored.
useSupplemental - If non-null use only parameters with supplemental flag, otherwise supplemental flag is ignored.
Returns:
Generated parameter panel.

getDefaultValue

protected java.lang.Object getDefaultValue(java.lang.Boolean useRequired,
                                           java.lang.Boolean useSupplemental,
                                           ALDOpParameterDescriptor descr)
Get the default for a paramter.

Usually the default value of a parameter is fetched directly from the parameter descriptor itself. However, sometimes default values depend on the system state or are taken from external devices (database, GUI). This method allows to customize the reading of default parameters and is intended to be overriden by sub-classes.

Parameters:
useRequired - Ignored.
useSupplemental - Ignored.
descr - Parameter descriptor in question.
Returns:
Default value of requested parameter, might be null.

initPanel

private void initPanel()
Inits the panel according to formerly specified descriptors.


registerDescriptor

protected void registerDescriptor(java.util.LinkedList<ALDOpParameterDescriptor> paramDescriptors,
                                  ALDOpParameterDescriptor descr)
Register a descriptor.

Registration is needed to allow the panel to get aware of the parameter. E.g., sometimes actions are required for certain parameter types on initialization, and this can be done within this function.

This method is intended to be overriden to customize parameter handling.

Parameters:
paramDescriptors - List to which the descriptor is added.
descr - Descriptor to be registered.

resetCreateInParameterPanel

protected void resetCreateInParameterPanel()
Method for actions required prior to panel initialization.

This method is intended to be overriden to customize panel generation.


setOperatorParameters

public void setOperatorParameters()
Retrieve parameter values from GUI and configure operator accordingly.


updateConfigPanel

public void updateConfigPanel(ALDOperator op)
Associate the panel with the given operator and update the GUI.

Parameters:
op - New operator object to be associated with GUI.

updatePanel

private void updatePanel()
Updates panel according to values in formerly specified operator.


validateOperatorParameters

public boolean validateOperatorParameters()
Check if operator is ready to run.

The operator can be run if all GUI elements of required parameters return non-null values, and if furtheron the operator's validate() method returns true.

Returns:
True, if operator is properly configured.