dods.clients.importwizard
Class VariableSelector

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 dods.clients.importwizard.VariableSelector
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
DArraySelector, DConstructorSelector, DDSSelector, GenericSelector

public abstract class VariableSelector
extends JPanel
implements ActionListener

This is the base class for the classes used by CEGenerator to make a form to allow the user to constrain the data.

Author:
Rich Honhart
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static RE extractName
           
protected static RE splitVars
           
 
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
VariableSelector()
          Creates a new instance of VariableSelector
 
Method Summary
 void actionPerformed(ActionEvent actionEvent)
           
 void addActionListener(ActionListener a)
          Add an action listener
 void addChild(VariableSelector child)
          Add a child to the VariableSelector.
protected  void addVariables(Enumeration variables, JPanel panel)
          For an Enumeration of BaseType's, this function creates the appropriate Swing objects to select parts of the variables which it both places in panel and returns as a Vector.
 void applyCE(String ce)
          Update the components on the screen to match a given constraint expression.
 void connectButton(JRadioButton button)
          Connect a radio button to the VariableSelector.
 void deselectAll()
          Deselect this variable selector and all it's children.
protected  void fireActionEvent()
          Send an action event to all the classes that have been added as listeners.
 String generateCE(String prefix)
          Generate a DODS constraint expression for the variable.
 JRadioButton getButton()
          Return the radiobutton connected to the VariableSelector
 VariableSelector getChild(String name)
          Get child name if it exists.
 Enumeration getChildren()
           
 String getName()
           
 boolean isEnabled()
           
 boolean isSelected()
           
 void reset()
          Reset the everything in this VariableSelector and all it's children.
 void selectAll()
          Select this variable and all it's children
 void setActionCommand(String command)
          Set the action command.
 void setEnabled(boolean enable)
          Enable or disable the VariableSelector and any selected children.
 void setName(String newName)
          Set the name of the VariableSelector (this is usually set to the name of the BaseType it's being used to constrain.
 void setSelected(boolean select)
          Select or deselect the VariableSelector.
 
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, 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, 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, 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

splitVars

protected static RE splitVars

extractName

protected static RE extractName
Constructor Detail

VariableSelector

public VariableSelector()
Creates a new instance of VariableSelector

Method Detail

addActionListener

public void addActionListener(ActionListener a)
Add an action listener

Parameters:
a - The ActionListener

addVariables

protected void addVariables(Enumeration variables,
                            JPanel panel)
For an Enumeration of BaseType's, this function creates the appropriate Swing objects to select parts of the variables which it both places in panel and returns as a Vector.

Parameters:
variables - The DODS variables to create Selectors for.
panel - The panel to put these Selectors in

actionPerformed

public void actionPerformed(ActionEvent actionEvent)
Specified by:
actionPerformed in interface ActionListener

addChild

public void addChild(VariableSelector child)
Add a child to the VariableSelector. This child is a VariableSelector which should represent a sub-variable. Not all specializations of VariableSelector will display children, only the ones for whom it is logical to have sub-variables such as DDSSelector and DConstructorSelector.

Parameters:
child - The child.

applyCE

public void applyCE(String ce)
Update the components on the screen to match a given constraint expression. This function does not work with any Dods compatible constraint expression, only the subset that can be generated by generateCE().

Parameters:
ce - The constraint expression.

connectButton

public void connectButton(JRadioButton button)
Connect a radio button to the VariableSelector. When this button is selected, the VariableSelector will be active, when it's deselected, the VariableSelector will be disabled

Parameters:
button - The button to connect to it.

deselectAll

public void deselectAll()
Deselect this variable selector and all it's children.


selectAll

public void selectAll()
Select this variable and all it's children


reset

public void reset()
Reset the everything in this VariableSelector and all it's children.


fireActionEvent

protected void fireActionEvent()
Send an action event to all the classes that have been added as listeners.


getButton

public JRadioButton getButton()
Return the radiobutton connected to the VariableSelector


getChild

public VariableSelector getChild(String name)
Get child name if it exists. If not, return null.

Parameters:
name - The name of the child
Returns:
The child (a VariableSelector) if it exists.

getChildren

public Enumeration getChildren()
Returns:
All the children as an Enumeration.

getName

public String getName()
Overrides:
getName in class Component
Returns:
The name of the VariableSelector.

generateCE

public String generateCE(String prefix)
Generate a DODS constraint expression for the variable.

Parameters:
prefix - Anything that needs to come before the constraint expression. This is usually a Structure, Sequence, or other container class. If a '.' is needed between the prefix and the part of the CE this class generates, it must be included at the end of the prefix.
Returns:
a DODS constraint expression that will return the variable represented by this VariableSelector.

isEnabled

public boolean isEnabled()
Overrides:
isEnabled in class Component
Returns:
Whether or not this VariableSelector is enabled. (whether or not the user can modify it).

isSelected

public boolean isSelected()
Returns:
Whether or not this VariableSelector is selected. (whether or not it should be included in a generated CE)

setActionCommand

public void setActionCommand(String command)
Set the action command.

Parameters:
command - The action command.

setEnabled

public void setEnabled(boolean enable)
Enable or disable the VariableSelector and any selected children.

Overrides:
setEnabled in class JComponent
Parameters:
enable - Enable (true) or Disable (false).

setName

public void setName(String newName)
Set the name of the VariableSelector (this is usually set to the name of the BaseType it's being used to constrain.

Overrides:
setName in class Component
Parameters:
newName - The name.

setSelected

public void setSelected(boolean select)
Select or deselect the VariableSelector. (Select the associated button, and enable or disable the selector itself).

Parameters:
select - Select(true) or Deselect(false).