Interface InplaceEditor

    • Method Detail

      • getEditorComponent

        java.lang.Object getEditorComponent​(AuthorInplaceContext context,
                                            Rectangle allocation,
                                            Point mouseInvocationLocation)
        Prepare and return the editor component.
        Parameters:
        context - The context where the editor will be used.
        allocation - The bounds where the editor will be shown. This is normally the bounds of the box in which the value being edited is rendered. If the editor requires to be presented in different bounds it should alter this parameter. The X,Y coordinates are relative to the parent in which the editor will be added.
        mouseInvocationLocation - if the editor was requested using the mouse this parameter represents the X,Y location where the event took place. It is relative to the parent in which the editor will be added. null if the editor wasn't requested through mouse interaction.

        OBS: This is the very first call received by an editor. This ensures that the editor is properly initialized for the subsequent calls (like a requestFocus() call).
        OBS: An editor implementation will have to add listeners onto itself like:
        Returns:
        The component that performs the editing. For the Standalone distribution this should be a java.awt.JComponent implementation. For the Eclipse plugin distribution, an org.eclipse.swt.widgets.Control is expected.
      • getScrollRectangle

        Rectangle getScrollRectangle()
        Returns a rectangle that should be made visible after the editor is shown. The coordinate should be relative to the editor itself. The default behavior is to make the entire editor visible but if the editor is bigger than the viewport the visible part might not be the right one. For example is the editor is a text field the caret might not be visible. This is when this method is useful. The caret rectangle should be returned so that the part of the editor with the caret is presented.
        Returns:
        A rectangle to be made visible or null to make the entire editor visible.
      • requestFocus

        void requestFocus()
        Requests focus inside the editing component.
      • getValue

        java.lang.Object getValue()
        Gets the value that the user entered.
        Returns:
        The value that the user entered.
      • commitValue

        void commitValue()
        Commit the given value inside the document without stopping the editing. Will only commit if a new string value is provided and only if the value that must be committed is different from the current value.
        Since:
        17.1
      • removeEditingListener

        void removeEditingListener​(InplaceEditingListener editingListener)
        Removes a listener that receives editing events.
        Parameters:
        editingListener - Editing listener.
      • refresh

        void refresh​(AuthorInplaceContext context)
        While this editor is inside an editing session a document change was detected that didn't originated form this editor. In this situation it might be good for the editor to refresh the presented data.

        Currently this method is called if:
        • This editor edits an attribute and the same attribute was externally modified. In this situation is recommended for the editor to update the current value.
        Parameters:
        context - An updated editing context for this editor.
        Since:
        16.1
      • insertContent

        boolean insertContent​(java.lang.String content)
        An insert text event was received by the author page and redirected to this currently active form control. The form control should insert this text as it sees fit. For example a text field might insert it at the caret position. An example when this event comes is when the user uses the Character Map Dialog to insert characters directly into a form control.
        Parameters:
        content - Content to be inserted.
        Returns:
        true if the event was handled or false if the form control can do nothing with the string. For example a text field can insert the text inside it but a check box form control can do nothing with it. If false is returned the form control editing session will be stopped and the author page will handle the event instead.
        Since:
        16.1
      • allowsRepostingEvents

        default boolean allowsRepostingEvents()
        Returns:
        true if the component allows receiving mouse events from the editor area if visible on screen.