dLife Home Page

dlife.robot.gui
Class ArraySensorDisplay<VTYPE>

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 dlife.gui.GUIPanel
                      extended by dlife.robot.gui.DeviceDisplay
                          extended by dlife.robot.gui.ArraySensorDisplay<VTYPE>
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Observer, Accessible
Direct Known Subclasses:
HemissonIRSensor.IRSensorDisplay, Khepera2IRSensor.IRSensorDisplay, Khepera3IRSensor.IRDisplay

public abstract class ArraySensorDisplay<VTYPE>
extends DeviceDisplay

GUI display for an ArraySensor. The values are displayed in a table with two columns. The left hand column displays a label for each value. The right hand column displays the value corresponding to each label. If the number of elements requires more space than is available a vertical scrollbar appears on the right. In addition a frozen check box appears at the bottom of the list. Checking this checkbox will prevent the displayed values from being updated. Note that this checkbox does not stop the updating of the underlying ArraySensor.

Version:
Apr 17, 2007
Author:
Grant Braught, Dickinson College
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ArraySensor<VTYPE> sensor
           
 
Fields inherited from class dlife.robot.gui.DeviceDisplay
myDevice
 
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
ArraySensorDisplay(ArraySensor<VTYPE> mySensor)
          Construct a new ArrayValueDisplay for the specified ArraySensor.
 
Method Summary
protected  void buildGUI()
          Assemble the pieces of the GUI.
 void columnHeaderChange()
          Indicate to this ArraySensorDisplay that the column headings have changed.
protected  void disableGUI()
          Nothing to disable in an ArraySensorDisplay.
protected  void enableGUI()
          Nothing to enable in an ArraySensorDisplay.
abstract  String getSensorColumnHeader()
          Get the name to be used at the top of the column of sensor names in the GUI display (e.g.
abstract  String getSensorName(int row)
          Get the name of the sensor for each row of the GUI display.
abstract  String getValueColumnHeader()
          Get the name to be used at the top of the column of sensor values in the GUI display (e.g.
 boolean isFrozen()
          Determine if this display is frozen or not.
static void main(String[] args)
          A little test method for the ArrayValueDisplay.
 void updateGUIFromDevice()
          Update the display.
 
Methods inherited from class dlife.robot.gui.DeviceDisplay
getContentPanel, getGUIName, isActive, isEnabled, replaceContentPanel, setActive, setEnabled, update
 
Methods inherited from class dlife.gui.GUIPanel
invokeBuildGUI
 
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, 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, 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

sensor

protected ArraySensor<VTYPE> sensor
Constructor Detail

ArraySensorDisplay

public ArraySensorDisplay(ArraySensor<VTYPE> mySensor)
Construct a new ArrayValueDisplay for the specified ArraySensor. The name of each Sensor in the ArraySensor will be displayed in the left column of the table. The value each Sensor will be displayed in the right column.

Parameters:
mySensor - the ArraySensor for which to display its values.
Method Detail

buildGUI

protected void buildGUI()
Assemble the pieces of the GUI.

Specified by:
buildGUI in class GUIPanel

getSensorColumnHeader

public abstract String getSensorColumnHeader()
Get the name to be used at the top of the column of sensor names in the GUI display (e.g. "Sensors").

Returns:
the name for the sensor column.

getValueColumnHeader

public abstract String getValueColumnHeader()
Get the name to be used at the top of the column of sensor values in the GUI display (e.g. "Distance (cm)").

Returns:
the name to be used for the value column.

getSensorName

public abstract String getSensorName(int row)
Get the name of the sensor for each row of the GUI display.

Parameters:
row - the row of the table.
Returns:
the name of the Sensor for the indicated row.

isFrozen

public boolean isFrozen()
Determine if this display is frozen or not. If the display is frozen then the values and labels that it displays will not be updated.

Returns:
true if this display is frozen and false if it is not.

updateGUIFromDevice

public void updateGUIFromDevice()
Update the display. This method is invoked automatically when there is a change to the data in the ArraySensor class.

Specified by:
updateGUIFromDevice in class DeviceDisplay

columnHeaderChange

public void columnHeaderChange()
Indicate to this ArraySensorDisplay that the column headings have changed. This will cause the column headings that are displayed in the GUI to update. Note that simply changing the value that is returned by the getSensorColumnHeader or the getValueColumnHeader methods is not sufficient to cause the GUI to update. This method must be called by subclasses that modify the column headers.


disableGUI

protected void disableGUI()
Nothing to disable in an ArraySensorDisplay.

Specified by:
disableGUI in class DeviceDisplay

enableGUI

protected void enableGUI()
Nothing to enable in an ArraySensorDisplay.

Specified by:
enableGUI in class DeviceDisplay

main

public static void main(String[] args)
A little test method for the ArrayValueDisplay. This creates an ArrayValueDisplay places it in a DeviceWindwo and pops it up on the screen. The values displayed are random.

Parameters:
args -

dLife Home Page