DESY ACOP Beans Home

com.cosylab.gui.components.slider
Class NavigationBar

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

public class NavigationBar
extends javax.swing.JPanel

Button bar for exact control over slider behaviour. Consists of six buttons (3 for decrementing, 3 for incrementing the value) and editable text field for entering exact values. Text field is updated to reflect current value.

Version:
$id$
Author:
Ales Pucelj
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 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
NavigationBar(Slider owner)
          Constructor for NavigationBar.
 
Method Summary
 void addSetListener(SetListener sl)
          Adds a set listener which receives notification when a new value is set in the field.
 java.lang.String format(double value)
          Convinience format with Slider format
 Slider.Button getAutoUpdateButton()
           
 javax.swing.Icon getButtonIcon(Slider.Button button)
           
 java.lang.String getButtonText(Slider.Button button)
          Returns the button text.
 java.lang.String getButtonTooltip(Slider.Button button)
          Returns the button tooltip.
 int getContinuousModeDelayTime()
          Sets the continuous mode delay time for the buttons hold update.
 int getContinuousModeRepeatTime()
          Returns the continuous mode repeat time for the buttons hold update.
 java.lang.String getFormat()
          Returns current format of text field.
 java.lang.String getUnits()
          Returns units currently displayed next to edit field.
 java.awt.Font getUnitsFont()
          Returns the font used to display units.
 double getValue()
          Returns text field value.
 boolean isButtonVisible(Slider.Button button)
          Returns the visibility of the button.
 boolean isUnitsVisible()
          Returns true if units are visible.
 void removeSetListener(SetListener sl)
          Removes a set listener.
 void setAutoUpdateButton(Slider.Button autoUpdateButton)
           
 void setBackground(java.awt.Color bg)
           
 void setButtonIcon(Slider.Button button, javax.swing.Icon icon)
           
 void setButtonText(Slider.Button button, java.lang.String text)
          Sets text for buttons.
 void setButtonTooltip(Slider.Button button, java.lang.String tooltip)
          Sets tooltips for buttons.
 void setButtonVisible(Slider.Button button, boolean visible)
          Sets the visibility of the button.
 void setContinuousModeDelayTime(int continuousModeDelayTime)
          Sets the continuous mode delay time for the buttons hold update.
 void setContinuousModeRepeatTime(int continuousModeRepeatTime)
          Sets the continuous mode repeat time for the buttons hold update.
 void setEnabled(boolean enabled)
           
 void setForeground(java.awt.Color fg)
           
 void setFormat(java.lang.String format)
          Sets new format for text field.
 void setMaximum(double min)
          Sets the maximum value.
 void setMinimum(double min)
          Sets the minimum value.
 void setUnits(java.lang.String units)
          Sets units to be displayed next to text field.
 void setUnitsFont(java.awt.Font font)
          Sets the font used to display units.
 void setUnitsVisible(boolean b)
          Sets the units visibility.
 void setValue(double value)
          Sets the value to the text field.
 
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, 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
 

Constructor Detail

NavigationBar

public NavigationBar(Slider owner)
Constructor for NavigationBar.

Parameters:
owner - Slider
Throws:
java.lang.IllegalArgumentException - if owner is null.
Method Detail

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class javax.swing.JComponent

setValue

public void setValue(double value)
Sets the value to the text field.

Parameters:
value - new value

getValue

public double getValue()
Returns text field value.

Returns:
current value of text field.

setContinuousModeDelayTime

public void setContinuousModeDelayTime(int continuousModeDelayTime)
Sets the continuous mode delay time for the buttons hold update.

Parameters:
continuousModeDelayTime - the initial delay time in millis

getContinuousModeDelayTime

public int getContinuousModeDelayTime()
Sets the continuous mode delay time for the buttons hold update.

Returns:
the initial delay time in millis

setContinuousModeRepeatTime

public void setContinuousModeRepeatTime(int continuousModeRepeatTime)
Sets the continuous mode repeat time for the buttons hold update.

Parameters:
continuousModeRepeatTime - the update period in millis

getContinuousModeRepeatTime

public int getContinuousModeRepeatTime()
Returns the continuous mode repeat time for the buttons hold update.

Returns:
the update period in millis

getFormat

public java.lang.String getFormat()
Returns current format of text field.

Returns:
current format of text field.

setFormat

public void setFormat(java.lang.String format)
Sets new format for text field. This format is used only when displaying the value.

Parameters:
format - to set for textfield.

setUnits

public void setUnits(java.lang.String units)
Sets units to be displayed next to text field.

Parameters:
units - string to set.

getUnits

public java.lang.String getUnits()
Returns units currently displayed next to edit field.

Returns:
current units string.

format

public java.lang.String format(double value)
Convinience format with Slider format

Parameters:
value - the value
Returns:
formated value as String

setMinimum

public void setMinimum(double min)
Sets the minimum value.

Parameters:
min - minimum

setMaximum

public void setMaximum(double min)
Sets the maximum value.

Parameters:
min - maximum

setUnitsVisible

public void setUnitsVisible(boolean b)
Sets the units visibility.

Parameters:
b - true if units are visible

isUnitsVisible

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

Returns:
true if visible

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class javax.swing.JComponent

setForeground

public void setForeground(java.awt.Color fg)
Overrides:
setForeground in class javax.swing.JComponent

addSetListener

public void addSetListener(SetListener sl)
Adds a set listener which receives notification when a new value is set in the field.

Parameters:
sl -

removeSetListener

public void removeSetListener(SetListener sl)
Removes a set listener.

Parameters:
sl -

setButtonText

public void setButtonText(Slider.Button button,
                          java.lang.String text)
Sets text for buttons.

Parameters:
button -
text -
See Also:

getButtonText

public java.lang.String getButtonText(Slider.Button button)
Returns the button text.

Parameters:
button -
Returns:

setButtonTooltip

public void setButtonTooltip(Slider.Button button,
                             java.lang.String tooltip)
Sets tooltips for buttons.

Parameters:
button -
tooltip -
See Also:

getButtonTooltip

public java.lang.String getButtonTooltip(Slider.Button button)
Returns the button tooltip.

Parameters:
button -
Returns:

setButtonVisible

public void setButtonVisible(Slider.Button button,
                             boolean visible)
Sets the visibility of the button.

Parameters:
button - the button
visible - true if button should be visible

isButtonVisible

public boolean isButtonVisible(Slider.Button button)
Returns the visibility of the button.

Parameters:
button -
Returns:
visibility of the button

setUnitsFont

public void setUnitsFont(java.awt.Font font)
Sets the font used to display units.

Parameters:
font - new font

getUnitsFont

public java.awt.Font getUnitsFont()
Returns the font used to display units.

Returns:

getAutoUpdateButton

public Slider.Button getAutoUpdateButton()

setAutoUpdateButton

public void setAutoUpdateButton(Slider.Button autoUpdateButton)

setButtonIcon

public void setButtonIcon(Slider.Button button,
                          javax.swing.Icon icon)

getButtonIcon

public javax.swing.Icon getButtonIcon(Slider.Button button)


Copyright © 2010. All Rights Reserved.