Package org.apache.batik.swing.gvt
Class TextSelectionManager
- java.lang.Object
-
- org.apache.batik.swing.gvt.TextSelectionManager
-
public class TextSelectionManager extends java.lang.ObjectThis class represents an object which manage GVT text nodes selection.- Version:
- $Id: TextSelectionManager.java 1808001 2017-09-11 09:51:29Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTextSelectionManager.MouseListenerTo implement a GraphicsNodeMouseListener.protected classTextSelectionManager.SelectionOverlayThe selection overlay.protected classTextSelectionManager.TextSelectionListenerTo implements a selection listener.
-
Field Summary
Fields Modifier and Type Field Description protected JGVTComponentcomponentThe associated JGVTComponent.protected TextSelectionManager.MouseListenermouseListenerThe mouse listener.protected java.awt.CursorpreviousCursorTo store the previous cursor.(package private) java.lang.ObjectselectionThe current selection or null if there is none.protected java.awt.ShapeselectionHighlightThe selection highlight.protected OverlayselectionOverlayThe selection overlay.protected java.awt.ColorselectionOverlayColorThe color of the selection overlay.protected java.awt.ColorselectionOverlayStrokeColorThe color of the outline of the selection overlay.static java.awt.CursorTEXT_CURSORThe cursor indicating that a text selection operation is under way.protected SelectionListenertextSelectionListenerThe text selection listener.protected ConcreteTextSelectortextSelectorThe text selector.protected booleanxorModeA flag bit that indicates whether or not the selection overlay is painted in XOR mode.
-
Constructor Summary
Constructors Constructor Description TextSelectionManager(JGVTComponent comp, EventDispatcher ed)Creates a new TextSelectionManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSelectionListener(SelectionListener sl)Add a selection listener to be notified when the text selection changes in the document.voidclearSelection()Clears the selection.protected java.awt.RectanglegetHighlightBounds()The highlight bounds.java.lang.ObjectgetSelection()Returns the current text selection or null if there is none.OverlaygetSelectionOverlay()Returns the selection overlay.java.awt.ColorgetSelectionOverlayColor()Returns the color of the selection overlay.java.awt.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 java.awt.Rectangleoutset(java.awt.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 textvoidsetSelectionOverlayColor(java.awt.Color color)Sets the color of the selection overlay to the specified color.voidsetSelectionOverlayStrokeColor(java.awt.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
-
TEXT_CURSOR
public static final java.awt.Cursor TEXT_CURSOR
The cursor indicating that a text selection operation is under way.
-
textSelector
protected ConcreteTextSelector textSelector
The text selector.
-
component
protected JGVTComponent component
The associated JGVTComponent.
-
selectionOverlay
protected Overlay selectionOverlay
The selection overlay.
-
mouseListener
protected TextSelectionManager.MouseListener mouseListener
The mouse listener.
-
previousCursor
protected java.awt.Cursor previousCursor
To store the previous cursor.
-
selectionHighlight
protected java.awt.Shape selectionHighlight
The selection highlight.
-
textSelectionListener
protected SelectionListener textSelectionListener
The text selection listener.
-
selectionOverlayColor
protected java.awt.Color selectionOverlayColor
The color of the selection overlay.
-
selectionOverlayStrokeColor
protected java.awt.Color selectionOverlayStrokeColor
The color of the outline of the selection overlay.
-
xorMode
protected boolean xorMode
A flag bit that indicates whether or not the selection overlay is painted in XOR mode.
-
selection
java.lang.Object selection
The current selection or null if there is none.
-
-
Constructor Detail
-
TextSelectionManager
public TextSelectionManager(JGVTComponent comp, EventDispatcher 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.
-
removeSelectionListener
public void removeSelectionListener(SelectionListener sl)
Remove a selection listener to be notified when the text selection changes in the document.
-
setSelectionOverlayColor
public void setSelectionOverlayColor(java.awt.Color color)
Sets the color of the selection overlay to the specified color.- Parameters:
color- the new color of the selection overlay
-
getSelectionOverlayColor
public java.awt.Color getSelectionOverlayColor()
Returns the color of the selection overlay.
-
setSelectionOverlayStrokeColor
public void setSelectionOverlayStrokeColor(java.awt.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
-
getSelectionOverlayStrokeColor
public java.awt.Color getSelectionOverlayStrokeColor()
Returns the 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
-
isSelectionOverlayXORMode
public boolean isSelectionOverlayXORMode()
Returns true if the selection overlay is painted in XOR mode, false otherwise.
-
getSelectionOverlay
public Overlay getSelectionOverlay()
Returns the selection overlay.
-
getSelection
public java.lang.Object getSelection()
Returns the current text selection or null if there is none.
-
clearSelection
public void clearSelection()
Clears the selection.
-
outset
protected java.awt.Rectangle outset(java.awt.Rectangle r, int amount)
-
getHighlightBounds
protected java.awt.Rectangle getHighlightBounds()
The highlight bounds.
-
-