at.spardat.xma.appshell
Interface IMenuItem

All Known Implementing Classes:
MenuItem

public interface IMenuItem

Interface for MenuItem.

Since:
1.4.0

Method Summary
 void addItem(int index, MenuItem item)
          Add the given MenuItem to the list of subitems at the given index.
 void addItem(MenuItem item)
          Add the given MenuItem to the list of subitems.
 void clearItems()
          Remove all MenuItems from the list of subitems.
 boolean containsItem(IMenuItem item)
          Determine if the given item is contained in the submenu of this menu.
 java.lang.Object getAttached()
          Get the visual representation of the MenuItem.
 org.eclipse.swt.graphics.Image getImage()
           
 int getIndex()
          Get the index of the MenuItem in the list of subitems in its parent.
 int getIndexOf(IMenuItem item)
          Get the index of the given MenuItem in the submenu of this.
 java.util.List getItems()
          Get the list of all MenuItems of the submenu of this MenuItem.
 java.lang.String getName()
          Get the name of the MenuItem.
 java.lang.Object getParentAttached()
          Get the visual representation of the parent MenuItem
 int getStyle()
          If no style was set then SWT.NONE is returned.
 ITask getTask()
          Get the Task than will be called whenever this MenuItem is selected.
 void removeItem(MenuItem item)
          Remove the given MenuItem from the list of subitems.
 void select()
          Select the MenuItem.
 void setAttached(java.lang.Object attached)
          Set the visual representation of the MenuItem e.g.: a ITreeWMClient or org.eclipse.swt.widget.MenuItem.
 void setImage(org.eclipse.swt.graphics.Image image)
          Sets the image to show at this item.
 void setTask(ITask task)
          Set the task to run when the MenuItem is selected
 

Method Detail

getItems

public java.util.List getItems()
Get the list of all MenuItems of the submenu of this MenuItem.

Returns:
the list of all MenuItems of the submenu.

containsItem

public boolean containsItem(IMenuItem item)
Determine if the given item is contained in the submenu of this menu.

Parameters:
item - the MenuItem to search for in the submenu.
Returns:
true if the given item is contained in the list of subitems.

clearItems

public void clearItems()
Remove all MenuItems from the list of subitems. The items are unregisterd from the AppShell and are no longer visible.


getAttached

public java.lang.Object getAttached()
Get the visual representation of the MenuItem. e.g.: a ITreeWMClient or org.eclipse.swt.widget.MenuItem.

Returns:
the GUI-Object corresponding to this MenuItem.

setAttached

public void setAttached(java.lang.Object attached)
Set the visual representation of the MenuItem e.g.: a ITreeWMClient or org.eclipse.swt.widget.MenuItem.

Parameters:
attached - the GUI-Object corresponding to this MenuItem.

getParentAttached

public java.lang.Object getParentAttached()
Get the visual representation of the parent MenuItem

Returns:
the GUI-Object corresponding to the parent of this MenuItem.

getName

public java.lang.String getName()
Get the name of the MenuItem. The name must be unique within the client side application.

Returns:
the name of the MenuItem

getIndex

public int getIndex()
Get the index of the MenuItem in the list of subitems in its parent.

Returns:
the index of this.

getIndexOf

public int getIndexOf(IMenuItem item)
Get the index of the given MenuItem in the submenu of this.

Parameters:
item - to determine the index of
Returns:
the index of the given item in the submenu

addItem

public void addItem(MenuItem item)
Add the given MenuItem to the list of subitems. The new item is registered at the AppShell and becomes visible. Note: A MenuItem used at a MenuAppShell (i.e. at an SWT menu) must be of the style CASCADE to have children.

Parameters:
item - to add.

addItem

public void addItem(int index,
                    MenuItem item)
Add the given MenuItem to the list of subitems at the given index. The new item is registered at the AppShell and becomes visible. Note: A MenuItem used at a MenuAppShell (i.e. at an SWT menu) must be of the style CASCADE to have children.

Parameters:
index - where to add the new item.
item - to add.

removeItem

public void removeItem(MenuItem item)
Remove the given MenuItem from the list of subitems. This item is unregisterd from the AppShell and is no longer visible.

Parameters:
item - to remove

getTask

public ITask getTask()
Get the Task than will be called whenever this MenuItem is selected.

Returns:
the Task of this item.

setTask

public void setTask(ITask task)
Set the task to run when the MenuItem is selected

Parameters:
task - the task of this item.

select

public void select()
Select the MenuItem. This runs its contained Task.


getImage

public org.eclipse.swt.graphics.Image getImage()
Returns:
Returns the image which is shown at this item. Can be null.

setImage

public void setImage(org.eclipse.swt.graphics.Image image)
Sets the image to show at this item.


getStyle

public int getStyle()
If no style was set then SWT.NONE is returned.

Returns:
Returns the style set at this item.