DESY ACOP Beans Home

com.cosylab.gui.components
Class LabelledWheelswitch

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

public class LabelledWheelswitch
extends AbstractNumericDisplayerPanel
implements PopupManageable

LabelledWheelswitch is extended Wheelswitch with title label and unit label in same style.

Version:
$id$
Author:
Igor Kriznar, 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
static java.lang.String VALUE
          Value property name.
 
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
LabelledWheelswitch()
          Creates a new LabelledWheelswitch object.
LabelledWheelswitch(double value)
          Creates a new LabelledWheelswitch object.
LabelledWheelswitch(double value, java.lang.String format, java.lang.String title, java.lang.String units)
          Creates a new LabelledWheelswitch object.
LabelledWheelswitch(java.lang.String format)
          Creates a new LabelledWheelswitch object.
 
Method Summary
 void addSetListener(SetListener l)
          Adds set listener to the NumberField.
 AbstractCustomizerPanel getCustomizer()
          Loads the default com.cosylab.gui.components.customizer.Customizer for this displayer and returns it.
 boolean getDigitsTakeUpAllSpace()
          true if digits take up all space, otherwise false
 AbstractWheelswitchFormatter getFormatter()
          Returns the formatter employed by the displayer.
 double getMaximum()
          Returns the maximum alowed value.
 double getMinimum()
          Returns the minimum alowed value.
 int getNumberOfAllDigits()
           
 State getState()
          Returns the current state of the component.
 double getValue()
          Returns the value displayed by the Wheelswitch and stored by the formatter.
protected  javax.swing.JComponent getValueComponent()
          Should return the component to display the value of this displayer.
protected  Wheelswitch getWheelswitch()
           
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 internalSetResizable()
          Overriden to implement additional functionality.
 boolean isAnimated()
          Returns weather the labelled wheelswitch is animated.
 boolean isEditable()
          Returns whether the wheelswitch can be edited by the user.
 boolean isTiltingEnabled()
          Returns true if tilting is enabled.
protected  void layoutValueAndTitleAndUnits()
           
protected  void layoutValueAndTitleAndUnitsAndBounds()
           
protected  void layoutValueAndUnits()
           
protected  void layoutValueAndUnitsAndBounds()
           
static void main(java.lang.String[] args)
          Runs simple test applet.
 void removeSetListener(SetListener l)
          Removes set listener from the NumberField.
 void setAnimated(boolean animated)
          Sets the animated property.
 void setBackground(java.awt.Color bg)
           
 void setDigitsTakeUpAllSpace(boolean bool)
          Set true if digits should take up all space, set false if place for not visible digits should be reserved (there is no resizing of digits and labels when 9 changes to 10 etc.).
 void setEditable(boolean newEditable)
          Sets the editability of the wheelswitch.
 void setFormatter(AbstractWheelswitchFormatter formatter)
          Set the formatter fot the value.
 void setMaximum(double newValue)
          Sets the maximum allowed value.
 void setMaxMin(double max, double min)
          Sets the maximum and minimum allowed values.
 void setMinimum(double newValue)
          Sets the minimum allowed value.
 void setNumberOfAllDigits(int numberOfAllDigits)
          If setDigitsTakeUpAllSpace(boolean) is set to false the place for numberOfAllDigits is reserved.
 void setPopupEnabled(boolean enabled)
          Enables or disables the popup menu.
 void setState(State state)
          Sets the state to the component.
 void setTiltingEnabled(boolean b)
          Enables/disables tilting of the displayer.
 void setTitleMaximumFontSize(int max)
          Sets the maximum title font size allowed.
 void setTitleMinimumFontSize(int min)
          Sets the minimum title font size allowed.
 void setUnits(java.lang.String value)
          Sets the units String to denote the physical units of numerical values displayed
 void setUnitsVisible(boolean b)
          Set to true to display units.
 void setValue(double newValue)
          Sets the value and displays it in the wheelswitch.
 
Methods inherited from class com.cosylab.gui.components.AbstractNumericDisplayerPanel
getFormat, getLayoutOrientation, getMaxComponent, getMaximumValue, getMinComponent, getMinimumValue, getNumberType, getUnits, getUnitsComponent, internalSetMaximum, internalSetMinimum, internalSetTitle, internalSetUnits, isBoundsVisible, isUnitsShownWithTitle, isUnitsVisible, layoutDisplayer, layoutValueAndBounds, layoutValueAndTitleAndBounds, setBoundsVisible, setForeground, setFormat, setLayoutOrientation, setMaximumValue, setMinimumValue, setNumberType, setTransferHandler, setUnitsShownWithTitle
 
Methods inherited from class com.cosylab.gui.components.AbstractDisplayerPanel
getPopupManager, getTitle, getTitleComponent, getTitleMaximumFontSize, getTitleMinimumFontSize, isDragEnabled, isDropEnabled, isEnhanced, isPopupEnabled, isResizable, isTitleVisible, layoutValue, layoutValueAndTitle, setDragEnabled, setDropEnabled, setEnabled, setEnhanced, 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
 
Methods inherited from interface com.cosylab.gui.components.util.PopupManageable
getPopupManager
 

Field Detail

VALUE

public static final java.lang.String VALUE
Value property name.

See Also:
Constant Field Values
Constructor Detail

LabelledWheelswitch

public LabelledWheelswitch()
Creates a new LabelledWheelswitch object.


LabelledWheelswitch

public LabelledWheelswitch(double value)
Creates a new LabelledWheelswitch object.

Parameters:
value - initial double value

LabelledWheelswitch

public LabelledWheelswitch(java.lang.String format)
Creates a new LabelledWheelswitch object.

Parameters:
format - initial number (C-style) format

LabelledWheelswitch

public LabelledWheelswitch(double value,
                           java.lang.String format,
                           java.lang.String title,
                           java.lang.String units)
Creates a new LabelledWheelswitch object.

Parameters:
value - initial double value
format - initial number (C-style) format
title - initial title
units - initial units
Method Detail

getCustomizer

public AbstractCustomizerPanel getCustomizer()
Description copied from class: AbstractDisplayerPanel
Loads the default com.cosylab.gui.components.customizer.Customizer for this displayer and returns it.

Overrides:
getCustomizer in class AbstractDisplayerPanel
Returns:
the Customizer intance for this displayer

setEditable

public void setEditable(boolean newEditable)
Sets the editability of the wheelswitch.

Parameters:
newEditable -

isEditable

public boolean isEditable()
Returns whether the wheelswitch can be edited by the user.

Returns:
boolean

setMaximum

public void setMaximum(double newValue)
Sets the maximum allowed value.

Parameters:
newValue -
See Also:
AbstractWheelswitchFormatter.setMaximum(double)

getMaximum

public double getMaximum()
Returns the maximum alowed value.

Returns:
double
See Also:
AbstractWheelswitchFormatter.getMaximum()

setMinimum

public void setMinimum(double newValue)
Sets the minimum allowed value.

Parameters:
newValue -
See Also:
AbstractWheelswitchFormatter.setMinimum(double)

getMinimum

public double getMinimum()
Returns the minimum alowed value.

Returns:
double
See Also:
AbstractWheelswitchFormatter.getMaximum()

setMaxMin

public void setMaxMin(double max,
                      double min)
Sets the maximum and minimum allowed values.

Parameters:
max -
min -
See Also:
Wheelswitch.setMaxMin(double, double)

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 AbstractNumericDisplayerPanel
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 AbstractNumericDisplayerPanel
Returns:
current state.
See Also:
StateOriginator.getState()

setTiltingEnabled

public void setTiltingEnabled(boolean b)
Enables/disables tilting of the displayer. Displayer tilts when out of bounds.

Parameters:
b - true if tilting is enabled
See Also:
Wheelswitch.setTiltingEnabled(boolean);

isTiltingEnabled

public boolean isTiltingEnabled()
Returns true if tilting is enabled.

Returns:
true if tilting is enabled

setValue

public void setValue(double newValue)
Sets the value and displays it in the wheelswitch. The method may also change the current digit selection if neccessary in order to point to the same decimal digit of the displayed value.

Parameters:
newValue -
See Also:
AbstractWheelswitchFormatter.setValue(double)

setAnimated

public void setAnimated(boolean animated)
Sets the animated property.

Parameters:
animated -
See Also:
Wheelswitch.setAnimated(boolean)

isAnimated

public boolean isAnimated()
Returns weather the labelled wheelswitch is animated.

Returns:
animated property
See Also:
Wheelswitch.isAnimated()

getValue

public double getValue()
Returns the value displayed by the Wheelswitch and stored by the formatter.

Returns:
double
See Also:
AbstractWheelswitchFormatter.getValue()

addSetListener

public void addSetListener(SetListener l)
Adds set listener to the NumberField.

See Also:
NumberField.addSetListener(SetListener)

removeSetListener

public void removeSetListener(SetListener l)
Removes set listener from the NumberField.

See Also:
NumberField.removeSetListener(SetListener)

getWheelswitch

protected Wheelswitch getWheelswitch()

getValueComponent

protected javax.swing.JComponent getValueComponent()
Description copied from class: AbstractDisplayerPanel
Should return the component to display the value of this displayer. This method is called inside the constructor to add the valueComponent to the AbstractDisplayerPanel. Subclasses should thus use lazy initialization inside this method.

Specified by:
getValueComponent in class AbstractDisplayerPanel
Returns:
the value component of the AbstractDisplayerPanel.

internalSetEnabled

protected void internalSetEnabled()
Description copied from class: AbstractNumericDisplayerPanel
Overriden to enable/disable min/max labels.

Overrides:
internalSetEnabled in class AbstractNumericDisplayerPanel

internalSetEnhanced

protected void internalSetEnhanced()
Description copied from class: AbstractNumericDisplayerPanel
Overriden to set enahnced mode to min/max labels.

Overrides:
internalSetEnhanced in class AbstractNumericDisplayerPanel

internalSetFormat

protected void internalSetFormat()
Overrides:
internalSetFormat in class AbstractNumericDisplayerPanel

internalSetResizable

protected void internalSetResizable()
Description copied from class: AbstractNumericDisplayerPanel
Overriden to implement additional functionality.

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

setUnitsVisible

public void setUnitsVisible(boolean b)
Description copied from class: AbstractNumericDisplayerPanel
Set to true to display units.

Overrides:
setUnitsVisible in class AbstractNumericDisplayerPanel
Parameters:
b - true if units are to be displayed.

setUnits

public void setUnits(java.lang.String value)
Description copied from class: AbstractNumericDisplayerPanel
Sets the units String to denote the physical units of numerical values displayed

Overrides:
setUnits in class AbstractNumericDisplayerPanel
Parameters:
value - units String

layoutValueAndTitleAndUnits

protected void layoutValueAndTitleAndUnits()
Overrides:
layoutValueAndTitleAndUnits in class AbstractNumericDisplayerPanel

layoutValueAndTitleAndUnitsAndBounds

protected void layoutValueAndTitleAndUnitsAndBounds()
Overrides:
layoutValueAndTitleAndUnitsAndBounds in class AbstractNumericDisplayerPanel

layoutValueAndUnits

protected void layoutValueAndUnits()
Overrides:
layoutValueAndUnits in class AbstractNumericDisplayerPanel

layoutValueAndUnitsAndBounds

protected void layoutValueAndUnitsAndBounds()
Overrides:
layoutValueAndUnitsAndBounds in class AbstractNumericDisplayerPanel

setBackground

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

setFormatter

public void setFormatter(AbstractWheelswitchFormatter formatter)
Set the formatter fot the value.

Parameters:
formatter - new formatter
See Also:
Wheelswitch.setFormatter(AbstractWheelswitchFormatter)

getFormatter

public AbstractWheelswitchFormatter getFormatter()
Returns the formatter employed by the displayer.

See Also:
Wheelswitch.getFormatter()

setTitleMaximumFontSize

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

Overrides:
setTitleMaximumFontSize in class AbstractNumericDisplayerPanel

setTitleMinimumFontSize

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

Overrides:
setTitleMinimumFontSize in class AbstractNumericDisplayerPanel

setDigitsTakeUpAllSpace

public void setDigitsTakeUpAllSpace(boolean bool)
Set true if digits should take up all space, set false if place for not visible digits should be reserved (there is no resizing of digits and labels when 9 changes to 10 etc.).

Parameters:
bool - boolean value

getDigitsTakeUpAllSpace

public boolean getDigitsTakeUpAllSpace()
true if digits take up all space, otherwise false

Returns:

setNumberOfAllDigits

public void setNumberOfAllDigits(int numberOfAllDigits)
If setDigitsTakeUpAllSpace(boolean) is set to false the place for numberOfAllDigits is reserved. Not needed additional digits are not shown.

Parameters:
numberOfAllDigits - number of all digits

getNumberOfAllDigits

public int getNumberOfAllDigits()
Returns:
The number of reserved places for digits.

setPopupEnabled

public void setPopupEnabled(boolean enabled)
Description copied from class: AbstractDisplayerPanel
Enables or disables the popup menu.

Overrides:
setPopupEnabled in class AbstractDisplayerPanel
Parameters:
enabled - true if enable or false if disableds

main

public static void main(java.lang.String[] args)
Runs simple test applet.

Parameters:
args - String[]


Copyright © 2010. All Rights Reserved.