Package org.fife.ui.rsyntaxtextarea
Class ErrorStrip
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.fife.ui.rsyntaxtextarea.ErrorStrip
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
public class ErrorStrip extends JPanel
A component to sit alongside anRSyntaxTextAreathat displays colored markers for locations of interest (parser errors, marked occurrences, etc.).ErrorStrips displayParserNotices fromParsers. Currently, the only way to get lines flagged in this component is to register aParseron an RSyntaxTextArea and returnParserNotices for each line to display an icon for. The severity of each notice must be at least the threshold set bysetLevelThreshold(org.fife.ui.rsyntaxtextarea.parser.ParserNotice.Level)to be displayed in this error strip. The default threshold isParserNotice.Level.WARNING.An
ErrorStripcan 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);
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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
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
accessibleContext, 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
-
-
Constructor Summary
Constructors Constructor Description ErrorStrip(RSyntaxTextArea textArea)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotify()Overridden so we only start listening for parser notices when this component (and presumably the text area) are visible.voiddoLayout()Manually manages layout since this component uses no layout manager.ColorgetCaretMarkerColor()returns the color to use when painting the caret marker.booleangetFollowCaret()Returns whether the caret's position should be drawn.ParserNotice.LevelgetLevelThreshold()Returns the minimum severity a parser notice must be for it to be displayed in this error strip.DimensiongetPreferredSize()booleangetShowMarkAll()Returns whether "mark all" highlights are shown in this error strip.booleangetShowMarkedOccurrences()Returns whether marked occurrences are shown in this error strip.StringgetToolTipText(MouseEvent e)protected voidpaintComponent(Graphics g)Overridden to (possibly) draw the caret's position.voidremoveNotify()voidsetCaretMarkerColor(Color color)Sets the color to use when painting the caret marker.voidsetFollowCaret(boolean follow)Toggles whether the caret's current location should be drawn.voidsetLevelThreshold(ParserNotice.Level level)Sets the minimum severity a parser notice must be for it to be displayed in this error strip.voidsetShowMarkAll(boolean show)Sets whether "mark all" highlights are shown in this error strip.voidsetShowMarkedOccurrences(boolean show)Sets whether marked occurrences are shown in this error strip.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
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
-
Methods inherited from class java.awt.Container
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
-
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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
ErrorStrip
public ErrorStrip(RSyntaxTextArea textArea)
Constructor.- Parameters:
textArea- The text area we are examining.
-
-
Method Detail
-
addNotify
public void addNotify()
Overridden so we only start listening for parser notices when this component (and presumably the text area) are visible.- Overrides:
addNotifyin classJComponent
-
doLayout
public void doLayout()
Manually manages layout since this component uses no layout manager.
-
getCaretMarkerColor
public Color getCaretMarkerColor()
returns the color to use when painting the caret marker.- Returns:
- The caret marker color.
- See Also:
setCaretMarkerColor(Color)
-
getFollowCaret
public boolean getFollowCaret()
Returns whether the caret's position should be drawn.- Returns:
- Whether the caret's position should be drawn.
- See Also:
setFollowCaret(boolean)
-
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
getPreferredSizein classJComponent
-
getLevelThreshold
public ParserNotice.Level getLevelThreshold()
Returns the minimum severity a parser notice must be for it to be displayed in this error strip. This will be one of the constants defined in theParserNoticeclass.- Returns:
- The minimum severity.
- See Also:
setLevelThreshold(org.fife.ui.rsyntaxtextarea.parser.ParserNotice.Level)
-
getShowMarkAll
public boolean getShowMarkAll()
Returns whether "mark all" highlights are shown in this error strip.- Returns:
- Whether markers are shown for "mark all" highlights.
- See Also:
setShowMarkAll(boolean)
-
getShowMarkedOccurrences
public boolean getShowMarkedOccurrences()
Returns whether marked occurrences are shown in this error strip.- Returns:
- Whether marked occurrences are shown.
- See Also:
setShowMarkedOccurrences(boolean)
-
getToolTipText
public String getToolTipText(MouseEvent e)
- Overrides:
getToolTipTextin classJComponent
-
paintComponent
protected void paintComponent(Graphics g)
Overridden to (possibly) draw the caret's position.- Overrides:
paintComponentin classJComponent- Parameters:
g- The graphics context.
-
removeNotify
public void removeNotify()
- Overrides:
removeNotifyin classJComponent
-
setCaretMarkerColor
public void setCaretMarkerColor(Color color)
Sets the color to use when painting the caret marker.- Parameters:
color- The new caret marker color.- See Also:
getCaretMarkerColor()
-
setFollowCaret
public void setFollowCaret(boolean follow)
Toggles whether the caret's current location should be drawn.- Parameters:
follow- Whether the caret's current location should be followed.- See Also:
getFollowCaret()
-
setLevelThreshold
public void setLevelThreshold(ParserNotice.Level level)
Sets the minimum severity a parser notice must be for it to be displayed in this error strip. This should be one of the constants defined in theParserNoticeclass. The default value isParserNotice.Level.WARNING.- Parameters:
level- The new severity threshold.- See Also:
getLevelThreshold(),ParserNotice
-
setShowMarkAll
public void setShowMarkAll(boolean show)
Sets whether "mark all" highlights are shown in this error strip.- Parameters:
show- Whether to show markers for "mark all" highlights.- See Also:
getShowMarkAll()
-
setShowMarkedOccurrences
public void setShowMarkedOccurrences(boolean show)
Sets whether marked occurrences are shown in this error strip.- Parameters:
show- Whether to show marked occurrences.- See Also:
getShowMarkedOccurrences()
-
-