DESY ACOP Beans Home

com.cosylab.gui.components
Class AbstractNumericDisplayerPanel

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 com.cosylab.gui.components.AbstractDisplayerPanel
                      extended by com.cosylab.gui.components.AbstractNumericDisplayerPanel
All Implemented Interfaces:
StateOriginator, PopupManageable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
LabelledNumberField, LabelledWheelswitch

public abstract class AbstractNumericDisplayerPanel
extends AbstractDisplayerPanel

An extension of AbstractDisplayerPanel used for numerical displayers.

Version:
$id$
Author:
Jernej Kamenik
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
 
Fields inherited from class com.cosylab.gui.components.AbstractDisplayerPanel
DYNAMIC_LAYOUT, HORIZONTAL_LAYOUT, VERTICAL_LAYOUT
 
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
AbstractNumericDisplayerPanel()
          Default constructor.
AbstractNumericDisplayerPanel(java.lang.String title, boolean titleVisible, int layoutOrientation, boolean resizable, boolean enabled, boolean enchanced, int minTitleFontSize, int maxTitleFontSize, java.lang.String units, boolean unitsVisible, boolean unitsShownWithTitle)
          Creates a new AbstractNumericDisplayerPanel object with initial parameters.
 
Method Summary
 java.lang.String getFormat()
          Gets the C-style format string used for formatting numerical display
 int getLayoutOrientation()
           Returns the current layout orientation setting.
protected  javax.swing.JComponent getMaxComponent()
          Gets the component displaying the maximum numerical value.
protected  java.lang.Number getMaximumValue()
           
protected  javax.swing.JComponent getMinComponent()
          Returns the component displaying the minimum numerical value.
protected  java.lang.Number getMinimumValue()
           
protected  java.lang.Class<? extends java.lang.Number> getNumberType()
          Determines the number type currently set to this NumericDispalyerPanel.
 State getState()
          Returns the current state of the component.
 java.lang.String getUnits()
          Gets the physical units of the value displayed by the numeric component
protected  javax.swing.JComponent getUnitsComponent()
          Returns the GUI component diplaying units.
protected  void internalSetEnabled()
          Overriden to enable/disable min/max labels.
protected  void internalSetEnhanced()
          Overriden to set enahnced mode to min/max labels.
protected  void internalSetFormat()
           
protected  void internalSetMaximum()
           
protected  void internalSetMinimum()
           
protected  void internalSetResizable()
          Overriden to implement additional functionality.
protected  void internalSetTitle()
           
protected  void internalSetUnits()
           
 boolean isBoundsVisible()
          Determines wether the component should display the numerical bounds of the value component
 boolean isUnitsShownWithTitle()
          If true units will be shown in title label.
 boolean isUnitsVisible()
          Returns true if units are displayed.
protected  void layoutDisplayer()
          Lays out the displayer according to the set layout orientation.
protected  void layoutValueAndBounds()
           
protected  void layoutValueAndTitleAndBounds()
           
protected  void layoutValueAndTitleAndUnits()
           
protected  void layoutValueAndTitleAndUnitsAndBounds()
           
protected  void layoutValueAndUnits()
           
protected  void layoutValueAndUnitsAndBounds()
           
 void setBackground(java.awt.Color bg)
           
 void setBoundsVisible(boolean b)
          Sets the visibility of the numerical bounds.
 void setForeground(java.awt.Color fg)
           
 void setFormat(java.lang.String value)
          Sets the C-style format String used for formatting numerical values
 void setLayoutOrientation(int i)
          Sets the orientation tag determining how the title and value components should be layed out inside the panel.
protected  void setMaximumValue(java.lang.Number value)
           
protected  void setMinimumValue(java.lang.Number value)
           
protected  void setNumberType(java.lang.Class<? extends java.lang.Number> class1)
           
 void setState(State state)
          Sets the state to the component.
 void setTitleMaximumFontSize(int max)
          Sets the maximum title font size allowed.
 void setTitleMinimumFontSize(int min)
          Sets the minimum title font size allowed.
 void setTransferHandler(javax.swing.TransferHandler newHandler)
           
 void setUnits(java.lang.String value)
          Sets the units String to denote the physical units of numerical values displayed
 void setUnitsShownWithTitle(boolean unitsShownWithTitle)
          If set to true units will be shown in title label
 void setUnitsVisible(boolean b)
          Set to true to display units.
 
Methods inherited from class com.cosylab.gui.components.AbstractDisplayerPanel
getCustomizer, getPopupManager, getTitle, getTitleComponent, getTitleMaximumFontSize, getTitleMinimumFontSize, getValueComponent, isDragEnabled, isDropEnabled, isEnhanced, isPopupEnabled, isResizable, isTitleVisible, layoutValue, layoutValueAndTitle, setDragEnabled, setDropEnabled, setEnabled, setEnhanced, setPopupEnabled, setResizable, setTitle, setTitleVisible
 
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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, 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

AbstractNumericDisplayerPanel

public AbstractNumericDisplayerPanel()
Default constructor.


AbstractNumericDisplayerPanel

public AbstractNumericDisplayerPanel(java.lang.String title,
                                     boolean titleVisible,
                                     int layoutOrientation,
                                     boolean resizable,
                                     boolean enabled,
                                     boolean enchanced,
                                     int minTitleFontSize,
                                     int maxTitleFontSize,
                                     java.lang.String units,
                                     boolean unitsVisible,
                                     boolean unitsShownWithTitle)
Creates a new AbstractNumericDisplayerPanel object with initial parameters.

Parameters:
title - initial value
titleVisible - initial value
layoutOrientation - initial value
resizable - initial value
enabled - initial value
enchanced - initial value
minTitleFontSize - initial value
maxTitleFontSize - initial value
units - initial value
unitsVisible - initial value
unitsShownWithTitle - initial value
Method Detail

setBoundsVisible

public void setBoundsVisible(boolean b)
Sets the visibility of the numerical bounds.

Parameters:
b - wether the bounds should be displayed in the panel.

isBoundsVisible

public boolean isBoundsVisible()
Determines wether the component should display the numerical bounds of the value component

Returns:
true if the bounds are displayed, false otherwise.

setFormat

public void setFormat(java.lang.String value)
Sets the C-style format String used for formatting numerical values

Parameters:
value - format String

getFormat

public java.lang.String getFormat()
Gets the C-style format string used for formatting numerical display

Returns:
the C-style format String

setLayoutOrientation

public void setLayoutOrientation(int i)
Description copied from class: AbstractDisplayerPanel
Sets the orientation tag determining how the title and value components should be layed out inside the panel.

Overrides:
setLayoutOrientation in class AbstractDisplayerPanel
Parameters:
i - layout tag, valid values are HORIZONTAL_LAYOUT, VERTICAL_LAYOUT, DYNAMIC_LAYOUT
See Also:
AbstractDisplayerPanel.getLayoutOrientation()

getLayoutOrientation

public int getLayoutOrientation()
Description copied from class: AbstractDisplayerPanel

Returns the current layout orientation setting.

Possible values are:

Overrides:
getLayoutOrientation in class AbstractDisplayerPanel
Returns:
int

setState

public void setState(State state)
Description copied from class: AbstractDisplayerPanel
Sets the state to the component.

Specified by:
setState in interface StateOriginator
Overrides:
setState in class AbstractDisplayerPanel
Parameters:
state - to set.
See Also:
StateOriginator.setState(com.cosylab.application.state.State)

getState

public State getState()
Description copied from class: AbstractDisplayerPanel
Returns the current state of the component.

Specified by:
getState in interface StateOriginator
Overrides:
getState in class AbstractDisplayerPanel
Returns:
current state.
See Also:
StateOriginator.getState()

setUnits

public void setUnits(java.lang.String value)
Sets the units String to denote the physical units of numerical values displayed

Parameters:
value - units String

getUnits

public java.lang.String getUnits()
Gets the physical units of the value displayed by the numeric component

Returns:
units String of numeric value displayed

setUnitsVisible

public void setUnitsVisible(boolean b)
Set to true to display units.

Parameters:
b - true if units are to be displayed.

isUnitsVisible

public boolean isUnitsVisible()
Returns true if units are displayed.

Returns:
boolean true if units are displayed.

getMaxComponent

protected javax.swing.JComponent getMaxComponent()
Gets the component displaying the maximum numerical value. This method is used by the NumericDisplayerPanelLayout.

Returns:
the component displaying the nuemrical maximum

setMaximumValue

protected void setMaximumValue(java.lang.Number value)

getMaximumValue

protected java.lang.Number getMaximumValue()

getMinComponent

protected javax.swing.JComponent getMinComponent()
Returns the component displaying the minimum numerical value. This method is used by the NumericDisplayerPanelLayout.

Returns:
the component displaying the nuemrical minimum

setMinimumValue

protected void setMinimumValue(java.lang.Number value)

getMinimumValue

protected java.lang.Number getMinimumValue()

setNumberType

protected void setNumberType(java.lang.Class<? extends java.lang.Number> class1)

getNumberType

protected java.lang.Class<? extends java.lang.Number> getNumberType()
Determines the number type currently set to this NumericDispalyerPanel. Only Numbers of selected type can be dispalyed by the component.

Returns:
Double.class or Long.class

getUnitsComponent

protected javax.swing.JComponent getUnitsComponent()
Returns the GUI component diplaying units.

Returns:
the GUI component diplaying units

internalSetEnabled

protected void internalSetEnabled()
Overriden to enable/disable min/max labels.

Overrides:
internalSetEnabled in class AbstractDisplayerPanel

internalSetEnhanced

protected void internalSetEnhanced()
Overriden to set enahnced mode to min/max labels.

Overrides:
internalSetEnhanced in class AbstractDisplayerPanel

internalSetFormat

protected void internalSetFormat()

internalSetMaximum

protected void internalSetMaximum()

internalSetMinimum

protected void internalSetMinimum()

internalSetResizable

protected void internalSetResizable()
Overriden to implement additional functionality.

Overrides:
internalSetResizable in class AbstractDisplayerPanel
See Also:
AbstractDisplayerPanel.setResizable(boolean)

internalSetUnits

protected void internalSetUnits()

internalSetTitle

protected void internalSetTitle()
Overrides:
internalSetTitle in class AbstractDisplayerPanel

layoutDisplayer

protected void layoutDisplayer()
Description copied from class: AbstractDisplayerPanel
Lays out the displayer according to the set layout orientation.

Overrides:
layoutDisplayer in class AbstractDisplayerPanel

layoutValueAndBounds

protected void layoutValueAndBounds()

layoutValueAndTitleAndBounds

protected void layoutValueAndTitleAndBounds()

layoutValueAndTitleAndUnits

protected void layoutValueAndTitleAndUnits()

layoutValueAndTitleAndUnitsAndBounds

protected void layoutValueAndTitleAndUnitsAndBounds()

layoutValueAndUnits

protected void layoutValueAndUnits()

layoutValueAndUnitsAndBounds

protected void layoutValueAndUnitsAndBounds()

isUnitsShownWithTitle

public boolean isUnitsShownWithTitle()
If true units will be shown in title label.

Returns:
if true units will be shown in title label

setUnitsShownWithTitle

public void setUnitsShownWithTitle(boolean unitsShownWithTitle)
If set to true units will be shown in title label

Parameters:
unitsShownWithTitle - if true units will be shown in title label

setTitleMaximumFontSize

public void setTitleMaximumFontSize(int max)
Description copied from class: AbstractDisplayerPanel
Sets the maximum title font size allowed.

Overrides:
setTitleMaximumFontSize in class AbstractDisplayerPanel

setTitleMinimumFontSize

public void setTitleMinimumFontSize(int min)
Description copied from class: AbstractDisplayerPanel
Sets the minimum title font size allowed.

Overrides:
setTitleMinimumFontSize in class AbstractDisplayerPanel

setTransferHandler

public void setTransferHandler(javax.swing.TransferHandler newHandler)
Overrides:
setTransferHandler in class AbstractDisplayerPanel

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class AbstractDisplayerPanel

setForeground

public void setForeground(java.awt.Color fg)
Overrides:
setForeground in class AbstractDisplayerPanel


Copyright © 2010. All Rights Reserved.