N
- the node location type.S
- the structure state type.public abstract class AnimatingLinkedView<T extends PresentationView.Settings,N extends NodeLocation & Locatable<? super N>,S extends StructureData<NodeData<N>>> extends PresentationView<T>
Modifier and Type | Class and Description |
---|---|
protected class |
AnimatingLinkedView.State
Viewer state.
|
PresentationView.MainRoot, PresentationView.Settings, PresentationView.SizeLimitDialog
ANIMATE, CCW, REVERSIBLE, ROUND, VERTICAL
Constructor and Description |
---|
AnimatingLinkedView(ViewerCreateData vcd,
int numValuesPerNodeIn)
Creates a new animating linked structure view.
|
AnimatingLinkedView(ViewerCreateData vcd,
int numValuesPerNodeIn,
boolean trackWidthIn,
boolean trackHeightIn)
Creates a new animating linked structure view with a scrollable main
panel.
|
AnimatingLinkedView(ViewerCreateData vcd,
int numValuesPerNodeIn,
int flags)
Creates a new animating linked structure view.
|
AnimatingLinkedView(ViewerCreateData vcd,
int numValuesPerNodeIn,
int flags,
boolean trackWidthIn,
boolean trackHeightIn)
Creates a new animating linked structure view with a scrollable main
panel.
|
Modifier and Type | Method and Description |
---|---|
void |
build(ViewerInitData vid,
Element initDataIn)
Builds the viewer non-gui internals.
|
void |
configure()
Called when settings that may affect the layout of nodes in the view
have changed.
|
protected abstract void |
configure(boolean update,
JPanel panel,
AnimatingLinkedView.State s)
Configures the viewer based on the current state.
|
JPanel |
createGui() |
void |
destroy()
Called when the viewer is closed or frozen.
|
protected static Composite |
getBlendComposite()
Gets the composite used to paint semi-transparent edges.
|
List<String> |
getDisplayFields()
Gets the names of fields that this view should display.
|
protected abstract Rectangle |
getLabelBounds(int row,
Rectangle2D textBounds,
AnimatingLinkedView.State s)
Gets the bounds rectangle for a row label.
|
protected abstract Point2D.Double |
getLinkTarget(int sourceRow,
NodeData<N> nd,
AnimatingLinkedView.State s,
double edgeAdjust) |
protected Point2D.Double |
getLVLinkSource(int row,
AnimatingLinkedView.State s) |
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<N> nd)
Gets the background color for a node.
|
protected abstract Rectangle |
getNodeRect(NodeData<N> nd,
AnimatingLinkedView.State s)
Gets the display rectangle for a node.
|
String |
getNodeType()
Gets the name of the node type for the structure.
|
protected int |
getNumValuesPerNode()
Gets the number of values in each node.
|
protected abstract PresentationElement |
getPe(NodeData<N> nd)
Gets the presentation element corresponding to a node.
|
int |
getSizeLimit()
Gets the node size limit.
|
protected boolean |
horizontalRows()
Determines if rows are stacked horizontally or vertically.
|
static boolean |
matchesLocal(String expression,
String localName)
Determines if an expression could be a match for a local variable.
|
protected abstract NodeData<N> |
nodeLocationToData(N location,
S currentData)
Gets the node data at a specified node location.
|
protected void |
paintArray(PresentationElement pe,
Graphics2D g)
Paints an array.
|
protected void |
paintHashArrayElement(PresentationElement pe,
Graphics2D g,
Rectangle elementRect,
boolean selected,
boolean valueIsNull,
String nodeLabel,
Rectangle rawTargetRect,
Rectangle targetRect)
Paints a has array node and arrow to target.
|
protected void |
paintLabels(AnimatingLinkedView.State s,
Graphics2D g,
String[] rowLabels,
List<NodeData<N>> rowTargets,
String message,
int t,
PresentationElement pe)
Paints labels.
|
protected abstract void |
paintMainView(Graphics graphics,
JPanel panel,
AnimatingLinkedView.State s)
Paints the view.
|
protected void |
paintNodes(AnimatingLinkedView.State s,
Graphics2D g,
Color fieldEdgeColor)
Paints the nodes, fields, and field edges.
|
boolean |
rightLabels()
Determines if labels are on the right.
|
protected abstract void |
setCollectionState(S data,
boolean enableCollection)
Protects the recorded structure from garbage collection, or removes that
protection.
|
protected void |
setSubViewValue(S currentData,
DebugContext context,
boolean isReset) |
protected abstract S |
update(Value value,
ViewerUpdateData data,
DebugContext context)
Gets the structure data.
|
void |
update(ViewerValueData valueData,
ViewerUpdateData data,
DebugContext context)
Updates the viewer.
|
void |
updateGui() |
addToolBarButton, animate, changeSizeLimit, createGlobalSettings, getAnimateDelay, getCurrentSettings, getElementChars, getElementWidth, getNewSizeLimit, getPerClassSettings, getRefSettings, getScrollableUnitIncrement, getSettingsCopy, init, isEmbedded, isReversed, isRound, isSimple, isVertical, isViewerTransparent, noSimpleForPrimitives, scaleFont, setError, setLabelLocation, setSelectionViewValue, setSizeLabelText, setValuesAreObjects, showEmbedded, showReversed, showRound, showSimple, showVertical, sizeLimitExceeded, toXML, valuesAreObjects
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInfo, getPriority, getViewName
public AnimatingLinkedView(ViewerCreateData vcd, int numValuesPerNodeIn)
vcd
- creation data.numValuesPerNodeIn
- number of values that will be displayed in each
node.public AnimatingLinkedView(ViewerCreateData vcd, int numValuesPerNodeIn, boolean trackWidthIn, boolean trackHeightIn)
vcd
- creation data.numValuesPerNodeIn
- number of values that will be displayed in each
node.trackWidthIn
- true if the width should conform to the scroll pane
width when in a scroll pane, false if the width should always be the
preferred width.trackHeightIn
- true if the height should conform to the scroll pane
height when in a scroll pane, false if the height should always be the
preferred height.public AnimatingLinkedView(ViewerCreateData vcd, int numValuesPerNodeIn, int flags)
vcd
- creation data.numValuesPerNodeIn
- number of values that will be displayed in each
node.flags
- additional creation flags.public AnimatingLinkedView(ViewerCreateData vcd, int numValuesPerNodeIn, int flags, boolean trackWidthIn, boolean trackHeightIn)
vcd
- creation data.numValuesPerNodeIn
- number of values that will be displayed in each
node.flags
- additional creation flags.trackWidthIn
- true if the width should conform to the scroll pane
width when in a scroll pane, false if the width should always be the
preferred width.trackHeightIn
- true if the height should conform to the scroll pane
height when in a scroll pane, false if the height should always be the
preferred height.public static boolean matchesLocal(String expression, String localName)
expression
- the expression of interest. This may be null.localName
- the name of the local variable.protected static Composite getBlendComposite()
public void build(ViewerInitData vid, Element initDataIn)
build
in interface Viewer
build
in class PresentationView<T extends PresentationView.Settings>
vid
- initialization and control element for the viewer.initDataIn
- XML initialization data for the viewer.public void configure()
configure
in class PresentationView<T extends PresentationView.Settings>
public JPanel createGui()
createGui
in class PresentationView<T extends PresentationView.Settings>
public void destroy()
public List<String> getDisplayFields()
public Dimension getMainSize()
public String getNodeType() throws ViewerException
ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public int getSizeLimit()
public boolean rightLabels()
PresentationView.showReversed()
.public void update(ViewerValueData valueData, ViewerUpdateData data, DebugContext context) throws ViewerException
valueData
- the new value and associated information, such as
declared type. This will be null for animation updates.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. This will be null for
animation updates.ViewerException
- if an exception is encountered.public void updateGui()
updateGui
in class PresentationView<T extends PresentationView.Settings>
protected abstract void configure(boolean update, JPanel panel, AnimatingLinkedView.State s)
update
- true if the viewer panel should be resized (if necessary)
and repainted, false if it should not.panel
- the panel on which the view will be displayed.s
- the current viewer state.protected abstract Rectangle getLabelBounds(int row, Rectangle2D textBounds, AnimatingLinkedView.State s)
row
- the row.textBounds
- bounds (size) of the label text.s
- the structure state.protected abstract Point2D.Double getLinkTarget(int sourceRow, NodeData<N> nd, AnimatingLinkedView.State s, double edgeAdjust)
protected Point2D.Double getLVLinkSource(int row, AnimatingLinkedView.State s)
protected Color getNodeColor(NodeData<N> nd)
nd
- node data for the node.protected abstract Rectangle getNodeRect(NodeData<N> nd, AnimatingLinkedView.State s)
nd
- the node data.s
- the structure state.protected int getNumValuesPerNode()
protected abstract PresentationElement getPe(NodeData<N> nd)
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.protected boolean horizontalRows()
PresentationView.showVertical()
.protected abstract NodeData<N> nodeLocationToData(N location, S currentData)
location
- the node location of interest.currentData
- current structure data.protected void paintArray(PresentationElement pe, Graphics2D g)
pe
- the presentation element used to render the array.g
- the graphics used to render the array.protected void paintHashArrayElement(PresentationElement pe, Graphics2D g, Rectangle elementRect, boolean selected, boolean valueIsNull, String nodeLabel, Rectangle rawTargetRect, Rectangle targetRect)
pe
- the presentation element used to render the node.g
- the graphics used to render the node.elementRect
- element bounds for the node element.selected
- true if the node is selected, false otherwise.valueIsNull
- true if the node value is null, false otherwise.nodeLabel
- the node label.rawTargetRect
- non-animation target node bounds, or if the value is
null, what those bounds would be if there were a target.targetRect
- the target node bounds. This is ignored if
valueIsNull
is true.protected void paintLabels(AnimatingLinkedView.State s, Graphics2D g, String[] rowLabels, List<NodeData<N>> rowTargets, String message, int t, PresentationElement pe)
s
- the viewer state.g
- the graphics to be used for painting.rowLabels
- the label for each row.rowTargets
- the target node for each row.message
- a short message to be displayed if local variable nodes
are not available, or null if no such message should be displayed.t
- position of top of bound of local variables area, or left of
bound if display is vertical.pe
- a PresentationElement to be used for layout.protected abstract void paintMainView(Graphics graphics, JPanel panel, AnimatingLinkedView.State s)
graphics
- the graphics to which the view will be rendered.panel
- the panel on which the view will be rendered.s
- the current viewer state.protected void paintNodes(AnimatingLinkedView.State s, Graphics2D g, Color fieldEdgeColor)
s
- the structure state to be painted.g
- the graphics to which nodes will be painted.fieldEdgeColor
- color for field-to-node edges.protected abstract void setCollectionState(S data, boolean enableCollection)
data
- the structure data to be protected or freed.enableCollection
- if true, garbage collection protection will be
removed, if false it will be enabled.protected void setSubViewValue(S currentData, DebugContext context, boolean isReset)
protected abstract S update(Value value, ViewerUpdateData data, DebugContext context) throws ViewerException
value
- the current structure value.data
- viewer update data.context
- the current debugger context.ViewerException
- if an error occurs while updating the viewer.