|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.swing.tool.Tool com.levigo.jadice.swing.search.tool.TextCursorTool
public class TextCursorTool
A Tool
to visualize and manage a text cursor akin to a text cursor in a word processor or
text editor. This tool can be used to navigate the document and to select text. However, no
actual editing of the document content is supported at this point (and the foreseeable future).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.levigo.jadice.swing.tool.Tool |
---|
Tool.ActivationRequest |
Field Summary |
---|
Fields inherited from class com.levigo.jadice.swing.tool.Tool |
---|
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY |
Constructor Summary | |
---|---|
TextCursorTool()
|
Method Summary | |
---|---|
void |
cursorAdvance(Granularity g)
Advance the cursor one logical position of the given Granularity . |
void |
cursorBacktrack(Granularity g)
Backtrack the cursor one logical position of the given Granularity . |
void |
cursorToEnd(Granularity g)
Place the cursor at the end of the element of the given granularity at the current cursor position. |
void |
cursorToStart(Granularity g)
Place the cursor at the start of the element of the given granularity at the current cursor position. |
protected Tool.ActivationRequest |
getActivationFeedback(MouseEditEvent e)
Provide feedback for the user about what would happen, if the mouse were pressed at the current location. |
int |
getBlinkInterval()
Get the blink interval of the cursor in milliseconds. |
protected void |
handleKeyPressed(KeyEditEvent e,
boolean isActive)
Invoked when a key has been pressed. |
protected void |
handleMouseClicked(MouseEditEvent e,
boolean isActive)
Invoked when the mouse button has been clicked (pressed and released) on a component. |
void |
hideCursor()
Hide the cursor (if it is currently showing). |
boolean |
isCursorSet()
|
boolean |
isSelectionMode()
|
protected Granularity |
modifierToGranularityHomeEnd(KeyEditEvent e)
Determine the Granularity to use when navigating using one of the keys
KeyEvent.VK_HOME , KeyEvent.VK_END . |
protected Granularity |
modifierToGranularityLeftRight(KeyEditEvent e)
Determine the Granularity to use when navigating using one of the keys
KeyEvent.VK_LEFT , KeyEvent.VK_RIGHT . |
protected Granularity |
modifierToGranularityUpDown(KeyEditEvent e)
Determine the Granularity to use when navigating using one of the keys
KeyEvent.VK_UP , KeyEvent.VK_DOWN . |
protected void |
render(RenderParameters parameters,
boolean isActive)
Renders the Tool's UI onto the given Graphics2D context using the given
RenderControls . |
void |
setBlinkInterval(int interval)
Set the blink interval of the cursor in milliseconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextCursorTool()
Method Detail |
---|
protected Tool.ActivationRequest getActivationFeedback(MouseEditEvent e)
Tool
MouseEvent.MOUSE_MOVED
events. If this
method returns null
no feedback is provided at all.
The activation request returned from this method is the same object that is used during
Tool.getActivationRequestForKeyPressed(KeyEditEvent)
to signal the auto-activation
candidacy.
This method should only return an activation request if it will actually candidate for
auto-activation later on using Tool.getActivationRequestForMousePressed(MouseEditEvent)
or
Tool.getActivationRequestForMouseDragged(MouseEditEvent)
.
getActivationFeedback
in class Tool
protected void handleMouseClicked(MouseEditEvent e, boolean isActive)
Tool
handleMouseClicked
in class Tool
isActive
- whether this tool is currently activeprotected void handleKeyPressed(KeyEditEvent e, boolean isActive)
Tool
KeyEvent
for a
definition of a key pressed event.
handleKeyPressed
in class Tool
isActive
- whether this tool is currently activeprotected Granularity modifierToGranularityHomeEnd(KeyEditEvent e)
Granularity
to use when navigating using one of the keys
KeyEvent.VK_HOME
, KeyEvent.VK_END
.
The default mapping is:
nothing | Granularity.LINE |
InputEvent.CTRL_MASK + InputEvent.ALT_MASK |
Granularity.PAGE |
InputEvent.ALT_MASK |
Granularity.BLOCK |
InputEvent.CTRL_MASK |
Granularity.DOCUMENT |
otherwise | null (don't handle this case) |
InputEvent.SHIFT_MASK
is ignored, as it is used to activate selection mode.
e
-
protected Granularity modifierToGranularityUpDown(KeyEditEvent e)
Granularity
to use when navigating using one of the keys
KeyEvent.VK_UP
, KeyEvent.VK_DOWN
.
The default mapping is:
nothing | Granularity.LINE |
InputEvent.CTRL_MASK |
Granularity.PAGE |
InputEvent.ALT_MASK |
Granularity.BLOCK |
otherwise | null (don't handle this case) |
InputEvent.SHIFT_MASK
is ignored, as it is used to activate selection mode.
e
-
protected Granularity modifierToGranularityLeftRight(KeyEditEvent e)
Granularity
to use when navigating using one of the keys
KeyEvent.VK_LEFT
, KeyEvent.VK_RIGHT
.
The default mapping is:
nothing | Granularity.GLYPH |
InputEvent.CTRL_MASK |
Granularity.WORD |
otherwise | null (don't handle this case) |
InputEvent.SHIFT_MASK
is ignored, as it is used to activate selection mode.
e
-
public void cursorToEnd(Granularity g)
Granularity.WORD
.
Navigating with a granularity of Granularity.GLYPH
does not make sense and has no
effect.
g
- the granularity of the element to navigate topublic void cursorToStart(Granularity g)
Granularity.WORD
.
Navigating with a granularity of Granularity.GLYPH
does not make sense and has no
effect.
g
- the granularity of the element to navigate topublic void cursorBacktrack(Granularity g)
Granularity
. For example, to
navigate to the previous character (as in cursor-left) use Granularity.GLYPH
.
g
- the granularity of the navigation steppublic void cursorAdvance(Granularity g)
Granularity
. For example, to
navigate to the next character (as in cursor-right) use Granularity.GLYPH
.
g
- the granularity of the navigation steppublic void hideCursor()
protected void render(RenderParameters parameters, boolean isActive)
Tool
Graphics2D
context using the given
RenderControls
.
This render method is called within the context and during the rendering of a single page. The page being rendered is passed to implementors of this method in order to be able to control and influence the page rendering.
render
in class Tool
parameters
- the view component which is currently being renderedisActive
- whether the called tool is currently activepublic void setBlinkInterval(int interval)
interval
- the interval in millisecondspublic int getBlinkInterval()
public boolean isCursorSet()
public boolean isSelectionMode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |