Class ParseTreeTableModel
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel
-
- All Implemented Interfaces:
TreeModel
public class ParseTreeTableModel extends Object implements TreeModel
The model that backs the parse tree in the GUI.
-
-
Field Summary
Fields Modifier and Type Field Description private EventListenerList
listenerList
A list of event listeners for the tree model.private ParseTreeTablePresentation
pModel
Presentation model.
-
Constructor Summary
Constructors Constructor Description ParseTreeTableModel(DetailAST parseTree)
Initialise pModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTreeModelListener(TreeModelListener listener)
private void
fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object... children)
Notify all listeners that have registered interest in 'tree structure changed' event.Object
getChild(Object parent, int index)
int
getChildCount(Object parent)
Class<?>
getColumnClass(int column)
Returns type of specified column number.int
getColumnCount()
Returns number of available column.String
getColumnName(int column)
Returns column name of specified column number.int
getIndexOfChild(Object parent, Object child)
Object
getRoot()
Object
getValueAt(Object node, int column)
Returns the value to be displayed for node at column number.boolean
isCellEditable(int column)
Indicates whether the value for nodenode
, at column numbercolumn
is editable.boolean
isLeaf(Object node)
void
removeTreeModelListener(TreeModelListener listener)
protected void
setParseMode(MainFrameModel.ParseMode mode)
Set parse mode.protected void
setParseTree(DetailAST parseTree)
Sets parse tree.void
valueForPathChanged(TreePath path, Object newValue)
-
-
-
Field Detail
-
pModel
private final ParseTreeTablePresentation pModel
Presentation model.
-
listenerList
private final EventListenerList listenerList
A list of event listeners for the tree model.
-
-
Constructor Detail
-
ParseTreeTableModel
public ParseTreeTableModel(DetailAST parseTree)
Initialise pModel.- Parameters:
parseTree
- DetailAST parse tree.
-
-
Method Detail
-
setParseTree
protected final void setParseTree(DetailAST parseTree)
Sets parse tree.- Parameters:
parseTree
- DetailAST parse tree.
-
setParseMode
protected void setParseMode(MainFrameModel.ParseMode mode)
Set parse mode.- Parameters:
mode
- ParseMode enum
-
getColumnCount
public int getColumnCount()
Returns number of available column.- Returns:
- the number of available column.
-
getColumnName
public String getColumnName(int column)
Returns column name of specified column number.- Parameters:
column
- the column number- Returns:
- the name for column number
column
.
-
getColumnClass
public Class<?> getColumnClass(int column)
Returns type of specified column number.- Parameters:
column
- the column number- Returns:
- the type for column number
column
.
-
getValueAt
public Object getValueAt(Object node, int column)
Returns the value to be displayed for node at column number.- Parameters:
node
- the nodecolumn
- the column number- Returns:
- the value to be displayed for node
node
, at column numbercolumn
.
-
getChildCount
public int getChildCount(Object parent)
- Specified by:
getChildCount
in interfaceTreeModel
-
valueForPathChanged
public void valueForPathChanged(TreePath path, Object newValue)
- Specified by:
valueForPathChanged
in interfaceTreeModel
-
getIndexOfChild
public int getIndexOfChild(Object parent, Object child)
- Specified by:
getIndexOfChild
in interfaceTreeModel
-
addTreeModelListener
public void addTreeModelListener(TreeModelListener listener)
- Specified by:
addTreeModelListener
in interfaceTreeModel
-
removeTreeModelListener
public void removeTreeModelListener(TreeModelListener listener)
- Specified by:
removeTreeModelListener
in interfaceTreeModel
-
fireTreeStructureChanged
private void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object... children)
Notify all listeners that have registered interest in 'tree structure changed' event. The event instance is lazily created using the parameters passed into the fire method.- Parameters:
source
- The Object responsible for generating the event.path
- An array of Object identifying the path to the parent of the modified items.childIndices
- An array of int that specifies the index values of the removed items.children
- An array of Object containing the inserted, removed, or changed objects.- See Also:
EventListenerList
-
isCellEditable
public boolean isCellEditable(int column)
Indicates whether the value for nodenode
, at column numbercolumn
is editable.- Parameters:
column
- the column number- Returns:
- true if editable
-
-