com.threerings.opengl.gui
Class Spinner

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.Spinner
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, UIConstants

public class Spinner
extends Container
implements UIConstants

Displays a value with little next and previous buttons.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container
Container.ChildOp
 
Field Summary
protected  String _action
          Our action string.
protected  TextComponent _editor
          Our label.
protected  SpinnerLogic _logic
          Spinner logic.
protected  ChangeListener _modelListener
          Listens for changes to the model and updates our state.
protected  Button _next
          Our buttons.
protected  Button _prev
          Our buttons.
 
Fields inherited from class com.threerings.opengl.gui.Container
_children, _layout
 
Fields inherited from class com.threerings.opengl.gui.Component
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Fields inherited from interface com.threerings.opengl.gui.UIConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
Spinner(GlContext ctx)
          Creates a spinner with a default Number spinner model with no minimum or maximum value, stepSize equal to 1, and an initial value of 0.
Spinner(GlContext ctx, SpinnerModel model)
          Creates a spinner with the specified spinner model.
 
Method Summary
protected  TextComponent createEditor(SpinnerModel model)
          Create the editor to use for this spinner.
protected  void fireAction(long when, int modifiers)
          Fire our action.
 String getAction()
          Get the action of this spinner.
protected  String getDefaultStyleConfig()
          Returns the name of the default config to be used for all instances of this component.
 SpinnerModel getModel()
          Get the current model.
 void setAction(String action)
          Set the action that will be fired when the state of this spinner changes, the argument will be the current value of the model.
 void setEditorStyleConfig(ConfigReference<StyleConfig> ref)
          Configures the style of the editor.
 void setEnabled(boolean enabled)
          Sets this components enabled state.
 void setModel(SpinnerModel newModel)
          Set a new model.
 void setNextStyleConfig(ConfigReference<StyleConfig> ref)
          Configures the style of the next button.
 void setPreviousStyleConfig(ConfigReference<StyleConfig> ref)
          Configures the style of the previous button.
 void setStyleConfig(String name)
          Sets the style configuration.
protected  void valueChanged()
          The state of the model has changed: fire an action if applicable.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getFirstDescendantFocus, getHitComponent, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, layout, remove, remove, removeAll, renderComponent, replace, setAlpha, setHoverable, setLayoutManager, validate, wasAdded, wasRemoved
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, changeCursor, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFallbackState, getFocusTarget, getHeight, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, scrollRectToVisible, scrollRectToVisible, setBackground, setBounds, setCursor, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, updateFromStyleConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logic

protected SpinnerLogic _logic
Spinner logic.


_action

protected String _action
Our action string.


_editor

protected TextComponent _editor
Our label.


_next

protected Button _next
Our buttons.


_prev

protected Button _prev
Our buttons.


_modelListener

protected ChangeListener _modelListener
Listens for changes to the model and updates our state.

Constructor Detail

Spinner

public Spinner(GlContext ctx)
Creates a spinner with a default Number spinner model with no minimum or maximum value, stepSize equal to 1, and an initial value of 0.


Spinner

public Spinner(GlContext ctx,
               SpinnerModel model)
Creates a spinner with the specified spinner model.

Method Detail

setModel

public void setModel(SpinnerModel newModel)
Set a new model.


getModel

public SpinnerModel getModel()
Get the current model.


setAction

public void setAction(String action)
Set the action that will be fired when the state of this spinner changes, the argument will be the current value of the model.


getAction

public String getAction()
Get the action of this spinner.


setEnabled

public void setEnabled(boolean enabled)
Description copied from class: Component
Sets this components enabled state. A component that is not enabled should not respond to user interaction and should render itself in such a way as not to afford user interaction.

Overrides:
setEnabled in class Container

setStyleConfig

public void setStyleConfig(String name)
Description copied from class: Component
Sets the style configuration.

Overrides:
setStyleConfig in class Component

setEditorStyleConfig

public void setEditorStyleConfig(ConfigReference<StyleConfig> ref)
Configures the style of the editor.


setNextStyleConfig

public void setNextStyleConfig(ConfigReference<StyleConfig> ref)
Configures the style of the next button.


setPreviousStyleConfig

public void setPreviousStyleConfig(ConfigReference<StyleConfig> ref)
Configures the style of the previous button.


createEditor

protected TextComponent createEditor(SpinnerModel model)
Create the editor to use for this spinner.


valueChanged

protected void valueChanged()
The state of the model has changed: fire an action if applicable.


fireAction

protected void fireAction(long when,
                          int modifiers)
Fire our action.


getDefaultStyleConfig

protected String getDefaultStyleConfig()
Description copied from class: Component
Returns the name of the default config to be used for all instances of this component. Derived classes will likely want to override this method and set up a default config for their type of component.

Overrides:
getDefaultStyleConfig in class Container