JIDE 3.5.15

com.jidesoft.margin
Class AbstractMargin

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.jidesoft.margin.AbstractMargin
All Implemented Interfaces:
Margin, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
AbstractMargin, AbstractRowMargin

public abstract class AbstractMargin
extends JComponent
implements Margin

AbstractMargin is a component that usually appears on the left side of a large component that has a scroll pane. It can be used to display information related to the component such as row number. When the component is scrolled, the margin will repaint the content to match with the new content that is visible in the scroll pane's view port. So it looks like the margin is scrolled with the scroll pane.

This is an abstract class. Two methods are abstract. They are Margin.paintMargin(java.awt.Graphics) and Margin.getPreferredWidth().

See Also:
Serialized Form

Nested Class Summary
 
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  List<MarginPainter> _marginPainters
           
protected  MarginSupport _marginSupport
           
protected  MarginSupport.ModelChangedCallback _modelChangedCallback
           
protected  Dimension _preferredSize
           
protected  MarginSupport.RepaintCallback _repaintCallback
           
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
protected AbstractMargin()
           
  AbstractMargin(MarginSupport marginSupport)
           
 
Method Summary
 void addMarginPainter(MarginPainter painter)
          Adds a margin painter to paint extra information on top of the current margin painted by paintMargin method.
protected  MarginSupport.ModelChangedCallback createModelChangedCallback()
          Creates the ModelChangedCallback.
protected  MarginSupport.RepaintCallback createRepaintCallback()
          Creates the repaint callback.
 Component getMarginComponent()
          Gets the margin component.
protected  List<MarginPainter> getMarginPainters()
           
 MarginSupport getMarginSupport()
          Gets the code editor.
 Dimension getPreferredSize()
           
 void invalidate()
           
 boolean isClickToSelect()
           
protected  void paintBackground(Graphics g)
           
protected  void paintComponent(Graphics g)
           
 void removeMarginPainter(MarginPainter painter)
          Removes a margin painter added by addMarginPainter.
 void setClickToSelect(boolean clickToSelect)
          Sets the flag whether to select the elements when clicking on the marker.
 void setMarginSupport(MarginSupport marginSupport)
          Sets the code editor.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, 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
 
Methods inherited from interface com.jidesoft.margin.Margin
getPreferredWidth, paintMargin
 

Field Detail

_marginSupport

protected MarginSupport _marginSupport

_preferredSize

protected Dimension _preferredSize

_marginPainters

protected List<MarginPainter> _marginPainters

_repaintCallback

protected MarginSupport.RepaintCallback _repaintCallback

_modelChangedCallback

protected MarginSupport.ModelChangedCallback _modelChangedCallback

PROPERTY_CLICK_TO_SELECT

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

AbstractMargin

protected AbstractMargin()

AbstractMargin

public AbstractMargin(MarginSupport marginSupport)
Method Detail

invalidate

public void invalidate()
Overrides:
invalidate in class Container

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

paintBackground

protected void paintBackground(Graphics g)

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent

getMarginSupport

public MarginSupport getMarginSupport()
Description copied from interface: Margin
Gets the code editor.

Specified by:
getMarginSupport in interface Margin
Returns:
the code editor.

setMarginSupport

public void setMarginSupport(MarginSupport marginSupport)
Description copied from interface: Margin
Sets the code editor.

Specified by:
setMarginSupport in interface Margin

createRepaintCallback

protected MarginSupport.RepaintCallback createRepaintCallback()
Creates the repaint callback. It will be called when a repaint is needed. The default implementation will call the margin's repaint method. Subclass can override to do something else.

Returns:
the RepaintCallback

createModelChangedCallback

protected MarginSupport.ModelChangedCallback createModelChangedCallback()
Creates the ModelChangedCallback. It will be called when the model is changed. The default implementation returns null. Subclass can override it to return a valid callback.

Returns:
the ModelChangedCallback.

getMarginComponent

public Component getMarginComponent()
Description copied from interface: Margin
Gets the margin component. If you implement your margin by extending a Component, you simply "return this" when implementing this method.

Specified by:
getMarginComponent in interface Margin
Returns:
the margin component.

addMarginPainter

public void addMarginPainter(MarginPainter painter)
Description copied from interface: Margin
Adds a margin painter to paint extra information on top of the current margin painted by paintMargin method.

Specified by:
addMarginPainter in interface Margin

removeMarginPainter

public void removeMarginPainter(MarginPainter painter)
Description copied from interface: Margin
Removes a margin painter added by addMarginPainter.

Specified by:
removeMarginPainter in interface Margin

getMarginPainters

protected List<MarginPainter> getMarginPainters()

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.

JIDE 3.5.15