com.fg.xmleditor
Class TreeViewBuilder

java.lang.Object
  extended bycom.fg.xmleditor.TreeViewBuilder
All Implemented Interfaces:
Common

public class TreeViewBuilder
extends java.lang.Object
implements Common

A helper class which is created and used by FXDocumentModelImpl. TreeViewBuilder doesn't have to be instantiated and used by the user code.

Version:
2.0
Author:
Felix Golubov

Field Summary
 
Fields inherited from interface com.fg.xmleditor.Common
APPINFO, EDITOR_CLASS, EDITOR_ID, EXPOSED, EXPOSED_FLAG, FALSE, ID, ID_FLAG, IDREF, IDREF_FLAG, MESSAGE, NAME, NODE_INFO, PARAM, SCHEMA_NS, TRUE
 
Constructor Summary
TreeViewBuilder(CacheStore cache, Validator validator)
          Creates a new instance of the TreeViewBuilder.
 
Method Summary
 FToggleNode insertInstance(FToggleNode arrayNode, int index)
          Insert a new FToggleNode instance of Element, Substitution Group or Model Group into an Array folder at the specified position.
 java.util.List loadDocument(org.w3c.dom.Element xmlElement, FToggleNode fElementNode)
          Loads an existing XML document with a root Element of the DOM tree specified.
 boolean populateNode(FToggleNode parentNode)
          Populates an empty Element node with all child nodes.
 void setFolderBackground(int type, java.awt.Color color)
          Sets background color for specified type of tree folders.
 void setNodeImage(int type, java.awt.Image image)
          Sets an image for the specified type of tree nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeViewBuilder

public TreeViewBuilder(CacheStore cache,
                       Validator validator)
Creates a new instance of the TreeViewBuilder.

Parameters:
cache - a CacheStore object.
validator - a Validator object.
Method Detail

setFolderBackground

public void setFolderBackground(int type,
                                java.awt.Color color)
Sets background color for specified type of tree folders. The folder type is specified by an integer constant declared in the XSRef class (or any number of these constants combined with | - bitwise OR operators).

Parameters:
type - a folder type - an integer constant declared in the XSRef class (or any number of these constants combined with | - bitwise OR operators).
color - a folder background.

setNodeImage

public void setNodeImage(int type,
                         java.awt.Image image)
Sets an image for the specified type of tree nodes. The node type is specified by an integer constant declared in the XSRef class (or any number of these constants combined with | - bitwise OR operators).

Parameters:
type - a node type - an integer constant declared in the XSRef class (or any number of these constants combined with | - bitwise OR operators).

populateNode

public boolean populateNode(FToggleNode parentNode)
Populates an empty Element node with all child nodes. Performs operation and returns true when operation is allowed and does nothing and returns false otherwise.

Parameters:
parentNode - FToggleNode object, which represents XML Element node.
Returns:
true when operation is allowed and false otherwise.

insertInstance

public FToggleNode insertInstance(FToggleNode arrayNode,
                                  int index)
Insert a new FToggleNode instance of Element, Substitution Group or Model Group into an Array folder at the specified position. If an instance can be inserted, the method returns reference to the new instance, otherwise it returns null.

Parameters:
arrayNode - FToggleNode object, which represents Array folder node.
Returns:
a reference to the inserted instance or null when operation is not allowed.

loadDocument

public java.util.List loadDocument(org.w3c.dom.Element xmlElement,
                                   FToggleNode fElementNode)
Loads an existing XML document with a root Element of the DOM tree specified.

Parameters:
xmlElement - a root Element of the DOM tree.
fElementNode - a FToggleNode object which represents XML root element.
Returns:
a list of the org.w3c.dom.Element elements, which have not been loaded because of the document structural invalidity or null if the whole document has been loaded successfully.