public abstract class SimpleBinaryTreeView extends AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
Modifier and Type | Class and Description |
---|---|
protected static class |
SimpleBinaryTreeView.ArrayData
A class that holds array data.
|
protected static class |
SimpleBinaryTreeView.ArrayElementData
A class that holds array element data.
|
protected static class |
SimpleBinaryTreeView.BTNodeLoc
Class for holding a binary tree node location within the entire
view.
|
protected static class |
SimpleBinaryTreeView.BTStructData
Structure data from an update.
|
protected static class |
SimpleBinaryTreeView.BTVSettings |
AnimatingLinkedView.State
PresentationView.MainRoot, PresentationView.Settings, PresentationView.SizeLimitDialog
ANIMATE, CCW, REVERSIBLE, ROUND, VERTICAL
Constructor and Description |
---|
SimpleBinaryTreeView(ViewerCreateData vcd,
int numValuesPerNode)
Creates a new SimpleBinaryTreeView.
|
Modifier and Type | Method and Description |
---|---|
void |
build(ViewerInitData vid,
Element initDataIn)
Builds the viewer non-gui internals.
|
void |
changeSizeLimit()
Changes a structure size limit imposed by the PresentationView subclass.
|
void |
configure(boolean update,
JPanel paintPanel,
AnimatingLinkedView.State s)
Configures the viewer based on the current state.
|
SimpleBinaryTreeView.BTVSettings |
createGlobalSettings()
Creates a global settings object for the viewer.
|
JPanel |
createGui() |
SimpleBinaryTreeView.ArrayData |
getArrayData(Value value,
ViewerUpdateData data,
DebugContext context)
Gets the array data.
|
Value |
getDummyNode(Value tree,
DebugContext context)
Gets the dummy node.
|
int |
getExpectedSize(Value tree,
DebugContext context)
Gets the expected node count.
|
protected Rectangle |
getLabelBounds(int row,
Rectangle2D textBounds,
AnimatingLinkedView.State s)
Gets the bounds rectangle for a row label.
|
abstract Value |
getLeft(Value tree,
Value node,
DebugContext context)
Gets the left node for a specified node.
|
Point2D.Double |
getLinkTarget(int sourceRow,
NodeData<SimpleBinaryTreeView.BTNodeLoc> nd,
AnimatingLinkedView.State s,
double edgeAdjust) |
Dimension |
getMainSize()
Gets the default size for the main panel when on the canvas, if this
needs to be different from the preferred size.
|
protected Color |
getNodeColor(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd)
Gets the background color for a node.
|
Integer |
getNodeColor(Value tree,
Value node,
Value[] values,
DebugContext context)
Gets the node background color.
|
Rectangle |
getNodeRect(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd,
AnimatingLinkedView.State s)
Gets the display rectangle for a node.
|
abstract Value |
getNodeValue(Value tree,
Value node,
int valueIndex,
DebugContext context)
Gets one of the values contained in a node.
|
String |
getNodeValueText(Value tree,
Value node,
Value nodeValue,
int valueIndex,
DebugContext context)
Gets the display text for a node value.
|
PresentationElement |
getPe(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd)
Gets the presentation element corresponding to a node.
|
int |
getPriority(ViewerPriorityData vpd)
Gets the viewer priority.
|
abstract Value |
getRight(Value tree,
Value node,
DebugContext context)
Gets the right node for a specified node.
|
abstract Value |
getRoot(Value tree,
DebugContext context)
Gets the root node for the structure.
|
String |
getRootNodeField()
Gets the name of the field that contains the root node, if there is one.
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Gets the unit increment when there is a scrollable main without a single
scrollable child.
|
SimpleBinaryTreeView.BTVSettings |
getSettingsCopy(SimpleBinaryTreeView.BTVSettings settingsIn)
Creates a copy of settings.
|
int |
getSizeLimit()
Gets the node size limit.
|
String |
getViewName()
Gets the display name of the viewer.
|
protected boolean |
horizontalRows()
Determines if rows are stacked horizontally or vertically.
|
protected void |
init(Element e)
Initializes the viewer.
|
boolean |
isCompact()
Gets the initial compact state for the viewer.
|
boolean |
isEmbedded()
Gets the initial embedded state for the viewer.
|
boolean |
isRound()
Gets the initial shape state for the viewer.
|
boolean |
isVertical()
Gets the initial vertical state for the viewer.
|
protected NodeData<SimpleBinaryTreeView.BTNodeLoc> |
nodeLocationToData(SimpleBinaryTreeView.BTNodeLoc location,
SimpleBinaryTreeView.BTStructData currentData)
Gets the node data at a specified node location.
|
void |
paintMainView(Graphics graphics,
JPanel paintPanel,
AnimatingLinkedView.State s)
Paints the view.
|
boolean |
rightLabels()
Determines if labels are on the right.
|
void |
setCollectionState(SimpleBinaryTreeView.BTStructData data,
boolean enableCollection)
Protects the recorded structure from garbage collection, or removes that
protection.
|
boolean |
showCompact()
Determines if the tree should use a compact layout.
|
boolean |
toXML(Document doc,
Element e)
Stores the state of the viewer in an XML dom element.
|
SimpleBinaryTreeView.BTStructData |
update(Value value,
ViewerUpdateData data,
DebugContext context)
Gets the structure data.
|
configure, destroy, getBlendComposite, getDisplayFields, getLVLinkSource, getNodeType, getNumValuesPerNode, matchesLocal, paintArray, paintHashArrayElement, paintLabels, paintNodes, setSubViewValue, update, updateGui
addToolBarButton, animate, getAnimateDelay, getCurrentSettings, getElementChars, getElementWidth, getNewSizeLimit, getPerClassSettings, getRefSettings, isReversed, isSimple, isViewerTransparent, noSimpleForPrimitives, scaleFont, setError, setLabelLocation, setSelectionViewValue, setSizeLabelText, setValuesAreObjects, showEmbedded, showReversed, showRound, showSimple, showVertical, sizeLimitExceeded, valuesAreObjects
public SimpleBinaryTreeView(ViewerCreateData vcd, int numValuesPerNode)
vcd
- creation data.numValuesPerNode
- the number of values to be displayed for each
node.public void build(ViewerInitData vid, Element initDataIn)
build
in interface Viewer
build
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
vid
- initialization and control element for the viewer.initDataIn
- XML initialization data for the viewer.public void changeSizeLimit()
PresentationView
sizeLimitExceeded()
is called, this
method must be overridden.changeSizeLimit
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
public void configure(boolean update, JPanel paintPanel, AnimatingLinkedView.State s)
configure
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
update
- true if the viewer panel should be resized (if necessary)
and repainted, false if it should not.paintPanel
- the panel on which the view will be displayed.s
- the current viewer state.public SimpleBinaryTreeView.BTVSettings createGlobalSettings()
createGlobalSettings
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
public JPanel createGui()
public SimpleBinaryTreeView.ArrayData getArrayData(Value value, ViewerUpdateData data, DebugContext context) throws ViewerException
value
- the new value.data
- information about this update, such as why it was triggered,
and if it was triggered by a flagged method entry, the method argument
values.context
- debugger context that is necessary for working with
values, and provides some global debugger access.ViewerException
- if an exception is encountered.public Value getDummyNode(Value tree, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes. If a tree is required to find the dummy node, then null must be
returned in this case, and local variable trees will display the dummy
node as an ordinary node if it appears in the tree.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public int getExpectedSize(Value tree, DebugContext context) throws ViewerException
tree
- the current tree being viewed.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public abstract Value getLeft(Value tree, Value node, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes. If a tree is required to follow the link and it can not be
obtained from the node, then return a null Value and local nodes will
show up without linked nodes.node
- the node of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public Point2D.Double getLinkTarget(int sourceRow, NodeData<SimpleBinaryTreeView.BTNodeLoc> nd, AnimatingLinkedView.State s, double edgeAdjust)
public Dimension getMainSize()
Overridden to supply a main size that doesn't include the local variables label.
getMainSize
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
public Integer getNodeColor(Value tree, Value node, Value[] values, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes.node
- the node of interest.values
- the values of the node of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public Rectangle getNodeRect(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd, AnimatingLinkedView.State s)
getNodeRect
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
nd
- the node data.s
- the structure state.public abstract Value getNodeValue(Value tree, Value node, int valueIndex, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes. If a tree is required to follow the link and it can not be
obtained from the node, then return a null Value and selecting local
variable nodes will not display the actual value.node
- the node of interest.valueIndex
- index of the value of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public String getNodeValueText(Value tree, Value node, Value nodeValue, int valueIndex, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes. If a tree is required to follow the link and it can not be
obtained from the node, then return any arbitrary value ("?" suggested)
for local variable nodes to display.node
- the node of interest.nodeValue
- the value of the node of interest.valueIndex
- index of the value of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public PresentationElement getPe(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd)
getPe
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
nd
- node data for the node, or null if the presentation element for
field nodes should be returned.nd
, or if nd
is null, the
presentation element used to layout and paint field nodes.public int getPriority(ViewerPriorityData vpd)
Viewer
vpd
- data about how the viewer will be used.Integer.MIN_VALUE
indicates that the viewer
dialog or canvas should change viewers.public abstract Value getRight(Value tree, Value node, DebugContext context) throws ViewerException
tree
- the tree object. This will be a null value for local variable
nodes. If a tree is required to follow the link and it can not be
obtained from the node, then return a null Value and local nodes will
show up without linked nodes.node
- the node of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public abstract Value getRoot(Value tree, DebugContext context) throws ViewerException
tree
- the current tree being viewed.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public String getRootNodeField()
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
visibleRect
- the main panel visible rect.orientation
- the scroll direction, one of
SwingConstants.VERTICAL
and SwingConstants.HORIZONTAL
.direction
- negative for a left or up scroll, positive for a right
or down scroll.public SimpleBinaryTreeView.BTVSettings getSettingsCopy(SimpleBinaryTreeView.BTVSettings settingsIn)
getSettingsCopy
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
settingsIn
- the settings to be copied.public int getSizeLimit()
getSizeLimit
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
public String getViewName()
Viewer
public boolean isCompact()
public boolean isEmbedded()
isEmbedded
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
public boolean isRound()
isRound
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
public boolean isVertical()
isVertical
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
public void paintMainView(Graphics graphics, JPanel paintPanel, AnimatingLinkedView.State s)
AnimatingLinkedView
paintMainView
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
graphics
- the graphics to which the view will be rendered.paintPanel
- the panel on which the view will be rendered.s
- the current viewer state.public boolean rightLabels()
rightLabels
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
PresentationView.showReversed()
.public void setCollectionState(SimpleBinaryTreeView.BTStructData data, boolean enableCollection)
setCollectionState
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
data
- the structure data to be protected or freed.enableCollection
- if true, garbage collection protection will be
removed, if false it will be enabled.public boolean showCompact()
public boolean toXML(Document doc, Element e)
toXML
in interface Viewer
toXML
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
doc
- the document to which the element applies.e
- the element to be populated.public SimpleBinaryTreeView.BTStructData update(Value value, ViewerUpdateData data, DebugContext context) throws ViewerException
update
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
value
- the current structure value.data
- viewer update data.context
- the current debugger context.ViewerException
- if an error occurs while updating the viewer.protected Rectangle getLabelBounds(int row, Rectangle2D textBounds, AnimatingLinkedView.State s)
getLabelBounds
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
row
- the row.textBounds
- bounds (size) of the label text.s
- the structure state.protected Color getNodeColor(NodeData<SimpleBinaryTreeView.BTNodeLoc> nd)
getNodeColor
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
nd
- node data for the node.protected boolean horizontalRows()
horizontalRows
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
PresentationView.showVertical()
.protected void init(Element e)
init
in class PresentationView<SimpleBinaryTreeView.BTVSettings>
e
- XML initialization data.protected NodeData<SimpleBinaryTreeView.BTNodeLoc> nodeLocationToData(SimpleBinaryTreeView.BTNodeLoc location, SimpleBinaryTreeView.BTStructData currentData)
nodeLocationToData
in class AnimatingLinkedView<SimpleBinaryTreeView.BTVSettings,SimpleBinaryTreeView.BTNodeLoc,SimpleBinaryTreeView.BTStructData>
location
- the node location of interest.currentData
- current structure data.