com.sas.visuals
Class SliderListener

com.sas.visuals.SliderListener
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.ViewInterface, ButtonListenerInterface, MultipleValueEventSourceInterface, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener

public class SliderListener
implements ButtonListenerInterface, java.awt.event.ActionListener

SliderListener is an implementation of the ButtonListenerInterface used to listen for user events on a SliderInterface component and change the state of its ButtonModelInterface properties. The SliderInterface component will listen on the ButtonModelInterface objects and will forward the state changes of the ButtonModelInterface to the user.

See Also:
SliderInterface, ScrollSlider, ButtonModelInterface, Serialized Form

Field Summary
protected  ButtonModelInterface decrementModel
           
protected  ButtonModelInterface incrementModel
           
protected  ButtonModelInterface model
           
protected  java.awt.Point offset
           
protected  java.awt.Point pressedPoint
           
protected  SliderInterface trackArea
           
 
Constructor Summary
SliderListener(ButtonModelInterface btnModel, ButtonModelInterface incModel, ButtonModelInterface decModel, SliderInterface area)
          Constructor that sets the buttonModels to change the state of based on the user events listened for.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          ActionListener method to handle ActionEvents from the increment and decrement ButtonModelInterface objects.
 ButtonModelInterface getButtonModel()
          Get the ButtonModelInterface for the thumb area of the SliderInterface.
 ButtonModelInterface getDecrementButtonModel()
          Get the ButtonModelInterface for the decrement area of the SliderInterface.
 ButtonModelInterface getIncrementButtonModel()
          Get the ButtonModelInterface for the increment area of the SliderInterface.
 void keyPressed(java.awt.event.KeyEvent evt)
          Method invoked when a key is pressed by the user while the component listened on has focus.
 void keyReleased(java.awt.event.KeyEvent evt)
          Method invoked when a key is released by the user while the component listened on has focus.
 void keyTyped(java.awt.event.KeyEvent evt)
          Method invoked when a key is typed by the user while the component listened on has focus.
 void mouseClicked(java.awt.event.MouseEvent evt)
          Method invoked when the mouse is clicked.
 void mouseDragged(java.awt.event.MouseEvent evt)
          Method invoked when the mouse is dragged.
 void mouseEntered(java.awt.event.MouseEvent evt)
          Method invoked when the mouse enters the button component area.
 void mouseExited(java.awt.event.MouseEvent evt)
          Method invoked when the mouse exits the button component area.
 void mouseMoved(java.awt.event.MouseEvent evt)
          Method invoked when the mouse is moved.
 void mousePressed(java.awt.event.MouseEvent evt)
          Method invoked when the mouse is pressed.
 void mouseReleased(java.awt.event.MouseEvent evt)
          Method invoked when the mouse is released.
 void setButtonModel(ButtonModelInterface btnModel)
          Set the ButtonModelInterface for the thumb area of the SliderInterface.
 

Field Detail

model

protected ButtonModelInterface model

incrementModel

protected ButtonModelInterface incrementModel

decrementModel

protected ButtonModelInterface decrementModel

trackArea

protected SliderInterface trackArea

pressedPoint

protected java.awt.Point pressedPoint

offset

protected java.awt.Point offset
Constructor Detail

SliderListener

public SliderListener(ButtonModelInterface btnModel,
                      ButtonModelInterface incModel,
                      ButtonModelInterface decModel,
                      SliderInterface area)
Constructor that sets the buttonModels to change the state of based on the user events listened for.

Parameters:
btnModel - the thumb area button model
incModel - the increment area button model
decModel - the decrement area button model
area - the slider being listened to
Method Detail

getIncrementButtonModel

public ButtonModelInterface getIncrementButtonModel()
Get the ButtonModelInterface for the increment area of the SliderInterface. The model will be modified based on user events that occur on the increment area of the slider.

Returns:
the ButtonModelInterface for the increment area of the SliderInterface

getDecrementButtonModel

public ButtonModelInterface getDecrementButtonModel()
Get the ButtonModelInterface for the decrement area of the SliderInterface. The model will be modified based on user events that occur on the decrement area of the slider.

Returns:
the ButtonModelInterface for the decrement area of the SliderInterface

getButtonModel

public ButtonModelInterface getButtonModel()
Get the ButtonModelInterface for the thumb area of the SliderInterface. The model will be modified based on user events that occur on the thumb area of the slider.

Specified by:
getButtonModel in interface ButtonListenerInterface
Returns:
the ButtonModelInterface for the thumb area of the SliderInterface

setButtonModel

public void setButtonModel(ButtonModelInterface btnModel)
Set the ButtonModelInterface for the thumb area of the SliderInterface. The model will be modified based on user events that occur on the thumb area of the slider.

Specified by:
setButtonModel in interface ButtonListenerInterface
Parameters:
btnModel - the ButtonModelInterface for the thumb area of the SliderInterface

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
ActionListener method to handle ActionEvents from the increment and decrement ButtonModelInterface objects. This method disarms the ButtonModelInterface objects if the last pressed point was outside of the bounds of the increment or decrement area.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - the ActionEvent

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Method invoked when a key is pressed by the user while the component listened on has focus. Causes the buttonModel armed and pressed to be set to true.

Specified by:
keyPressed in interface java.awt.event.KeyListener
See Also:
KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Method invoked when a key is released by the user while the component listened on has focus. This sets the buttonModel pressed to false.

Specified by:
keyReleased in interface java.awt.event.KeyListener
See Also:
KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Method invoked when a key is typed by the user while the component listened on has focus. DOES NOTHING in this implementation.

Specified by:
keyTyped in interface java.awt.event.KeyListener
See Also:
KeyListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Method invoked when the mouse is moved. DOES NOTHING in this implementation.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
See Also:
MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Method invoked when the mouse is dragged. This sets the incrementModel and decrementModel rollover and armed to true or false based on the mouse position and the increment and decrement bounds returned from the SliderInterface object. This method also changes the thumb position if the thumb has been pressed.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
See Also:
MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Method invoked when the mouse is clicked. DOES NOTHING in this implementation.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
See Also:
MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Method invoked when the mouse is pressed. This sets the correct ButtonModelInterface object's "pressed" state based on the mouse position from the event.

Specified by:
mousePressed in interface java.awt.event.MouseListener
See Also:
MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Method invoked when the mouse is released. This sets the correct ButtonModelInterface object's "pressed" state to false.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
See Also:
MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Method invoked when the mouse enters the button component area. This sets the correct ButtonModelInterface object's "rollover" state to true.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
See Also:
MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Method invoked when the mouse exits the button component area. This sets the correct ButtonModelInterface object's "rollover" state to false.

Specified by:
mouseExited in interface java.awt.event.MouseListener
See Also:
MouseListener



Copyright © 2009 SAS Institute Inc. All Rights Reserved.