## edu.stanford.nlp.trees.tregex.gui
Class MatchesPanel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      edu.stanford.nlp.trees.tregex.gui.MatchesPanel

All Implemented Interfaces:
  ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener

    public class MatchesPanel

extends JPanel
implements ListSelectionListener

Component for displaying the list of trees that match the query.

Author:
  Anna Rafferty
See Also:
  Serialized Form

Nested Class Summary
`static interface` `MatchesPanel.MatchesPanelListener` Allows other panels to be updated about changes to the matches panel (better abstraction)

Nested classes/interfaces inherited from class javax.swing.JPanel
`JPanel.AccessibleJPanel`

Nested classes/interfaces inherited from class javax.swing.JComponent
`JComponent.AccessibleJComponent`

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 inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

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`

Method Summary
`void` `addListener(ListSelectionListener l)` Become a listener to changes in which tree is selected
`void` `addListener(MatchesPanel.MatchesPanelListener l)` Become a listener to changes in the trees the matches panel is showing
`void` `focusOnList()`
`Color` `getHighlightColor()`
`static MatchesPanel` `getInstance()` Returns the singleton instance of the MatchesPanel
`HashMap<TreeFromFile,List<Tree>>` `getMatchedParts()`
`StringBuffer` `getMatchedSentences()` Returns all currently displayed sentences in string buffer, plain text form
`StringBuffer` `getMatches()` Returns all currently displayed matches in string buffer, penn treebank form (suitable for writing out, for instance)
`int` `getMaxMatches()`
`Pair<TreeFromFile,List<Tree>>` `getSelectedMatch()` Get the selected tree and its corresponding matched parts
`boolean` `isEmpty()` Determine whether any trees are in the matches panel at this time
`boolean` `isShowOnlyMatchedPortion()`
`void` `removeAllMatches()`
`void` `setFontName(String fontName)`
`void` `setHighlightColor(Color highlightColor)`
`void` `setMatches(List<TreeFromFile> matches, HashMap<TreeFromFile,List<Tree>> matchedParts)` Used to set the trees to be displayed in this panel (which should match the tregex expression)
`void` `setMaxMatches(int maxMatches)`
`void` `setShowOnlyMatchedPortion(boolean showOnlyMatchedPortion)`
`void` `valueChanged(ListSelectionEvent arg0)`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### getInstance

    public static MatchesPanel getInstance()

  Returns the singleton instance of the MatchesPanel

  Returns:
    The singleton instance of the MatchesPanel

### removeAllMatches

    public void removeAllMatches()

### setMatches

    public void setMatches(List<TreeFromFile> matches,
                           HashMap<TreeFromFile,List<Tree>> matchedParts)

  Used to set the trees to be displayed in this panel (which should match the tregex expression)

  Parameters:
    `matches` - trees that match the expression

### getSelectedMatch

    public Pair<TreeFromFile,List<Tree>> getSelectedMatch()

  Get the selected tree and its corresponding matched parts

  Returns:
    a tree that matches the tregex expression

### getMatches

    public StringBuffer getMatches()

  Returns all currently displayed matches in string buffer, penn treebank form (suitable for writing out, for instance)

  Returns:
    StringBuffer filled with the penn treebank forms of all trees in the matches panel

### getMatchedSentences

    public StringBuffer getMatchedSentences()

  Returns all currently displayed sentences in string buffer, plain text form

  Returns:
    StringBuffer filled with the plain text form of all sentences in the matches panel

### isEmpty

    public boolean isEmpty()

  Determine whether any trees are in the matches panel at this time

  Returns:
    true if trees are present

### addListener

    public void addListener(MatchesPanel.MatchesPanelListener l)

  Become a listener to changes in the trees the matches panel is showing

### addListener

    public void addListener(ListSelectionListener l)

  Become a listener to changes in which tree is selected

### getMatchedParts

    public HashMap<TreeFromFile,List<Tree>> getMatchedParts()

### getHighlightColor

    public Color getHighlightColor()

### setHighlightColor

    public void setHighlightColor(Color highlightColor)

### isShowOnlyMatchedPortion

    public boolean isShowOnlyMatchedPortion()

### setShowOnlyMatchedPortion

    public void setShowOnlyMatchedPortion(boolean showOnlyMatchedPortion)

### setFontName

    public void setFontName(String fontName)

### valueChanged

    public void valueChanged(ListSelectionEvent arg0)

  Specified by:
    `valueChanged` in interface `ListSelectionListener`

### getMaxMatches

    public int getMaxMatches()

### setMaxMatches

    public void setMaxMatches(int maxMatches)

### focusOnList

    public void focusOnList()

Stanford NLP Group