edu.neu.ccs.gui
Class StringObjectRadioPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.neu.ccs.gui.RadioPanel
                      extended byedu.neu.ccs.gui.StringObjectRadioPanel
All Implemented Interfaces:
Accessible, Displayable, ImageObserver, JPTConstants, MenuContainer, Serializable, StringObjectView, SwingConstants

public class StringObjectRadioPanel
extends RadioPanel
implements StringObjectView

A view based on RadioPanel for the selection of an object using an associated string in a StringObjectMap.

It is invalid to modify the items in this view after construction by using methods of the base class.

Since:
2.3
Version:
2.3.3
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
protected  StringObjectMap pairmap
          The internal two way map.
 
Fields inherited from class edu.neu.ccs.gui.RadioPanel
BACKGROUND, buttonGroup, commonactions, DEFAULT_SELECTION, defaultLayout, defaultViewState, labelButtonMap, labelIndexMap, modelButtonMap, OPTION_COUNT, SELECTED_BUTTON, SELECTED_INDEX, SELECTED_LABEL, SET_LABEL_TEXT
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.StringObjectView
VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
StringObjectRadioPanel()
          The default constructor.
StringObjectRadioPanel(Object[][] pairs)
          The constructor that uses a pairs array to construct the internal two way map.
StringObjectRadioPanel(Object[][] pairs, ActionListener action)
          The constructor that uses a pairs array to construct the internal two way map; and provides the action listener to perform when an option is selected.
StringObjectRadioPanel(Object[][] pairs, ActionListener action, int selection)
          The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; and provides the initial selection string.
StringObjectRadioPanel(Object[][] pairs, ActionListener action, int selection, LayoutManager layout)
          The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.
StringObjectRadioPanel(StringObjectMap map)
          The constructor that copies the given string-object map to construct the internal string-object map.
StringObjectRadioPanel(StringObjectMap map, ActionListener action)
          The constructor that copies the given string-object map to construct the internal string-object map; and provides the action listener to perform when an option is selected.
StringObjectRadioPanel(StringObjectMap map, ActionListener action, int selection)
          The constructor that copies the given string-object map to construct the internal string-object map; provides the action listener to perform when an option is selected; and provides the initial selection string.
StringObjectRadioPanel(StringObjectMap map, ActionListener action, int selection, LayoutManager layout)
          The constructor that copies the given string-object map to construct the internal string-object map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.
StringObjectRadioPanel(StringObjectPair[] pairs)
          The constructor that uses a pairs array to construct the internal two way map.
StringObjectRadioPanel(StringObjectPair[] pairs, ActionListener action)
          The constructor that uses a pairs array to construct the internal two way map; and provides the action listener to perform when an option is selected.
StringObjectRadioPanel(StringObjectPair[] pairs, ActionListener action, int selection)
          The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; and provides the initial selection string.
StringObjectRadioPanel(StringObjectPair[] pairs, ActionListener action, int selection, LayoutManager layout)
          The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.
 
Method Summary
 void addPair(String string, Object object)
          Adds the new pair with the given string and object.
 void addPair(StringObjectPair pair)
          Adds the new string-object pair.
 void addPairs(Object[][] pairs)
          Adds the new pairs.
 void addPairs(StringObjectMap map)
          Adds the new map.
 void addPairs(StringObjectPair[] pairs)
          Adds the new pairs.
 Object getSelectedObject()
          Returns the object corresponding to the currently selected string in the view.
 String getSelectedString()
          Returns the currently selected string in the view.
protected  void initializeSORadioPanel(StringObjectPair[] pairs, ActionListener action, int selection, LayoutManager layout)
          The initializer.
 void setSelectedObject(Object object)
          Sets the view to the string corresponding to the given object.
 void setSelectedString(String string)
          Sets the view to the string provided that the string is in the internal map.
 
Methods inherited from class edu.neu.ccs.gui.RadioPanel
addActionListener, addActionListener, addActionListeners, addOption, addOption, addOption, addOption, addOptions, addOptions, addOptions, getButtonModel, getDefaultBackground, getDefaultFont, getDefaultViewState, getIndex, getIndex, getLabel, getLabel, getLabelText, getOptionButton, getOptionButton, getOptionButton, getOptionButtons, getOptionCount, getSelectedButton, getSelectedIndex, getSelectedLabel, getViewState, initializeRadioPanel, refreshComponent, removeActionListener, removeActionListener, removeActionListeners, reset, setBackground, setDefaultViewState, setEnabled, setFont, setLabelText, setSelectedButton, setSelectedIndex, setSelectedLabel, setViewState
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from interface edu.neu.ccs.gui.StringObjectView
addActionListener, removeActionListener
 

Field Detail

pairmap

protected StringObjectMap pairmap
The internal two way map.

Constructor Detail

StringObjectRadioPanel

public StringObjectRadioPanel()

The default constructor.

Other constructors:


StringObjectRadioPanel

public StringObjectRadioPanel(Object[][] pairs)

The constructor that uses a pairs array to construct the internal two way map.

Parameters:
pairs - the string-object pairs to add
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(Object[][] pairs,
                              ActionListener action)

The constructor that uses a pairs array to construct the internal two way map; and provides the action listener to perform when an option is selected.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(Object[][] pairs,
                              ActionListener action,
                              int selection)

The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; and provides the initial selection string.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(Object[][] pairs,
                              ActionListener action,
                              int selection,
                              LayoutManager layout)

The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
layout - the layout manager
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectPair[] pairs)

The constructor that uses a pairs array to construct the internal two way map.

Parameters:
pairs - the string-object pairs to add
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectPair[] pairs,
                              ActionListener action)

The constructor that uses a pairs array to construct the internal two way map; and provides the action listener to perform when an option is selected.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectPair[] pairs,
                              ActionListener action,
                              int selection)

The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; and provides the initial selection string.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectPair[] pairs,
                              ActionListener action,
                              int selection,
                              LayoutManager layout)

The constructor that uses a pairs array to construct the internal two way map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
layout - the layout manager
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectMap map)

The constructor that copies the given string-object map to construct the internal string-object map.

Parameters:
map - the string-object map to add
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectMap map,
                              ActionListener action)

The constructor that copies the given string-object map to construct the internal string-object map; and provides the action listener to perform when an option is selected.

Parameters:
map - the string-object map to add
action - the action listener to perform when an option is selected
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectMap map,
                              ActionListener action,
                              int selection)

The constructor that copies the given string-object map to construct the internal string-object map; provides the action listener to perform when an option is selected; and provides the initial selection string.

Parameters:
map - the string-object map to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
See Also:
StringObjectRadioPanel()

StringObjectRadioPanel

public StringObjectRadioPanel(StringObjectMap map,
                              ActionListener action,
                              int selection,
                              LayoutManager layout)

The constructor that copies the given string-object map to construct the internal string-object map; provides the action listener to perform when an option is selected; provides the initial selection string; and provides the layout manager.

Parameters:
map - the string-object map to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
layout - the layout manager
See Also:
StringObjectRadioPanel()
Method Detail

initializeSORadioPanel

protected final void initializeSORadioPanel(StringObjectPair[] pairs,
                                            ActionListener action,
                                            int selection,
                                            LayoutManager layout)
The initializer.

Parameters:
pairs - the string-object pairs to add
action - the action listener to perform when an option is selected
selection - the desired preferred selection
layout - the layout manager

getSelectedString

public final String getSelectedString()

Returns the currently selected string in the view.

Specified by:
getSelectedString in interface StringObjectView
Returns:
the selected string
See Also:
getSelectedObject()

getSelectedObject

public final Object getSelectedObject()

Returns the object corresponding to the currently selected string in the view.

Specified by:
getSelectedObject in interface StringObjectView
Returns:
the selected object
See Also:
getSelectedString()

setSelectedString

public final void setSelectedString(String string)

Sets the view to the string provided that the string is in the internal map.

Does nothing if the string is null or is not in the internal map.

Does nothing if the view state will be unchanged.

Specified by:
setSelectedString in interface StringObjectView
Parameters:
string - the string to use to set the view
See Also:
setSelectedObject(Object)

setSelectedObject

public final void setSelectedObject(Object object)

Sets the view to the string corresponding to the given object.

Does nothing if the object is null or is not in the internal map.

Specified by:
setSelectedObject in interface StringObjectView
Parameters:
object - the object to use to set the view
See Also:
setSelectedString(String)

addPair

public final void addPair(String string,
                          Object object)

Adds the new pair with the given string and object.

Parameters:
string - the string
object - the object
See Also:
addPair(StringObjectPair)

addPair

public final void addPair(StringObjectPair pair)

Adds the new string-object pair.

Parameters:
pair - the string-object pair

addPairs

public final void addPairs(Object[][] pairs)

Adds the new pairs.

Parameters:
pairs - the string-object pairs to add
See Also:
addPairs(StringObjectPair[]), addPairs(StringObjectMap)

addPairs

public final void addPairs(StringObjectPair[] pairs)

Adds the new pairs.

Parameters:
pairs - the string-object pairs to add
See Also:
addPairs(Object[][]), addPairs(StringObjectMap)

addPairs

public final void addPairs(StringObjectMap map)

Adds the new map.

Parameters:
map - the string-object map to add
See Also:
addPairs(Object[][]), addPairs(StringObjectPair[])