Class AbstractEditComponentTextControl<EC extends Component>

    • Constructor Detail

      • AbstractEditComponentTextControl

        public AbstractEditComponentTextControl​(EC editedComponent,
                                                java.lang.String editedProperty,
                                                ValueControl<java.lang.String> editControl,
                                                Flow flow)
        Edited component, value control, and flow constructor.
        Parameters:
        editedComponent - The component the text of which is to be edited.
        editedProperty - The component property that will be affected when the text changes.
        editControl - The control used to edit the text.
        flow - The logical axis (line or page) along which information is flowed.
        Throws:
        java.lang.NullPointerException - if the edited component, value control, text property, and/or flow axis is null.
    • Method Detail

      • isEditable

        public boolean isEditable()
        Specified by:
        isEditable in interface EditComponent
        Returns:
        Whether the value is editable and the component will allow the the user to change the value.
      • setEditable

        public void setEditable​(boolean newEditable)
        Description copied from interface: EditComponent
        Sets whether the value is editable and the component will allow the the user to change the value. This is a bound property of type Boolean.
        Specified by:
        setEditable in interface EditComponent
        Parameters:
        newEditable - true if the component should allow the user to change the value.
        See Also:
        EditComponent.EDITABLE_PROPERTY
      • getEditedComponent

        public EC getEditedComponent()
        Returns:
        The component the text of which is to be edited.
      • getEditControl

        public ValueControl<java.lang.String> getEditControl()
        Returns:
        The control used to edit the text.
      • getEditActionPrototype

        public ActionPrototype getEditActionPrototype()
        Returns:
        The action prototype for editing the text.
      • getAcceptActionPrototype

        public ActionPrototype getAcceptActionPrototype()
        Returns:
        The action prototype for accepting edits.
      • getRejectActionPrototype

        public ActionPrototype getRejectActionPrototype()
        Returns:
        The action prototype for rejecting edits.
      • getDeleteActionPrototype

        public ActionPrototype getDeleteActionPrototype()
        Returns:
        The action prototype for deleting the text.
      • editLabel

        public void editLabel()
        Initiates editing.
      • acceptEdit

        public void acceptEdit()
        Accepts edits. If the component is not in edit mode, no action occurs. This implementation defers to acceptEdit(String).
        See Also:
        getMode()
      • acceptEdit

        protected void acceptEdit​(java.lang.String text)
        Accepts edits with the given text. If the component is not in edit mode, no action occurs. This implementation sets the edit component text to the given text and fires and edited event.
        Parameters:
        text - The edited text to accept.
        See Also:
        getMode(), setText(Component, String)
      • rejectEdit

        public void rejectEdit()
        Cancels edits.
      • deleteLabel

        public void deleteLabel()
        Removes the current label by setting it to null.
      • update

        protected void update()
        Description copied from class: AbstractComponent
        Updates the condition of the component based upon the state. This method is a convenience method for complex components that would like to perform wholesale updates any prototypes, enabled/disabled status, proxied actions, etc. This version does nothing.
        Overrides:
        update in class AbstractComponent
      • getText

        protected abstract java.lang.String getText​(EC editedComponent)
        Retrieves the text from the edited component.
        Parameters:
        editedComponent - The component the text of which is to be edited.
        Returns:
        The current text of the edited component
      • setText

        protected abstract void setText​(EC editedComponent,
                                        java.lang.String newText)
        Updates the text of the edited component.
        Parameters:
        editedComponent - The component the text of which is to be edited.
        newText - The new text to set in the edited component.
      • fireEdited

        protected void fireEdited​(EditEvent editEvent)
        Fires a given edit event to all registered edit listeners.
        Parameters:
        editEvent - The edit event to fire.