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, wait
getAccelerator, getIcon, getId, getMnemonic, getText, getToolTipText, isEnabled, isVisible, setAccelerator, setAccelerator, setEnabled, setIcon, setMnemonic, setMnemonic, setText, setToolTipText, setVisible
addItemModelListener, removeItemModelListener
public 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()
IMenuModel
getChildren
in interface IMenuModel
public final IMenuItemModel findItemByPath(java.lang.String... idPath)
IMenuModel
findItemByPath
in interface IMenuModel
idPath
- The path of the items idspublic final IActionItemModel addAction(IAction action)
IMenuModel
addAction
in interface IMenuModel
action
- The action to usepublic final IActionItemModel addAction(int index, IAction action)
IMenuModel
addAction
in interface IMenuModel
index
- The index to add the item ataction
- The action to usepublic final IMenuModel addMenu()
IMenuModel
addMenu
in interface IMenuModel
public final ISeparatorItemModel addSeparator()
IMenuModel
addSeparator
in interface IMenuModel
public final ISeparatorItemModel addSeparator(int index)
IMenuModel
addSeparator
in interface IMenuModel
index
- The index where to add the separatorpublic final void addBefore(IMenuItemModel newItem, java.lang.String... idPath)
IMenuModel
addBefore
in interface IMenuModel
newItem
- The item to addidPath
- The path where to add the itempublic final void addAfter(IMenuItemModel newItem, java.lang.String... idPath)
IMenuModel
addAfter
in interface IMenuModel
newItem
- The item to addidPath
- The path where to add the itempublic final void addItem(IMenuItemModel item)
IMenuModel
addItem
in interface IMenuModel
item
- The item to add, must not be nullpublic final void addItem(int index, IMenuItemModel item)
IMenuModel
addItem
in interface IMenuModel
index
- 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)
IMenuModel
addItem
in interface IMenuModel
itemBuilder
- 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)
IMenuModel
addItem
in interface IMenuModel
index
- The index to add the item atitemBuilder
- The builder that defines the itempublic final IActionItemModel addActionItem()
IMenuModel
addActionItem
in interface IMenuModel
public final IActionItemModel addActionItem(java.lang.String text)
IMenuModel
addActionItem
in interface IMenuModel
text
- The label text of the action itempublic final IActionItemModel addActionItem(java.lang.String text, java.lang.String toolTipText)
IMenuModel
addActionItem
in interface IMenuModel
text
- The label text of the action itemtoolTipText
- The tooltip text of the action itempublic final IActionItemModel addActionItem(java.lang.String text, IImageConstant icon)
IMenuModel
addActionItem
in interface IMenuModel
text
- 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)
IMenuModel
addActionItem
in interface IMenuModel
text
- The label text of the action itemtoolTipText
- The tooltip text of the action itemicon
- The icon of the action itempublic final ICheckedItemModel addCheckedItem()
IMenuModel
addCheckedItem
in interface IMenuModel
public final ICheckedItemModel addCheckedItem(java.lang.String text)
IMenuModel
addCheckedItem
in interface IMenuModel
text
- The label text of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, java.lang.String toolTipText)
IMenuModel
addCheckedItem
in interface IMenuModel
text
- The label text of the itemtoolTipText
- The tooltip text of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, IImageConstant icon)
IMenuModel
addCheckedItem
in interface IMenuModel
text
- The label text of the itemicon
- The icon of the itempublic final ICheckedItemModel addCheckedItem(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModel
addCheckedItem
in interface IMenuModel
text
- The label text of the itemtoolTipText
- The tooltip text of the itemicon
- The icon of the itempublic final IRadioItemModel addRadioItem()
IMenuModel
addRadioItem
in interface IMenuModel
public final IRadioItemModel addRadioItem(java.lang.String text)
IMenuModel
addRadioItem
in interface IMenuModel
text
- The label text of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, java.lang.String toolTipText)
IMenuModel
addRadioItem
in interface IMenuModel
text
- The label text of the itemtoolTipText
- The tooltip text of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, IImageConstant icon)
IMenuModel
addRadioItem
in interface IMenuModel
text
- The label text of the itemicon
- The icon of the itempublic final IRadioItemModel addRadioItem(java.lang.String text, java.lang.String toolTipText, IImageConstant icon)
IMenuModel
addRadioItem
in interface IMenuModel
text
- The label text of the itemtoolTipText
- The tooltip text of the itemicon
- The icon of the itempublic final ISeparatorItemModel addSeparator(java.lang.String id)
IMenuModel
addSeparator
in interface IMenuModel
id
- The id of the separatorpublic final IMenuModel addMenu(java.lang.String text)
IMenuModel
addMenu
in interface IMenuModel
text
- The label text of the sub menupublic final IMenuModel addMenu(java.lang.String text, java.lang.String toolTipText)
IMenuModel
addMenu
in interface IMenuModel
text
- The label text of the sub menutoolTipText
- The tooltip text of the submenupublic final IMenuModel addMenu(java.lang.String text, IImageConstant icon)
IMenuModel
addMenu
in interface IMenuModel
text
- 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)
IMenuModel
addMenu
in interface IMenuModel
text
- The label text of the sub menutoolTipText
- The tooltip text of the submenuicon
- The icon of the submenupublic final void addItemsOfModel(IMenuModel menuModel)
IMenuModel
addItemsOfModel
in interface IMenuModel
menuModel
- The model which items should be addedpublic final void bind(IMenuModel model)
IMenuModel
bind
in interface IMenuModel
model
- The model to bind this model topublic final void unbind(IMenuModel model)
IMenuModel
unbind
in interface IMenuModel
model
- the model to unbind, may be not bound already but must not be nullpublic void addDecorator(IDecorator<IAction> decorator)
IMenuModel
addDecorator
in interface IMenuModel
decorator
- The decorator to add, must not be nullpublic void removeDecorator(IDecorator<IAction> decorator)
IMenuModel
removeDecorator
in interface IMenuModel
decorator
- The decorator to remove, must not be nullpublic final void removeItem(IMenuItemModel item)
IMenuModel
removeItem
in interface IMenuModel
item
- The item to remove, must not be nullpublic final void removeItem(int index)
IMenuModel
removeItem
in interface IMenuModel
index
- The index where to remove the itempublic final void removeAllItems()
IMenuModel
removeAllItems
in interface IMenuModel
public final void addListModelListener(IListModelListener listener)
IListModelObservable
addListModelListener
in interface IListModelObservable
listener
- The listener to addpublic final void removeListModelListener(IListModelListener listener)
IListModelObservable
removeListModelListener
in interface IListModelObservable
listener
- The listener to removepublic IMenuModel createCopy()
IItemModel
createCopy
in interface IItemModel
createCopy
in interface IMenuItemModel
createCopy
in interface IMenuModel
public 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()
IItemModel
getId
in interface IItemModel
public final java.lang.String getText()
IItemModel
getText
in interface IItemModel
public final java.lang.String getToolTipText()
IItemModel
getToolTipText
in interface IItemModel
public final IImageConstant getIcon()
IItemModel
getIcon
in interface IItemModel
public final Accelerator getAccelerator()
IItemModel
getAccelerator
in interface IItemModel
public final java.lang.Character getMnemonic()
IItemModel
getMnemonic
in interface IItemModel
public final boolean isEnabled()
IItemModel
isEnabled
in interface IItemModel
public final void setText(java.lang.String text)
IItemModel
setText
in interface IItemModel
text
- The label text of the item, may be nullpublic final void setToolTipText(java.lang.String toolTipText)
IItemModel
setToolTipText
in interface IItemModel
toolTipText
- The tooltip text to set, may be nullpublic final void setIcon(IImageConstant icon)
IItemModel
setIcon
in interface IItemModel
icon
- The icon to set, may be nullpublic final void setAccelerator(Accelerator accelerator)
IItemModel
setAccelerator
in interface IItemModel
accelerator
- The accelerator to set, may be nullpublic final void setAccelerator(VirtualKey key, Modifier... modifier)
IItemModel
setAccelerator
in interface IItemModel
key
- The character to usemodifier
- The modifier to usepublic final void setMnemonic(java.lang.Character mnemonic)
IItemModel
setMnemonic
in interface IItemModel
mnemonic
- The mnemonic character to set, may be nullpublic final void setMnemonic(char mnemonic)
IItemModel
setMnemonic
in interface IItemModel
mnemonic
- The mnemonic character to setpublic final void setEnabled(boolean enabled)
IItemModel
setEnabled
in interface IItemModel
enabled
- The enabled state to setpublic void setVisible(boolean visible)
IItemModel
setVisible
in interface IItemModel
visible
- The visible state to setpublic boolean isVisible()
IItemModel
isVisible
in interface IItemModel
public final void addItemModelListener(IItemModelListener listener)
IItemModelObservable
addItemModelListener
in interface IItemModelObservable
listener
- The listener to addpublic final void removeItemModelListener(IItemModelListener listener)
IItemModelObservable
removeItemModelListener
in interface IItemModelObservable
listener
- The listener to removepublic IItemModel unwrap()
unwrap
in interface IWrapper<IItemModel>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Siehe auch Jowidgets Nutzerhandbuch