faa.tg.util.aircraftViewer
Class FieldPanel

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 faa.tg.util.gui.awt.DraggableJPanel
                      extended by faa.tg.util.aircraftViewer.FieldPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class FieldPanel
extends DraggableJPanel
implements java.awt.event.ActionListener

  This class is a gui representation of any field (if not by using accessor
  method, than by using toString)  More specifically it is a JPanel that contains a label 
  which is the name of the field(the accessor method - "get"), a label 
  containing the value of the field, if the field is an instance of AMeasure 
  a combo box of the units that the value can be displayed in, and if the 
  value can be converted into a Double, a button which if pressed displays
  a StripChart that will also display the field's value. 
  

Version:
$Id: FieldPanel.java,v 3.4 2008/11/24 22:16:32 lykensj Exp $
Author:
Bethany Leffler, Titan See the source: FieldPanel.java
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.awt.Color backColor
           
private  javax.swing.JPanel buttonPanel
           
private  javax.swing.JButton chartButton
           
private  javax.swing.JFrame chartFrame
           
private  javax.swing.JComboBox comboBox
           
static java.lang.String CVS_VERSION_ID
          CVS Version
private static java.awt.Font DEFAULT_FONT
           
private  StripChartDockManager dockMgr
           
private  javax.swing.JLabel field
           
private  java.lang.String fieldName
           
private  FieldPanelPreferences fieldPanelPrefs
           
private  AircraftInformation lastAcInfo
           
private  MethodChain methodChain
           
private  java.lang.String selectedUnits
           
(package private) static long serialVersionUID
           
private  StripChartComponent ssc
           
private  boolean stripChartVisible
           
private  javax.swing.JLabel value
           
 
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
FieldPanel(MethodChain methodChain)
          Constructor - creates two JLabels, a drop down of the Unit_type, and a button
FieldPanel(MethodChain methodChain, java.lang.String units)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent action)
          When comboBox gets changed, reset the value displayed to reflect this using the last AircraftInformation recieved.
 void clear()
          Clears all the values that are currently being displayed
private  void clearStripChart()
          Clears all the values that are currently being displayed on the StripChart
private  void createStripChart()
          Creates and shows a new frame with the StripChartComponent already defined and with the title as this field's name and the acid for which it is being displayed
 javax.swing.JFrame createStripChart(java.lang.String title, java.awt.Point location, java.awt.Dimension size, FieldPanelPreferences panelPrefs)
          Creates and returns a new frame containing a StripChartComponent with the given StripChart preferences and given title
 StripChartPreferences getChartPreferences()
          gets the strip chart preferences for this field
 java.lang.String getFieldName()
          Returns the name of the field the panel is for
 MethodChain getMethodChain()
          Returns the MethodChain used to retrieve the value of this field
 java.lang.String getTitle()
          Returns the title of this field currently displayed (the accessor method minus "get").
 java.lang.String getValue()
          Returns the value currently being displayed as a String
 void hideStripChart()
          disposes of the strip chart frame
 void hideStripChartButton()
          Takes the StripChart button off of the display
private  void makeComboBox()
          Creates a comboBox filled with AUnits that this.value can be displayed in, adds it to this frame and adds this as an ActionListener
private  void makePanel()
          Populates this panel with the title and "" until a value has been received
private  void makeStripChartButton()
          Creates a button for the "Strip Chart", adds it to this panel, and adds this as an ActionListener
 void setBackground(int color)
          Sets the background one of two colors.
 void setSCDockManager(StripChartDockManager manager)
          Sets the StripChartDockManager
 void showStripChart()
          displays the strip chart frame
 java.lang.String toString()
           
 void updateValue(AircraftInformation acInfo)
          Sets the value, combo box and stripChart (if applicable) to the values that are specified in the given AircraftState by invoking this.methodChain
 
Methods inherited from class faa.tg.util.gui.awt.DraggableJPanel
drawLineOnBottom, drawLineOnTop, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, reset, select
 
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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
CVS Version

See Also:
Constant Field Values

backColor

private java.awt.Color backColor

field

private javax.swing.JLabel field

value

private javax.swing.JLabel value

buttonPanel

private javax.swing.JPanel buttonPanel

comboBox

private javax.swing.JComboBox comboBox

selectedUnits

private java.lang.String selectedUnits

chartButton

private javax.swing.JButton chartButton

methodChain

private MethodChain methodChain

lastAcInfo

private AircraftInformation lastAcInfo

ssc

private StripChartComponent ssc

chartFrame

private javax.swing.JFrame chartFrame

fieldPanelPrefs

private FieldPanelPreferences fieldPanelPrefs

dockMgr

private StripChartDockManager dockMgr

DEFAULT_FONT

private static java.awt.Font DEFAULT_FONT

stripChartVisible

private boolean stripChartVisible

fieldName

private java.lang.String fieldName
Constructor Detail

FieldPanel

public FieldPanel(MethodChain methodChain,
                  java.lang.String units)
Constructor

Parameters:
methodChain - - methodChain the chain of methods to call to get value
units - - the units to use

FieldPanel

public FieldPanel(MethodChain methodChain)
Constructor - creates two JLabels, a drop down of the Unit_type, and a button

Parameters:
methodChain - the chain of methods to call to get value
Method Detail

getFieldName

public java.lang.String getFieldName()
Returns the name of the field the panel is for


hideStripChartButton

public void hideStripChartButton()
Takes the StripChart button off of the display


makePanel

private void makePanel()
Populates this panel with the title and "" until a value has been received


getValue

public java.lang.String getValue()
Returns the value currently being displayed as a String


setBackground

public void setBackground(int color)
Sets the background one of two colors.

Parameters:
color - color desired - if 0 color is LIGHT_GRAY otherwise its GRAY

getMethodChain

public MethodChain getMethodChain()
Returns the MethodChain used to retrieve the value of this field


getTitle

public java.lang.String getTitle()
Returns the title of this field currently displayed (the accessor method minus "get").


clearStripChart

private void clearStripChart()
Clears all the values that are currently being displayed on the StripChart


clear

public void clear()
Clears all the values that are currently being displayed


setSCDockManager

public void setSCDockManager(StripChartDockManager manager)
Sets the StripChartDockManager


makeStripChartButton

private void makeStripChartButton()
Creates a button for the "Strip Chart", adds it to this panel, and adds this as an ActionListener


makeComboBox

private void makeComboBox()
Creates a comboBox filled with AUnits that this.value can be displayed in, adds it to this frame and adds this as an ActionListener


updateValue

public void updateValue(AircraftInformation acInfo)
Sets the value, combo box and stripChart (if applicable) to the values that are specified in the given AircraftState by invoking this.methodChain

Parameters:
acInfo - state to update this panel with

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent action)
When comboBox gets changed, reset the value displayed to reflect this using the last AircraftInformation recieved. When the StripChart Button gets pressed, create a new StripChart

Specified by:
actionPerformed in interface java.awt.event.ActionListener

showStripChart

public void showStripChart()
displays the strip chart frame


hideStripChart

public void hideStripChart()
disposes of the strip chart frame


toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

getChartPreferences

public StripChartPreferences getChartPreferences()
gets the strip chart preferences for this field


createStripChart

private void createStripChart()
Creates and shows a new frame with the StripChartComponent already defined and with the title as this field's name and the acid for which it is being displayed


createStripChart

public javax.swing.JFrame createStripChart(java.lang.String title,
                                           java.awt.Point location,
                                           java.awt.Dimension size,
                                           FieldPanelPreferences panelPrefs)
Creates and returns a new frame containing a StripChartComponent with the given StripChart preferences and given title

Returns:
the JFrame just created