org.tanager.ui
Class CButtonPane

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.tanager.ui.CButtonPane
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class CButtonPane
extends javax.swing.JPanel

This class encapsulates the buttons in the Tanager UI. Up, Down, Left, Right, Middle, Menu, Stop, and Power are the only buttons at this time.

Version:
$Revision: 1.2.2.7 $
Author:
Bob Lavey
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
private  javax.swing.JButton downButton_
           Represents the Down button.
private  javax.swing.JButton leftButton_
           Represents the Left button.
private  javax.swing.JButton menuButton_
           Represents the Menu button.
private  javax.swing.JButton middleButton_
           Represents the Middle button.
private  javax.swing.JButton powerButton_
           Represents the Power (On/Off) button.
private  javax.swing.JButton rightButton_
           Represents the Right button.
private static long serialVersionUID
           Represents the universal version ID of this class.
private  javax.swing.JButton stopButton_
           Represents the Stop button.
private  javax.swing.Icon stopIcon_
           Represents the default icon for the Stop button.
private  javax.swing.JButton upButton_
           Represents the Up button.
 
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
CButtonPane(IUIControllerCallback uiController, java.awt.Color backgroundColor)
           This is the only contructor allowed for a CButtonPane object.
 
Method Summary
 void addButtonListener(IButtonHandler buttonHandler)
           This method is used to add a listener to the various buttons.
protected  javax.swing.JPanel createLowerNavigationButtonPanel(java.awt.Color backgroundColor)
           This method arranges the Down button in a new pane.
protected  javax.swing.JPanel createMiddleNavigationButtonPanel(java.awt.Color backgroundColor)
           This method arranges the Left, Right, and Middle buttons in a new pane.
protected  javax.swing.JPanel createUpperNavigationButtonPanel(java.awt.Color backgroundColor)
           This method arranges the Up button in a new pane.
 void redraw(javax.swing.Icon middleButtonIcon)
           This method redraws the pane using the settings from our current state.
 void removeButtonListener(IButtonHandler buttonHandler)
           This method is used to remove a listener from the various buttons.
 
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
 

Field Detail

serialVersionUID

private static final long serialVersionUID

Represents the universal version ID of this class. This ID is recommended for all classes that implement the Serializable interface.

See Also:
Constant Field Values

upButton_

private javax.swing.JButton upButton_

Represents the Up button.


downButton_

private javax.swing.JButton downButton_

Represents the Down button.


leftButton_

private javax.swing.JButton leftButton_

Represents the Left button.


middleButton_

private javax.swing.JButton middleButton_

Represents the Middle button.


rightButton_

private javax.swing.JButton rightButton_

Represents the Right button.


stopButton_

private javax.swing.JButton stopButton_

Represents the Stop button.


menuButton_

private javax.swing.JButton menuButton_

Represents the Menu button.


powerButton_

private javax.swing.JButton powerButton_

Represents the Power (On/Off) button.


stopIcon_

private javax.swing.Icon stopIcon_

Represents the default icon for the Stop button.

Constructor Detail

CButtonPane

public CButtonPane(IUIControllerCallback uiController,
                   java.awt.Color backgroundColor)

This is the only contructor allowed for a CButtonPane object. It initializes the pane's buttons and layout.

Semantics:
  1. set up our layout manager and other properties
  2. create the Up, Down, Left, Right, Middle, Menu, Stop, and Power buttons, and set their properties
  3. arrange the Up, Down, Left, Right, Middle, Menu, Stop, and Power buttons in our pane

Parameters:
uiController - a reference to the a class implementing the IUIControllerCallback interface
backgroundColor - the background color for the controls on this pane
Method Detail

addButtonListener

public void addButtonListener(IButtonHandler buttonHandler)

This method is used to add a listener to the various buttons.

Semantics:
  1. if the given button handler's supportsUpButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's up button callback
  2. if the given button handler's supportsDownButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's down button callback
  3. if the given button handler's supportsLeftButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's left button callback
  4. if the given button handler's supportsMiddleButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's middle button callback
  5. if the given button handler's supportsStopButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's stop button callback
  6. if the given button handler's supportsMenuButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's menu button callback
  7. if the given button handler's supportsPowerButton() method returns true
    1. call the button pane's addActionListener() method, passing the given button handler's power button callback

Parameters:
buttonHandler - the listener to add to the buttons

removeButtonListener

public void removeButtonListener(IButtonHandler buttonHandler)

This method is used to remove a listener from the various buttons.

Semantics:
  1. if the given button handler's supportsUpButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's up button callback
  2. if the given button handler's supportsDownButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's down button callback
  3. if the given button handler's supportsLeftButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's left button callback
  4. if the given button handler's supportsMiddleButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's middle button callback
  5. if the given button handler's supportsStopButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's stop button callback
  6. if the given button handler's supportsMenuButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's menu button callback
  7. if the given button handler's supportsPowerButton() method returns true
    1. call the button pane's removeActionListener() method, passing the given button handler's power button callback

Parameters:
buttonHandler - the listener to add to the buttons

redraw

public void redraw(javax.swing.Icon middleButtonIcon)

This method redraws the pane using the settings from our current state.

Semantics:
  1. set the middle button's icon to the given middle button icon
  2. redraw the pane

Parameters:
middleButtonIcon - the icon to be displayed on the middle button

createUpperNavigationButtonPanel

protected javax.swing.JPanel createUpperNavigationButtonPanel(java.awt.Color backgroundColor)

This method arranges the Up button in a new pane.

Parameters:
backgroundColor -
Returns:
a new pane containing the Up button

createMiddleNavigationButtonPanel

protected javax.swing.JPanel createMiddleNavigationButtonPanel(java.awt.Color backgroundColor)

This method arranges the Left, Right, and Middle buttons in a new pane.

Parameters:
backgroundColor -
Returns:
a new pane containing the Left, Right, and Middle buttons

createLowerNavigationButtonPanel

protected javax.swing.JPanel createLowerNavigationButtonPanel(java.awt.Color backgroundColor)

This method arranges the Down button in a new pane.

Parameters:
backgroundColor -
Returns:
a new pane containing the Down button