|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.salespointframework.core.MenuSheetObject
public abstract class MenuSheetObject
A generic menu element.
MenuSheet
,
MenuSheetItem
,
MenuSheetSeparator
Field Summary | |
---|---|
private boolean |
m_fVisible
Is this MenuSheetObject currently on display? |
protected MenuSheet |
m_msParent
The MenuSheet that contains this menu element. |
protected SaleProcess |
m_pAttached
The SaleProcess attached to this MenuSheetObject, if any. |
private java.lang.String |
m_sCaption
The caption of the menu element. |
protected SalesPoint |
m_spAttached
The SalesPoint attached to this MenuSheetObject, if any. |
private java.lang.String |
m_sTag
Immutable tag, that can be used to identify the menu element. |
private static int |
s_nLastTagID
The last tag id that was given to a default tag. |
private static java.lang.String |
STD_TAG_PREFIX
The default tag prefix, if no tag was given. |
Constructor Summary | |
---|---|
MenuSheetObject(java.lang.String sCaption)
Create a new MenuSheetObject with a caption and a default tag. |
|
MenuSheetObject(java.lang.String sCaption,
java.lang.String sTag)
Create a new MenuSheetObject with a caption and a tag. |
Method Summary | |
---|---|
SaleProcess |
attach(SaleProcess p)
Attach a SaleProcess to this MenuSheetObject. |
SalesPoint |
attach(SalesPoint sp)
Attach a SalesPoint to this MenuSheetObject. |
SaleProcess |
detachSaleProcess()
Detach the currently attached SaleProcess. |
SalesPoint |
detachSalesPoint()
Detach the currently attached SalesPoint. |
boolean |
equals(java.lang.Object o)
Compare this MenuSheetObject to the given object and return true if they are equal. |
java.lang.String |
getCaption()
Get the MenuSheetObject's caption. |
abstract javax.swing.JMenu |
getMenuPeer()
Return the JMenu peer for this MenuSheetObject. |
MenuSheet |
getParent()
Get the parent MenuSheet of this MenuSheetObject. |
abstract javax.swing.JMenuItem |
getPeer()
Return the JMenuItem peer for this MenuSheetObject. |
java.lang.String |
getTag()
Get the MenuSheetObject's tag. |
MenuSheetObject |
getTaggedItem(java.lang.String sTag)
Convenience method for in-depth search for a tagged item. |
MenuSheetObject |
getTaggedItem(java.lang.String sTag,
boolean fTopLevelOnly)
Get the first MenuSheetObject with the given tag which is managed by this one. |
boolean |
isSeparator()
Return true if this is a separator. |
boolean |
isVisible()
Get the visibility state of this MenuSheetObject. |
void |
setCaption(java.lang.String sCaption)
Set the MenuSheetObject's caption. |
(package private) void |
setParent(MenuSheet msParent)
Set the parent of the MenuSheetObject. |
void |
setVisible(boolean fVisible)
Mark this MenuSheetObject visible or invisible. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String m_sCaption
private java.lang.String m_sTag
null
!
private boolean m_fVisible
protected MenuSheet m_msParent
protected SalesPoint m_spAttached
protected SaleProcess m_pAttached
private static final java.lang.String STD_TAG_PREFIX
private static int s_nLastTagID
Constructor Detail |
---|
public MenuSheetObject(java.lang.String sCaption, java.lang.String sTag)
sCaption
- the caption of this MenuObjectsTag
- the tag of this MenuObject. If null
, a default, unique tag
will be given.public MenuSheetObject(java.lang.String sCaption)
You can find out about the tag by calling getTag()
.
sCaption
- the caption of the MenuSheetObject.Method Detail |
---|
public java.lang.String getCaption()
public void setCaption(java.lang.String sCaption)
sCaption
- the new caption.public java.lang.String getTag()
null
and should be unique in the containing MenuSheet.
MenuSheet
,
getTaggedItem(java.lang.String, boolean)
public MenuSheetObject getTaggedItem(java.lang.String sTag, boolean fTopLevelOnly)
The default implementation returns this MenuSheetObject if it has the given tag,
and null
otherwise.
sTag
- the tag that is searched for.fTopLevelOnly
- if true, only the top level items are searched.public MenuSheetObject getTaggedItem(java.lang.String sTag)
Equivalent to:
getTaggedItem (sTag, false);
sTag
- the tag to be searched for.public SalesPoint attach(SalesPoint sp)
sp
- the SalesPoint to be attached.
public SalesPoint detachSalesPoint()
public SaleProcess attach(SaleProcess p)
p
- the process to be attached.
public SaleProcess detachSaleProcess()
void setParent(MenuSheet msParent)
public MenuSheet getParent()
public void setVisible(boolean fVisible)
This method is usually not called directly.
fVisible
- the visibility state of the MenuSheetObject.public boolean isVisible()
public boolean isSeparator()
getPeer()
,
getMenuPeer()
public boolean equals(java.lang.Object o)
For MenuSheetObjects equality of references is measured, i.e.
equals()
will only return true if this == o
.
equals
in class java.lang.Object
o
- the object to compare to.public abstract javax.swing.JMenuItem getPeer()
public abstract javax.swing.JMenu getMenuPeer()
For MenuSheetItems and similar MenuSheetObjects it is recommended that you create a JMenu with the same caption and only one item, the MenuElement peer of the MenuSheetObject. Make sure, however, to create all these objects afresh for the JMenu peer, lest there should result inpredictably behaving menus. This does, of course not apply, if the MenuElement peer and the JMenu peer are entirely equal as is the case for MenuSheets.
Although JMenuItem peer and JMenu peer should be different objects, subsequent
calls to getMenuPeer()
can still return the same object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |