net.sf.navigator.displayer
Class AbstractMenuDisplayer

java.lang.Object
  extended by net.sf.navigator.displayer.AbstractMenuDisplayer
All Implemented Interfaces:
MenuDisplayer
Direct Known Subclasses:
MessageResourcesMenuDisplayer

public abstract class AbstractMenuDisplayer
extends Object
implements MenuDisplayer

Abstract implementation of MenuDisplayer that can be used as a basis for other menu displayers.

Version:
Author:
ssayles

Field Summary
protected  MessageResources displayStrings
           
protected  org.apache.commons.logging.Log log
           
protected  MenuDisplayerMapping mapping
           
protected  String name
           
protected  javax.servlet.jsp.JspWriter out
           
protected  PermissionsAdapter permissionsAdapter
          Holds value of property permissionsAdapter.
protected  String target
           
 
Fields inherited from interface net.sf.navigator.displayer.MenuDisplayer
_SELF, DEFAULT_CONFIG, EMPTY, NBSP
 
Constructor Summary
AbstractMenuDisplayer()
           
 
Method Summary
abstract  void display(MenuComponent menu)
           
 void end(javax.servlet.jsp.PageContext pageContext)
          Lifecycle method that should be called when the MenuDisplayer is done being used.
 String getConfig()
          Returns the name of the message resources bundle that contains display and/or configuration definitions.
 String getName()
          Returns the name of the MenuDisplayer.
 PermissionsAdapter getPermissionsAdapter()
          Getter for property permissionsAdapter.
 String getTarget()
          Returns the target name for any hrefs that may be generated.
protected  String getTarget(MenuComponent menu)
          Convenience method that will first return the target for the displayer if it is not null.
 void init(javax.servlet.jsp.PageContext pageContext, MenuDisplayerMapping mapping)
          Lifecycle method that should be called when the MenuDisplayer is being prepared for use.
 boolean isAllowed(MenuComponent menu)
          Returns true if the specified component is usable.
 void setConfig(String config)
          Sets the name of the message resources bundle that contains display and/or configuration definitions.
 void setName(String name)
          Sets the name of the MenuDisplayer
 void setPermissionsAdapter(PermissionsAdapter permissionsAdapter)
          Setter for property permissionsAdapter.
 void setTarget(String target)
          Setter for property target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log

name

protected String name

displayStrings

protected MessageResources displayStrings

out

protected javax.servlet.jsp.JspWriter out

target

protected String target

permissionsAdapter

protected PermissionsAdapter permissionsAdapter
Holds value of property permissionsAdapter.


mapping

protected MenuDisplayerMapping mapping
Constructor Detail

AbstractMenuDisplayer

public AbstractMenuDisplayer()
Method Detail

getName

public String getName()
Description copied from interface: MenuDisplayer
Returns the name of the MenuDisplayer.

Specified by:
getName in interface MenuDisplayer
Returns:
Value of property name.

setName

public void setName(String name)
Description copied from interface: MenuDisplayer
Sets the name of the MenuDisplayer

Specified by:
setName in interface MenuDisplayer
Parameters:
name - New value of property name.

getConfig

public String getConfig()
Description copied from interface: MenuDisplayer
Returns the name of the message resources bundle that contains display and/or configuration definitions.

Specified by:
getConfig in interface MenuDisplayer
Returns:
Value of property config.

setConfig

public void setConfig(String config)
Description copied from interface: MenuDisplayer
Sets the name of the message resources bundle that contains display and/or configuration definitions.

Specified by:
setConfig in interface MenuDisplayer
Parameters:
config - New value of property config.

getTarget

public String getTarget()
Description copied from interface: MenuDisplayer
Returns the target name for any hrefs that may be generated.

Specified by:
getTarget in interface MenuDisplayer
Returns:
the value for target.

getTarget

protected String getTarget(MenuComponent menu)
Convenience method that will first return the target for the displayer if it is not null. If the displayer target is null, then it will return menu.getTarget().

Returns:
the target for the menu link.

setTarget

public void setTarget(String target)
Description copied from interface: MenuDisplayer
Setter for property target.

Specified by:
setTarget in interface MenuDisplayer
Parameters:
target - New value of property target.

getPermissionsAdapter

public PermissionsAdapter getPermissionsAdapter()
Getter for property permissionsAdapter.

Specified by:
getPermissionsAdapter in interface MenuDisplayer
Returns:
Value of property permissionsAdapter.

setPermissionsAdapter

public void setPermissionsAdapter(PermissionsAdapter permissionsAdapter)
Setter for property permissionsAdapter.

Specified by:
setPermissionsAdapter in interface MenuDisplayer
Parameters:
permissionsAdapter - New value of property permissionsAdapter.

init

public void init(javax.servlet.jsp.PageContext pageContext,
                 MenuDisplayerMapping mapping)
Lifecycle method that should be called when the MenuDisplayer is being prepared for use.

Specified by:
init in interface MenuDisplayer
Parameters:
pageContext - The JSP pageContext to give the displayer access to any resources it may need.
mapping - The menu displayer mapping used to embody the xml definition.

display

public abstract void display(MenuComponent menu)
                      throws javax.servlet.jsp.JspException,
                             IOException
Specified by:
display in interface MenuDisplayer
Throws:
javax.servlet.jsp.JspException
IOException

end

public void end(javax.servlet.jsp.PageContext pageContext)
Description copied from interface: MenuDisplayer
Lifecycle method that should be called when the MenuDisplayer is done being used.

Specified by:
end in interface MenuDisplayer
Parameters:
pageContext - The JSP pageContext to give the displayer access to any resources it may need.

isAllowed

public boolean isAllowed(MenuComponent menu)
Returns true if the specified component is usable. If permissionsAdapter is not defined, this method will return true. Otherwise, the adapter will be used to check permissions on the menu.

Parameters:
menu - The menu component.
Returns:
true if the menu component is usable.


Copyright © 2003-2007 SourceForge. All Rights Reserved.