|
Eclipse Draw2d 3.0.1 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.draw2d.Figure
org.eclipse.draw2d.Clickable
A Clickable responds to mouse clicks in some way (determined by a ClickBehavior) and
fires action events. No visual appearance of feedback is offered. Depends on a model
holder and an event handler which understands the model and updates the model
accordingly. ButtonModel is used by default. Any figure can be set as contents
to a Clickable. Clickable->EventHandler->Model->ModelObserver->Listeners of actions.
| Nested Class Summary |
| Nested classes inherited from class org.eclipse.draw2d.Figure |
Figure.FigureIterator, Figure.IdentitySearch |
| Nested classes inherited from class org.eclipse.draw2d.IFigure |
IFigure.NoInsets |
| Field Summary | |
static int |
DEFAULT_FIRING
An action is performed every time the mouse is released. |
protected static int |
MAX_FLAG
The highest reserved flag used by this class |
static int |
REPEAT_FIRING
Firing starts as soon as the mouse is pressed on this Clickable, and keeps firing at prefixed intervals until the mouse is released. |
static int |
STYLE_BUTTON
Style constant that defines a push button. |
static int |
STYLE_TOGGLE
Style constant that defines a toggle button. |
| Fields inherited from class org.eclipse.draw2d.Figure |
bgColor, border, bounds, fgColor, flags, font, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
| Fields inherited from interface org.eclipse.draw2d.IFigure |
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
| Constructor Summary | |
Clickable()
Constructs a Clickable with no contents. |
|
Clickable(IFigure contents)
Constructs a Clickable whose contents are provided as input. |
|
Clickable(IFigure contents,
int style)
Constructs a Clickable whose contents are provided as input. |
|
| Method Summary | |
void |
addActionListener(ActionListener listener)
Adds the given listener to the list of action listeners of this Figure. |
void |
addChangeListener(ChangeListener listener)
Adds the given listener to the list of state change listeners of this figure. |
protected ButtonModel |
createDefaultModel()
Returns a newly created ButtonModel as the default model to be used by this Clickable based on the button style. |
protected org.eclipse.draw2d.ClickableEventHandler |
createEventHandler()
Returns a newly created event handler for this Clickable and its model. |
protected org.eclipse.draw2d.Clickable.ModelObserver |
createModelObserver()
Returns a newly created model observer which listens to the model, and fires any action or state changes. |
void |
doClick()
Fires an action performed event. |
protected void |
fireActionPerformed()
Called when there has been an action performed by this Clickable, which is determined by the model. |
protected void |
fireStateChanged(ChangeEvent modelChange)
Called when there has been a change of state in the model of this clickable. |
ButtonModel |
getModel()
Returns the behavior model used by this Clickable. |
protected void |
hookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
Adds the given ClickableEventHandler to this clickable. |
protected void |
init()
Initializes this Clickable by setting a default model and adding a clickable event handler for that model. |
boolean |
isRolloverEnabled()
Returns true if rollover feedback is enabled. |
boolean |
isSelected()
Returns true if this Clickable is in a selected state. |
boolean |
isStyle(int style)
Returns true if this Clickable's style is the same as the passed style. |
protected void |
paintBorder(Graphics graphics)
If this Clickable has focus, this method paints a focus rectangle. |
protected void |
paintClientArea(Graphics graphics)
Paints the area of this figure excluded by the borders. |
void |
removeActionListener(ActionListener listener)
Removes the given listener from the list of ActionListener's of this Clickable. |
void |
removeChangeListener(ChangeListener listener)
Removes the given listener from the list of ChangeListener's of this clickable. |
protected void |
setContents(IFigure contents)
Sets the Figure which is the contents of this Clickable. |
void |
setEnabled(boolean value)
Sets this IFigure to be enabled. |
void |
setEventHandler(org.eclipse.draw2d.ClickableEventHandler h)
Sets the event handler which interacts with the model to determine the behavior of this Clickable. |
void |
setFiringMethod(int type)
Determines how this clickable is to fire notifications to its listeners. |
void |
setModel(ButtonModel model)
Sets the model to be used by this clickable for its state and behavior determination. |
void |
setRolloverEnabled(boolean value)
Enables or disables rollover feedback of this figure. |
void |
setSelected(boolean value)
Sets the selected state of this Clickable. |
void |
setStyle(int style)
Sets this Clickable's style to the passed value, either STYLE_BUTTON or
STYLE_TOGGLE. |
protected void |
unhookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
Removes the given ClickableEventHandler containing listeners from this Clickable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static int MAX_FLAG
public static final int STYLE_BUTTON
public static final int STYLE_TOGGLE
public static final int DEFAULT_FIRING
public static final int REPEAT_FIRING
| Constructor Detail |
public Clickable()
public Clickable(IFigure contents)
contents - The content figure
public Clickable(IFigure contents,
int style)
STYLE_BUTTON or STYLE_TOGGLE).
contents - The content figurestyle - The button style| Method Detail |
public void addActionListener(ActionListener listener)
listener - The ActionListener to be addedpublic void addChangeListener(ChangeListener listener)
listener - The ChangeListener to be addedprotected ButtonModel createDefaultModel()
protected org.eclipse.draw2d.ClickableEventHandler createEventHandler()
protected org.eclipse.draw2d.Clickable.ModelObserver createModelObserver()
public void doClick()
protected void fireActionPerformed()
protected void fireStateChanged(ChangeEvent modelChange)
modelChange - The ChangeEventpublic ButtonModel getModel()
protected void hookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
handler - The new event handlerprotected void init()
public boolean isRolloverEnabled()
true if rollover feedback is enabled.
true rollover feedback is enabledpublic boolean isSelected()
true if this Clickable is in a selected state. The model is the
one which holds all this state based information.
true if this Clickable is in a selected statepublic boolean isStyle(int style)
true if this Clickable's style is the same as the passed style.
style - The style to be checked
true if this Clickable's style is the same as the passed styleprotected void paintBorder(Graphics graphics)
paintBorder in class Figuregraphics - Graphics handle for paintingBorder.paint(IFigure, Graphics, Insets)protected void paintClientArea(Graphics graphics)
paintClientArea in class Figuregraphics - Graphics handle for paintingpublic void removeActionListener(ActionListener listener)
listener - Listener to be removed from this figurepublic void removeChangeListener(ChangeListener listener)
listener - Listener to be removed from this figureprotected void setContents(IFigure contents)
contents - Contents of the clickablepublic void setEnabled(boolean value)
IFigure
setEnabled in interface IFiguresetEnabled in class FigureIFigure.setEnabled(boolean)public void setEventHandler(org.eclipse.draw2d.ClickableEventHandler h)
h - Event handler for this clickablepublic void setFiringMethod(int type)
DEFAULT_FIRING), an action is performed every time the mouse
is released. In the repeat firing method (REPEAT_FIRING), firing starts as
soon as it is pressed on this clickable, and keeps firing at prefixed intervals until
the mouse is released.
type - Type of firingpublic void setModel(ButtonModel model)
model - The new model of this Clickablepublic void setRolloverEnabled(boolean value)
value - The rollover state to be setpublic void setSelected(boolean value)
value - New selected state of this clickable.isSelected()public void setStyle(int style)
STYLE_BUTTON or
STYLE_TOGGLE.
style - The button styleprotected void unhookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
handler - The event handler to be removed
|
Eclipse Draw2d 3.0.1 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||