Package com.iizix.swt
Class IzSubMenu
java.lang.Object
com.iizix.swt.IzSubMenu
A submenu item information holder that can be added to the main menu together with a set of actions in order to be able to save an array of item in an 
Object [] for fast construction or appending to menus while in about-to-display state.The enabled and visibility states can be controlled with this submenu BEFORE a menu has been displayed, not during menu is shown, i.e. it will not change the states of the menu or menu items. This state applies to all contained items.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescriptionAdds the items that must be either instance of IAction of IzSubMenu, or null entries for separators.Adds a separator.- getImage()Returns the image for the submenu.- Object[]- getItems()Gets the array of items.- getText()Returns the text of the submenu.- booleanReturns if there are any visible and enabled items.- booleanGets the enabled state.- booleanGets the enabled state.- setEnabled- (boolean enabled) Enables the submenu with all its items.Changes the image of the submenu.Changes the text of the submenu.- setVisible- (boolean visible) Set the visibility state for the submenu with all its items.
- Constructor Details- IzSubMenuConstructs the submenu.- Parameters:
- text- The text.
- image- The image, or null for none.
- Throws:
- NullPointerException- If text is null.
 
 
- Method Details- setTextChanges the text of the submenu. This does not affect any menu that is currently displayed, only ones to come.- Parameters:
- text- The new text.
- Returns:
- The thisinstance for concatenation.
- Throws:
- NullPointerException- If text is null.
 
- getTextReturns the text of the submenu.- Returns:
- The text, never null.
 
- setImageChanges the image of the submenu. This does not affect any menu that is currently displayed, only ones to come.- Parameters:
- image- The image or null for none.
- Returns:
- The thisinstance for concatenation.
 
- getImageReturns the image for the submenu.- Returns:
- The image, or null for none.
 
- addSeparatorAdds a separator.- Returns:
- The thisinstance for concatenation.
 
- addAdds the items that must be either instance of IAction of IzSubMenu, or null entries for separators.- Parameters:
- items- The items.
- Returns:
- The thisinstance for concatenation.
 
- getItemsGets the array of items.- Returns:
- An array of Object's as null for separator, IAction or IzSubMenu instances.
 
- setEnabledEnables the submenu with all its items.- Parameters:
- enabled- The new enabled state.
- Returns:
- thissubmenu to enable concatenation.
 
- isEnabledpublic boolean isEnabled()Gets the enabled state.- Returns:
- The enabled state.
 
- setVisibleSet the visibility state for the submenu with all its items.- Parameters:
- visible- The new visible state.
- Returns:
- thissubmenu to enable concatenation.
 
- isVisiblepublic boolean isVisible()Gets the enabled state.- Returns:
- The enabled state.
 
- hasEnabledVisibleItemspublic boolean hasEnabledVisibleItems()Returns if there are any visible and enabled items. Separators are ignored.- Returns:
- true if at least one action is enabled or a submenu hasEnabledVisibleItems().