JIDE 3.5.15

com.jidesoft.marker
Class MarkerArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.marker.MarkerArea
All Implemented Interfaces:
MarkerListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
MarkerArea

public class MarkerArea
extends JPanel
implements MarkerListener

MarkerArea is an area next to a component with a vertical scroll bar to display markers for error, warning, or whatever information in the code you would like to display. There are two parts in a MarkerArea. The top is an area called MarkerEye. It displays the current status of the markers. You can use MarkerEyePainter to customize how to paint it. For example, if there are errors in the table, you can display a red box to indicate something is wrong. Or display a yellow box if there are just warnings. If everything is OK, display a green box. You can even display an icon if you want using MarkerEyePainter. The second part is called MarkerStripe. It displays stripes to indicate those errors or warnings or any other information. Each stripe is associated with a range of code and a tooltip for the message. For example, an error stripe usually has a tooltip telling user what the error is. MarkerStripePainter is the painter class to paint the stripe.

The whole MarkerArea is driven by a model class called MarkerModel. By default, we put the MarkerModel inside an implementation of an interface called MarkerSupport which provides some more information to display the marker other than the MarkerModel. MarkerModel that stores all the markers. You can use code to add or remove markers to this model. MarkerArea will display them immediately when something is changed.

A typical usage of MarkerArea is to use it along with a component that has a vertical scroll bar, such as JTable, JList, JTree and JTextArea. These components could be very tall which is the reason a vertical scroll bar is needed. A MarkerArea provides a way to see an overview of certain information, such as validation errors/warnings, recent changes, modifications by users, without having to scroll up and down.

See Also:
MarkerEye, MarkerStripe, MarkerModel, DefaultMarkerModel, 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
protected  MarkerEye _eye
           
protected  MarkerEyePainter _eyePainter
           
protected  boolean _inspecting
           
protected  MarkerSupport _markerSupport
           
protected  int _minimumMode
           
protected  int _mode
           
protected  MarkerStripe _stripe
           
protected  MarkerStripePainter _stripePainter
           
static Color DEFAULT_ERROR_COLOR
           
static Color DEFAULT_FINE_COLOR
           
static Color DEFAULT_INSPECTING_COLOR
           
static Color DEFAULT_WARNING_COLOR
           
static int MODE_ERROR
           
static int MODE_FINE
           
static int MODE_WARNING
           
static String PROPERTY_CLICK_TO_SELECT
           
 
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
 
Constructor Summary
MarkerArea(MarkerSupport markerSupport)
           
 
Method Summary
 void applyMinimumMode()
           
 void clearMarkerColors()
          Clears all registered marker colors.
protected  MarkerEye createMarkerEye()
          Creates a default MarkerEye.
protected  MarkerStripe createMarkerStripe()
          Creates a default MarkerStripe.
 void dispose()
          Disposes the MarkerArea.
 MarkerEyePainter getEyePainter()
           
 Color getMarkerColor(int type)
          Gets the color registered for the marker type.
 MarkerEye getMarkerEye()
          Gets the MarkerEye.
 MarkerStripe getMarkerStripe()
          Gets the MarkerStripe.
 MarkerSupport getMarkerSupport()
           
 int getMode()
           
 String getResourceString(String key)
          Gets the resource string used by CodeEditor.
 MarkerStripePainter getStripePainter()
           
 boolean isClickToSelect()
           
 boolean isInspecting()
           
 void markerChanged(MarkerEvent e)
          This method is called when any marker change happened.
 void registerMarkerColor(int type, Color color)
          Resisters a color for a marker type.
 void requireMinimumMode(int minimum)
           
 void setClickToSelect(boolean clickToSelect)
          Sets the flag whether to select the elements when clicking on the marker.
 void setEyePainter(MarkerEyePainter eyePainter)
           
 void setInspecting(boolean inspecting)
           
 void setMarkerSupport(MarkerSupport markerSupport)
           
 void setMode(int mode)
           
 void setStripePainter(MarkerStripePainter stripePainter)
           
 void unregisterMarkerColor(int type)
          Unregisters the color from the marker type.
 void updateMarkerAreaHeight(int preferredHeight)
           
 
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
 

Field Detail

MODE_FINE

public static final int MODE_FINE
See Also:
Constant Field Values

MODE_WARNING

public static final int MODE_WARNING
See Also:
Constant Field Values

MODE_ERROR

public static final int MODE_ERROR
See Also:
Constant Field Values

DEFAULT_FINE_COLOR

public static final Color DEFAULT_FINE_COLOR

DEFAULT_WARNING_COLOR

public static final Color DEFAULT_WARNING_COLOR

DEFAULT_ERROR_COLOR

public static final Color DEFAULT_ERROR_COLOR

DEFAULT_INSPECTING_COLOR

public static final Color DEFAULT_INSPECTING_COLOR

_markerSupport

protected MarkerSupport _markerSupport

_eye

protected MarkerEye _eye

_stripe

protected MarkerStripe _stripe

_eyePainter

protected MarkerEyePainter _eyePainter

_stripePainter

protected MarkerStripePainter _stripePainter

_mode

protected int _mode

_minimumMode

protected int _minimumMode

_inspecting

protected boolean _inspecting

PROPERTY_CLICK_TO_SELECT

public static final String PROPERTY_CLICK_TO_SELECT
See Also:
Constant Field Values
Constructor Detail

MarkerArea

public MarkerArea(MarkerSupport markerSupport)
Method Detail

createMarkerStripe

protected MarkerStripe createMarkerStripe()
Creates a default MarkerStripe. Subclass can override this method to create your own MarkerStripe subclass.

Returns:
the MarkerStripe.

createMarkerEye

protected MarkerEye createMarkerEye()
Creates a default MarkerEye. Subclass can override this method to create your own MarkerEye subclass.

Returns:
the MarkerEye.

getMarkerStripe

public MarkerStripe getMarkerStripe()
Gets the MarkerStripe.

Returns:
the MarkerStripe.

getMarkerEye

public MarkerEye getMarkerEye()
Gets the MarkerEye.

Returns:
the MarkerEye.

getEyePainter

public MarkerEyePainter getEyePainter()

setEyePainter

public void setEyePainter(MarkerEyePainter eyePainter)

getStripePainter

public MarkerStripePainter getStripePainter()

setStripePainter

public void setStripePainter(MarkerStripePainter stripePainter)

getMarkerSupport

public MarkerSupport getMarkerSupport()

setMarkerSupport

public void setMarkerSupport(MarkerSupport markerSupport)

markerChanged

public void markerChanged(MarkerEvent e)
Description copied from interface: MarkerListener
This method is called when any marker change happened.

Specified by:
markerChanged in interface MarkerListener

isInspecting

public boolean isInspecting()

setInspecting

public void setInspecting(boolean inspecting)

getMode

public int getMode()

setMode

public void setMode(int mode)

applyMinimumMode

public void applyMinimumMode()

requireMinimumMode

public void requireMinimumMode(int minimum)

updateMarkerAreaHeight

public void updateMarkerAreaHeight(int preferredHeight)

getResourceString

public String getResourceString(String key)
Gets the resource string used by CodeEditor.

Parameters:
key - the resource key
Returns:
the localized resource string.

registerMarkerColor

public void registerMarkerColor(int type,
                                Color color)
Resisters a color for a marker type.

Parameters:
type - a marker type.
color - color for the marker type. The marker type is defined in Marker.

unregisterMarkerColor

public void unregisterMarkerColor(int type)
Unregisters the color from the marker type.

Parameters:
type - the marker type.

clearMarkerColors

public void clearMarkerColors()
Clears all registered marker colors.


getMarkerColor

public Color getMarkerColor(int type)
Gets the color registered for the marker type. If the type is not registered, Color.Yellow (which is defined as MarkerArea#DEFAULT_WARNING_COLOR) will be returned.

Parameters:
type - the marker type.
Returns:
the color registered for the marker type

isClickToSelect

public boolean isClickToSelect()

setClickToSelect

public void setClickToSelect(boolean clickToSelect)
Sets the flag whether to select the elements when clicking on the marker.

Parameters:
clickToSelect - true or false.

dispose

public void dispose()
Disposes the MarkerArea.

Since:
3.4.6

JIDE 3.5.15