com.borland.primetime.editor
Class Gutter

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.borland.primetime.editor.Gutter

public class Gutter
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener, javax.swing.event.DocumentListener, java.awt.event.MouseListener, java.beans.PropertyChangeListener

The Gutter is a panel which sits on the left edge of a TextView. It displays special marks and such that are associated with the document currently viewed in the editor.

See Also:
TextView, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  int clickRow
           
protected  java.util.ArrayList gutterListeners
           
static int GUTTERWIDTH
           
protected static java.util.ArrayList staticGutterListeners
           
 
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
 
Constructor Summary
Gutter()
          Create a new Gutter object.
 
Method Summary
 void addGutterListener(GutterListener l)
          Add a listener for gutter events.
 void addMark(int row, LineMark mark)
          Add a mark to the gutter.
static void addStaticGutterListener(GutterListener l)
          Add a listener for gutter events.
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
protected  void fireLineClicked(int line, java.awt.event.MouseEvent e)
          This method is called when the mouse was clicked on a particular row.
protected  void fireLinesChanged()
          This method is called when the number of lines has changed in the document of the attached editor.
 EditorPane getEditor()
          Return the editor associated with this gutter.
 int getMarkLine(LineMark mark)
          Get the current location of a mark.
 LineMark[] getMarks(int lineNumber)
          This method is returns an array of the marks on a particular line.
 java.awt.Dimension getPreferredSize()
          This method is overridden because this component's actual size should always be its preferred size.
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  void paintComponent(java.awt.Graphics g)
           
protected  void paintMark(java.awt.Graphics g, int index)
          Paint the mark for a particular index
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void removeGutterListener(GutterListener l)
          Remove a listener for gutter events.
 void removeMark(LineMark mark)
          Remove a mark from the gutter.
static void removeStaticGutterListener(GutterListener l)
          Remove a listener for gutter events.
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void setEditor(EditorPane editor)
          Set the editor to associate with this gutter.
 void setFont(java.awt.Font f)
          This is only used to remain synchronized with the font height of the associated editor.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gutterListeners

protected java.util.ArrayList gutterListeners

staticGutterListeners

protected static java.util.ArrayList staticGutterListeners

GUTTERWIDTH

public static int GUTTERWIDTH

clickRow

protected int clickRow
Constructor Detail

Gutter

public Gutter()
Create a new Gutter object. At this point, it has no editor associated with it.
Method Detail

setEditor

public void setEditor(EditorPane editor)
Set the editor to associate with this gutter.

getEditor

public EditorPane getEditor()
Return the editor associated with this gutter.

setFont

public void setFont(java.awt.Font f)
This is only used to remain synchronized with the font height of the associated editor.
Overrides:
setFont in class javax.swing.JComponent

addGutterListener

public void addGutterListener(GutterListener l)
Add a listener for gutter events.

removeGutterListener

public void removeGutterListener(GutterListener l)
Remove a listener for gutter events.

addStaticGutterListener

public static void addStaticGutterListener(GutterListener l)
Add a listener for gutter events.

removeStaticGutterListener

public static void removeStaticGutterListener(GutterListener l)
Remove a listener for gutter events.

fireLineClicked

protected void fireLineClicked(int line,
                               java.awt.event.MouseEvent e)
This method is called when the mouse was clicked on a particular row.
Parameters:
line - The 1-based index of the row that was clicked on.
e - The MouseEvent that caused the click.

fireLinesChanged

protected void fireLinesChanged()
This method is called when the number of lines has changed in the document of the attached editor.

getMarkLine

public int getMarkLine(LineMark mark)
Get the current location of a mark.
Parameters:
mark - The mark of interest.
Returns:
the current line number of the specified mark; this value is 1-based. returns -1 if the mark is not found.

addMark

public void addMark(int row,
                    LineMark mark)
Add a mark to the gutter.
Parameters:
row - The 1-based row at which to add the mark.
mark - The mark to add.

removeMark

public void removeMark(LineMark mark)
Remove a mark from the gutter.
Parameters:
mark - The mark to remove.

getMarks

public LineMark[] getMarks(int lineNumber)
This method is returns an array of the marks on a particular line.
Parameters:
lineNumber - The 1-based index of the line of interest.
Returns:
an array of the marks on the specified line.

getPreferredSize

public java.awt.Dimension getPreferredSize()
This method is overridden because this component's actual size should always be its preferred size.
Overrides:
getPreferredSize in class javax.swing.JComponent

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintMark

protected void paintMark(java.awt.Graphics g,
                         int index)
Paint the mark for a particular index

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener