com.threerings.opengl.gui
Class SpinnerLogic

java.lang.Object
  extended by com.threerings.opengl.gui.SpinnerLogic

public class SpinnerLogic
extends Object

Contains the logic for a spinner, allowing the hook-up of any buttons/label.


Field Summary
protected  ActionListener _buttonListener
          Listens to our buttons and updates the model when they're pressed.
protected  boolean _enabled
          Are we enabled?
protected  TextComponent _label
          Displays and allows direct editing of the value.
protected  SpinnerModel _model
          Our model.
protected  ChangeListener _modelListener
          Listens for changes to the model and updates our state.
protected  Button _next
          The next and previous buttons.
protected  Button _prev
          The next and previous buttons.
 
Constructor Summary
SpinnerLogic(TextComponent label, Button next, Button prev, SpinnerModel model)
          Create the logic of a spinner with other components.
 
Method Summary
 SpinnerModel getModel()
          Get the current model.
protected  int getRotationCount(ActionEvent event)
          Get the number of times to rotate the spinner...
 Object getValue()
          Convenience to get the current value of this spinner.
 void setEnabled(boolean enabled)
          Set whether the logic of the spinner should be enabled.
 void setModel(SpinnerModel newModel)
          Set a new model.
protected  void updateButtons()
          Update the enabled state of the buttons.
protected  void updateValue()
          The state of the model has changed: update our subcomponents and fire an action if applicable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_next

protected Button _next
The next and previous buttons.


_prev

protected Button _prev
The next and previous buttons.


_label

protected TextComponent _label
Displays and allows direct editing of the value.


_model

protected SpinnerModel _model
Our model.


_enabled

protected boolean _enabled
Are we enabled?


_modelListener

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


_buttonListener

protected ActionListener _buttonListener
Listens to our buttons and updates the model when they're pressed.

Constructor Detail

SpinnerLogic

public SpinnerLogic(TextComponent label,
                    Button next,
                    Button prev,
                    SpinnerModel model)
Create the logic of a spinner with other components.

Method Detail

setModel

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


getModel

public SpinnerModel getModel()
Get the current model.


getValue

public Object getValue()
Convenience to get the current value of this spinner.


setEnabled

public void setEnabled(boolean enabled)
Set whether the logic of the spinner should be enabled.


updateValue

protected void updateValue()
The state of the model has changed: update our subcomponents and fire an action if applicable.


updateButtons

protected void updateButtons()
Update the enabled state of the buttons.


getRotationCount

protected int getRotationCount(ActionEvent event)
Get the number of times to rotate the spinner...