com.sapportals.portal.prt.pom
Class AbstractNode

java.lang.Object
  |
  +--com.sapportals.portal.prt.pom.AbstractNode
All Implemented Interfaces:
IEventTarget, INode, IPOMConstants, IReleasable

public abstract class AbstractNode
extends java.lang.Object
implements INode, IEventTarget

The AbstractNode is a generic implementation of the INode interface, and of the IEventTarget


Field Summary
protected  NodeMode m_mode
           
protected  java.lang.String m_nodeName
           
protected  IPortalComponent m_portalComponent
           
protected  IPortalNode mm_portalNode
           
 
Fields inherited from interface com.sapportals.portal.prt.pom.IPOMConstants
ABOUT_MODE, ABOUT_REQUEST_EVENT, ACTION_EVENT, AFTER_CONTENT_EVENT, BEFORE_CONTENT_EVENT, COMPONENT_EVENT, COMPONENT_NODE, DEFAULT_MODE, EDIT_ACKNOWLEDGE_EVENT, EDIT_MODE, EDIT_REQUEST_EVENT, HELP_MODE, HELP_REQUEST_EVENT, LOGON_EVENT, LOGON_MODE, LOGOUT_EVENT, ON_NODE_READY_EVENT, ON_NODE_REMOVE_EVENT, ON_POM_READY_EVENT, PORTAL_NODE, PREVIEW_MODE, PREVIEW_REQUEST_EVENT, REFRESH_MODE, REFRESH_REQUEST_EVENT, REQUEST_EVENT, TEST_MODE
 
Constructor Summary
  AbstractNode(java.lang.String nodeName)
          Builds a node without referencing a IPortalComponent
protected AbstractNode(java.lang.String nodeName, IPortalComponent aComponent)
          Constructor
 
Method Summary
 INode addChildNode(INode node)
          Adds a node as a children of this node.
 void addEventListener(EventType type, IEventListener listener)
          Registers an event listener for this node.
 void addEventListener(EventType type, IEventListener listener, IEventFilter filter)
          Registers an event listener for this node.
 void dispatchEvent(IEvent evt)
          Start dispatching of an event.
 INodeList getChildNodes()
          Returns the child nodes
 INodeList getChildNodesByName(java.lang.String name)
          Finds direct children by a specified name.
 IPortalComponent getComponent()
          Gets the (@link IPortalComponent IPortalComponent} linked with this node.
 INode getFirstChild()
          Returns the first child
 INode getLastChild()
          Returns the
 INode getNextSibling()
          Returns the
 INode getNextSiblingOfChild(INode childNode)
          Returns the
 java.lang.String getNodeMark()
          Retrieves the mark set on this node.
 NodeMode getNodeMode()
          Gets the mode to be used for the associated component during this request.
 java.lang.String getNodeName()
          The name given during the node construction.
 INode getParentNode()
          Returns the
 IPortalNode getPortalNode()
          Returns the
 INode getPreviousSibling()
          Returns the
 INode getPreviousSiblingOfChild(INode childNode)
          Returns the
 java.lang.Object getValue(java.lang.String name)
          Retrieves an object from this node according to its name.
 boolean hasChildNodes()
          If this node has children
 boolean isRootNode()
          Whether this node is a root node or not.
 void putValue(java.lang.String name, java.lang.Object value)
          Enables to register an object value associated with this node.
 void release()
          from interface IReleasable
 void removeChildNode(INode node)
          Removes the given node from the children of this node.
 void removeEventListener(EventType type, IEventListener listener)
          Unregisters an event listener.
 void removeEventListener(EventType type, IEventListener listener, IEventFilter filter)
          Unregisters an event listener.
 void removeValue(java.lang.String name)
          Removes an object from this node
 void setNodeMark(java.lang.String mark)
          Sets a mark on this node.
 void setNodeMode(NodeMode mode)
          Sets the mode to be used for the associated component during this request.
 void setParentNode(INode parentNode)
          Sets the parent node of this node
 void setPortalNode(IPortalNode portalNode)
          Registers the portal Node of this node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sapportals.portal.prt.pom.INode
getNodeType
 

Field Detail

m_nodeName

protected java.lang.String m_nodeName

mm_portalNode

protected IPortalNode mm_portalNode

m_portalComponent

protected IPortalComponent m_portalComponent

m_mode

protected NodeMode m_mode
Constructor Detail

AbstractNode

public AbstractNode(java.lang.String nodeName)
Builds a node without referencing a IPortalComponent
Parameters:
nodeName - The name identifying the node

AbstractNode

protected AbstractNode(java.lang.String nodeName,
                       IPortalComponent aComponent)
Constructor
Parameters:
nodeName - The name of the node
Method Detail

setPortalNode

public void setPortalNode(IPortalNode portalNode)
Registers the portal Node of this node
Specified by:
setPortalNode in interface INode
Parameters:
portalNode - The portal node to set

getNodeName

public java.lang.String getNodeName()
The name given during the node construction.
Specified by:
getNodeName in interface INode
Returns:
the name of this node

getComponent

public IPortalComponent getComponent()
Gets the (@link IPortalComponent IPortalComponent} linked with this node.
Specified by:
getComponent in interface INode
Returns:
the component associated with the node

setNodeMode

public void setNodeMode(NodeMode mode)
Sets the mode to be used for the associated component during this request. Valid values are MODE_DEFAULT, MODE_PREVIEW, MODE_EDIT,...
Note: Implementation should be aware of side effects. It is safe to allow the transition from MODE_DEFAULT to any other mode, but not back.
Specified by:
setNodeMode in interface INode
Parameters:
mode -  

getNodeMode

public NodeMode getNodeMode()
Gets the mode to be used for the associated component during this request. Warning: If the node has no parent and setNodeMode has never been called on that node the returned value will be DEFAULT_MODE temporarily until the node is part of the POM (addChildNode is called with this node)
Specified by:
getNodeMode in interface INode
Returns:
the current node mode

getChildNodes

public INodeList getChildNodes()
Returns the child nodes
Specified by:
getChildNodes in interface INode
Returns:
a list of the children of this node

getFirstChild

public INode getFirstChild()
Returns the first child
Specified by:
getFirstChild in interface INode
Returns:
the first node of all children of this node

getLastChild

public INode getLastChild()
Returns the
Specified by:
getLastChild in interface INode
Returns:
The last node of all children of this node

getNextSibling

public INode getNextSibling()
Returns the
Specified by:
getNextSibling in interface INode
Returns:
The next node in the children list of this node's parent

getPreviousSibling

public INode getPreviousSibling()
Returns the
Specified by:
getPreviousSibling in interface INode
Returns:
The previous node in the children list of this node's parent

getPreviousSiblingOfChild

public INode getPreviousSiblingOfChild(INode childNode)
Returns the
Specified by:
getPreviousSiblingOfChild in interface INode
Parameters:
childNode - the reference node to obtain the sibling
Returns:
previous sibling of specified child node.

getNextSiblingOfChild

public INode getNextSiblingOfChild(INode childNode)
Returns the
Specified by:
getNextSiblingOfChild in interface INode
Parameters:
childNode - the reference node to obtain the sibling
Returns:
next sibling of specified child node.

addChildNode

public INode addChildNode(INode node)
                   throws PortalOMException
Adds a node as a children of this node.
Specified by:
addChildNode in interface INode
Parameters:
node - the node to add as a child
Returns:
the current node
Throws:
PortalOMException - If the child node is null or it already belong to another node

removeChildNode

public void removeChildNode(INode node)
                     throws PortalOMException
Removes the given node from the children of this node.
Specified by:
removeChildNode in interface INode
Parameters:
node - The node to remove
Throws:
PortalOMException -  

getParentNode

public INode getParentNode()
Returns the
Specified by:
getParentNode in interface INode
Returns:
The parent node of this node

getPortalNode

public IPortalNode getPortalNode()
Returns the
Specified by:
getPortalNode in interface INode
Returns:
The portal Node, namely the root node of this POM

setParentNode

public void setParentNode(INode parentNode)
Sets the parent node of this node
Specified by:
setParentNode in interface INode
Parameters:
parentNode -  

hasChildNodes

public boolean hasChildNodes()
Description copied from interface: INode
If this node has children
Specified by:
hasChildNodes in interface INode
Returns:
A boolean indicating wether this node has children.

isRootNode

public boolean isRootNode()
Whether this node is a root node or not.
Only nodes implementing IPortalNode are supposed to be root nodes.
Returns:
true if this node is the root node.

getChildNodesByName

public INodeList getChildNodesByName(java.lang.String name)
Finds direct children by a specified name.
Specified by:
getChildNodesByName in interface INode
Parameters:
name - The search name
Returns:
children with the specified name

removeEventListener

public void removeEventListener(EventType type,
                                IEventListener listener)
Unregisters an event listener.
Specified by:
removeEventListener in interface IEventTarget
Parameters:
type -  
listener -  

removeEventListener

public void removeEventListener(EventType type,
                                IEventListener listener,
                                IEventFilter filter)
Unregisters an event listener.
Parameters:
type -  
listener -  

addEventListener

public void addEventListener(EventType type,
                             IEventListener listener,
                             IEventFilter filter)
                      throws PortalOMException
Registers an event listener for this node. If already registered, the associated data will be updated.
Specified by:
addEventListener in interface IEventTarget
Parameters:
type - the EventType, the Listener wants to listen to
listener - the listener to add
Throws:
PortalOMException -  

addEventListener

public void addEventListener(EventType type,
                             IEventListener listener)
                      throws PortalOMException
Registers an event listener for this node. If already registered, the associated data will be updated.
Specified by:
addEventListener in interface IEventTarget
Parameters:
type - the EventType, the Listener wants to listen to
listener - the listener to add
useCapture - whether
Throws:
PortalOMException -  

dispatchEvent

public void dispatchEvent(IEvent evt)
                   throws PortalOMException
Start dispatching of an event.
Specified by:
dispatchEvent in interface IEventTarget
Parameters:
evt - the event to dispatch
Throws:
PortalOMException -  

putValue

public void putValue(java.lang.String name,
                     java.lang.Object value)
Enables to register an object value associated with this node.
Can be used as a generic store mechanism.
Specified by:
putValue in interface INode
Parameters:
name - An identifier for the value put in this node
value - An object value

getValue

public java.lang.Object getValue(java.lang.String name)
Retrieves an object from this node according to its name.
This object value should have been registered with the putValue method
Specified by:
getValue in interface INode
Parameters:
name - An identifier of the object
Returns:
The held object or null if not present.

removeValue

public void removeValue(java.lang.String name)
Removes an object from this node
Specified by:
removeValue in interface INode
Parameters:
name - An identifier of the object

setNodeMark

public void setNodeMark(java.lang.String mark)
Sets a mark on this node. The mark up of the current Portal Object Model will be serialized during url generation, e.g. using IPortalComponentRequest.createComponentURL(com.sapportals.portal.prt.pom.INode, com.sapportals.portal.prt.event.IPortalRequestEvent). In order to keep generated urls short you should use the mark up mechanisms carefully.
Specified by:
setNodeMark in interface INode
Parameters:
mark - The mark to be put on this node

getNodeMark

public java.lang.String getNodeMark()
Retrieves the mark set on this node. This mark could be have been set in a previous request. If we do not know our mark yet, we ask the PortalNode for it.
Specified by:
getNodeMark in interface INode

release

public void release()
from interface IReleasable
Specified by:
release in interface IReleasable