|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sale.MenuSheetObject sale.MenuSheet
A MenuSheet consisting of MenuSheetObjects
.
MenuSheets represent menus, abstracting from the form they are being displayed in. A MenuSheet could be displayed as a JMenuBar as well as a JMenu or JPopUpMenu. Independently of this it will always behave in the same way from the point of view of the applicion developer.
Field Summary | |
static String |
HELP_MENU_TAG
A tag that will identify the help menu, should this MenuSheet be displayed as a JMenuBar. |
protected ImageIcon[] |
m_aiImages
The Images associated with the icons of this MenuSheet( [0]:DefaultImage, [1]:PressedImage, [2]:DisabledImage, [3]:PressedDiabledImage ). |
protected char |
m_cMnemonic
The Mnemonic of this MenuSheet. |
protected JMenuBar |
m_jmbBarPeer
The JMenuBar peer, if any. |
protected JMenu |
m_jmPeer
The JMenu peer, if any. |
protected LinkedList |
m_lmsoItems
The items of this MenuSheet. |
protected MenuSheet |
m_msMerged
The MenuSheet that has been merged into this one, if any. |
protected MenuSheet |
m_msMergeParent
The MenuSheet into which this MenuSheet was merged, if any. |
protected int |
m_nMergedAt
The peer index at which the merged menu was inserted. |
protected String |
m_sMergedBefore
The tag before which the merged menu was inserted. |
protected String |
m_sToolTip
The ToolTip of this MenuSheet. |
Fields inherited from class sale.MenuSheetObject |
m_msParent, m_pAttached, m_spAttached |
Constructor Summary | |
MenuSheet(String sCaption)
Creates a new MenuSheet with caption and a default tag. |
|
MenuSheet(String sCaption,
String sTag)
Creates a new MenuSheet with caption and tag. |
|
MenuSheet(String sCaption,
String sTag,
char cMnemonic)
Creates a new MenuSheet with caption, tag and mnemonic. |
Method Summary | |
void |
add(MenuSheetObject mso)
Adds a MenuSheetObject to the end of this MenuSheet. |
SaleProcess |
attach(SaleProcess p)
Attach a SaleProcess to this MenuSheet. |
SalesPoint |
attach(SalesPoint sp)
Attach a SalesPoint to this MenuSheet. |
ImageIcon |
getDefaultIcon()
Get the default icon of this MenuSheet. |
ImageIcon |
getDisabledIcon()
Get the disabled item of this MenuSheet. |
ImageIcon |
getDisabledSelectedIcon()
Get the disabled selected item of this MenuSheet. |
JMenuBar |
getMenuBar()
Return the JMenuBar peer. |
JMenu |
getMenuPeer()
For MenuSheets there is no difference between JMenuItem and JMenu peer, they are both JMenus. |
char |
getMnemonic()
Get the Mnemonic of this MenuSheet. |
JMenuItem |
getPeer()
The JMenuItem peer of a MenuSheet is, of course, a JMenu. |
protected Object |
getPeerLock()
Return the monitor used to synchronized access to the peers. |
ImageIcon |
getSelectedIcon()
Get the selected icon of this MenuSheet. |
MenuSheetObject |
getTaggedItem(String sTag,
boolean fTopLevelOnly)
Get a MenuSheetObject by its tag. |
String |
getToolTipText()
Get the ToolTip of this MenuSheet. |
Iterator |
iterator()
Return a fail-fast, readonly iterator of the items in this MenuSheet. |
JMenuBar |
mergePeers(MenuSheet msToMerge,
String sBeforeTag)
Merges the peers of two MenuSheets. |
MenuSheetObject |
remove(MenuSheetObject msoRemove)
Remove a MenuSheetObject from the MenuSheet. |
MenuSheetObject |
remove(String sTag)
Remove a tagged top level item from the MenuSheet. |
void |
setCaption(String sCaption)
Set the caption of this MenuSheet. |
void |
setDefaultIcon(ImageIcon iiImageIcon)
Set the default icon of this MenuSheet. |
void |
setDisabledIcon(ImageIcon iiImageIcon)
Set the disabled icon of this MenuSheet. |
void |
setDisabledSelectedIcon(ImageIcon iiImageIcon)
Set the disabled selected icon of this MenuSheet. |
void |
setMnemonic(char cMnemonic)
Set the mnemonic of this MenuSheet. |
void |
setSelectedIcon(ImageIcon iiImageIcon)
Set the selected icon of this MenuSheet. |
void |
setToolTipText(String s)
Set the ToolTip of this MenuSheet. |
void |
setVisible(boolean fVisible)
Mark this MenuSheet, all its descendants and merged peer MenuSheets visible or invisible. |
Methods inherited from class sale.MenuSheetObject |
detachSaleProcess, detachSalesPoint, equals, getCaption, getParent, getTag, getTaggedItem, isSeparator, isVisible |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient JMenu m_jmPeer
protected transient JMenuBar m_jmbBarPeer
protected MenuSheet m_msMerged
protected String m_sMergedBefore
protected int m_nMergedAt
protected MenuSheet m_msMergeParent
protected LinkedList m_lmsoItems
protected ImageIcon[] m_aiImages
protected char m_cMnemonic
protected String m_sToolTip
public static final String HELP_MENU_TAG
Constructor Detail |
public MenuSheet(String sCaption, String sTag, char cMnemonic)
sCaption
- the caption of the new MenuSheet.sTag
- the tag of the new MenuSheet. If null
a default tag will be created.cMnemonic
- the mnemonic of the new MenuSheet.public MenuSheet(String sCaption, String sTag)
sCaption
- the caption of the new MenuSheet.sTag
- the tag of the new MenuSheet. If null
a default tag will be created.public MenuSheet(String sCaption)
sCaption
- the caption of the new MenuSheet.Method Detail |
protected final Object getPeerLock()
public void add(MenuSheetObject mso)
Should the MenuSheet currently be displayed, the new item will be displayed as well.
mso
- the new MenuSheetObject.public MenuSheetObject remove(String sTag)
If an item with the given tag is found among the top level items of this MenuSheet, it is removed and the removed item is returned. Otherwise, the call is ignored.
If the MenuSheet is currently on display, the peer will reflect the changes.
sTag
- the tag of the item to be removed.
public MenuSheetObject remove(MenuSheetObject msoRemove)
If the MenuSheet is currently on display, the peer will reflect the changes.
public Iterator iterator()
Fail-fast means, that this iterator will throw a ConcurrentModificationException
when a
structural change occured to the underlying MenuSheet.
Also, the remove()
method will throw an UnsupportedOperationException
, as
this is a readonly iterator.
ConcurrentModificationException
public final JMenuBar mergePeers(MenuSheet msToMerge, String sBeforeTag)
The peers of the top level MenuSheetObjects of the given MenuSheet are merged into the JMenuBar peer of this MenuSheet. They will be inserted into the JMenuBar peer before the MenuSheetpObject with the given tag. If no such MenuSheetObject can be found in the MenuSheet they are appended to the end of the peer.
Merging can always only result in a JMenuBar peer. A JMenu peer cannot be merged. However, merging can be nested. I.e. it is legal, to merge a MenuSheet, into whose peer another MenuSheet's peer has been merged, into a third MenuSheet.
Although the peers of the two MenuSheets are merged, they stay independent with respect to anything else. The MenuSheetObjects of the merged MenuSheet can still only be accessed through that MenuSheet and vice-vera. Also, the attached SalesPoint and SaleProcess stay independent.
For merging to function correctly, you must set the created JMenuBar in your JFrame. Something like this will do the trick:
setJMenuBar (ms.mergePeers (msToMerge, "MERGE_BEFORE_THIS"));
This method is usually not called directly.
msToMerge
- the MenuSheet to be merged into this one.sBeforeTag
- before which tag to merge in the MenuSheet.public MenuSheetObject getTaggedItem(String sTag, boolean fTopLevelOnly)
This will iterate over all MenuSheetObjects in this MenuSheet and return the first one, that has the given tag.
getTaggedItem
in class MenuSheetObject
sTag
- the tag to search for.fTopLevelOnly
- if true, only the direct elements in this MenuSheet are searched.
ConcurrentModificationException
- if the structure of the MenuSheet changed
during the search.public SalesPoint attach(SalesPoint sp)
attach
in class MenuSheetObject
sp
- the SalesPoint to be attached.
public SaleProcess attach(SaleProcess p)
attach
in class MenuSheetObject
p
- the process to be attached.
public void setVisible(boolean fVisible)
setVisible
in class MenuSheetObject
fVisible
- the visibility state of the MenuSheetObject.public void setCaption(String sCaption)
If there is a peer it will reflect the changes immediately.
setCaption
in class MenuSheetObject
sCaption
- the new caption.public void setMnemonic(char cMnemonic)
If there is a peer it will reflect the changes immediately.
public void setToolTipText(String s)
If there is a peer it will reflect the changes immediately.
s
- the new ToolTip-Text.public void setDefaultIcon(ImageIcon iiImageIcon)
If there is a peer it will reflect the changes immediately.
iiImageIcon
- the new icon.public void setSelectedIcon(ImageIcon iiImageIcon)
If there is a peer it will reflect the changes immediately.
iiImageIcon
- the new icon.public void setDisabledIcon(ImageIcon iiImageIcon)
If there is a peer it will reflect the changes immediately.
iiImageIcon
- the new icon.public void setDisabledSelectedIcon(ImageIcon iiImageIcon)
If there is a peer it will reflect the changes immediately.
iiImageIcon
- the new icon.public JMenuItem getPeer()
getPeer
in class MenuSheetObject
public JMenu getMenuPeer()
getMenuPeer
in class MenuSheetObject
public JMenuBar getMenuBar()
For a MenuSheet there is a special peer: the JMenuBar peer. All items of this MenuSheet will present their JMenu peer in the JMenuBar. Only MenuSheetSeparators are not displayed in a JMenuBar representation. Merged peers are only displayed in the JMenuBar representation.
public char getMnemonic()
public String getToolTipText()
public ImageIcon getDefaultIcon()
public ImageIcon getSelectedIcon()
public ImageIcon getDisabledIcon()
public ImageIcon getDisabledSelectedIcon()
|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |