Class CmsEditableGroup

java.lang.Object
org.opencms.ui.components.editablegroup.CmsEditableGroup

public class CmsEditableGroup extends Object
Manages a group of widgets used as a multivalue input.

This class is not itself a widget, it just coordinates the other widgets actually used to display the multivalue widget group.

  • Constructor Details

    • CmsEditableGroup

      public CmsEditableGroup(com.vaadin.ui.AbstractOrderedLayout container, com.google.common.base.Supplier<com.vaadin.ui.Component> componentFactory, CmsEditableGroup.I_EmptyHandler emptyHandler)
      Creates a new instance.

      Parameters:
      container - the container in which to render the individual rows
      componentFactory - the factory used to create new input fields
      placeholder - the placeholder to display when there are no rows
    • CmsEditableGroup

      public CmsEditableGroup(com.vaadin.ui.AbstractOrderedLayout container, com.google.common.base.Supplier<com.vaadin.ui.Component> componentFactory, String addButtonCaption)
      Creates a new instance.

      Parameters:
      container - the container in which to render the individual rows
      componentFactory - the factory used to create new input fields
      addButtonCaption - the caption for the button which is used to add a new row to an empty list
  • Method Details

    • addRow

      public void addRow(com.vaadin.ui.Component component)
      Adds a row for the given component at the end of the group.
      Parameters:
      component - the component to wrap in the row to be added
    • addRowAfter

      Adds a new row after the given one.
      Parameters:
      row - the row after which a new one should be added
    • getContainer

      public com.vaadin.ui.AbstractOrderedLayout getContainer()
      Gets the row container.
      Returns:
      the row container
    • getErrorListener

      public com.vaadin.ui.Component.Listener getErrorListener()
      Gets the error listener.
      Returns:
      t
    • getNewComponentFactory

      public com.google.common.base.Supplier<com.vaadin.ui.Component> getNewComponentFactory()
      Gets the factory used for creating new components.
      Returns:
      the factory used for creating new components
    • getRowCaption

      Returns the row caption.

      Returns:
      the row caption
    • getRows

      Gets all rows.
      Returns:
      the list of all rows
    • init

      public void init()
      Initializes the multivalue group.

    • moveDown

      public void moveDown(I_CmsEditableGroupRow row)
      Moves the given row down.
      Parameters:
      row - the row to move
    • moveUp

      public void moveUp(I_CmsEditableGroupRow row)
      Moves the given row up.
      Parameters:
      row - the row to move
    • onEdit

      public void onEdit(I_CmsEditableGroupRow row)
    • remove

      public void remove(I_CmsEditableGroupRow row)
      Removes the given row.
      Parameters:
      row - the row to remove
    • removeAll

      public void removeAll()
    • setAddButtonVisible

      public void setAddButtonVisible(boolean visible)
      See Also:
      • org.opencms.ui.components.editablegroup.I_CmsEditableGroup#setAddButtonVisible(boolean)
    • setEditEnabled

      public void setEditEnabled(boolean enabled)
      Enables / disables edit button.
      Parameters:
      enabled - true if edit button should be enabled
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Sets the error message.

      Parameters:
      errorMessage - the error message
    • setRowBuilder

      public void setRowBuilder(CmsEditableGroup.I_RowBuilder rowBuilder)
      Sets the row builder.
      Parameters:
      rowBuilder - the row builder
    • setRowCaption

      public void setRowCaption(String rowCaption)
      Sets the row caption.

      Parameters:
      rowCaption - the row caption to set
    • hasError

      protected boolean hasError(com.vaadin.ui.Component component)
      Checks if the given group component has an error.

      Parameters:
      component - the component to check
      Returns:
      true if the component has an error