|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.bluemarsh.jswat.view.SourceViewTextArea
Class SourceViewTextArea is a quasi-text component that implements the SourceViewArea interface for easily getting the line number that corresponds to a view coordinate.
In addition, this class has the ability to interpret the value of the string under the mouse pointer. That is, it will read the string and assume it is a variable reference. If it is a variable, the value is displayed in the form of a tooltip.
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected SourceContent |
content
Content that contains the text. |
protected static boolean |
DEBUG
If true, does additional debugging output to console. |
protected com.bluemarsh.adt.PriorityList |
drawLayersList
Draw layers in priority order. |
protected static java.awt.Color |
gutterColor
Color for the gutter background. |
protected com.bluemarsh.adt.PriorityList |
gutterLayersList
Draw layers in priority order. |
protected int |
gutterWidth
Width of the gutter. |
protected static Category |
logCategory
Debug reporting category. |
protected SelectionDrawLayer |
selectionDrawLayer
Draw layer for drawing the current text selection. |
protected int |
sourceWidth
Width of the source code. |
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 | |
SourceViewTextArea(char[] buf)
Constructs a SourceViewTextArea for the given text. |
Method Summary | |
void |
addDrawLayer(DrawLayer layer,
int prio)
Adds the given draw layer to this text area. |
void |
addGutterLayer(GutterDrawLayer layer,
int prio)
Adds the given draw layer to this text area. |
SourceContent |
getContent()
Returns the source view text area content object. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
java.awt.Dimension |
getPreferredSize()
Calculates and returns the preferred size of the text area. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight()
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
int |
getSelectionEnd()
Returns the selected text's end position. |
int |
getSelectionStart()
Returns the selected text's start position. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
Checks to see if the mouse if hovering over a variable; if so, attempts to find the value of that variable and set the tooltip text. |
void |
paint(java.awt.Graphics g)
Invoked by Swing to draw components. |
protected void |
paintGutter(java.awt.Graphics g)
Draws the line numbers in the gutter area. |
protected void |
paintText(java.awt.Graphics g)
Draws the text of the text area. |
void |
select(int selectionStart,
int selectionEnd)
Selects the text found between the specified start and end locations. |
void |
setContent(SourceContent content)
Sets the source view text area content object to the one given. |
int |
viewToLine(java.awt.Point pt)
Turns a view coordinate into a one-based line number. |
int |
viewToModel(java.awt.Point pt)
Turns a view coordinate into a zero-based character offset. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
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, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, 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 |
protected static final boolean DEBUG
protected static Category logCategory
protected static java.awt.Color gutterColor
protected SourceContent content
protected SelectionDrawLayer selectionDrawLayer
protected com.bluemarsh.adt.PriorityList drawLayersList
protected com.bluemarsh.adt.PriorityList gutterLayersList
protected int gutterWidth
protected int sourceWidth
Constructor Detail |
public SourceViewTextArea(char[] buf)
buf
- array of text, sized to fit.Method Detail |
public void addDrawLayer(DrawLayer layer, int prio)
layer
- draw layer to add.prio
- priority for the draw layer.public void addGutterLayer(GutterDrawLayer layer, int prio)
layer
- draw layer to add.prio
- priority for the draw layer.public SourceContent getContent()
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
JComponent.getPreferredSize()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
getScrollableUnitIncrement
in interface javax.swing.Scrollable
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or
SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater
than zero for down/right.JScrollBar.setUnitIncrement(int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
getScrollableBlockIncrement
in interface javax.swing.Scrollable
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or
SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater
than zero for down/right.JScrollBar.setBlockIncrement(int)
public boolean getScrollableTracksViewportWidth()
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
public boolean getScrollableTracksViewportHeight()
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
public int getSelectionEnd()
public int getSelectionStart()
public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
getToolTipText
in class javax.swing.JComponent
event
- the event that caused the tooltip to appear.public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- the Graphics context in which to paint.protected void paintGutter(java.awt.Graphics g)
g
- graphics context to draw to.protected void paintText(java.awt.Graphics g)
g
- graphics context to draw to.public void select(int selectionStart, int selectionEnd)
selectionStart
- the start position of the text >= 0selectionEnd
- the end position of the text >= 0public void setContent(SourceContent content)
content
- new content object.public int viewToLine(java.awt.Point pt)
viewToLine
in interface com.bluemarsh.jswat.view.SourceViewArea
pt
- Point within the view coordinates.public int viewToModel(java.awt.Point pt)
pt
- Point within the view coordinates.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |