Top Inners Fields Constructors Methods
org.antlr.v4.gui

public Class TreeViewer

extends JComponent
Class Inheritance
Imports
org.abego.treelayout.NodeExtentProvider, .TreeForTreeLayout, .TreeLayout, org.abego.treelayout.util.DefaultConfiguration, org.antlr.v4.runtime.ParserRuleContext, org.antlr.v4.runtime.misc.Utils, org.antlr.v4.runtime.tree.ErrorNode, .Tree, .Trees, javax.imageio.ImageIO, javax.print.PrintException, javax.swing.*, javax.swing.event.ChangeEvent, .ChangeListener, .TreeSelectionEvent, .TreeSelectionListener, javax.swing.filechooser.FileFilter, javax.swing.tree.DefaultMutableTreeNode, .TreePath, .TreeSelectionModel, java.awt.*, java.awt.event.ActionEvent, .ActionListener, .WindowAdapter, .WindowEvent, .WindowListener, java.awt.geom.CubicCurve2D, .Rectangle2D, java.awt.image.BufferedImage, java.io.File, .FileWriter, .BufferedWriter, .IOException, .Writer, java.util.ArrayList, .Collection, .List, java.util.concurrent.Callable, .ExecutorService, .Executors, .Future, java.util.prefs.Preferences

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
private static class
public static class

Field Summary

Modifier and TypeField and Description
protected int
protected Color
protected Color
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
protected Font
protected String
protected int
protected int
protected double
protected double
protected Color
protected List<Tree>
public static final Color
protected int
protected int
protected double
protected Color
protected TreeLayout<Tree>
protected TreeTextProvider
private boolean
Inherited from javax.swing.JComponent:
listenerListTOOL_TIP_TEXT_KEYuiUNDEFINED_CONDITIONWHEN_ANCESTOR_OF_FOCUSED_COMPONENTWHEN_FOCUSEDWHEN_IN_FOCUSED_WINDOW

Constructor Summary

AccessConstructor and Description
public
TreeViewer(List<String> ruleNames, Tree tree)

Method Summary

Modifier and TypeMethod and Description
public void
addHighlightedNodes(Collection<Tree> nodes)

Slow for big lists of highlighted nodes

private static void
protected void
generateBox(Writer writer, Tree parent)

protected void
generateEdges(Writer writer, Tree parent)

private static File
private static void
private static void
public int
public Color
protected Rectangle2D.Double
public Color
protected Graphics
getComponentGraphics(Graphics
the original Graphics object
g
)

Overrides javax.swing.JComponent.getComponentGraphics.

Returns the graphics object used to paint this component.
private static JFileChooser
getFileChooser(final String fileEnding, final String description)

public Font
getFont()

Overrides java.awt.Component.getFont.

Implements java.awt.MenuContainer.getFont.

Gets the font of this component.
public Color
protected int
public double
private Dimension
protected String
getText(Tree tree)

public Color
protected TreeForTreeLayout<Tree>
public TreeForTreeLayout<Tree>
getTreeLayoutAdaptor(Tree root)

Get an adaptor for root that indicates how to walk ANTLR trees.

public TreeTextProvider
public boolean
protected boolean
private static String
line(String x1, String y1, String x2, String y2, String style)

public Future<JFrame>
open()

public void
paint(Graphics
the Graphics context in which to paint
g
)

Overrides javax.swing.JComponent.paint.

Invoked by Swing to draw components.
protected void
protected void
private void
paintSVG(Writer writer)

private static String
rect(String x, String y, String width, String height, String style, String extraAttributes)

public void
public void
save(String fileName)

public void
setArcSize(int arcSize)

public void
setBorderColor(Color borderColor)

public void
setBoxColor(Color boxColor)

public void
setFont(Font
the desired Font for this component
font
)

Overrides javax.swing.JComponent.setFont.

Sets the font for this component.
public void
public void
setFontSize(int sz)

public void
setHighlightedBoxColor(Color highlightedBoxColor)

public void
setRuleNames(List<String> ruleNames)

public void
setScale(double scale)

public void
setTextColor(Color textColor)

public void
setTree(Tree root)

public void
public void
setUseCurvedEdges(boolean useCurvedEdges)

protected static JFrame
showInDialog(final TreeViewer viewer)

public void
text(Graphics g, String s, int x, int y)

private static String
text(String x, String y, String style, String text)

private void
Inherited from javax.swing.JComponent:
addAncestorListeneraddNotifyaddVetoableChangeListenercomputeVisibleRectcontainscreateToolTipdisableenablefirePropertyChangefirePropertyChangefirePropertyChangefireVetoableChangegetActionForKeyStrokegetActionMapgetAlignmentXgetAlignmentYgetAncestorListenersgetAutoscrollsgetBaselinegetBaselineResizeBehaviorgetBordergetBoundsgetClientPropertygetComponentPopupMenugetConditionForKeyStrokegetDebugGraphicsOptionsgetDefaultLocalegetFontMetricsgetGraphicsgetHeightgetInheritsPopupMenugetInputMapgetInputMapgetInputVerifiergetInsetsgetInsetsgetListenersgetLocationgetMaximumSizegetMinimumSizegetNextFocusableComponentgetPopupLocationgetPreferredSizegetRegisteredKeyStrokesgetRootPanegetSizegetToolTipLocationgetToolTipTextgetToolTipTextgetTopLevelAncestorgetTransferHandlergetUIgetUIClassIDgetVerifyInputWhenFocusTargetgetVetoableChangeListenersgetVisibleRectgetWidthgetXgetYgrabFocushideisDoubleBufferedisLightweightComponentisManagingFocusisOpaqueisOptimizedDrawingEnabledisPaintingForPrintisPaintingOriginisPaintingTileisRequestFocusEnabledisValidateRootpaintBorderpaintChildrenpaintComponentpaintImmediatelypaintImmediatelyparamStringprintprintAllprintBorderprintChildrenprintComponentprocessComponentKeyEventprocessKeyBindingprocessKeyEventprocessMouseEventprocessMouseMotionEventputClientPropertyregisterKeyboardActionregisterKeyboardActionremoveAncestorListenerremoveNotifyremoveVetoableChangeListenerrepaintrepaintrequestDefaultFocusrequestFocusrequestFocusrequestFocusInWindowrequestFocusInWindowresetKeyboardActionsreshaperevalidatescrollRectToVisiblesetActionMapsetAlignmentXsetAlignmentYsetAutoscrollssetBackgroundsetBordersetComponentPopupMenusetDebugGraphicsOptionssetDefaultLocalesetDoubleBufferedsetEnabledsetFocusTraversalKeyssetForegroundsetInheritsPopupMenusetInputMapsetInputVerifiersetMaximumSizesetMinimumSizesetNextFocusableComponentsetOpaquesetPreferredSizesetRequestFocusEnabledsetToolTipTextsetTransferHandlersetUIsetVerifyInputWhenFocusTargetsetVisibleunregisterKeyboardActionupdateupdateUI