public class MenuModel extends java.lang.Object implements IMenuModel
| Constructor and Description |
|---|
MenuModel()
Creates a new menu model
|
MenuModel(IMenuModelBuilder builder)
Creates a new menu model defined by a builder
|
MenuModel(java.lang.String text)
Creates a new menu model
|
MenuModel(java.lang.String text,
IImageConstant icon)
Creates a new menu model
|
MenuModel(java.lang.String text,
java.lang.String toolTipText)
Creates a new menu model
|
MenuModel(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates a nwe menu model
|
MenuModel(java.lang.String id,
java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates a nwe menu model
|
| Modifier and Type | Method and Description |
|---|---|
IActionItemModel |
addAction(IAction action)
Creates an adds an action item and binds it to the given action
|
IActionItemModel |
addAction(int index,
IAction action)
Creates an adds an action item at a given index and binds it to the given action
|
IActionItemModel |
addActionItem()
Creates and adds a action item
|
IActionItemModel |
addActionItem(java.lang.String text)
Creates and adds a action item
|
IActionItemModel |
addActionItem(java.lang.String text,
IImageConstant icon)
Creates and adds a action item
|
IActionItemModel |
addActionItem(java.lang.String text,
java.lang.String toolTipText)
Creates and adds a action item
|
IActionItemModel |
addActionItem(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates and adds a action item
|
void |
addAfter(IMenuItemModel newItem,
java.lang.String... idPath)
Adds an item after another item defined by an path of item id
If the given path not exists, an IllegalArgumentException will be thrown
|
void |
addBefore(IMenuItemModel newItem,
java.lang.String... idPath)
Adds an item before another item defined by an path of item id
If the given path not exists, an IllegalArgumentException will be thrown
|
ICheckedItemModel |
addCheckedItem()
Creates and adds a checked item
|
ICheckedItemModel |
addCheckedItem(java.lang.String text)
Creates and adds a checked item
|
ICheckedItemModel |
addCheckedItem(java.lang.String text,
IImageConstant icon)
Creates and adds a checked item
|
ICheckedItemModel |
addCheckedItem(java.lang.String text,
java.lang.String toolTipText)
Creates and adds a checked item
|
ICheckedItemModel |
addCheckedItem(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates and adds a checked item
|
void |
addDecorator(IDecorator<IAction> decorator)
Adds an action decorator for all actions contained in this menu an all sub menus.
|
<MODEL_TYPE extends IMenuItemModel,BUILDER_TYPE extends IItemModelBuilder<?,MODEL_TYPE>> |
addItem(BUILDER_TYPE itemBuilder)
Adds an item defined by an builder and returns the build item
|
void |
addItem(IMenuItemModel item)
Adds an item to the model
|
<MODEL_TYPE extends IMenuItemModel,BUILDER_TYPE extends IItemModelBuilder<?,MODEL_TYPE>> |
addItem(int index,
BUILDER_TYPE itemBuilder)
Adds an item at a given index defined by an builder and returns the build item
|
void |
addItem(int index,
IMenuItemModel item)
Adds an item at a given index
|
void |
addItemModelListener(IItemModelListener listener)
Adds a item model listener
|
void |
addItemsOfModel(IMenuModel menuModel)
Adds all items of a given model to this model
|
void |
addListModelListener(IListModelListener listener)
Adds a list model listener
|
IMenuModel |
addMenu()
Creates and add a submenu
|
IMenuModel |
addMenu(java.lang.String text)
Creates and add a submenu
|
IMenuModel |
addMenu(java.lang.String text,
IImageConstant icon)
Creates and add a submenu
|
IMenuModel |
addMenu(java.lang.String text,
java.lang.String toolTipText)
Creates and add a submenu
|
IMenuModel |
addMenu(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates and add a submenu
|
IRadioItemModel |
addRadioItem()
Creates and adds a radio item
|
IRadioItemModel |
addRadioItem(java.lang.String text)
Creates and adds a radio item
|
IRadioItemModel |
addRadioItem(java.lang.String text,
IImageConstant icon)
Creates and adds a radio item
|
IRadioItemModel |
addRadioItem(java.lang.String text,
java.lang.String toolTipText)
Creates and adds a radio item
|
IRadioItemModel |
addRadioItem(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates and adds a radio item
|
ISeparatorItemModel |
addSeparator()
Creates and adds a separator
|
ISeparatorItemModel |
addSeparator(int index)
Creates and adds separator at a given index
|
ISeparatorItemModel |
addSeparator(java.lang.String id)
Creates and adds a separator
|
void |
bind(IMenuModel model)
Binds the given model to this model with the following manner:
1.
|
static IMenuModelBuilder |
builder()
Creates a new menu model builder
|
static IMenuModelBuilder |
builder(java.lang.String text)
Creates a new menu model builder and set defaults
|
static IMenuModelBuilder |
builder(java.lang.String text,
IImageConstant icon)
Creates a new menu model builder and set defaults
|
static IMenuModelBuilder |
builder(java.lang.String text,
java.lang.String toolTipText)
Creates a new menu model builder and set defaults
|
static IMenuModelBuilder |
builder(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates a new menu model builder and set defaults
|
static IMenuModelBuilder |
builder(java.lang.String id,
java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
Creates a new menu model builder and set defaults
|
static IMenuModel |
create()
Creates a new menu model instance
|
IMenuModel |
createCopy()
Creates a deep copy of the item and its children.
|
boolean |
equals(java.lang.Object obj) |
IMenuItemModel |
findItemByPath(java.lang.String... idPath)
Searches for an item in this model defined by a given path
|
Accelerator |
getAccelerator()
Gets the key accelerator that should be used for the item
|
java.util.List<IMenuItemModel> |
getChildren()
Gets a unmodifieable copy of the menus items
|
IImageConstant |
getIcon()
Gets the items icon
|
java.lang.String |
getId()
Gets the id of the item
|
protected IMenuModel |
getItemModel() |
java.lang.Character |
getMnemonic()
Gets the mnemonic character
|
java.lang.String |
getText()
Gets the items label text
|
java.lang.String |
getToolTipText()
Gets the tooltip text of the item
|
int |
hashCode() |
boolean |
isEnabled()
Gets the enabled state of the item
Remark: Not all bound items may support to become disabled
|
boolean |
isVisible()
Gets the visible state of the item
|
void |
removeAllItems()
Removes all items from the menu
|
void |
removeDecorator(IDecorator<IAction> decorator)
Removes a decorator for all actions contained in this menu an all sub menus.
|
void |
removeItem(IMenuItemModel item)
Removes an item from this menu
|
void |
removeItem(int index)
Removes an item at a given index
|
void |
removeItemModelListener(IItemModelListener listener)
removes a item model listener
|
void |
removeListModelListener(IListModelListener listener)
removes a list model listener
|
void |
setAccelerator(Accelerator accelerator)
Sets the key accelerator that should be used for the item
|
void |
setAccelerator(VirtualKey key,
Modifier... modifier)
Sets the key accelerator that should be used for the item
|
void |
setEnabled(boolean enabled)
Sets the enabled state of the item.
|
void |
setIcon(IImageConstant icon)
Sets the items icon
|
void |
setMnemonic(char mnemonic)
Sets the mnemonic character
|
void |
setMnemonic(java.lang.Character mnemonic)
Sets the mnemonic character
|
void |
setText(java.lang.String text)
Sets the items label text
|
void |
setToolTipText(java.lang.String toolTipText)
Sets the tooltip text for the item
|
void |
setVisible(boolean visible)
Sets the visible state of an item
Items that was set invisible will be hidden in their container
|
void |
unbind(IMenuModel model)
Unbind the given model.
|
IItemModel |
unwrap() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetAccelerator, getIcon, getId, getMnemonic, getText, getToolTipText, isEnabled, isVisible, setAccelerator, setAccelerator, setEnabled, setIcon, setMnemonic, setMnemonic, setText, setToolTipText, setVisibleaddItemModelListener, removeItemModelListenerpublic MenuModel()
public MenuModel(java.lang.String text)
text - The label text of the menu modelpublic MenuModel(java.lang.String text,
IImageConstant icon)
text - The label texticon - The iconpublic MenuModel(java.lang.String text,
java.lang.String toolTipText)
text - The label texttoolTipText - The tooltip textpublic MenuModel(java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
text - The label texttoolTipText - The tooltip texticon - The iconpublic MenuModel(java.lang.String id,
java.lang.String text,
java.lang.String toolTipText,
IImageConstant icon)
id - the idtext - The label texttoolTipText - The tooltip texticon - The iconpublic MenuModel(IMenuModelBuilder builder)
builder - The builder that defines the modelprotected IMenuModel getItemModel()
public final java.util.List<IMenuItemModel> getChildren()
IMenuModelgetChildren in interface IMenuModelpublic final IMenuItemModel findItemByPath(java.lang.String... idPath)
IMenuModelfindItemByPath in interface IMenuModelidPath - The path of the items idspublic final IActionItemModel addAction(IAction action)
IMenuModeladdAction in interface IMenuModelaction - The action to usepublic final IActionItemModel addAction(int index, IAction action)
IMenuModeladdAction in interface IMenuModelindex - The index to add the item ataction - The action to usepublic final IMenuModel addMenu()
IMenuModeladdMenu in interface IMenuModelpublic final ISeparatorItemModel addSeparator()
IMenuModeladdSeparator in interface IMenuModelpublic final ISeparatorItemModel addSeparator(int index)
IMenuModeladdSeparator in interface IMenuModelindex - The index where to add the separatorpublic final void addBefore(IMenuItemModel newItem, java.lang.String... idPath)
IMenuModeladdBefore in interface IMenuModelnewItem - The item to addidPath - The path where to add the itempublic final void addAfter(IMenuItemModel newItem, java.lang.String... idPath)
IMenuModeladdAfter in interface IMenuModelnewItem - The item to addidPath - The path where to add the itempublic final void addItem(IMenuItemModel item)
IMenuModeladdItem in interface IMenuModelitem - The item to add, must not be nullpublic final void addItem(int index,
IMenuItemModel item)
IMenuModeladdItem in interface IMenuModelindex - The index to add the item atitem - The item to addpublic final <MODEL_TYPE extends IMenuItemModel,BUILDER_TYPE extends IItemModelBuilder<?,MODEL_TYPE>> MODEL_TYPE addItem(BUILDER_TYPE itemBuilder)
IMenuModeladdItem in interface IMenuModelitemBuilder - The builder that defines the itempublic final <MODEL_TYPE extends IMenuItemModel,BUILDER_TYPE extends IItemModelBuilder<?,MODEL_TYPE>> MODEL_TYPE addItem(int index, BUILDER_TYPE itemBuilder)
IMenuModeladdItem in interface IMenuModelindex - The index to add the item atitemBuilder - The builder that defines the itempublic final IActionItemModel addActionItem()
IMenuModeladdActionItem in interface IMenuModelpublic final IActionItemModel addActionItem(java.lang.String text)
IMenuModeladdActionItem in interface IMenuModeltext - The label text of the action itempublic final IActionItemModel addActionItem(java.lang.String text, java.lang.String toolTipText)
IMenuModeladdActionItem in interface IMenuModeltext - The label text of the action itemtoolTipText - The tooltip text of the action itempublic final IActionItemModel addActionItem(java.lang.String text, IImageConstant icon)
IMenuModeladdActionItem in interface IMenuModeltext - The label text of the action itemicon - The icon of the action itempublic final IActionItemModel addActionItem(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModeladdActionItem in interface IMenuModeltext - The label text of the action itemtoolTipText - The tooltip text of the action itemicon - The icon of the action itempublic final ICheckedItemModel addCheckedItem()
IMenuModeladdCheckedItem in interface IMenuModelpublic final ICheckedItemModel addCheckedItem(java.lang.String text)
IMenuModeladdCheckedItem in interface IMenuModeltext - The label text of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, java.lang.String toolTipText)
IMenuModeladdCheckedItem in interface IMenuModeltext - The label text of the itemtoolTipText - The tooltip text of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, IImageConstant icon)
IMenuModeladdCheckedItem in interface IMenuModeltext - The label text of the itemicon - The icon of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModeladdCheckedItem in interface IMenuModeltext - The label text of the itemtoolTipText - The tooltip text of the itemicon - The icon of the itempublic final IRadioItemModel addRadioItem()
IMenuModeladdRadioItem in interface IMenuModelpublic final IRadioItemModel addRadioItem(java.lang.String text)
IMenuModeladdRadioItem in interface IMenuModeltext - The label text of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, java.lang.String toolTipText)
IMenuModeladdRadioItem in interface IMenuModeltext - The label text of the itemtoolTipText - The tooltip text of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, IImageConstant icon)
IMenuModeladdRadioItem in interface IMenuModeltext - The label text of the itemicon - The icon of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModeladdRadioItem in interface IMenuModeltext - The label text of the itemtoolTipText - The tooltip text of the itemicon - The icon of the itempublic final ISeparatorItemModel addSeparator(java.lang.String id)
IMenuModeladdSeparator in interface IMenuModelid - The id of the separatorpublic final IMenuModel addMenu(java.lang.String text)
IMenuModeladdMenu in interface IMenuModeltext - The label text of the sub menupublic final IMenuModel addMenu(java.lang.String text, java.lang.String toolTipText)
IMenuModeladdMenu in interface IMenuModeltext - The label text of the sub menutoolTipText - The tooltip text of the submenupublic final IMenuModel addMenu(java.lang.String text, IImageConstant icon)
IMenuModeladdMenu in interface IMenuModeltext - The label text of the sub menuicon - The icon of the submenupublic final IMenuModel addMenu(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModeladdMenu in interface IMenuModeltext - The label text of the sub menutoolTipText - The tooltip text of the submenuicon - The icon of the submenupublic final void addItemsOfModel(IMenuModel menuModel)
IMenuModeladdItemsOfModel in interface IMenuModelmenuModel - The model which items should be addedpublic final void bind(IMenuModel model)
IMenuModelbind in interface IMenuModelmodel - The model to bind this model topublic final void unbind(IMenuModel model)
IMenuModelunbind in interface IMenuModelmodel - the model to unbind, may be not bound already but must not be nullpublic void addDecorator(IDecorator<IAction> decorator)
IMenuModeladdDecorator in interface IMenuModeldecorator - The decorator to add, must not be nullpublic void removeDecorator(IDecorator<IAction> decorator)
IMenuModelremoveDecorator in interface IMenuModeldecorator - The decorator to remove, must not be nullpublic final void removeItem(IMenuItemModel item)
IMenuModelremoveItem in interface IMenuModelitem - The item to remove, must not be nullpublic final void removeItem(int index)
IMenuModelremoveItem in interface IMenuModelindex - The index where to remove the itempublic final void removeAllItems()
IMenuModelremoveAllItems in interface IMenuModelpublic final void addListModelListener(IListModelListener listener)
IListModelObservableaddListModelListener in interface IListModelObservablelistener - The listener to addpublic final void removeListModelListener(IListModelListener listener)
IListModelObservableremoveListModelListener in interface IListModelObservablelistener - The listener to removepublic IMenuModel createCopy()
IItemModelcreateCopy in interface IItemModelcreateCopy in interface IMenuItemModelcreateCopy in interface IMenuModelpublic static IMenuModel create()
public static IMenuModelBuilder builder()
public static IMenuModelBuilder builder(java.lang.String text)
text - The label text to set on the builderpublic static IMenuModelBuilder builder(java.lang.String text, java.lang.String toolTipText)
text - The label text to set on the buildertoolTipText - The tooltip text to set on the builderpublic static IMenuModelBuilder builder(java.lang.String text, IImageConstant icon)
text - The label text to set on the buildericon - The icon to set on the builderpublic static IMenuModelBuilder builder(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
text - The label text to set on the buildertoolTipText - The tooltip text to set on the buildericon - The icon to set on the builderpublic static IMenuModelBuilder builder(java.lang.String id, java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
id - The id to set on the buildertext - The label text to set on the buildertoolTipText - The tooltip text to set on the buildericon - The icon to set on the builderpublic final java.lang.String getId()
IItemModelgetId in interface IItemModelpublic final java.lang.String getText()
IItemModelgetText in interface IItemModelpublic final java.lang.String getToolTipText()
IItemModelgetToolTipText in interface IItemModelpublic final IImageConstant getIcon()
IItemModelgetIcon in interface IItemModelpublic final Accelerator getAccelerator()
IItemModelgetAccelerator in interface IItemModelpublic final java.lang.Character getMnemonic()
IItemModelgetMnemonic in interface IItemModelpublic final boolean isEnabled()
IItemModelisEnabled in interface IItemModelpublic final void setText(java.lang.String text)
IItemModelsetText in interface IItemModeltext - The label text of the item, may be nullpublic final void setToolTipText(java.lang.String toolTipText)
IItemModelsetToolTipText in interface IItemModeltoolTipText - The tooltip text to set, may be nullpublic final void setIcon(IImageConstant icon)
IItemModelsetIcon in interface IItemModelicon - The icon to set, may be nullpublic final void setAccelerator(Accelerator accelerator)
IItemModelsetAccelerator in interface IItemModelaccelerator - The accelerator to set, may be nullpublic final void setAccelerator(VirtualKey key, Modifier... modifier)
IItemModelsetAccelerator in interface IItemModelkey - The character to usemodifier - The modifier to usepublic final void setMnemonic(java.lang.Character mnemonic)
IItemModelsetMnemonic in interface IItemModelmnemonic - The mnemonic character to set, may be nullpublic final void setMnemonic(char mnemonic)
IItemModelsetMnemonic in interface IItemModelmnemonic - The mnemonic character to setpublic final void setEnabled(boolean enabled)
IItemModelsetEnabled in interface IItemModelenabled - The enabled state to setpublic void setVisible(boolean visible)
IItemModelsetVisible in interface IItemModelvisible - The visible state to setpublic boolean isVisible()
IItemModelisVisible in interface IItemModelpublic final void addItemModelListener(IItemModelListener listener)
IItemModelObservableaddItemModelListener in interface IItemModelObservablelistener - The listener to addpublic final void removeItemModelListener(IItemModelListener listener)
IItemModelObservableremoveItemModelListener in interface IItemModelObservablelistener - The listener to removepublic IItemModel unwrap()
unwrap in interface IWrapper<IItemModel>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectSiehe auch Jowidgets Nutzerhandbuch