org.apache.batik.swing.gvt

Class TextSelectionManager

public class TextSelectionManager extends Object

This class represents an object which manage GVT text nodes selection.
Nested Class Summary
protected classTextSelectionManager.MouseListener
To implement a GraphicsNodeMouseListener.
protected classTextSelectionManager.SelectionOverlay
The selection overlay.
protected classTextSelectionManager.TextSelectionListener
To implements a selection listener.
Field Summary
protected AbstractJGVTComponentcomponent
The associated JGVTComponent.
protected TextSelectionManager.MouseListenermouseListener
The mouse listener.
protected CursorpreviousCursor
To store the previous cursor.
protected ShapeselectionHighlight
The selection highlight.
protected OverlayselectionOverlay
The selection overlay.
protected ColorselectionOverlayColor
The color of the selection overlay.
protected ColorselectionOverlayStrokeColor
The color of the outline of the selection overlay.
protected SelectionListenertextSelectionListener
The text selection listener.
protected ConcreteTextSelectortextSelector
The text selector.
static CursorTEXT_CURSOR
The cursor indicating that a text selection operation is under way.
protected booleanxorMode
A flag bit that indicates whether or not the selection overlay is painted in XOR mode.
Constructor Summary
TextSelectionManager(AbstractJGVTComponent comp, AWTEventDispatcher ed)
Creates a new TextSelectionManager.
Method Summary
voidaddSelectionListener(SelectionListener sl)
Add a selection listener to be notified when the text selection changes in the document.
voidclearSelection()
Clears the selection.
protected RectanglegetHighlightBounds()
The highlight bounds.
ObjectgetSelection()
Returns the current text selection or null if there is none.
OverlaygetSelectionOverlay()
Returns the selection overlay.
ColorgetSelectionOverlayColor()
Returns the color of the selection overlay.
ColorgetSelectionOverlayStrokeColor()
Returns the color of the outline of the selection overlay.
booleanisSelectionOverlayXORMode()
Returns true if the selection overlay is painted in XOR mode, false otherwise.
protected Rectangleoutset(Rectangle r, int amount)
voidremoveSelectionListener(SelectionListener sl)
Remove a selection listener to be notified when the text selection changes in the document.
voidsetSelection(Mark start, Mark end)
Sets the selected text
voidsetSelectionOverlayColor(Color color)
Sets the color of the selection overlay to the specified color.
voidsetSelectionOverlayStrokeColor(Color color)
Sets the color of the outline of the selection overlay to the specified color.
voidsetSelectionOverlayXORMode(boolean state)
Sets whether or not the selection overlay will be painted in XOR mode, depending on the specified parameter.

Field Detail

component

protected AbstractJGVTComponent component
The associated JGVTComponent.

mouseListener

protected TextSelectionManager.MouseListener mouseListener
The mouse listener.

previousCursor

protected Cursor previousCursor
To store the previous cursor.

selectionHighlight

protected Shape selectionHighlight
The selection highlight.

selectionOverlay

protected Overlay selectionOverlay
The selection overlay.

selectionOverlayColor

protected Color selectionOverlayColor
The color of the selection overlay.

selectionOverlayStrokeColor

protected Color selectionOverlayStrokeColor
The color of the outline of the selection overlay.

textSelectionListener

protected SelectionListener textSelectionListener
The text selection listener.

textSelector

protected ConcreteTextSelector textSelector
The text selector.

TEXT_CURSOR

public static final Cursor TEXT_CURSOR
The cursor indicating that a text selection operation is under way.

xorMode

protected boolean xorMode
A flag bit that indicates whether or not the selection overlay is painted in XOR mode.

Constructor Detail

TextSelectionManager

public TextSelectionManager(AbstractJGVTComponent comp, AWTEventDispatcher ed)
Creates a new TextSelectionManager.

Method Detail

addSelectionListener

public void addSelectionListener(SelectionListener sl)
Add a selection listener to be notified when the text selection changes in the document.

clearSelection

public void clearSelection()
Clears the selection.

getHighlightBounds

protected Rectangle getHighlightBounds()
The highlight bounds.

getSelection

public Object getSelection()
Returns the current text selection or null if there is none.

getSelectionOverlay

public Overlay getSelectionOverlay()
Returns the selection overlay.

getSelectionOverlayColor

public Color getSelectionOverlayColor()
Returns the color of the selection overlay.

getSelectionOverlayStrokeColor

public Color getSelectionOverlayStrokeColor()
Returns the color of the outline of the selection overlay.

isSelectionOverlayXORMode

public boolean isSelectionOverlayXORMode()
Returns true if the selection overlay is painted in XOR mode, false otherwise.

outset

protected Rectangle outset(Rectangle r, int amount)

removeSelectionListener

public void removeSelectionListener(SelectionListener sl)
Remove a selection listener to be notified when the text selection changes in the document.

setSelection

public void setSelection(Mark start, Mark end)
Sets the selected text

setSelectionOverlayColor

public void setSelectionOverlayColor(Color color)
Sets the color of the selection overlay to the specified color.

Parameters: color the new color of the selection overlay

setSelectionOverlayStrokeColor

public void setSelectionOverlayStrokeColor(Color color)
Sets the color of the outline of the selection overlay to the specified color.

Parameters: color the new color of the outline of the selection overlay

setSelectionOverlayXORMode

public void setSelectionOverlayXORMode(boolean state)
Sets whether or not the selection overlay will be painted in XOR mode, depending on the specified parameter.

Parameters: state true implies the selection overlay will be in XOR mode

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.