Top Description Inners Fields Constructors Methods
org.antlr.stringtemplate.misc

public Class JTreeStringTemplateModel

extends Object
implements TreeModel
Class Inheritance
All Implemented Interfaces
javax.swing.tree.TreeModel
Imports
antlr.collections.AST, javax.swing.event.*, javax.swing.tree.*, org.antlr.stringtemplate.StringTemplate, .StringTemplateGroup, org.antlr.stringtemplate.language.*, java.util.*, java.lang.reflect.Constructor

A model that pulls data from a string template hierarchy. This code is extremely ugly!

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
JTreeStringTemplateModel.MapEntryWrapper

Wrap an entry in a map so that name appears as the root and the value appears as the child or children.

pack-priv static class
pack-priv abstract static class

Field Summary

Modifier and TypeField and Description
pack-priv static Map<K, V>
pack-priv JTreeStringTemplateModel.Wrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addTreeModelListener(TreeModelListener
the listener to add
l
)

Implements javax.swing.tree.TreeModel.addTreeModelListener.

Adds a listener for the TreeModelEvent posted after the tree changes.
public Object
getChild(Object
a node in the tree, obtained from this data source
parent
,
int
index of child to be returned
index
)

Implements javax.swing.tree.TreeModel.getChild.

Get a child object.
public int
getChildCount(Object
a node in the tree, obtained from this data source
parent
)

Implements javax.swing.tree.TreeModel.getChildCount.

Returns the number of children of parent.
public int
getIndexOfChild(Object
a node in the tree, obtained from this data source
parent
,
Object
the node we are interested in
child
)

Implements javax.swing.tree.TreeModel.getIndexOfChild.

Returns the index of child in parent.
public Object
getRoot()

Implements javax.swing.tree.TreeModel.getRoot.

Returns the root of the tree.
public boolean
isLeaf(Object
a node in the tree, obtained from this data source
node
)

Implements javax.swing.tree.TreeModel.isLeaf.

Returns true if node is a leaf.
public void
removeTreeModelListener(TreeModelListener
the listener to remove
l
)

Implements javax.swing.tree.TreeModel.removeTreeModelListener.

Removes a listener previously added with addTreeModelListener.
public void
valueForPathChanged(TreePath
path to the node that the user has altered
path
,
Object
the new value from the TreeCellEditor
newValue
)

Implements javax.swing.tree.TreeModel.valueForPathChanged.

Messaged when the user has altered the value for the item identified by path to newValue.
public static Object
wrap(Object o)

Get a wrapper object by adding "Wrapper" to class name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNameToWrapperMapback to summary
pack-priv static Map<K, V> classNameToWrapperMap
rootback to summary
pack-priv JTreeStringTemplateModel.Wrapper root

Constructor Detail

JTreeStringTemplateModelback to summary
public JTreeStringTemplateModel(StringTemplate st)

Method Detail

addTreeModelListenerback to summary
public void addTreeModelListener(TreeModelListener l)

Implements javax.swing.tree.TreeModel.addTreeModelListener.

Doc from javax.swing.tree.TreeModel.addTreeModelListener.

Adds a listener for the TreeModelEvent posted after the tree changes.

Parameters
l:TreeModelListener

the listener to add

getChildback to summary
public Object getChild(Object parent, int index)

Implements javax.swing.tree.TreeModel.getChild.

Get a child object. If Conditional then return subtemplate. If ASTExpr and INCLUDE then return ith chunk of sub StringTemplate

Parameters
parent:Object

Doc from javax.swing.tree.TreeModel.getChild.

a node in the tree, obtained from this data source

index:int

Doc from javax.swing.tree.TreeModel.getChild.

index of child to be returned

Returns:Object

Doc from javax.swing.tree.TreeModel.getChild.

the child of parent at index index

getChildCountback to summary
public int getChildCount(Object parent)

Implements javax.swing.tree.TreeModel.getChildCount.

Doc from javax.swing.tree.TreeModel.getChildCount.

Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

Parameters
parent:Object

a node in the tree, obtained from this data source

Returns:int

the number of children of the node parent

getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements javax.swing.tree.TreeModel.getIndexOfChild.

Doc from javax.swing.tree.TreeModel.getIndexOfChild.

Returns the index of child in parent. If either parent or child is null, returns -1. If either parent or child don't belong to this tree model, returns -1.

Parameters
parent:Object

a node in the tree, obtained from this data source

child:Object

the node we are interested in

Returns:int

the index of the child in the parent, or -1 if either child or parent are null or don't belong to this tree model

getRootback to summary
public Object getRoot()

Implements javax.swing.tree.TreeModel.getRoot.

Doc from javax.swing.tree.TreeModel.getRoot.

Returns the root of the tree. Returns null only if the tree has no nodes.

Returns:Object

the root of the tree

isLeafback to summary
public boolean isLeaf(Object node)

Implements javax.swing.tree.TreeModel.isLeaf.

Doc from javax.swing.tree.TreeModel.isLeaf.

Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

Parameters
node:Object

a node in the tree, obtained from this data source

Returns:boolean

true if node is a leaf

removeTreeModelListenerback to summary
public void removeTreeModelListener(TreeModelListener l)

Implements javax.swing.tree.TreeModel.removeTreeModelListener.

Doc from javax.swing.tree.TreeModel.removeTreeModelListener.

Removes a listener previously added with addTreeModelListener.

Parameters
l:TreeModelListener

the listener to remove

valueForPathChangedback to summary
public void valueForPathChanged(TreePath path, Object newValue)

Implements javax.swing.tree.TreeModel.valueForPathChanged.

Doc from javax.swing.tree.TreeModel.valueForPathChanged.

Messaged when the user has altered the value for the item identified by path to newValue. If newValue signifies a truly new value the model should post a treeNodesChanged event.

Parameters
path:TreePath

path to the node that the user has altered

newValue:Object

the new value from the TreeCellEditor

wrapback to summary
public static Object wrap(Object o)

Get a wrapper object by adding "Wrapper" to class name. If not present, return the object.

org.antlr.stringtemplate.misc back to summary

pack-priv Class JTreeStringTemplateModel.ExprWrapper

extends Wrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Expr

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public int
public Expr
public int
public Object
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Display different things depending on the ASTExpr type

Field Detail

exprback to summary
pack-priv Expr expr

Constructor Detail

ExprWrapperback to summary
public ExprWrapper(Object o)

Method Detail

getChildback to summary
public Object getChild(Object parent, int index)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChild.

getChildCountback to summary
public int getChildCount(Object parent)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChildCount.

getExprback to summary
public Expr getExpr()
getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getIndexOfChild.

getWrappedObjectback to summary
public Object getWrappedObject()

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getWrappedObject.

isLeafback to summary
public boolean isLeaf(Object node)

Overrides org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.isLeaf.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Display different things depending on the ASTExpr type

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

org.antlr.stringtemplate.misc back to summary

pack-priv Class JTreeStringTemplateModel.HashMapWrapper

extends Wrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv HashMap<K, V>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public int
public int
private List<E>
public Object
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

tableback to summary
pack-priv HashMap<K, V> table

Constructor Detail

HashMapWrapperback to summary
public HashMapWrapper(Object o)

Method Detail

getChildback to summary
public Object getChild(Object parent, int index)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChild.

getChildCountback to summary
public int getChildCount(Object parent)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChildCount.

getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getIndexOfChild.

getTableAsListOfKeysback to summary
private List<E> getTableAsListOfKeys()
getWrappedObjectback to summary
public Object getWrappedObject()

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getWrappedObject.

isLeafback to summary
public boolean isLeaf(Object node)

Overrides org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.isLeaf.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

org.antlr.stringtemplate.misc back to summary

pack-priv Class JTreeStringTemplateModel.ListWrapper

extends Wrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv List<E>
v

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public int
public int
public Object
public boolean

Field Detail

vback to summary
pack-priv List<E> v

Constructor Detail

ListWrapperback to summary
public ListWrapper(Object o)

Method Detail

getChildback to summary
public Object getChild(Object parent, int index)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChild.

getChildCountback to summary
public int getChildCount(Object parent)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChildCount.

getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getIndexOfChild.

getWrappedObjectback to summary
public Object getWrappedObject()

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getWrappedObject.

isLeafback to summary
public boolean isLeaf(Object node)

Overrides org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.isLeaf.

org.antlr.stringtemplate.misc back to summary

pack-priv Class JTreeStringTemplateModel.MapEntryWrapper

extends Wrapper
Class Inheritance

Wrap an entry in a map so that name appears as the root and the value appears as the child or children.

Field Summary

Modifier and TypeField and Description
pack-priv Object
pack-priv Object

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public int
public int
public Object
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

keyback to summary
pack-priv Object key
valueback to summary
pack-priv Object value

Constructor Detail

MapEntryWrapperback to summary
public MapEntryWrapper(Object key, Object value)

Method Detail

getChildback to summary
public Object getChild(Object parent, int index)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChild.

getChildCountback to summary
public int getChildCount(Object parent)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChildCount.

getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getIndexOfChild.

getWrappedObjectback to summary
public Object getWrappedObject()

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getWrappedObject.

isLeafback to summary
public boolean isLeaf(Object node)

Overrides org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.isLeaf.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

org.antlr.stringtemplate.misc back to summary

pack-priv Class JTreeStringTemplateModel.StringTemplateWrapper

extends Wrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv StringTemplate

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public int
public int
public StringTemplate
public Object
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

stback to summary
pack-priv StringTemplate st

Constructor Detail

StringTemplateWrapperback to summary
public StringTemplateWrapper(Object o)

Method Detail

getChildback to summary
public Object getChild(Object parent, int index)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChild.

getChildCountback to summary
public int getChildCount(Object parent)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getChildCount.

getIndexOfChildback to summary
public int getIndexOfChild(Object parent, Object child)

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getIndexOfChild.

getStringTemplateback to summary
public StringTemplate getStringTemplate()
getWrappedObjectback to summary
public Object getWrappedObject()

Implements abstract org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.getWrappedObject.

isLeafback to summary
public boolean isLeaf(Object node)

Overrides org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper.isLeaf.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

org.antlr.stringtemplate.misc back to summary

pack-priv abstract Class JTreeStringTemplateModel.Wrapper

extends Object
Class Inheritance
  • java.lang.Object
  • org.antlr.stringtemplate.misc.JTreeStringTemplateModel.Wrapper
Known Direct Subclasses
org.antlr.stringtemplate.misc.JTreeStringTemplateModel.StringTemplateWrapper, org.antlr.stringtemplate.misc.JTreeStringTemplateModel.ExprWrapper, org.antlr.stringtemplate.misc.JTreeStringTemplateModel.ListWrapper, org.antlr.stringtemplate.misc.JTreeStringTemplateModel.MapEntryWrapper, org.antlr.stringtemplate.misc.JTreeStringTemplateModel.HashMapWrapper

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public abstract Object
getChild(Object parent, int index)

public abstract int
public abstract int
getIndexOfChild(Object parent, Object child)

public abstract Object
public boolean
isLeaf(Object node)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Wrapperback to summary
pack-priv Wrapper()

Method Detail

getChildback to summary
public abstract Object getChild(Object parent, int index)
getChildCountback to summary
public abstract int getChildCount(Object parent)
getIndexOfChildback to summary
public abstract int getIndexOfChild(Object parent, Object child)
getWrappedObjectback to summary
public abstract Object getWrappedObject()
isLeafback to summary
public boolean isLeaf(Object node)