com.vaadin.sass.internal
Class ScssStylesheet

java.lang.Object
  extended by com.vaadin.sass.internal.tree.Node
      extended by com.vaadin.sass.internal.ScssStylesheet
All Implemented Interfaces:
java.io.Serializable

public class ScssStylesheet
extends Node

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.vaadin.sass.internal.tree.Node
children, parentNode
 
Constructor Summary
ScssStylesheet()
          Read in a file SCSS and parse it into a ScssStylesheet
 
Method Summary
 void addChild(int index, VariableNode node)
           
static void addVariable(VariableNode node)
           
static void closeVariableScope(java.util.Map<java.lang.String,VariableNode> originalScope)
          End a scope for variables, replacing all active variables with those from the original scope (obtained from openVariableScope()).
 void compile()
          Applies all the visitors and compiles SCSS into Css.
static ScssStylesheet get()
           
static ScssStylesheet get(java.lang.String identifier)
          Main entry point for the SASS compiler.
static ScssStylesheet get(java.lang.String identifier, java.lang.String encoding)
          Main entry point for the SASS compiler.
 java.lang.String getCharset()
           
 java.lang.String getFileName()
           
static java.util.HashMap<Node,Node> getLastNodeAdded()
           
static MixinDefNode getMixinDefinition(java.lang.String name)
           
static VariableNode getVariable(java.lang.String string)
           
static java.util.ArrayList<VariableNode> getVariables()
           
static java.util.Map<java.lang.String,VariableNode> openVariableScope()
          Start a new scope for variables.
 void removeEmptyBlocks(Node node)
           
 org.w3c.css.sac.InputSource resolveStylesheet(java.lang.String identifier)
           
 void setCharset(java.lang.String charset)
           
 void setFileName(java.lang.String fileName)
           
static void setStylesheetResolvers(ScssStylesheetResolver... styleSheetResolvers)
           
 java.lang.String toString()
          Prints out the current state of the node tree.
 void traverse()
          Method for manipulating the data contained within the Node.
 boolean traverse(Node node)
          Traverses a node and its children recursively, calling all the appropriate handlers via Node.traverse().
static void warning(java.lang.String msg)
           
 
Methods inherited from class com.vaadin.sass.internal.tree.Node
appendAll, appendChild, appendChild, appendChildrenAfter, getChildren, getParentNode, hasChildren, removeChild, setChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScssStylesheet

public ScssStylesheet()
Read in a file SCSS and parse it into a ScssStylesheet

Parameters:
file -
Throws:
java.io.IOException
Method Detail

get

public static ScssStylesheet get(java.lang.String identifier)
                          throws org.w3c.css.sac.CSSException,
                                 java.io.IOException
Main entry point for the SASS compiler. Takes in a file and builds up a ScssStylesheet tree out of it. Calling compile() on it will transform SASS into CSS. Calling toString() will print out the SCSS/CSS.

Parameters:
identifier - The file path. If null then null is returned.
Returns:
Throws:
org.w3c.css.sac.CSSException
java.io.IOException

get

public static ScssStylesheet get(java.lang.String identifier,
                                 java.lang.String encoding)
                          throws org.w3c.css.sac.CSSException,
                                 java.io.IOException
Main entry point for the SASS compiler. Takes in a file and encoding then builds up a ScssStylesheet tree out of it. Calling compile() on it will transform SASS into CSS. Calling toString() will print out the SCSS/CSS.

Parameters:
identifier - The file path. If null then null is returned.
encoding -
Returns:
Throws:
org.w3c.css.sac.CSSException
java.io.IOException

setStylesheetResolvers

public static void setStylesheetResolvers(ScssStylesheetResolver... styleSheetResolvers)

resolveStylesheet

public org.w3c.css.sac.InputSource resolveStylesheet(java.lang.String identifier)

compile

public void compile()
             throws java.lang.Exception
Applies all the visitors and compiles SCSS into Css.

Throws:
java.lang.Exception

toString

public java.lang.String toString()
Prints out the current state of the node tree. Will return SCSS before compile and CSS after. For now this is an own method with it's own implementation that most node types will implement themselves.

Overrides:
toString in class Node

addChild

public void addChild(int index,
                     VariableNode node)

get

public static ScssStylesheet get()

traverse

public void traverse()
Description copied from class: Node
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.

Specified by:
traverse in class Node

traverse

public boolean traverse(Node node)
Traverses a node and its children recursively, calling all the appropriate handlers via Node.traverse(). The node itself may be removed during the traversal and replaced with other nodes at the same position or later on the child list of its parent.

Parameters:
node - node to traverse
Returns:
true if the node was removed (and possibly replaced by others), false if not

openVariableScope

public static java.util.Map<java.lang.String,VariableNode> openVariableScope()
Start a new scope for variables. Any variables set or modified after opening a new scope are only valid until the scope is closed, at which time they are replaced with their old values.

Returns:
old scope to give to a paired closeVariableScope(Map) call at the end of the scope (unmodifiable map).

closeVariableScope

public static void closeVariableScope(java.util.Map<java.lang.String,VariableNode> originalScope)
End a scope for variables, replacing all active variables with those from the original scope (obtained from openVariableScope()).

Parameters:
originalScope - original scope

removeEmptyBlocks

public void removeEmptyBlocks(Node node)

addVariable

public static void addVariable(VariableNode node)

getVariable

public static VariableNode getVariable(java.lang.String string)

getVariables

public static java.util.ArrayList<VariableNode> getVariables()

getMixinDefinition

public static MixinDefNode getMixinDefinition(java.lang.String name)

setFileName

public void setFileName(java.lang.String fileName)

getFileName

public java.lang.String getFileName()

getLastNodeAdded

public static java.util.HashMap<Node,Node> getLastNodeAdded()

warning

public static final void warning(java.lang.String msg)

getCharset

public java.lang.String getCharset()

setCharset

public void setCharset(java.lang.String charset)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.