com.vaadin.sass.internal.tree
Class Node

java.lang.Object
  extended by com.vaadin.sass.internal.tree.Node
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BlockNode, CommentNode, ConsoleMessageNode, ContentNode, DefNode, EachDefNode, ElseNode, ExtendNode, FontFaceNode, ForNode, IfElseDefNode, IfNode, ImportNode, KeyframeSelectorNode, KeyframesNode, MediaNode, MicrosoftRuleNode, MixinNode, NestPropertiesNode, ReturnNode, RuleNode, ScssStylesheet, SimpleNode, TemporaryNode, VariableNode, WhileNode

public abstract class Node
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary
static interface Node.BuildStringStrategy
           
static class Node.PrintStrategy
           
static class Node.ToStringStrategy
           
 
Field Summary
static Node.BuildStringStrategy PRINT_STRATEGY
           
static Node.BuildStringStrategy TO_STRING_STRATEGY
           
 
Constructor Summary
  Node()
           
protected Node(Node nodeToCopy)
           
 
Method Summary
 void appendChild(Node node)
          Append a new child node to the end of the child list.
abstract  Node copy()
          Copy a node (deep copy including children).
protected  Collection<Node> copyChildren()
           
 List<Node> getChildren()
           
 Node getNormalParentNode()
           
 Node getParentNode()
           
 String printState()
          Prints out the current state of the node tree.
 void replaceNode(Node oldChild, Collection<? extends Node> newNodes)
          Replace the child oldChild with a collection of nodes.
 void replaceNodeAt(int index, Node newChild)
          Replace the child at the given position with another node.
protected  void setChildren(Collection<Node> newChildren)
          Deprecated. 
abstract  Collection<Node> traverse(ScssContext context)
          Method for manipulating the data contained within the Node.
 Collection<Node> traverseChildren(ScssContext context)
           
protected  Collection<Node> traverseChildren(ScssContext context, boolean newScope)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINT_STRATEGY

public static Node.BuildStringStrategy PRINT_STRATEGY

TO_STRING_STRATEGY

public static Node.BuildStringStrategy TO_STRING_STRATEGY
Constructor Detail

Node

public Node()

Node

protected Node(Node nodeToCopy)
Method Detail

replaceNodeAt

public void replaceNodeAt(int index,
                          Node newChild)
Replace the child at the given position with another node.

Parameters:
index - the position of the old node that is to be replaced
newChild - replacing node

replaceNode

public void replaceNode(Node oldChild,
                        Collection<? extends Node> newNodes)
Replace the child oldChild with a collection of nodes.

Parameters:
oldChild - child to replace
newNodes - replacing nodes, can be an empty collection

appendChild

public void appendChild(Node node)
Append a new child node to the end of the child list. This method should only be used when constructing the Node tree, not when modifying it.

Parameters:
node - new child to append

getChildren

public List<Node> getChildren()

setChildren

@Deprecated
protected void setChildren(Collection<Node> newChildren)
Deprecated. 


traverse

public abstract Collection<Node> traverse(ScssContext context)
Method for manipulating the data contained within the Node. Traversing a node is allowed to modify the node, replace it with one or more nodes at the same or later position in its parent and modify the children of the node, but not modify or remove preceding nodes in its parent. Traversing a node is also allowed to modify the definitions currently in scope as its side-effect.

Parameters:
context - current compilation context
Returns:
nodes replacing the current node

printState

public String printState()
Prints out the current state of the node tree. Will return SCSS before compile and CSS after. Result value could be null.

Returns:
State as a string

getParentNode

public Node getParentNode()

getNormalParentNode

public Node getNormalParentNode()

copy

public abstract Node copy()
Copy a node (deep copy including children). The copy is detached from the original tree, with null as parent, and data that is not relevant to handling of function or mixin expansion is not copied.

Returns:
copy of the node

copyChildren

protected Collection<Node> copyChildren()

traverseChildren

public Collection<Node> traverseChildren(ScssContext context)

traverseChildren

protected Collection<Node> traverseChildren(ScssContext context,
                                            boolean newScope)


Copyright © 2013–2015 Vaadin. All rights reserved.