|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.clients.web.extensions.AbstractJspFactory net.sf.basedb.clients.web.extensions.AbstractJspActionFactory<MenuItemAction> net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory
public class FixedMenuItemFactory
A simple implementation of a menu item action factory that creates the same fixed menu item for all users not using any context information.
The menu is by default a regular menuitem and is both
visible and enabled. Use the setter method to change
the properties. Changes to the properties are immediately
visible in the menu items returned from the
getActions(InvokationContext)
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sf.basedb.clients.web.extensions.menu.MenuItemAction |
---|
MenuItemAction.MenuType |
Field Summary | |
---|---|
private MenuItemAction[] |
actions
|
private boolean |
enabled
|
private String |
icon
|
private String |
menuId
|
private String |
onClick
|
private String |
style
|
private String |
submenuId
|
private String |
title
|
private String |
tooltip
|
private MenuItemAction.MenuType |
type
|
private boolean |
visible
|
Constructor Summary | |
---|---|
FixedMenuItemFactory()
Create a new factory instance. |
Method Summary | |
---|---|
MenuItemAction[] |
getActions(InvokationContext<? super MenuItemAction> context)
This method may be called one or several times for each request. |
String |
getIcon()
Get an absolute reference to an image that will be displayed in the menu. |
String |
getMenuId()
The ID of the menu where this menu item belongs, or null if it belongs to the top-level menu. |
String |
getOnClick()
A javascript action that is executed when the user clicks the menu. |
String |
getStyle()
Extra CSS style attributes that will be added to the style attribute of the menu item div. |
String |
getSubmenuId()
The ID of a new submenu. |
String |
getTitle()
Get the title of the menu. |
String |
getTooltip()
A tooltip that is shown as a yellow popup when the user points the mouse at the menu item. |
MenuItemAction.MenuType |
getType()
The type of menu item. |
boolean |
isEnabled()
If the menu item should be enabled or disabled. |
boolean |
isVisible()
If the menu item should be visible or not. |
void |
setEnabled(boolean enabled)
|
void |
setEnabled(String enabled)
|
void |
setIcon(String icon)
|
void |
setMenuId(String menuId)
|
void |
setOnClick(String onClick)
|
void |
setStyle(String style)
|
void |
setSubmenuId(String submenuId)
|
void |
setTitle(String title)
|
void |
setTooltip(String tooltip)
|
void |
setType(MenuItemAction.MenuType type)
|
void |
setType(String type)
|
void |
setVisible(boolean visible)
|
void |
setVisible(String visible)
|
Methods inherited from class net.sf.basedb.clients.web.extensions.AbstractJspActionFactory |
---|
prepareContext |
Methods inherited from class net.sf.basedb.clients.web.extensions.AbstractJspFactory |
---|
getScripts, getStylesheets, prepareContext, setScript, setStylesheet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private MenuItemAction[] actions
private String menuId
private String submenuId
private String icon
private String onClick
private String style
private String title
private String tooltip
private boolean enabled
private boolean visible
private MenuItemAction.MenuType type
Constructor Detail |
---|
public FixedMenuItemFactory()
Method Detail |
---|
public MenuItemAction[] getActions(InvokationContext<? super MenuItemAction> context)
ActionFactory
getActions
in interface ActionFactory<MenuItemAction>
context
- The current invokation context
public String getIcon()
MenuItemAction
getIcon
in interface MenuItemAction
public String getMenuId()
MenuItemAction
getMenuId
in interface MenuItemAction
public String getOnClick()
MenuItemAction
Menu.openUrl(url)
The URL can be any valid URL. To access a JSP page on the BASE server you need to know the root path of the web application and the session ID for the logged in user. This information available in the JspContext passed to the factory class. If you, for example, want to open the reporters list page, you can create the URL like this:
String url = jspContext.getRoot() + "/views/reporters/index.jsp?ID=" + jspContext.getSessionControl().getId();It is also possible to use pure JavaScript to extract the root URL and session ID. Here is an example that opens the reporter list page:
Menu.openUrl(getRoot()+'views/reporters/index.jsp?ID='+getSessionId());Another possibility that works for the root path is to use a factory that has enabled variable substitution. In this case you can use:
Menu.openUrl('$ROOT$/views/reporters/index.jsp?ID='+getSessionId());
Main.openPopup(url, windowName, width, height, options)
The URL follows the same rules as the above. The windowName
is a name to give to the popup window. Use only alphabetical characters (a-z).
The size is controlled with the width
and height
options, given in pixels. BASE will automatically rescale the window
if the user has choosen a bigger or smaller font size. Other
options can be specified in the options
parameter. See
documentation for the window.open()
javascript function
for valid syntax.
getOnClick
in interface MenuItemAction
public String getStyle()
MenuItemAction
style
attribute of the menu item div.
getStyle
in interface MenuItemAction
public String getSubmenuId()
MenuItemAction
MenuItemAction.MenuType.SUBMENU
, and is ignored otherwise.
getSubmenuId
in interface MenuItemAction
public String getTitle()
MenuItemAction
getTitle
in interface MenuItemAction
public String getTooltip()
MenuItemAction
getTooltip
in interface MenuItemAction
public MenuItemAction.MenuType getType()
MenuItemAction
getType
in interface MenuItemAction
public boolean isEnabled()
MenuItemAction
isEnabled
in interface MenuItemAction
public boolean isVisible()
MenuItemAction
isVisible
in interface MenuItemAction
@VariableSetter @PathSetter public void setIcon(String icon)
public void setMenuId(String menuId)
@VariableSetter public void setOnClick(String onClick)
public void setStyle(String style)
public void setSubmenuId(String submenuId)
public void setTitle(String title)
public void setTooltip(String tooltip)
public void setEnabled(boolean enabled)
public void setEnabled(String enabled)
public void setVisible(boolean visible)
public void setVisible(String visible)
public void setType(MenuItemAction.MenuType type)
public void setType(String type)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |