Class TextSelectionTool

  • All Implemented Interfaces:

    public final class TextSelectionTool
    extends Tool
    • Constructor Detail

      • TextSelectionTool

        public TextSelectionTool()
    • Method Detail

      • getPageView

        protected com.levigo.jadice.web.client.viewer.internal.BasicPageView getPageView()
      • repaint

        protected void repaint()
      • getSelections

        public List<? extends Selection> getSelections()
        The list of selections. The size of the list is the amount of pages lying within the selection.
      • render

        protected void render​(RenderParameters parameters,
                              boolean isActive)
        Description copied from class: Tool
        Renders the Tool's UI onto the given 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 rendered
        isActive - whether the called tool is currently active
      • handleMousePressed

        protected void handleMousePressed​(MouseEditEvent e,
                                          boolean isActive)
        If a correct Text Selection is detected, create a SelectTextGesture. 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.
        handleMousePressed in class Tool
        e - the event
        isActive - whether this tool is currently active
      • copySelectedText

        protected void copySelectedText​(List<Selection> selections)
        Copy the selected text to the Clipboard so that one can paste it later on into some target application.
        selections - containing selected text elements.
      • handleMouseReleased

        protected void handleMouseReleased​(MouseEditEvent e,
                                           boolean isActive)
        Description copied from class: Tool
        Invoked when a mouse button has been released on a component.
        handleMouseReleased in class Tool
        e - the event
        isActive - whether this tool is currently active
      • clearSelection

        public void clearSelection()
        Remove previously selected items from the Clipboard.
      • setHighlightTool

        public void setHighlightTool​(Class<? extends HighlightTool> highlightTool)
        Overwrite the used HighlightTool. This is for testing only.
        highlightTool - the Class to use
      • setActive

        protected void setActive​(boolean active)
        Description copied from class: Tool
        Receive notification from the tool manager about the tool's active state.
        setActive in class Tool
        active - controls whether to activate or deactivate this Tool
      • setEnabled

        protected void setEnabled​(boolean enabled)
        Description copied from class: Tool
        Receive 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 the Tool.handleEditEvent(boolean, EditEvent) and Tool.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.
        setEnabled in class Tool
        enabled - controls whether to enable or disable this Tool
      • onDragStart

        protected void onDragStart​( event)
        Used for dragging text from the browser to other applications.
        event - the DragStartEvent fired when someone starts to drag a previously selected text.