Class AbstractNode
- java.lang.Object
-
- de.hybris.platform.commons.translator.nodes.AbstractNode
-
- Direct Known Subclasses:
ListNode
,SimpleNode
,TableNode
public abstract class AbstractNode extends java.lang.Object
Abstract class that is an interface for all type of nodes
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
OPEN_TAG
open tag key for attributes map
-
Constructor Summary
Constructors Constructor Description AbstractNode(java.lang.String nodeName, java.lang.String nodeText)
create node with name and textAbstractNode(java.lang.String nodeName, java.lang.String nodeText, java.util.Map generateAttributes)
create node with name, text and map
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Add an attribute and its value to the nodes attributesvoid
addAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
add a map of attributes to the nodes attributesvoid
addChildNode(AbstractNode child)
method that add one node to child nodes collection and set its parent as this nodevoid
addChildNodes(java.util.List<AbstractNode> childNodes)
method that add all nodes from collection to this node child nodes collection, and set their parents as this nodejava.lang.String
getAttributeByName(java.lang.String attributeName)
returns the value of the given attributejava.util.Map<java.lang.String,java.lang.String>
getAttributes()
AbstractNode
getChildNodeByName(java.lang.String nodeName)
returns the node with the given name (or null, if no such code could be found)java.util.List<AbstractNode>
getChildNodes()
java.lang.String
getNodeName()
java.lang.String
getNodeText()
AbstractNode
getParentNode()
java.lang.String
getStyleClass()
this method was created because getting class from attributes in velocity template will produce java.util.Mapboolean
isOpenTag()
checks if the tag is open
it must be a openTag key in attributes map and the value must be truevoid
setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
set all attributes of this nodevoid
setChildNodes(java.util.List<AbstractNode> childNodes)
set collection of contained nodesvoid
setNodeName(java.lang.String nodeName)
void
setNodeText(java.lang.String nodeText)
void
setParentNode(AbstractNode parentNode)
-
-
-
Field Detail
-
OPEN_TAG
public static final java.lang.String OPEN_TAG
open tag key for attributes map- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractNode
public AbstractNode(java.lang.String nodeName, java.lang.String nodeText)
create node with name and text- Parameters:
nodeName
-nodeText
-
-
AbstractNode
public AbstractNode(java.lang.String nodeName, java.lang.String nodeText, java.util.Map generateAttributes)
create node with name, text and map- Parameters:
nodeName
-nodeText
-generateAttributes
-
-
-
Method Detail
-
getNodeName
public java.lang.String getNodeName()
-
setNodeName
public void setNodeName(java.lang.String nodeName)
-
getNodeText
public java.lang.String getNodeText()
-
setNodeText
public void setNodeText(java.lang.String nodeText)
-
getParentNode
public AbstractNode getParentNode()
-
setParentNode
public void setParentNode(AbstractNode parentNode)
-
getChildNodes
public java.util.List<AbstractNode> getChildNodes()
- Returns:
- nodes contained (children) by this node
-
getChildNodeByName
public AbstractNode getChildNodeByName(java.lang.String nodeName)
returns the node with the given name (or null, if no such code could be found)- Parameters:
nodeName
- The name of the child node to search for- Returns:
- first found node with given name, otherwise null
-
setChildNodes
public void setChildNodes(java.util.List<AbstractNode> childNodes)
set collection of contained nodes- Parameters:
childNodes
- The nodes to set to this node as children
-
addChildNodes
public void addChildNodes(java.util.List<AbstractNode> childNodes)
method that add all nodes from collection to this node child nodes collection, and set their parents as this node- Parameters:
childNodes
- The nodes to add to this node as children
-
addChildNode
public void addChildNode(AbstractNode child)
method that add one node to child nodes collection and set its parent as this node- Parameters:
child
- The node to add to this node as child
-
getAttributes
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
- Returns:
- a attributeName:attributValue map of all attributes of this node
-
getAttributeByName
public java.lang.String getAttributeByName(java.lang.String attributeName)
returns the value of the given attribute- Parameters:
attributeName
- The name of the attribute for which to the the value- Returns:
- attribute for a given name
-
setAttributes
public void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
set all attributes of this node- Parameters:
attributes
- An attributeName:attributValue map with all attributes of this node
-
addAttributes
public void addAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
add a map of attributes to the nodes attributes- Parameters:
attributes
- An attributeName:attributValue map that shall be added to the nodes attributes
-
addAttribute
public void addAttribute(java.lang.String attributeName, java.lang.String attributeValue)
Add an attribute and its value to the nodes attributes- Parameters:
attributeName
- The name of the attributeattributeValue
- The value of the attribute
-
getStyleClass
public java.lang.String getStyleClass()
this method was created because getting class from attributes in velocity template will produce java.util.Map
-
isOpenTag
public boolean isOpenTag()
checks if the tag is open
it must be a openTag key in attributes map and the value must be true- Returns:
- the openTag
-
-