www.element4solution.com

e4s.html.navigation
Class E4Menu

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.E4HtmlObject
          extended by e4s.html.navigation.E4Menu
All Implemented Interfaces:
E4MenuLayout_Intf

public class E4Menu
extends E4HtmlObject
implements E4MenuLayout_Intf

Provides a tab-layouted menu. Each menu item will be displayed as a property tab like style, consisting of elements of type e4s.html. http://www.drweb.de/weblog/weblog/?p=531

See Also:
E4MenuFrameset,

Example_Menu.java


Field Summary
 E4FrameName m_target
           
static int MENU_STYLE_DIRECTION_HORIZONTAL
           
static int MENU_STYLE_DIRECTION_VERTICAL
           
static int MENU_STYLE_IMAGES_A
           
static int MENU_STYLE_IMAGES_APPLICATION
           
static int MENU_STYLE_IMAGES_B1
           
static int MENU_STYLE_IMAGES_B2
           
static int MENU_STYLE_IMAGES_B3
           
static int MENU_STYLE_IMAGES_B4
           
static int MENU_STYLE_IMAGES_C1
           
static int MENU_STYLE_IMAGES_C2
           
static int MENU_STYLE_IMAGES_C3
           
static int MENU_STYLE_IMAGES_CLIENT
           
static int MENU_STYLE_IMAGES_D1
           
static int MENU_STYLE_IMAGES_D2
           
static int MENU_STYLE_IMAGES_E1
           
static int MENU_STYLE_IMAGES_E2
           
static int MENU_STYLE_REPRESENTATION_GRAFICAL
          Grafical representation of the menu.
static int MENU_STYLE_REPRESENTATION_TEXT
          Grafical representation of the menu.
static int NO_MENU_REFRESH
          Prevent E4Menu refresh (e.g. to avoid timeout when logging out)
static java.lang.String PREFIX_USER_VAL_ID
           
static int X_FIRST_ACTIVE
           
static int X_FIRST_INACTIVE
           
static int X_LAST_ACTIVE
           
static int X_LAST_INACTIVE
           
static int X_LEFT_ACTIVE
           
static int X_LEFT_INACTIVE
           
static int X_MIDDLE_ACTIVE
           
static int X_MIDDLE_INACTIVE
           
static int X_REMAINING
           
static int X_RIGHT_ACTIVE
           
static int X_RIGHT_INACTIVE_ACTIVE
           
static int X_RIGHT_INACTIVE_INACTIVE
           
static int X_STARTING
           
 
Fields inherited from class e4s.html.E4HtmlObject
m_parent_e4sID
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4Menu(int style, E4FrameName target, E4ServletImplementation_Intf servlet)
           
E4Menu(java.lang.String persistantObjId, E4FrameName target, E4ServletImplementation_Intf servlet)
           
E4Menu(java.lang.String persistantObjId, int style, E4FrameName target, E4ServletImplementation_Intf servlet)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 int addMenuItem(A href)
           
 int addMenuItem(E4Label_Intf label, A href)
           
 int addMenuItem(E4Label_Intf label, A href, int id)
           
 int addMenuItem(E4Label_Intf label, E4Method mref)
           
 int addMenuItem(E4Label_Intf label, E4Method mref, int id)
           
 int addMenuItem(E4MenuItem item)
           
 int addMenuItem(java.lang.String label, A href)
           
 int addMenuItem(java.lang.String label, A href, int id)
           
 int addMenuItem(java.lang.String label, E4Method mref)
           
 int addMenuItem(java.lang.String label, E4Method mref, int id)
           
 E4JavaScript buildScripting(E4ServletImplementation_Intf servlet)
           
 boolean changeActive(E4Method_Intf mref)
          Active the menu item with the given id and de-activate all others.
 boolean changeActive(int id)
          Active the menu item with the given id and de-activate all others.
 void collectScripts(E4ScriptsVec v, E4ServletImplementation_Intf servlet)
           
 void collectStylesForEditing(E4StylesHash v, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with style definitions used so far during display of this page.
 void collectTranslationsForEditing(E4TranslationsVec v, E4ServletImplementation_Intf servlet)
           
 E4MenuItem findMenuElement(int id)
          Get the menu item by it's ID.
static java.lang.StringBuffer formatLabel(java.lang.StringBuffer label, boolean active)
           
 E4MenuItem getActive()
          Get the activated menu item.
 E4Color getActiveColor()
          Get the color for active menu element.
 int getActiveId()
          Get the ID of the activated menu item.
 E4CgiParams getAdditionalParams()
           
 E4Color getBgColor()
          Get the background color for the menu.
 CLASS_Name getClass_ActiveItem()
           
 CLASS_Name getClass_Baseline()
           
 CLASS_Name getClass_Body()
           
 CLASS_Name getClass_Items()
           
 E4Color getColorBaseline()
          Get the color for the baseline of the menu.
 java.lang.String getJS_Name()
          Get the name of the E4JavaScript for this menu.
static E4Menu getMenu(java.lang.String persistantObjId, E4ServletImplementation_Intf servlet)
          Retrieves a menu object out of the persistant list of menu objects.
 java.lang.String getMenuID()
          Get the identifier for this menu
 int getMenuStyle()
          Get the basic layout style of the menu.
 int getRememberedID(E4ApplObj_Intf applobj)
           
 boolean getRememberID()
           
static E4SelectValues getSelection4MenuStyle()
           
 E4FrameName getTarget()
           
 IMG[] getUserdefinedImages()
           
static IMG[] initImages(int style, E4ApplObj_Intf applobj)
           
static IMG[] initImages(int style, E4ServletImplementation_Intf servlet)
           
static boolean isHorizontal(int style)
          Detect, weather a menu style is horizontal or not.
static TABLE prepareContent_Horz(E4ID parent_id, E4ServletImplementation_Intf servlet, java.util.Vector menu_elements)
           
static TABLE prepareContent_Horz(E4ID parent_id, E4ServletImplementation_Intf servlet, java.util.Vector menu_elements, boolean stretch_vertical, E4MenuLayout_Intf menu)
           
static TABLE prepareContent_Horz(E4ID parent_id, E4ServletImplementation_Intf servlet, java.util.Vector menu_elements, E4MenuLayout_Intf menu)
           
static TABLE prepareContent_Vert(E4ID parent_id, E4ServletImplementation_Intf servlet, java.util.Vector menu_elements, E4Menu menu)
           
 TABLE prepareContent(E4ServletImplementation_Intf servlet)
           
 void setActiveColor(E4Color color)
          Define the color for active menu element.
 void setAdditionalParams(E4CgiParams params)
           
 void setBgColor(E4Color color)
          Define the background color for the menu.
 void setClass_ActiveItem(CLASS_Name classname)
           
 void setClass_Baseline(CLASS_Name classname)
           
 void setClass_Body(CLASS_Name classname)
           
 void setClass_Items(CLASS_Name classname)
           
 void setColorBaseline(E4Color color)
          Define the color for the baseline of the menu, this is a thick line below the menu items.
 void setImageStyle(int layout)
           
 void setRememberID()
          If called, the current active item ID will be stored in a E4UserValues with prefix PREFIX_USER_VAL_ID.
 void setStyleGrafic()
           
 void setStyleText()
          Set the basic layout style of the menu.
 void setUserdefinedImages(IMG[] images)
           
 void toHtml(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
           
 java.lang.String toString()
          Debug capabilities only - do not use except debugging and tracing.
 
Methods inherited from class e4s.html.E4HtmlObject
E4ID, E4ID, set_e4sID
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MENU_STYLE_IMAGES_APPLICATION

public static final int MENU_STYLE_IMAGES_APPLICATION
See Also:
Constant Field Values

MENU_STYLE_IMAGES_CLIENT

public static final int MENU_STYLE_IMAGES_CLIENT
See Also:
Constant Field Values

NO_MENU_REFRESH

public static final int NO_MENU_REFRESH
Prevent E4Menu refresh (e.g. to avoid timeout when logging out)

See Also:
Constant Field Values

MENU_STYLE_REPRESENTATION_GRAFICAL

public static final int MENU_STYLE_REPRESENTATION_GRAFICAL
Grafical representation of the menu. This is the default value.

See Also:
setImageStyle(int), getMenuStyle(), MENU_STYLE_REPRESENTATION_TEXT, Constant Field Values

MENU_STYLE_REPRESENTATION_TEXT

public static final int MENU_STYLE_REPRESENTATION_TEXT
Grafical representation of the menu. This is the default value.

See Also:
setImageStyle(int), getMenuStyle(), MENU_STYLE_REPRESENTATION_GRAFICAL, Constant Field Values

MENU_STYLE_DIRECTION_HORIZONTAL

public static final int MENU_STYLE_DIRECTION_HORIZONTAL
See Also:
Constant Field Values

MENU_STYLE_DIRECTION_VERTICAL

public static final int MENU_STYLE_DIRECTION_VERTICAL
See Also:
Constant Field Values

MENU_STYLE_IMAGES_A

public static final int MENU_STYLE_IMAGES_A
See Also:
Constant Field Values

MENU_STYLE_IMAGES_B1

public static final int MENU_STYLE_IMAGES_B1
See Also:
Constant Field Values

MENU_STYLE_IMAGES_B2

public static final int MENU_STYLE_IMAGES_B2
See Also:
Constant Field Values

MENU_STYLE_IMAGES_B3

public static final int MENU_STYLE_IMAGES_B3
See Also:
Constant Field Values

MENU_STYLE_IMAGES_B4

public static final int MENU_STYLE_IMAGES_B4
See Also:
Constant Field Values

MENU_STYLE_IMAGES_C1

public static final int MENU_STYLE_IMAGES_C1
See Also:
Constant Field Values

MENU_STYLE_IMAGES_C2

public static final int MENU_STYLE_IMAGES_C2
See Also:
Constant Field Values

MENU_STYLE_IMAGES_C3

public static final int MENU_STYLE_IMAGES_C3
See Also:
Constant Field Values

MENU_STYLE_IMAGES_D1

public static final int MENU_STYLE_IMAGES_D1
See Also:
Constant Field Values

MENU_STYLE_IMAGES_D2

public static final int MENU_STYLE_IMAGES_D2
See Also:
Constant Field Values

MENU_STYLE_IMAGES_E1

public static final int MENU_STYLE_IMAGES_E1
See Also:
Constant Field Values

MENU_STYLE_IMAGES_E2

public static final int MENU_STYLE_IMAGES_E2
See Also:
Constant Field Values

PREFIX_USER_VAL_ID

public static final java.lang.String PREFIX_USER_VAL_ID
See Also:
Constant Field Values

X_STARTING

public static int X_STARTING

X_FIRST_ACTIVE

public static int X_FIRST_ACTIVE

X_FIRST_INACTIVE

public static int X_FIRST_INACTIVE

X_LEFT_ACTIVE

public static int X_LEFT_ACTIVE

X_LEFT_INACTIVE

public static int X_LEFT_INACTIVE

X_MIDDLE_ACTIVE

public static int X_MIDDLE_ACTIVE

X_MIDDLE_INACTIVE

public static int X_MIDDLE_INACTIVE

X_RIGHT_ACTIVE

public static int X_RIGHT_ACTIVE

X_RIGHT_INACTIVE_INACTIVE

public static int X_RIGHT_INACTIVE_INACTIVE

X_RIGHT_INACTIVE_ACTIVE

public static int X_RIGHT_INACTIVE_ACTIVE

X_LAST_ACTIVE

public static int X_LAST_ACTIVE

X_LAST_INACTIVE

public static int X_LAST_INACTIVE

X_REMAINING

public static int X_REMAINING

m_target

public E4FrameName m_target
Constructor Detail

E4Menu

public E4Menu(int style,
              E4FrameName target,
              E4ServletImplementation_Intf servlet)

E4Menu

public E4Menu(java.lang.String persistantObjId,
              int style,
              E4FrameName target,
              E4ServletImplementation_Intf servlet)

E4Menu

public E4Menu(java.lang.String persistantObjId,
              E4FrameName target,
              E4ServletImplementation_Intf servlet)
Method Detail

setStyleText

public void setStyleText()
Set the basic layout style of the menu. This can either be grafical (the menu items are surrounded by images) or a simple table with a border.

See Also:
getMenuStyle()

setStyleGrafic

public void setStyleGrafic()

setImageStyle

public void setImageStyle(int layout)

getMenuStyle

public int getMenuStyle()
Get the basic layout style of the menu. This can either be grafical (the menu items are surrounded by images) or a simple table with a border.

Specified by:
getMenuStyle in interface E4MenuLayout_Intf
Returns:
MENU_STYLE_REPRESENTATION_GRAFICAL for the grafical representation or #STYLE_SIMPLE for the simple (table like) representation.
See Also:
MENU_STYLE_REPRESENTATION_GRAFICAL, #STYLE_SIMPLE, setImageStyle(int)

getMenu

public static E4Menu getMenu(java.lang.String persistantObjId,
                             E4ServletImplementation_Intf servlet)
Retrieves a menu object out of the persistant list of menu objects. Note, that a menu object is stored one time, can be modified and used as often as required under the same ObjId. This is related to one session.

Parameters:
persistantObjId - the identification of this menu object
servlet - the servlet context
Returns:
null if not found, or the object representing the menu
See Also:
e4s.servlet

initImages

public static IMG[] initImages(int style,
                               E4ServletImplementation_Intf servlet)

initImages

public static IMG[] initImages(int style,
                               E4ApplObj_Intf applobj)

getJS_Name

public java.lang.String getJS_Name()
Get the name of the E4JavaScript for this menu.

See Also:
E4MenuItem.getJS_Name(java.lang.String)

buildScripting

public E4JavaScript buildScripting(E4ServletImplementation_Intf servlet)

addMenuItem

public int addMenuItem(java.lang.String label,
                       A href)

addMenuItem

public int addMenuItem(java.lang.String label,
                       A href,
                       int id)

addMenuItem

public int addMenuItem(E4Label_Intf label,
                       A href,
                       int id)

addMenuItem

public int addMenuItem(E4Label_Intf label,
                       A href)

addMenuItem

public int addMenuItem(A href)

addMenuItem

public int addMenuItem(java.lang.String label,
                       E4Method mref,
                       int id)

addMenuItem

public int addMenuItem(java.lang.String label,
                       E4Method mref)

addMenuItem

public int addMenuItem(E4Label_Intf label,
                       E4Method mref)

addMenuItem

public int addMenuItem(E4Label_Intf label,
                       E4Method mref,
                       int id)

addMenuItem

public int addMenuItem(E4MenuItem item)

getMenuID

public java.lang.String getMenuID()
Get the identifier for this menu


changeActive

public boolean changeActive(int id)
Active the menu item with the given id and de-activate all others.

Parameters:
menu_id - the menu-ID to be activated, use -1 to deactivate all menu items.
Returns:
true if this ID was found within the menu
See Also:
e4s.html.E4TabbedMenu#changeActive, e4s.html.TabbedMenu_Item#getId(), E4MenuElement.changeActive(int), E4MenuFrameset.changeActive(int), changeActive(e4s.html.E4Method_Intf)

changeActive

public boolean changeActive(E4Method_Intf mref)
Active the menu item with the given id and de-activate all others.

Parameters:
mref - the associated method to be activated, use null to deactivate all menu items.
Returns:
true if this method was found within the menu
See Also:
e4s.html.E4TabbedMenu#changeActive, e4s.html.TabbedMenu_Item#getId(), E4MenuElement.changeActive(e4s.html.E4Method_Intf), E4MenuFrameset.changeActive(e4s.html.E4Method_Intf), changeActive(int)

findMenuElement

public E4MenuItem findMenuElement(int id)
Get the menu item by it's ID.

Parameters:
id - ID of the menu-item
Returns:
the menu item or null if not found

getActive

public E4MenuItem getActive()
Get the activated menu item.

Returns:
the active menu item
See Also:
getActiveId(), changeActive(int)

getActiveId

public int getActiveId()
Get the ID of the activated menu item.

Returns:
the active menu item's ID
See Also:
getActive(), changeActive(int)

toHtml

public void toHtml(E4StringBufferHtml buf,
                   E4ServletImplementation_Intf servlet)
            throws java.lang.Exception
Throws:
java.lang.Exception

prepareContent

public TABLE prepareContent(E4ServletImplementation_Intf servlet)

prepareContent_Horz

public static TABLE prepareContent_Horz(E4ID parent_id,
                                        E4ServletImplementation_Intf servlet,
                                        java.util.Vector menu_elements)

prepareContent_Horz

public static TABLE prepareContent_Horz(E4ID parent_id,
                                        E4ServletImplementation_Intf servlet,
                                        java.util.Vector menu_elements,
                                        E4MenuLayout_Intf menu)

prepareContent_Horz

public static TABLE prepareContent_Horz(E4ID parent_id,
                                        E4ServletImplementation_Intf servlet,
                                        java.util.Vector menu_elements,
                                        boolean stretch_vertical,
                                        E4MenuLayout_Intf menu)

prepareContent_Vert

public static TABLE prepareContent_Vert(E4ID parent_id,
                                        E4ServletImplementation_Intf servlet,
                                        java.util.Vector menu_elements,
                                        E4Menu menu)

formatLabel

public static java.lang.StringBuffer formatLabel(java.lang.StringBuffer label,
                                                 boolean active)

setColorBaseline

public void setColorBaseline(E4Color color)
Define the color for the baseline of the menu, this is a thick line below the menu items.

Parameters:
color - the baseline color, null if no baseline shall be drawn.
See Also:
getColorBaseline()

getColorBaseline

public E4Color getColorBaseline()
Get the color for the baseline of the menu. This is a thick line below the menu items.

Specified by:
getColorBaseline in interface E4MenuLayout_Intf
Returns:
color the baseline color, null if no baseline shall be drawn.
See Also:
#setColorBaseline()

setBgColor

public void setBgColor(E4Color color)
Define the background color for the menu.

Parameters:
color - the background color.
See Also:
setActiveColor(e4s.html.E4Color), getBgColor()

getBgColor

public E4Color getBgColor()
Get the background color for the menu.

Specified by:
getBgColor in interface E4MenuLayout_Intf
Returns:
the background color.
See Also:
setBgColor(e4s.html.E4Color)

setActiveColor

public void setActiveColor(E4Color color)
Define the color for active menu element.

Parameters:
color - the color for the active item. In MENU_STYLE_REPRESENTATION_GRAFICAL mode only.
See Also:
getActiveColor(), setBgColor(e4s.html.E4Color), MENU_STYLE_REPRESENTATION_GRAFICAL

getActiveColor

public E4Color getActiveColor()
Get the color for active menu element.

Specified by:
getActiveColor in interface E4MenuLayout_Intf
Returns:
color the color for the active item. In MENU_STYLE_REPRESENTATION_GRAFICAL mode only.
See Also:
setActiveColor(e4s.html.E4Color)

getTarget

public E4FrameName getTarget()

toString

public java.lang.String toString()
Debug capabilities only - do not use except debugging and tracing.

Overrides:
toString in class E4Object

collectScripts

public void collectScripts(E4ScriptsVec v,
                           E4ServletImplementation_Intf servlet)

collectTranslationsForEditing

public void collectTranslationsForEditing(E4TranslationsVec v,
                                          E4ServletImplementation_Intf servlet)

setClass_Items

public void setClass_Items(CLASS_Name classname)

setClass_ActiveItem

public void setClass_ActiveItem(CLASS_Name classname)

getClass_Items

public CLASS_Name getClass_Items()
Specified by:
getClass_Items in interface E4MenuLayout_Intf

getClass_ActiveItem

public CLASS_Name getClass_ActiveItem()
Specified by:
getClass_ActiveItem in interface E4MenuLayout_Intf

setClass_Baseline

public void setClass_Baseline(CLASS_Name classname)

getClass_Baseline

public CLASS_Name getClass_Baseline()
Specified by:
getClass_Baseline in interface E4MenuLayout_Intf

setClass_Body

public void setClass_Body(CLASS_Name classname)

getClass_Body

public CLASS_Name getClass_Body()

collectStylesForEditing

public void collectStylesForEditing(E4StylesHash v,
                                    E4ServletImplementation_Intf servlet)
Build a list (Vector) with style definitions used so far during display of this page. Run throught all subclasses elements and collect their styles as well. Note, that a style will only be added one time. The Vector contains elements of class E4StyleUsage.

Parameters:
v - the Vector where the styles will be collected, may not be null
See Also:
E4ServletImplementation_Intf.sessionCanEditStyles(), #collectStylesForEditing(e4s.html.style.E4StylesHash, e4s.html.style.STYLE_Name, boolean)

setAdditionalParams

public void setAdditionalParams(E4CgiParams params)

setUserdefinedImages

public void setUserdefinedImages(IMG[] images)
Specified by:
setUserdefinedImages in interface E4MenuLayout_Intf

getUserdefinedImages

public IMG[] getUserdefinedImages()
Specified by:
getUserdefinedImages in interface E4MenuLayout_Intf

getAdditionalParams

public E4CgiParams getAdditionalParams()

getSelection4MenuStyle

public static E4SelectValues getSelection4MenuStyle()

isHorizontal

public static boolean isHorizontal(int style)
Detect, weather a menu style is horizontal or not. A MENU_STYLE_IMAGES_APPLICATION or MENU_STYLE_IMAGES_CLIENT style is always horizontal, other styles depend of the MENU_STYLE_DIRECTION_HORIZONTAL setting.

Parameters:
style - a style combination
Returns:
true if horizontal

setRememberID

public void setRememberID()
If called, the current active item ID will be stored in a E4UserValues with prefix PREFIX_USER_VAL_ID.

See Also:
PREFIX_USER_VAL_ID, getRememberID()

getRememberID

public boolean getRememberID()
See Also:
setRememberID()

getRememberedID

public int getRememberedID(E4ApplObj_Intf applobj)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com