Package org.sonar.sslr.internal.toolkit
Class ToolkitViewImpl
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- org.sonar.sslr.internal.toolkit.ToolkitViewImpl
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants,ToolkitView
public class ToolkitViewImpl extends JFrame implements ToolkitView
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
-
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description ToolkitPresenterpresenter-
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
-
-
Constructor Summary
Constructors Constructor Description ToolkitViewImpl(ToolkitPresenter presenter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConfigurationProperty(String name, String description)Add a new configuration property to the configuration tab.voidappendToConsole(String message)Append the given message to the console view.voidclearAstSelections()Clear all the selections in the abstract syntax tree view.voidclearConsole()Clear the console.voidclearSourceCodeHighlights()Clear all the highlights in the source code editor.voiddisableXPathEvaluateButton()Disable the XPath evaluate button.voiddisplayAst(AstNode astNode)Display the abstract syntax tree view starting from a given node.voiddisplayHighlightedSourceCode(String htmlHighlightedSourceCode)Display the given HTML highlighted source code in the source code editor.voiddisplayXml(String xml)Display the given string in the XML view.voidenableXPathEvaluateButton()Enable the XPath evaluate button.AstNodegetAstNodeFollowingCurrentSourceCodeTextCursorPosition()Get the AST node which follows the current source code editor text cursor position.StringgetConfigurationPropertyValue(String name)Get the value currently entered in the configuration property field identified by the given name.List<AstNode>getSelectedAstNodes()Get the list of nodes currently selected in the abstract syntax tree view.StringgetSourceCode()Get the source code currently entered in the source code editor.PointgetSourceCodeScrollbarPosition()Get the current source code editor scrollbars' position point.StringgetXPath()Get the text currently entered in the XPath field.voidhighlightSourceCode(AstNode astNode)Highlight the given AST node in the source code editor.FilepickFileToParse()Prompt the user for a file to parse and return it.voidrun()Launch the application.voidscrollAstTo(AstNode astNode)Scroll the abstract syntax tree view in order to make the given AST node visible.voidscrollSourceCodeTo(AstNode astNode)Scroll the source code editor in order to make the given AST node visible.voidscrollSourceCodeTo(Point point)Scroll the source code editor in order to make the given point visible.voidselectAstNode(AstNode astNode)Select the given AST node in the abstract syntax tree view.voidsetConfigurationPropertyErrorMessage(String name, String errorMessage)Set the error message of the configuration property identified by the given name.voidsetConfigurationPropertyValue(String name, String value)Set the current value of the configuration property field identified by the given name.voidsetFocusOnAbstractSyntaxTreeView()Set the focus on the abstract syntax tree view.voidsetFocusOnConfigurationPropertyField(String name)Set the focus on the configuration field identified by the given name.voidsetFocusOnConfigurationView()Set the focus on the configuration view.voidsetFocusOnConsoleView()Set the focus on the console view.-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Methods inherited from interface org.sonar.sslr.internal.toolkit.ToolkitView
setTitle
-
-
-
-
Field Detail
-
presenter
public final transient ToolkitPresenter presenter
-
-
Constructor Detail
-
ToolkitViewImpl
public ToolkitViewImpl(ToolkitPresenter presenter)
-
-
Method Detail
-
run
public void run()
Description copied from interface:ToolkitViewLaunch the application.- Specified by:
runin interfaceToolkitView
-
pickFileToParse
public File pickFileToParse()
Description copied from interface:ToolkitViewPrompt the user for a file to parse and return it.- Specified by:
pickFileToParsein interfaceToolkitView- Returns:
- The file to parse, or null if no file was picked
-
displayHighlightedSourceCode
public void displayHighlightedSourceCode(String htmlHighlightedSourceCode)
Description copied from interface:ToolkitViewDisplay the given HTML highlighted source code in the source code editor. Scrollbars state is undefined after a call to this method.- Specified by:
displayHighlightedSourceCodein interfaceToolkitView- Parameters:
htmlHighlightedSourceCode- The HTML highlighted source code
-
displayAst
public void displayAst(@Nullable AstNode astNode)
Description copied from interface:ToolkitViewDisplay the abstract syntax tree view starting from a given node.- Specified by:
displayAstin interfaceToolkitView- Parameters:
astNode- The root AST node or null if no abstract syntax tree must be shown
-
displayXml
public void displayXml(String xml)
Description copied from interface:ToolkitViewDisplay the given string in the XML view.- Specified by:
displayXmlin interfaceToolkitView- Parameters:
xml- The string to display
-
getSourceCodeScrollbarPosition
public Point getSourceCodeScrollbarPosition()
Description copied from interface:ToolkitViewGet the current source code editor scrollbars' position point.- Specified by:
getSourceCodeScrollbarPositionin interfaceToolkitView- Returns:
- The point
-
scrollSourceCodeTo
public void scrollSourceCodeTo(Point point)
Description copied from interface:ToolkitViewScroll the source code editor in order to make the given point visible.- Specified by:
scrollSourceCodeToin interfaceToolkitView- Parameters:
point- to make visible
-
getSourceCode
public String getSourceCode()
Description copied from interface:ToolkitViewGet the source code currently entered in the source code editor.- Specified by:
getSourceCodein interfaceToolkitView- Returns:
- The source code
-
getXPath
public String getXPath()
Description copied from interface:ToolkitViewGet the text currently entered in the XPath field.- Specified by:
getXPathin interfaceToolkitView- Returns:
- The XPath field text
-
selectAstNode
public void selectAstNode(AstNode astNode)
Description copied from interface:ToolkitViewSelect the given AST node in the abstract syntax tree view.- Specified by:
selectAstNodein interfaceToolkitView- Parameters:
astNode- The AST node to select, null will lead to a no operation
-
highlightSourceCode
public void highlightSourceCode(AstNode astNode)
Description copied from interface:ToolkitViewHighlight the given AST node in the source code editor.- Specified by:
highlightSourceCodein interfaceToolkitView- Parameters:
astNode- The AST node to highlight
-
clearAstSelections
public void clearAstSelections()
Description copied from interface:ToolkitViewClear all the selections in the abstract syntax tree view.- Specified by:
clearAstSelectionsin interfaceToolkitView
-
scrollAstTo
public void scrollAstTo(@Nullable AstNode astNode)
Description copied from interface:ToolkitViewScroll the abstract syntax tree view in order to make the given AST node visible.- Specified by:
scrollAstToin interfaceToolkitView- Parameters:
astNode- The AST node to make visible, null will lead to a no operation
-
clearSourceCodeHighlights
public void clearSourceCodeHighlights()
Description copied from interface:ToolkitViewClear all the highlights in the source code editor.- Specified by:
clearSourceCodeHighlightsin interfaceToolkitView
-
scrollSourceCodeTo
public void scrollSourceCodeTo(@Nullable AstNode astNode)
Description copied from interface:ToolkitViewScroll the source code editor in order to make the given AST node visible.- Specified by:
scrollSourceCodeToin interfaceToolkitView- Parameters:
astNode- The AST node to make visible, null will lead to a no operation
-
disableXPathEvaluateButton
public void disableXPathEvaluateButton()
Description copied from interface:ToolkitViewDisable the XPath evaluate button.- Specified by:
disableXPathEvaluateButtonin interfaceToolkitView
-
enableXPathEvaluateButton
public void enableXPathEvaluateButton()
Description copied from interface:ToolkitViewEnable the XPath evaluate button.- Specified by:
enableXPathEvaluateButtonin interfaceToolkitView
-
getAstNodeFollowingCurrentSourceCodeTextCursorPosition
@Nullable public AstNode getAstNodeFollowingCurrentSourceCodeTextCursorPosition()
Description copied from interface:ToolkitViewGet the AST node which follows the current source code editor text cursor position.- Specified by:
getAstNodeFollowingCurrentSourceCodeTextCursorPositionin interfaceToolkitView- Returns:
- The following AST node, or null if there is no such node
-
getSelectedAstNodes
public List<AstNode> getSelectedAstNodes()
Description copied from interface:ToolkitViewGet the list of nodes currently selected in the abstract syntax tree view.- Specified by:
getSelectedAstNodesin interfaceToolkitView- Returns:
- The list of selected AST nodes
-
appendToConsole
public void appendToConsole(String message)
Description copied from interface:ToolkitViewAppend the given message to the console view.- Specified by:
appendToConsolein interfaceToolkitView- Parameters:
message- The message to append
-
setFocusOnConsoleView
public void setFocusOnConsoleView()
Description copied from interface:ToolkitViewSet the focus on the console view.- Specified by:
setFocusOnConsoleViewin interfaceToolkitView
-
setFocusOnAbstractSyntaxTreeView
public void setFocusOnAbstractSyntaxTreeView()
Description copied from interface:ToolkitViewSet the focus on the abstract syntax tree view.- Specified by:
setFocusOnAbstractSyntaxTreeViewin interfaceToolkitView
-
clearConsole
public void clearConsole()
Description copied from interface:ToolkitViewClear the console.- Specified by:
clearConsolein interfaceToolkitView
-
addConfigurationProperty
public void addConfigurationProperty(String name, String description)
Description copied from interface:ToolkitViewAdd a new configuration property to the configuration tab.- Specified by:
addConfigurationPropertyin interfaceToolkitView
-
getConfigurationPropertyValue
public String getConfigurationPropertyValue(String name)
Description copied from interface:ToolkitViewGet the value currently entered in the configuration property field identified by the given name.- Specified by:
getConfigurationPropertyValuein interfaceToolkitView- Parameters:
name- The name of the configuration property- Returns:
- The current value of the field
-
setConfigurationPropertyValue
public void setConfigurationPropertyValue(String name, String value)
Description copied from interface:ToolkitViewSet the current value of the configuration property field identified by the given name.- Specified by:
setConfigurationPropertyValuein interfaceToolkitView- Parameters:
name- The name of the configuration propertyvalue- The value to be set
-
setConfigurationPropertyErrorMessage
public void setConfigurationPropertyErrorMessage(String name, String errorMessage)
Description copied from interface:ToolkitViewSet the error message of the configuration property identified by the given name.- Specified by:
setConfigurationPropertyErrorMessagein interfaceToolkitView- Parameters:
name- The name of the configuration propertyerrorMessage- The error message
-
setFocusOnConfigurationPropertyField
public void setFocusOnConfigurationPropertyField(String name)
Description copied from interface:ToolkitViewSet the focus on the configuration field identified by the given name.- Specified by:
setFocusOnConfigurationPropertyFieldin interfaceToolkitView
-
setFocusOnConfigurationView
public void setFocusOnConfigurationView()
Description copied from interface:ToolkitViewSet the focus on the configuration view.- Specified by:
setFocusOnConfigurationViewin interfaceToolkitView
-
-