org.benow.web.menu
Class MenuItemImpl

java.lang.Object
  extended by org.benow.security.SecureObject
      extended by org.benow.repository.util.PersistentObjectImpl
          extended by org.benow.repository.mapping.JSQLObject
              extended by org.benow.web.menu.MenuItemImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, org.benow.repository.util.PersistentObject, MenuItem
Direct Known Subclasses:
PageMenuItem

public class MenuItemImpl
extends org.benow.repository.mapping.JSQLObject
implements MenuItem

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.benow.repository.mapping.JSQLObject
org.benow.repository.mapping.JSQLObject.XSQLVersionDesc, org.benow.repository.mapping.JSQLObject.XSQLVersioned
 
Field Summary
 boolean canned
          did this item come from a bootstrap?
protected  org.benow.repository.mapping.JSQLArrayList<MenuItemImpl> children
           
 int pos
           
 
Fields inherited from class org.benow.repository.util.PersistentObjectImpl
conn, recycled
 
Fields inherited from class org.benow.security.SecureObject
admin
 
Fields inherited from interface org.benow.repository.util.PersistentObject
FIELD_NAME_KEY
 
Constructor Summary
protected MenuItemImpl()
           
  MenuItemImpl(java.lang.String name, java.lang.String description, java.lang.String href)
           
  MenuItemImpl(java.lang.String name, java.lang.String description, java.lang.String href, java.lang.String onClick)
           
 
Method Summary
 void addChild(MenuItem item)
           
 MenuItem addChild(java.lang.String name, java.lang.String desc, java.lang.String href)
           
 void addClassName(java.lang.String cn)
          Add a css class to be associated with the menu item
 void addDynamicChild(MenuItem item)
          Adds a child without updating it or refreshing the system menu.
 MenuItem addDynamicChild(java.lang.String name, java.lang.String desc, java.lang.String href)
           
 boolean enabled()
           
 java.lang.String getAbsolutePath()
           
 MenuItem getChildByName(java.lang.String name)
           
 MenuItem getChildByPath(java.lang.String absolutePath)
          gets child by given path, digs into children if neeeded
 MenuItem getChildByPos(int pos)
           
 java.util.List getChildren()
           
 java.util.List getChildrenDirectly()
          get children with no db fetch
 java.lang.String getDescription()
           
 java.lang.String getHotkey()
          Get hotkey to trigger this item.
 java.lang.String getHREF()
           
 java.lang.String getName()
           
 java.lang.String getOnClick()
           
 MenuItem getParent()
           
 java.lang.String getPermission()
           
 int getPosition()
           
 boolean hasNew()
           
 void moveDown()
          increases position among siblings
 void moveUp()
          decreases position among siblings
 void removeChild(MenuItem item)
           
 void removeSelf()
          remove this item
 MenuItem resolve()
          Creates a copy of this menu item (recursively) and resolves all plugin items and selected state according to the request
 void select()
          Recursively select nodes based on the current requested uri.
 void setEnabled(boolean enabled)
           
 MenuItem setHotkey(java.lang.String hotkey)
          Of the format alt-shift-X ctrl-y x
 void setName(java.lang.String name)
           
 void setOnClick(java.lang.String onClick)
           
 void setSelected()
           
 java.lang.String toString()
           
 
Methods inherited from class org.benow.repository.mapping.JSQLObject
fetchExpectedField, fetchField, fetchFieldQuiet, forgetField, isFetched, isLocked, lock, refetchFieldQuiet, setFetched
 
Methods inherited from class org.benow.repository.util.PersistentObjectImpl
compareTo, doIsTransient, equals, getKey, isTransient, recycle, remove, remove, repositoryAfterLoad, repositoryAfterPersist, repositoryAfterTransient, repositoryBeforePersist, repositoryBeforeTransient, setKey, update, update
 
Methods inherited from class org.benow.security.SecureObject
assertOnePermission, assertPermission, assertPermission, declarePermission, declareViewPermission, declareViewPermission
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pos

public int pos

canned

public boolean canned
did this item come from a bootstrap?


children

protected org.benow.repository.mapping.JSQLArrayList<MenuItemImpl> children
Constructor Detail

MenuItemImpl

protected MenuItemImpl()

MenuItemImpl

public MenuItemImpl(java.lang.String name,
                    java.lang.String description,
                    java.lang.String href)

MenuItemImpl

public MenuItemImpl(java.lang.String name,
                    java.lang.String description,
                    java.lang.String href,
                    java.lang.String onClick)
Method Detail

enabled

public boolean enabled()
Specified by:
enabled in interface MenuItem
Returns:
true if item is enabled.

setOnClick

public void setOnClick(java.lang.String onClick)

getPermission

public java.lang.String getPermission()
Specified by:
getPermission in interface MenuItem

setName

public void setName(java.lang.String name)

getChildren

public java.util.List getChildren()
Specified by:
getChildren in interface MenuItem

getName

public java.lang.String getName()
Specified by:
getName in interface MenuItem

getParent

public MenuItem getParent()
Specified by:
getParent in interface MenuItem

addChild

public void addChild(MenuItem item)
Specified by:
addChild in interface MenuItem

addDynamicChild

public void addDynamicChild(MenuItem item)
Adds a child without updating it or refreshing the system menu. Intended for dynamic menu creation

Parameters:
item -

addDynamicChild

public MenuItem addDynamicChild(java.lang.String name,
                                java.lang.String desc,
                                java.lang.String href)

removeChild

public void removeChild(MenuItem item)
Specified by:
removeChild in interface MenuItem

getAbsolutePath

public java.lang.String getAbsolutePath()
Specified by:
getAbsolutePath in interface MenuItem

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface MenuItem

getHREF

public java.lang.String getHREF()
Specified by:
getHREF in interface MenuItem

getPosition

public int getPosition()
Specified by:
getPosition in interface MenuItem
Returns:
the position of this item among its siblings (if first child is 0, etc)

getChildByPos

public MenuItem getChildByPos(int pos)
Specified by:
getChildByPos in interface MenuItem

getChildByPath

public MenuItem getChildByPath(java.lang.String absolutePath)
                        throws org.benow.repository.NoSuchObjectException
Description copied from interface: MenuItem
gets child by given path, digs into children if neeeded

Specified by:
getChildByPath in interface MenuItem
Throws:
org.benow.repository.NoSuchObjectException

getChildByName

public MenuItem getChildByName(java.lang.String name)
                        throws org.benow.repository.NoSuchObjectException
Specified by:
getChildByName in interface MenuItem
Throws:
org.benow.repository.NoSuchObjectException

getChildrenDirectly

public java.util.List getChildrenDirectly()
get children with no db fetch

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class org.benow.repository.util.PersistentObjectImpl

hasNew

public boolean hasNew()

addChild

public MenuItem addChild(java.lang.String name,
                         java.lang.String desc,
                         java.lang.String href)
Specified by:
addChild in interface MenuItem

moveUp

public void moveUp()
Description copied from interface: MenuItem
decreases position among siblings

Specified by:
moveUp in interface MenuItem

moveDown

public void moveDown()
Description copied from interface: MenuItem
increases position among siblings

Specified by:
moveDown in interface MenuItem

removeSelf

public void removeSelf()
Description copied from interface: MenuItem
remove this item

Specified by:
removeSelf in interface MenuItem

getOnClick

public java.lang.String getOnClick()
Specified by:
getOnClick in interface MenuItem

setEnabled

public void setEnabled(boolean enabled)

setSelected

public void setSelected()

resolve

public MenuItem resolve()
Description copied from interface: MenuItem
Creates a copy of this menu item (recursively) and resolves all plugin items and selected state according to the request

Specified by:
resolve in interface MenuItem
Returns:

select

public void select()
Recursively select nodes based on the current requested uri. Should be called on a resolved (via resolve()) copy of the root tree.

Specified by:
select in interface MenuItem

getHotkey

public java.lang.String getHotkey()
Description copied from interface: MenuItem
Get hotkey to trigger this item. A solo character, or a key press combination, such as

Specified by:
getHotkey in interface MenuItem
Returns:

setHotkey

public MenuItem setHotkey(java.lang.String hotkey)
Of the format

Parameters:
hotkey -
Returns:
this

addClassName

public void addClassName(java.lang.String cn)
Add a css class to be associated with the menu item

Parameters:
cn -