Class TextSelectionTool
java.lang.Object
com.levigo.jadice.web.client.tool.Tool
com.levigo.jadice.web.client.tools.TextSelectionTool
- All Implemented Interfaces:
MenuContributor
-
Nested Class Summary
Nested classes/interfaces inherited from class com.levigo.jadice.web.client.tool.Tool
Tool.ActivationRequest -
Field Summary
FieldsFields inherited from class com.levigo.jadice.web.client.tool.Tool
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemove previously selected items from theClipboard.voidcontribute(ContributionContext context, MenuBuilder menuBuilder) This method is called in order to give the menu contributor a chance to contribute context menu entries via the suppliedMenuBuilder.protected voidcopySelectedText(List<Selection> selections) Copy the selected text to theClipboardso that one can paste it later on into some target application.protected Tool.ActivationRequestProvide feedback for the user about what would happen, if the mouse were pressed at the current location.protected HighlightToolprotected com.levigo.jadice.web.client.viewer.internal.BasicPageViewprotected voidhandleMousePressed(MouseEditEvent e, boolean isActive) If a correct Text Selection is detected, create aSelectTextGesture.protected voidhandleMouseReleased(MouseEditEvent e, boolean isActive) Invoked when a mouse button has been released on a component.protected voidrender(RenderParameters parameters, boolean isActive) Renders the Tool's UI onto the givenGraphics2Dcontext using the givenRenderControls.protected voidrepaint()protected voidsetActive(boolean active) Receive notification from the tool manager about the tool's active state.protected voidsetEnabled(boolean enabled) Receive notification from the tool manager about the tool's enabled state.voidsetHighlightTool(Class<? extends HighlightTool> highlightTool) Overwrite the used HighlightTool.protected voidsetManager(ToolManager manager) Receives theToolManagerinstance, which theToolimplementation has been registered for.Methods inherited from class com.levigo.jadice.web.client.tool.Tool
ensureDebugId, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getActivationRequestForTouchMove, getActivationRequestForTouchStart, getDispatchPriority, getManager, getRenderPriority, handleEditEvent, handleGestureChange, handleGestureEnd, handleGestureStart, handleKeyPressed, handleKeyReleased, handleKeyTyped, handleMouseClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseMoved, handleMouseWheelMoved, handlePointerDown, handlePointerMove, handlePointerUp, handleTouchEnd, handleTouchMove, handleTouchStart, propagatePropertyChange, setCursor, setCursor, setStatusFeedback
-
Field Details
-
KEY_SELECT
- See Also:
-
-
Constructor Details
-
TextSelectionTool
public TextSelectionTool()
-
-
Method Details
-
getPageView
protected com.levigo.jadice.web.client.viewer.internal.BasicPageView getPageView() -
repaint
protected void repaint() -
getSelections
- Returns:
- The list of selections. The size of the list is the amount of pages lying within the selection.
-
getActivationFeedback
Description copied from class:ToolProvide feedback for the user about what would happen, if the mouse were pressed at the current location. This method is called while handlingMouseMoveEvents. If this method returnsnullno feedback is provided at all. The activation request returned from this method is the same object that is used duringTool.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 usingTool.getActivationRequestForMousePressed(MouseEditEvent)orTool.getActivationRequestForMouseDragged(MouseEditEvent).- Overrides:
getActivationFeedbackin classTool- Parameters:
e- theMouseEditEvent- Returns:
- the
Tool.ActivationRequest
-
setManager
Description copied from class:ToolReceives theToolManagerinstance, which theToolimplementation has been registered for. If theToolisderegisteredthis method will be called with null.- Overrides:
setManagerin classTool- Parameters:
manager- theToolManager
-
render
Description copied from class:ToolRenders the Tool's UI onto the givenGraphics2Dcontext using the givenRenderControls.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.
-
handleMousePressed
If a correct Text Selection is detected, create aSelectTextGesture. When this gesture is stopped by releasing the left mouse button, the selected text can be copied, but not before. As fix for the problem described in JWT-501 and JSX-2139, before creating the gesture set the focus on the body-element of the whole page (not only some embedded iframe). This needs to be done so IE11 (and possible other browsers) loose the focus on the address bar, as otherwise the content of the address bar will be copied instead of the selected text.- Overrides:
handleMousePressedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
copySelectedText
Copy the selected text to theClipboardso that one can paste it later on into some target application.- Parameters:
selections- containing selected text elements.
-
handleMouseReleased
Description copied from class:ToolInvoked when a mouse button has been released on a component.- Overrides:
handleMouseReleasedin classTool- Parameters:
e- the eventisActive- whether this tool is currently active
-
clearSelection
public void clearSelection()Remove previously selected items from theClipboard. -
setHighlightTool
Overwrite the used HighlightTool. This is for testing only.- Parameters:
highlightTool- the Class to use
-
getHighlightTool
-
setActive
protected void setActive(boolean active) Description copied from class:ToolReceive notification from the tool manager about the tool's active state. -
setEnabled
protected void setEnabled(boolean enabled) Description copied from class:ToolReceive notification from the tool manager about the tool's enabled state. In general, tools need not and should not try to implement different behaviour depending on the enabled state, as this is already covered by the ToolManager calling theTool.handleEditEvent(boolean, EditEvent)andTool.render(RenderParameters, boolean)in the appropriate state only. However, some tools may need to perform extended actions (for example, for resource management purposes) upon a change of the enabled state.- Overrides:
setEnabledin classTool- Parameters:
enabled- controls whether to enable or disable thisTool
-