com.vaadin.ui.components.grid.

Class EditorImpl<T>

    • Constructor Detail

      • EditorImpl

        public EditorImpl​(PropertySet<T> propertySet)

        Constructor for internal implementation of the Editor.

        Parameters:

        propertySet - the property set to use for configuring the default binder

    • Method Detail

      • generateData

        public void generateData​(T item,
                                 elemental.json.JsonObject jsonObject)

        Description copied from interface: DataGenerator

        Adds custom data for the given item to its serialized JsonObject representation. This JSON object will be sent to client-side DataProvider.

        Specified by:

        generateData in interface DataGenerator<T>

        Parameters:

        item - the data item being serialized

        jsonObject - the JSON object being sent to the client

      • setBinder

        public Editor<T> setBinder​(Binder<T> binder)

        Description copied from interface: Editor

        Sets the underlying Binder to this Editor.

        Specified by:

        setBinder in interface Editor<T>

        Parameters:

        binder - the binder for updating editor fields; not null

        Returns:

        this editor

      • getBinder

        public Binder<T> getBinder()

        Description copied from interface: Editor

        Returns the underlying Binder from Editor.

        Specified by:

        getBinder in interface Editor<T>

        Returns:

        the binder; not null

      • setBuffered

        public Editor<T> setBuffered​(boolean buffered)

        Description copied from interface: Editor

        Sets the Editor buffered mode. When the editor is in buffered mode, edits are only committed when the user clicks the save button. In unbuffered mode valid changes are automatically committed.

        Specified by:

        setBuffered in interface Editor<T>

        Parameters:

        buffered - true if editor should be buffered; false if not

        Returns:

        this editor

      • setEnabled

        public Editor<T> setEnabled​(boolean enabled)

        Description copied from interface: Editor

        Enables or disabled the Editor. A disabled editor cannot be opened.

        Specified by:

        setEnabled in interface Editor<T>

        Parameters:

        enabled - true if editor should be enabled; false if not

        Returns:

        this editor

      • isBuffered

        public boolean isBuffered()

        Description copied from interface: Editor

        Returns whether Editor is buffered or not.

        Specified by:

        isBuffered in interface Editor<T>

        Returns:

        true if editor is buffered; false if not

        See Also:

        Editor.setBuffered(boolean)

      • isEnabled

        public boolean isEnabled()

        Description copied from interface: Editor

        Returns whether Editor is enabled or not.

        Specified by:

        isEnabled in interface Editor<T>

        Returns:

        true if editor is enabled; false if not

      • doEdit

        protected void doEdit​(T bean)

        Handles editor component generation and adding them to the hierarchy of the Grid.

        Parameters:

        bean - the edited item; can't be null

      • save

        public boolean save()

        Description copied from interface: Editor

        Saves any changes from the Editor fields to the edited bean.

        Specified by:

        save in interface Editor<T>

        Returns:

        true if save succeeded; false if not

      • isOpen

        public boolean isOpen()

        Description copied from interface: Editor

        Returns whether Editor is open or not.

        Specified by:

        isOpen in interface Editor<T>

        Returns:

        true if editor is open; false if not

      • cancel

        public void cancel()

        Description copied from interface: Editor

        Close the editor discarding any unsaved changes.

        Specified by:

        cancel in interface Editor<T>

      • editRow

        public void editRow​(int rowNumber)
                     throws IllegalStateException,
                            IllegalArgumentException

        Description copied from interface: Editor

        Opens the editor interface for the provided row. Scrolls the Grid to bring the row to view if it is not already visible. Note that any cell content rendered by a WidgetRenderer will not be visible in the editor row.

        Specified by:

        editRow in interface Editor<T>

        Parameters:

        rowNumber - the row number of the edited item

        Throws:

        IllegalStateException - if the editor is not enabled, Grid is read-only, or already editing a different item in buffered mode

        IllegalArgumentException - if the rowNumber is not in the backing data provider

        See Also:

        Editor.setEnabled(boolean)

      • doClose

        protected void doClose()

        Handles clean up for closing the Editor.

      • setSaveCaption

        public Editor<T> setSaveCaption​(String saveCaption)

        Description copied from interface: Editor

        Sets the caption of the save button in buffered mode.

        Specified by:

        setSaveCaption in interface Editor<T>

        Parameters:

        saveCaption - the save button caption

        Returns:

        this editor

      • setCancelCaption

        public Editor<T> setCancelCaption​(String cancelCaption)

        Description copied from interface: Editor

        Sets the caption of the cancel button in buffered mode.

        Specified by:

        setCancelCaption in interface Editor<T>

        Parameters:

        cancelCaption - the cancel button caption

        Returns:

        this editor

      • getSaveCaption

        public String getSaveCaption()

        Description copied from interface: Editor

        Gets the caption of the save button in buffered mode.

        Specified by:

        getSaveCaption in interface Editor<T>

        Returns:

        the save button caption

      • getCancelCaption

        public String getCancelCaption()

        Description copied from interface: Editor

        Gets the caption of the cancel button in buffered mode.

        Specified by:

        getCancelCaption in interface Editor<T>

        Returns:

        the cancel button caption

      • getState

        protected EditorState getState()

        Description copied from class: AbstractClientConnector

        Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.

        As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use getState(false) to avoid marking the connector as dirty.

        Overrides:

        getState in class Grid.AbstractGridExtension<T>

        Returns:

        The shared state for this connector. Never null.

      • setErrorGenerator

        public Editor<T> setErrorGenerator​(EditorErrorGenerator<T> errorGenerator)

        Description copied from interface: Editor

        Sets the error message generator for this editor.

        The default message is a concatenation of column field validation failures and bean validation failures.

        Specified by:

        setErrorGenerator in interface Editor<T>

        Parameters:

        errorGenerator - the function to generate error messages; not null

        Returns:

        this editor

        See Also:

        EditorErrorGenerator

      • addSaveListener

        public Registration addSaveListener​(EditorSaveListener<T> listener)

        Description copied from interface: Editor

        Adds an editor save listener.

        Specified by:

        addSaveListener in interface Editor<T>

        Parameters:

        listener - save listener

        Returns:

        a registration object for removing the listener

      • addCancelListener

        public Registration addCancelListener​(EditorCancelListener<T> listener)

        Description copied from interface: Editor

        Adds an editor cancel listener.

        Specified by:

        addCancelListener in interface Editor<T>

        Parameters:

        listener - cancel listener

        Returns:

        a registration object for removing the listener

      • addOpenListener

        public Registration addOpenListener​(EditorOpenListener<T> listener)

        Description copied from interface: Editor

        Adds an editor open listener.

        Specified by:

        addOpenListener in interface Editor<T>

        Parameters:

        listener - open listener

        Returns:

        a registration object for removing the listener

      • getGrid

        public Grid<T> getGrid()

        Description copied from interface: Editor

        Gets the Grid instance which this editor belongs to.

        Specified by:

        getGrid in interface Editor<T>

        Returns:

        the grid which owns the editor