class GUIProofTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel, java.io.Serializable
Proof
object.
The tree structure of the proof is transformed, so that nodes following each other on a long branch are represented as kin, while new subtrees are displayed for branching points.
There are thus two kinds of node in this TreeModel,
GUIProofTreeNode
s, representing nodes of
the displayed proof, and GUIBranchNode
s
representing branching points. (There is also one at the root.)
Modifier and Type | Class and Description |
---|---|
(package private) class |
GUIProofTreeModel.ProofTreeListener |
Modifier and Type | Field and Description |
---|---|
private ProofTreeViewFilter.NodeFilter |
activeNodeFilter |
private boolean |
attentive |
private java.util.WeakHashMap<Node,GUIBranchNode> |
branchNodes |
(package private) java.util.Collection<javax.swing.tree.TreePath> |
expansionState |
private javax.swing.event.EventListenerList |
listenerList |
private Proof |
proof |
private GUIProofTreeModel.ProofTreeListener |
proofTreeListener |
private java.util.WeakHashMap<Node,GUIAbstractTreeNode> |
proofTreeNodes |
(package private) javax.swing.tree.TreePath |
selection |
private static long |
serialVersionUID |
Constructor and Description |
---|
GUIProofTreeModel(Proof p)
construct a GUIProofTreeModel that mirrors the given
Proof.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.
|
GUIAbstractTreeNode |
find(Node n)
Return the GUIProofTreeNode corresponding to node n, if one
has already been generated, and null otherwise.
|
GUIBranchNode |
findBranch(Node n)
Return the GUIBranchNode corresponding to the subtree rooted
at n, if one has already been generated, and null otherwise.
|
protected void |
fireTreeStructureChanged(java.lang.Object[] path)
Notify all listeners that have registered interest for
notification on treeStructureChanged events.
|
private void |
flushCaches(Node n) |
private void |
flushCaches(javax.swing.tree.TreeNode trn) |
GUIBranchNode |
getBranchNode(Node n,
java.lang.Object label)
Return the GUIBranchNode corresponding to the subtree rooted
at n.
|
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Returns the child of parent at index index in the parent's
child array.
|
int |
getChildCount(java.lang.Object parent)
Returns the number of children of parent.
|
java.util.Collection<javax.swing.tree.TreePath> |
getExpansionState() |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Returns the index of child in parent.
|
GUIAbstractTreeNode |
getProofTreeNode(Node n)
Return the GUIProofTreeNode corresponding to node n.
|
java.lang.Object |
getRoot()
Returns the root of the tree.
|
javax.swing.tree.TreePath |
getSelection() |
boolean |
hideClosedSubtrees() |
boolean |
isAttentive()
returns true if the model respond to changes in the proof
immediately
|
boolean |
isLeaf(java.lang.Object guiNode)
Returns true if node is a leaf.
|
void |
register() |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().
|
void |
setAttentive(boolean b)
Sets whether this object should respond to changes in the
the proof immediately.
|
void |
setFilter(ProofTreeViewFilter filter,
boolean active)
Set filters active or inactive and update tree if necessary.
|
void |
storeExpansionState(java.util.Collection<javax.swing.tree.TreePath> c) |
void |
storeSelection(javax.swing.tree.TreePath t) |
void |
unregister()
Call this when the GUIProofTreeModel is no longer needed.
|
void |
updateTree(Node p_node) |
private void |
updateTree(javax.swing.tree.TreeNode trn)
Take the appropriate actions after a change in the Proof.
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
Messaged when the user has altered the value for the item identified
by path to newValue.
|
private static final long serialVersionUID
private Proof proof
private GUIProofTreeModel.ProofTreeListener proofTreeListener
private ProofTreeViewFilter.NodeFilter activeNodeFilter
private javax.swing.event.EventListenerList listenerList
private boolean attentive
private java.util.WeakHashMap<Node,GUIAbstractTreeNode> proofTreeNodes
private java.util.WeakHashMap<Node,GUIBranchNode> branchNodes
java.util.Collection<javax.swing.tree.TreePath> expansionState
javax.swing.tree.TreePath selection
public GUIProofTreeModel(Proof p)
public void unregister()
Note that after calling unregister
, this
GUIProofTreeModel does not respond to changes in the proof tree
any more.
public void register()
public void setAttentive(boolean b)
public boolean isAttentive()
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to addremoveTreeModelListener(javax.swing.event.TreeModelListener)
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to removeaddTreeModelListener(javax.swing.event.TreeModelListener)
public boolean hideClosedSubtrees()
public void setFilter(ProofTreeViewFilter filter, boolean active)
filter
- active
- public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
parent
- a node in the tree, obtained from this data sourcepublic int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
parent
- a node in the tree, obtained from this data sourcepublic int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
parent
- a node in the tree, obtained from this data sourcechild
- a child of parent, obtained from this data sourcepublic java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public boolean isLeaf(java.lang.Object guiNode)
isLeaf
in interface javax.swing.tree.TreeModel
guiNode
- a node in the tree, obtained from this data sourcepublic void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface javax.swing.tree.TreeModel
path
- path to the node that the user has altered.newValue
- the new value from the TreeCellEditor.private void updateTree(javax.swing.tree.TreeNode trn)
trn
- tree node to update.public void updateTree(Node p_node)
private void flushCaches(javax.swing.tree.TreeNode trn)
private void flushCaches(Node n)
protected void fireTreeStructureChanged(java.lang.Object[] path)
public GUIAbstractTreeNode find(Node n)
public GUIAbstractTreeNode getProofTreeNode(Node n)
public GUIBranchNode findBranch(Node n)
public GUIBranchNode getBranchNode(Node n, java.lang.Object label)
public void storeExpansionState(java.util.Collection<javax.swing.tree.TreePath> c)
public java.util.Collection<javax.swing.tree.TreePath> getExpansionState()
public void storeSelection(javax.swing.tree.TreePath t)
public javax.swing.tree.TreePath getSelection()