|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.AlarmButtonModel
public class AlarmButtonModel
AlarmButtonModel is a button model that sends ActionEvents while the button is in the pressed and armed state. The events are based on an initial delay and startInterval. When the model pressed state is set to true and the armed state is true, an event is sent and an Alarm object is started. While in the pressed state and after the delay time is past another ActionEvent is sent. From then until when the pressed or the armed state is turned off or the model is disarmed, an ActionEvent is sent based on a shrinking interval starting with the startInterval until the interval between events is less than 50ms. The behavior of this model allows buttons similar to the arrow buttons on scrollbars that continue to send events while pressed.
Field Summary | |
---|---|
protected AlarmInterface |
alarm
|
protected long |
delay
|
protected long |
startInterval
|
Fields inherited from class com.sas.visuals.DefaultButtonModel |
---|
actionCommand, actionListenerList, armed, disabled, itemListenerList, keyAccelerator, nextState, pressed, prevState, rollover, selected, selectionGroup, state, stateCount |
Constructor Summary | |
---|---|
AlarmButtonModel()
Default constructor. |
|
AlarmButtonModel(long delay,
long startInterval)
Constructor to set the delay and the startInterval. |
Method Summary | |
---|---|
void |
fireAlarm(AlarmEvent e)
The method for listening to AlarmEvents sent out by the Alarm object. |
AlarmInterface |
getAlarm()
Get the alarm used to determine when the next ActionEvent will be sent when the button is pressed and armed. |
long |
getDelay()
Get the delay before ActionEvents are sent after the first event is sent. |
long |
getStartInterval()
Get the start value of the interval between when ActionEvents are sent when the button is pressed. |
void |
setAlarm(AlarmInterface a)
Set the alarm used to determine when the timed ActionEvents are sent out while the model "pressed" and "armed" states are true. |
void |
setArmed(boolean a)
Set the armed state of the model. |
void |
setDelay(long d)
Set the amount of delay before ActionEvents are sent after the first event is sent. |
void |
setDisabled(boolean d)
Set the disabled state of the button model. |
void |
setPressed(boolean p)
Set the pressed state of the model. |
void |
setStartInterval(long interval)
Set the start value of the interval between when ActionEvents are sent when the button is pressed and armed. |
protected void |
updateAlarm()
Update the alarm interval each time the alarm is fired. |
Methods inherited from class com.sas.visuals.DefaultButtonModel |
---|
addActionListener, addItemListener, getActionCommand, getKeyAccelerator, getNextState, getPrevState, getSelectedObjects, getSelectionGroup, getState, getStateCount, isArmed, isDisabled, isPressed, isRollover, isSelected, removeActionListener, removeItemListener, setActionCommand, setDefaultValues, setKeyAccelerator, setRollover, setSelected, setSelectionGroup, setState |
Field Detail |
---|
protected AlarmInterface alarm
protected long delay
protected long startInterval
Constructor Detail |
---|
public AlarmButtonModel()
public AlarmButtonModel(long delay, long startInterval)
delay
- the delay before the second ActionEvent is sentstartInterval
- the startInterval between ActionEvents sent after the delay timeMethod Detail |
---|
public AlarmInterface getAlarm()
public long getDelay()
public void setDelay(long d)
d
- the millisecond value of the delay before ActionEvents are sent after the first event is sent.public long getStartInterval()
public void setStartInterval(long interval)
interval
- the start interval amountpublic void setAlarm(AlarmInterface a)
a
- the alarmpublic void fireAlarm(AlarmEvent e)
fireAlarm
in interface AlarmListener
e
- an AlarmEventprotected void updateAlarm()
public void setDisabled(boolean d)
setDisabled
in interface ButtonModelInterface
setDisabled
in class DefaultButtonModel
d
- true if disabled, false otherwise.DefaultButtonModel.isDisabled()
public void setPressed(boolean p)
setPressed
in interface ButtonModelInterface
setPressed
in class DefaultButtonModel
p
- the new pressed state of the modelDefaultButtonModel.isPressed()
public void setArmed(boolean a)
setArmed
in interface ButtonModelInterface
setArmed
in class DefaultButtonModel
a
- the armed state of the modelDefaultButtonModel.isArmed()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |