public class ErrorStrip
extends javax.swing.JPanel
RSyntaxTextArea
that displays
colored markers for locations of interest (parser errors, marked
occurrences, etc.).
ErrorStrip
s display ParserNotice
s from
Parser
s. Currently, the only way to get lines flagged in this
component is to register a Parser
on an RSyntaxTextArea and
return ParserNotice
s for each line to display an icon for.
The severity of each notice must be at least the threshold set by
setLevelThreshold(org.fife.ui.rsyntaxtextarea.parser.ParserNotice.Level)
to be displayed in this error strip. The default threshold is
ParserNotice.Level.WARNING
.
An ErrorStrip
can be added to a UI like so:
textArea = createTextArea(); textArea.addParser(new MyParser(textArea)); // Identifies lines to display scrollPane = new RTextScrollPane(textArea, true); ErrorStrip es = new ErrorStrip(textArea); JPanel temp = new JPanel(new BorderLayout()); temp.add(scrollPane); temp.add(es, BorderLayout.LINE_END);
Modifier and Type | Class and Description |
---|---|
static interface |
ErrorStrip.ErrorStripMarkerToolTipProvider
Returns tool tip text for the markers in an
ErrorStrip that
denote one or more parser notices. |
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ErrorStrip(RSyntaxTextArea textArea)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNotify()
Overridden so we only start listening for parser notices when this
component (and presumably the text area) are visible.
|
void |
doLayout()
Manually manages layout since this component uses no layout manager.
|
java.awt.Color |
getCaretMarkerColor()
returns the color to use when painting the caret marker.
|
boolean |
getFollowCaret()
Returns whether the caret's position should be drawn.
|
ParserNotice.Level |
getLevelThreshold()
Returns the minimum severity a parser notice must be for it to be
displayed in this error strip.
|
java.awt.Dimension |
getPreferredSize() |
boolean |
getShowMarkAll()
Returns whether "mark all" highlights are shown in this error strip.
|
boolean |
getShowMarkedOccurrences()
Returns whether marked occurrences are shown in this error strip.
|
java.lang.String |
getToolTipText(java.awt.event.MouseEvent e) |
protected void |
paintComponent(java.awt.Graphics g)
Overridden to (possibly) draw the caret's position.
|
void |
removeNotify() |
void |
setCaretMarkerColor(java.awt.Color color)
Sets the color to use when painting the caret marker.
|
void |
setFollowCaret(boolean follow)
Toggles whether the caret's current location should be drawn.
|
void |
setLevelThreshold(ParserNotice.Level level)
Sets the minimum severity a parser notice must be for it to be displayed
in this error strip.
|
void |
setMarkerToolTipProvider(ErrorStrip.ErrorStripMarkerToolTipProvider provider)
Sets the provider of tool tips for markers in this error strip.
|
void |
setShowMarkAll(boolean show)
Sets whether "mark all" highlights are shown in this error strip.
|
void |
setShowMarkedOccurrences(boolean show)
Sets whether marked occurrences are shown in this error strip.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public ErrorStrip(RSyntaxTextArea textArea)
textArea
- The text area we are examining.public void addNotify()
addNotify
in class javax.swing.JComponent
public void doLayout()
doLayout
in class java.awt.Container
public java.awt.Color getCaretMarkerColor()
setCaretMarkerColor(Color)
public boolean getFollowCaret()
setFollowCaret(boolean)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public ParserNotice.Level getLevelThreshold()
ParserNotice
class.setLevelThreshold(org.fife.ui.rsyntaxtextarea.parser.ParserNotice.Level)
public boolean getShowMarkAll()
setShowMarkAll(boolean)
public boolean getShowMarkedOccurrences()
setShowMarkedOccurrences(boolean)
public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
getToolTipText
in class javax.swing.JComponent
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- The graphics context.public void removeNotify()
removeNotify
in class javax.swing.JComponent
public void setCaretMarkerColor(java.awt.Color color)
color
- The new caret marker color.getCaretMarkerColor()
public void setFollowCaret(boolean follow)
follow
- Whether the caret's current location should be followed.getFollowCaret()
public void setLevelThreshold(ParserNotice.Level level)
ParserNotice
class. The default value is
ParserNotice.Level.WARNING
.level
- The new severity threshold.getLevelThreshold()
,
ParserNotice
public void setMarkerToolTipProvider(ErrorStrip.ErrorStripMarkerToolTipProvider provider)
provider
- The provider. If this is null
, a default
implementation will be used.public void setShowMarkAll(boolean show)
show
- Whether to show markers for "mark all" highlights.getShowMarkAll()
public void setShowMarkedOccurrences(boolean show)
show
- Whether to show marked occurrences.getShowMarkedOccurrences()