org.proteinshader.gui.components.controlpanel
Class RadioPanel

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 org.proteinshader.gui.components.controlpanel.RadioPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class RadioPanel
extends JPanel

Presents a common set of radio buttons and menus that are used by other panels (color, visibility, and scale panels).

The RadioPanel can be set to be of Type.CARTOON or Type.ATOM, which has more menu options. The RadioPanel object will hold on to a ModifierVisitor so that it can accept DrawableModifier objects (AtomModifier, BondModifier, and SegmentModifier) from other panels (color, visibility, and scale panels).

See Also:
Serialized Form

Nested Class Summary
static class RadioPanel.Type
          There are two slightly different versions of the RadioPanel.
 
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
 
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
RadioPanel(Mediator mediator, Frame dialogOwner, RadioPanel.Type type)
          Constructs a RadioPanel.
 
Method Summary
 RadioButtonEnum getActiveRadioButton()
          Returns the RadioButtonEnum corresponding to the currently active radio button: SELECTED, HELICES, STRANDS, LOOPS, or GLOBAL.
 void modifyGlobal(AtomModifier atomModifier, BondModifier bondModifier, SegmentModifier segmentModifier)
          Applies the DrawableModifiers to whatever item or items are currently selected in the "Global:" menu.
 void modifyHelices(AtomModifier atomModifier, BondModifier bondModifier, SegmentModifier segmentModifier)
          Applies the DrawableModifiers to the Helix or Helices currently selected in the "Helices:" menu.
 void modifyLoops(AtomModifier atomModifier, BondModifier bondModifier, SegmentModifier segmentModifier)
          Applies the DrawableModifiers to the Loop or Loops currently selected in the "Loops:" menu.
 void modifySelected(AtomModifier atomModifier, BondModifier bondModifier, SegmentModifier segmentModifier)
          Applies the DrawableModifiers to whatever item or items are currently selected in the "Selected:" menu.
 void modifyStrands(AtomModifier atomModifier, BondModifier bondModifier, SegmentModifier segmentModifier)
          Applies the DrawableModifiers to the BetaStrand or BetaStrands currently selected in the "Strands:" menu.
 void replaceLowerPanel(JPanel lowerPanel)
          Replaces the lower panel of the RadioPanel.
 void setActiveRadioButton(JComboBox activeMenu)
          This method is called by the menu action listener in order to update the active radio button.
 void setActiveRadioButton(RadioButtonEnum activeRadioButton)
          Sets the RadioButtonEnum corresponding to the currently active radio button: SELECTED, HELICES, STRANDS, LOOPS, or GLOBAL.
 void setDefaultRadioButtonAndMenu()
          Sets the default radio button and menu, which are currently the radio button labeled "Selected:" and the first menu item, which is "Model".
 void setSelectedMenu(String item)
          Sets the "Selected:" menu to the item given as an argument.
 void updateModelInfo()
          Updates the "Helices:", "BetaStrands:", and "Loops:" menus with the Helices and BetaStrands of the current Model.
 
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, 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
 

Constructor Detail

RadioPanel

public RadioPanel(Mediator mediator,
                  Frame dialogOwner,
                  RadioPanel.Type type)
Constructs a RadioPanel.

Parameters:
mediator - the centralized Mediator that most listeners need to call on to accomplish their task.
dialogOwner - the owner of any Dialogs opened from the SelectorPanel (or null if there is no requested owner).
Method Detail

replaceLowerPanel

public void replaceLowerPanel(JPanel lowerPanel)
Replaces the lower panel of the RadioPanel. For example, this can be used to switch the lower panel from a ColorPanel to a VisibilityPanel.

Parameters:
lowerPanel - the new lower panel to display.

modifySelected

public void modifySelected(AtomModifier atomModifier,
                           BondModifier bondModifier,
                           SegmentModifier segmentModifier)
Applies the DrawableModifiers to whatever item or items are currently selected in the "Selected:" menu.

Parameters:
atomModifier - an AtomModifier programmed to modify Atoms (or null for no modifications).
bondModifier - a BondModifier programmed to modify Bonds (or null for no modifications).
segmentModifier - a SegmentModifier programmed to modify Segments (or null for no modifications).

modifyHelices

public void modifyHelices(AtomModifier atomModifier,
                          BondModifier bondModifier,
                          SegmentModifier segmentModifier)
Applies the DrawableModifiers to the Helix or Helices currently selected in the "Helices:" menu.

Parameters:
atomModifier - an AtomModifier programmed to modify Atoms (or null for no modifications).
bondModifier - a BondModifier programmed to modify Bonds (or null for no modifications).
segmentModifier - a SegmentModifier programmed to modify Segments (or null for no modifications).

modifyStrands

public void modifyStrands(AtomModifier atomModifier,
                          BondModifier bondModifier,
                          SegmentModifier segmentModifier)
Applies the DrawableModifiers to the BetaStrand or BetaStrands currently selected in the "Strands:" menu.

Parameters:
atomModifier - an AtomModifier programmed to modify Atoms (or null for no modifications).
bondModifier - a BondModifier programmed to modify Bonds (or null for no modifications).
segmentModifier - a SegmentModifier programmed to modify Segments (or null for no modifications).

modifyLoops

public void modifyLoops(AtomModifier atomModifier,
                        BondModifier bondModifier,
                        SegmentModifier segmentModifier)
Applies the DrawableModifiers to the Loop or Loops currently selected in the "Loops:" menu.

Parameters:
atomModifier - an AtomModifier programmed to modify Atoms (or null for no modifications).
bondModifier - a BondModifier programmed to modify Bonds (or null for no modifications).
segmentModifier - a SegmentModifier programmed to modify Segments (or null for no modifications).

modifyGlobal

public void modifyGlobal(AtomModifier atomModifier,
                         BondModifier bondModifier,
                         SegmentModifier segmentModifier)
Applies the DrawableModifiers to whatever item or items are currently selected in the "Global:" menu.

Parameters:
atomModifier - an AtomModifier programmed to modify Atoms (or null for no modifications).
bondModifier - a BondModifier programmed to modify Bonds (or null for no modifications).
segmentModifier - a SegmentModifier programmed to modify Segments (or null for no modifications).

getActiveRadioButton

public RadioButtonEnum getActiveRadioButton()
Returns the RadioButtonEnum corresponding to the currently active radio button: SELECTED, HELICES, STRANDS, LOOPS, or GLOBAL.

Returns:
The active button type as a RadioButtonEnum.

setActiveRadioButton

public void setActiveRadioButton(RadioButtonEnum activeRadioButton)
Sets the RadioButtonEnum corresponding to the currently active radio button: SELECTED, HELICES, STRANDS, LOOPS, or GLOBAL.

Parameters:
activeRadioButton - the active button type.

setActiveRadioButton

public void setActiveRadioButton(JComboBox activeMenu)
This method is called by the menu action listener in order to update the active radio button. This reason this action is done is that if a user has just made a choice from a menu, he/she will likely expect that the corresponding radio button should be activated to indicate that this is the menu to read from when a modification (color change, visibility, etc) is made.

Parameters:
activeMenu - the active menu.

setDefaultRadioButtonAndMenu

public void setDefaultRadioButtonAndMenu()
Sets the default radio button and menu, which are currently the radio button labeled "Selected:" and the first menu item, which is "Model".


setSelectedMenu

public void setSelectedMenu(String item)
Sets the "Selected:" menu to the item given as an argument.

The item argument must be the name of a choice in the menu (such as 'Model', 'Chain', or 'Residues'). Otherwise, no action will occur.

Parameters:
item - the name of a menu choice.

updateModelInfo

public void updateModelInfo()
Updates the "Helices:", "BetaStrands:", and "Loops:" menus with the Helices and BetaStrands of the current Model.



Copyright © 2007-2008