|
Draw2D v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.eclipse.draw2d.Figure
|
+--org.eclipse.draw2d.Clickable
Clickable - that which 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.
| Inner classes inherited from class org.eclipse.draw2d.Figure |
Figure.FigureIterator |
| Inner classes inherited from class org.eclipse.draw2d.IFigure |
IFigure.NoInsets |
| Field Summary | |
static int |
DEFAULT_FIRING
|
static int |
REPEAT_FIRING
|
static int |
STYLE_BUTTON
|
static int |
STYLE_TOGGLE
|
| Fields inherited from class org.eclipse.draw2d.Figure |
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, 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. |
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 clickable event handler to this clickable. |
protected void |
hookModel(ButtonModel model)
Sets model to be used by 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 whether rollover feedback is enabled or not. |
boolean |
isSelected()
Returns whether this Clickable is in a selected state or not. |
boolean |
isStyle(int style)
Returns true if this Clickable's style is the
same as the passed style. |
protected void |
paintBorder(Graphics graphics)
Paints the border associated with this figure, if one exists. |
protected void |
paintClientArea(Graphics g)
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 figure 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 roll over feedback of this figure, repainting it. |
void |
setSelected(boolean value)
Sets the selected state of this Clickable. |
void |
setStyle(int style)
Sets this Clickable's style to the passed value. |
protected void |
unhookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
Removes the given event handler 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 |
public static int STYLE_BUTTON
public static int STYLE_TOGGLE
public static final int DEFAULT_FIRING
public static final int REPEAT_FIRING
| Constructor Detail |
public Clickable()
public Clickable(IFigure contents)
public Clickable(IFigure contents,
int style)
style - Integer constants STYLE_BUTTON
or STYLE_TOGGLE.| Method Detail |
public void addActionListener(ActionListener listener)
listener - Action listener to be added.removeActionListener(ActionListener)public void addChangeListener(ChangeListener listener)
listener - Change listener to be added.removeChangeListener(ChangeListener)protected ButtonModel createDefaultModel()
ButtonModel as the default model
to be used by this Clickable.ButtonModelprotected org.eclipse.draw2d.ClickableEventHandler createEventHandler()
protected org.eclipse.draw2d.Clickable.ModelObserver createModelObserver()
public void doClick()
protected void fireActionPerformed()
protected void fireStateChanged(ChangeEvent modelChange)
public ButtonModel getModel()
protected void hookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
handler - The new event handler.protected void hookModel(ButtonModel model)
model - Model to be used.protected void init()
public boolean isRolloverEnabled()
setRolloverEnabled(boolean)public boolean isSelected()
setSelected(boolean)public boolean isStyle(int style)
true if this Clickable's style is the
same as the passed style.protected void paintBorder(Graphics graphics)
FigurepaintBorder in class Figureorg.eclipse.draw2d.FigureBorder.paint(IFigure, Graphics, Insets)protected void paintClientArea(Graphics g)
paintClientArea in class Figureg - Graphics handle for painting.public void removeActionListener(ActionListener listener)
listener - Listener to be removed from this figure.addActionListener(ActionListener)public void removeChangeListener(ChangeListener listener)
listener - Listener to be removed from this figure.addChangeListener(ChangeListener)protected void setContents(IFigure contents)
contents - Contents of the clickable.public void setEnabled(boolean value)
IFiguresetEnabled in class Figurepublic void setEventHandler(org.eclipse.draw2d.ClickableEventHandler h)
h - Event handler for this clickable.public void setFiringMethod(int type)
type - Type of firing. Can be any of the firing behavior
values defined in the model.public void setModel(ButtonModel model)
model - New model of this Clickable.public void setRolloverEnabled(boolean value)
value - Rollover state to be set.isRolloverEnabled()public void setSelected(boolean value)
value - New selected state of this clickable.isSelected()public void setStyle(int style)
style - Integer constants STYLE_BUTTON
or STYLE_TOGGLE.protected void unhookEventHandler(org.eclipse.draw2d.ClickableEventHandler handler)
handler - Event handler to be removed from this figure.
|
Draw2D v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||