Class CmsEditableGroup
java.lang.Object
org.opencms.ui.components.editablegroup.CmsEditableGroup
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Empty handler which shows or hides an 'Add' button to add new rows, depending on whether the group is empty.static class
Default implementation for row builder.static interface
Handles state changes when the group becomes empty/not empty.static interface
Interface for group row components that can have errors.static interface
Builds editable group rows by wrapping other components. -
Constructor Summary
ConstructorDescriptionCmsEditableGroup
(com.vaadin.ui.AbstractOrderedLayout container, com.google.common.base.Supplier<com.vaadin.ui.Component> componentFactory, String addButtonCaption) Creates a new instance.CmsEditableGroup
(com.vaadin.ui.AbstractOrderedLayout container, com.google.common.base.Supplier<com.vaadin.ui.Component> componentFactory, CmsEditableGroup.I_EmptyHandler emptyHandler) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRow
(com.vaadin.ui.Component component) Adds a row for the given component at the end of the group.void
Adds a new row after the given one.com.vaadin.ui.AbstractOrderedLayout
Gets the row container.com.vaadin.ui.Component.Listener
Gets the error listener.com.google.common.base.Supplier<com.vaadin.ui.Component>
Gets the factory used for creating new components.Returns the row caption.getRows()
Gets all rows.protected boolean
hasError
(com.vaadin.ui.Component component) Checks if the given group component has an error.void
init()
Initializes the multivalue group.void
Moves the given row down.void
Moves the given row up.void
void
Removes the given row.void
void
setAddButtonVisible
(boolean visible) void
setEditEnabled
(boolean enabled) Enables / disables edit button.void
setErrorMessage
(String errorMessage) Sets the error message.void
setRowBuilder
(CmsEditableGroup.I_RowBuilder rowBuilder) Sets the row builder.void
setRowCaption
(String rowCaption) Sets the row caption.
-
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 rowscomponentFactory
- the factory used to create new input fieldsplaceholder
- 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 rowscomponentFactory
- the factory used to create new input fieldsaddButtonCaption
- the caption for the button which is used to add a new row to an empty list
-
-
Method Details
-
addRow
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
Gets the row container.- Returns:
- the row container
-
getErrorListener
Gets the error listener.- Returns:
- t
-
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
Initializes the multivalue group. -
moveDown
Moves the given row down.- Parameters:
row
- the row to move
-
moveUp
Moves the given row up.- Parameters:
row
- the row to move
-
onEdit
-
remove
Removes the given row.- Parameters:
row
- the row to remove
-
removeAll
-
setAddButtonVisible
- See Also:
-
org.opencms.ui.components.editablegroup.I_CmsEditableGroup#setAddButtonVisible(boolean)
-
setEditEnabled
Enables / disables edit button.- Parameters:
enabled
- true if edit button should be enabled
-
setErrorMessage
Sets the error message.- Parameters:
errorMessage
- the error message
-
setRowBuilder
Sets the row builder.- Parameters:
rowBuilder
- the row builder
-
setRowCaption
Sets the row caption.- Parameters:
rowCaption
- the row caption to set
-
hasError
Checks if the given group component has an error.- Parameters:
component
- the component to check- Returns:
- true if the component has an error
-