|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.tensegrity.gui.swt.repository.AbstractSwtRepositoryItem
com.tensegrity.gui.swt.repository.ActionSwtRepositoryItem
An ActionSwtRepositoryItem is a AbstractSwtRepositoryItem
which can perform a given action (i.e. perform a
) upon a left or
right mouse click.
Command
Three constructors are available, the more useful ones being
and ActionSwtRepositoryItem(Composite, String, Class, Command, String, int, int)
since they set the icon one the ActionSwtRepositoryItem(Composite, SwtIcon, Command, String, int, int)ActionSwtRepositoryItem instance.
Note that by default no
is set, but one can use the AbstractSwtDragSourceListener method
in order to set one.
setDragListener(AbstractSwtDragSourceListener)
Subclasses might consider overridding
for example in order to add a context menu to instances of invokeRightClickAction(MouseEvent)ActionSwtRepositoryItem.
Note that this class can be considered as the SWT equivalent of
.
ActionRepositoryItem
One should call the dispose() method in order to free all
allocated resources once instances of this class are no longer needed.
| Nested Class Summary | |
static class |
ActionSwtRepositoryItem.ClickActionProvider
This class allows, by mean of inheritance, to customize the application behaviour when a left or right mouse click is performed upon repository items. |
| Field Summary |
| Fields inherited from class com.tensegrity.gui.swt.repository.AbstractSwtRepositoryItem |
DEFAULT_WIDTH_AND_HEIGHT, mouseIn, mousePressed |
| Fields inherited from class org.eclipse.swt.widgets.Control |
handle |
| Constructor Summary | |
ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
Creates an instance of ActionSwtRepositoryItem with no
associated icon. |
|
ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
java.lang.String iconPath,
java.lang.Class resourceclass,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
Creates an instance of ActionSwtRepositoryItem with the
image which can be loaded using the two parameters iconPath
and resourceclass. |
|
ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
SwtIcon icon,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
Creates an instance of ActionSwtRepositoryItem which
displays the passed icon. |
|
| Method Summary | |
ActionSwtRepositoryItem.ClickActionProvider |
getClickActionProvider()
Returns the clickActionProvider. |
protected AbstractSwtDragSourceListener |
getDragListener()
Returns the AbstractSwtDragSourceListener associated to
this repository item.
|
protected java.lang.Object |
getTooltip()
Returns the tooltip for this repository item. |
java.lang.String |
getToolTipText()
|
void |
invokeLeftClickAction(org.eclipse.swt.events.MouseEvent e)
Invokes the actionPerformed of the internal Action
instance. |
void |
invokeRightClickAction(org.eclipse.swt.events.MouseEvent e)
Forwards to the invokeLeftClickAction, but can be overriden
to implement context menus on repository items. |
boolean |
isCommandEnabled()
Check whether or not the command is enabled |
void |
mouseDown(org.eclipse.swt.events.MouseEvent e)
|
void |
performAction()
Perform the registered action |
void |
setClickActionProvider(ActionSwtRepositoryItem.ClickActionProvider clickActionProvider)
Sets the value of clickActionProvider |
void |
setDragListener(AbstractSwtDragSourceListener dragListener)
Associates the given AbstractSwtDragSourceListener with
this instance of ActionSwtRepositoryItem.
|
void |
setText(java.lang.String text)
Overridden method change the tooltip controlled by an UIManager-instance. |
| Methods inherited from class com.tensegrity.gui.swt.repository.AbstractSwtRepositoryItem |
dispose, getIconHeight, getIconlabel, getIconWidth, initToolTipGenerator, installDragging, mouseDoubleClick, mouseEnter, mouseExit, mouseHover, mouseUp, setImage |
| Methods inherited from class org.eclipse.swt.widgets.Composite |
checkSubclass, computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList |
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
| Methods inherited from class org.eclipse.swt.widgets.Control |
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update |
| Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
java.lang.String iconPath,
java.lang.Class resourceclass,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
ActionSwtRepositoryItem with the
image which can be loaded using the two parameters iconPath
and resourceclass. Upon left or right mouse click
the given Command is performed.
parent - widget which will be the parent of the new instance (cannot be
null)iconPath - the path to the image relative to resourceclassresourceclass - the class used to load the iconaction - the Command to perform on click, cannot be nulltooltip - the tooltip, which may be nulliconWidth - the icon widthiconHeight - the icon height
public ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
ActionSwtRepositoryItem with no
associated icon. Upon left or right mouse click
the given Command is performed.
parent - widget which will be the parent of the new instance (cannot be
null)action - the Command to perform on click, cannot be nulltooltip - the tooltip, which may be nulliconWidth - the icon widthiconHeight - the icon height
public ActionSwtRepositoryItem(org.eclipse.swt.widgets.Composite parent,
SwtIcon icon,
Command action,
java.lang.String tooltip,
int iconWidth,
int iconHeight)
ActionSwtRepositoryItem which
displays the passed icon. Upon left or right mouse click
the given Command is performed.
parent - widget which will be the parent of the new instance (cannot be
null)icon - optional icon, which may be nullaction - the Command to perform on click, cannot be nulltooltip - the tooltip, which may be nulliconWidth - the icon widthiconHeight - the icon height| Method Detail |
public void setText(java.lang.String text)
setText in class AbstractSwtRepositoryItemtext - the new tooltip text.public void invokeRightClickAction(org.eclipse.swt.events.MouseEvent e)
invokeLeftClickAction, but can be overriden
to implement context menus on repository items.
e - the MouseEvent.public void invokeLeftClickAction(org.eclipse.swt.events.MouseEvent e)
actionPerformed of the internal Action
instance. NOTE: You may consider to use invokeLater here to allow
Labels mousePressed to return *BEFORE* the actionPerformed has
been processed.
e - the MouseEvent.public void performAction()
protected AbstractSwtDragSourceListener getDragListener()
AbstractSwtRepositoryItem
Returns the AbstractSwtDragSourceListener associated to
this repository item.
getDragListener in class AbstractSwtRepositoryItemAbstractSwtDragSourceListener associated to
this repository item.public void setDragListener(AbstractSwtDragSourceListener dragListener)
Associates the given AbstractSwtDragSourceListener with
this instance of ActionSwtRepositoryItem.
dragListener - the new AbstractSwtDragSourceListener
associated with this instance of
ActionSwtRepositoryItemprotected java.lang.Object getTooltip()
AbstractSwtRepositoryItemReturns the tooltip for this repository item.
getTooltip in class AbstractSwtRepositoryItempublic java.lang.String getToolTipText()
public void mouseDown(org.eclipse.swt.events.MouseEvent e)
mouseDown in interface org.eclipse.swt.events.MouseListenermouseDown in class AbstractSwtRepositoryItempublic void setClickActionProvider(ActionSwtRepositoryItem.ClickActionProvider clickActionProvider)
clickActionProvider - The new value to set.public ActionSwtRepositoryItem.ClickActionProvider getClickActionProvider()
public boolean isCommandEnabled()
Check whether or not the command is enabled
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||