[ Web Proxy ]
URL:
Viewing: https://patternfly-java.github.io/apidocs/org/patternfly/component/HasItems.html [Back]  [Original]

HasItems (PatternFly Java 0.9.7 API)
Contents 
  1. Description
  2. Method Summary
  3. Method Details
    1. addItems(Iterable, Function)
    2. addItem(S)
    3. add(S)
    4. onAdd(AddItemHandler)
    5. items()
    6. size()
    7. isEmpty()
    8. contains(String)
    9. item(String)
    10. updateItem(T, Function)
    11. updateItem(String)
    12. updateItem(S)
    13. onUpdate(UpdateItemHandler)
    14. replaceItemElement(S, BiConsumer)
    15. removeItem(String)
    16. onRemove(RemoveItemHandler)
    17. clear()
Hide sidebar Hide sidebar [Hide sidebar]Show sidebar [Show sidebar] Show sidebar

Interface HasItems<E extends Element, C extends HasItems<E,C,S>, S extends HasIdentifier<? extends HTMLElement, ?>>

Type Parameters:
E - the element type of the main component
C - the type of the main component
S - the type of the subcomponent (representing an item)
All Superinterfaces:
IsElement<E>, Iterable<S>, TypedBuilder<E,C>
All Known Subinterfaces:
Ordered<E,C,S>
All Known Implementing Classes:
Accordion, ActionList, ActionListGroup, AlertGroup, Breadcrumb, DataList, DescriptionList, ExpandableNavigationGroup, Finder, FinderColumn, Form, JumpLinks, JumpLinksList, LabelGroup, List, MenuList, Navigation, NavigationGroup, NotificationDrawerList, ProgressStepper, SimpleList, SimpleListGroup, Tabs, Tbody, TemplateComponent, ToggleGroup, ToolbarContent, ToolbarFilterContent, ToolbarGroup, ToolbarToggleGroup, Tr, TreeView, TreeViewItem, Wizard, WizardNav

public interface HasItems<E extends Element, C extends HasItems<E,C,S>, S extends HasIdentifier<? extends HTMLElement, ?>> extends Iterable<S>, TypedBuilder<E,C>, IsElement<E>
The HasItems interface represents a component that can contain a collection of items. It provides methods for adding, removing, and manipulating items within the component.

The child component must implement HasIdentifier and often also implements ComponentContext.

CopyCopy snippet [Copy snippet]
record User(String id, String name, boolean valid) {}

// construction time
List<User> users = emptyList();
DataList dl = dataList()
        .addItems(users, user -> dataListItem(user.id())
                .store("user", user)
                .addCell(dataListCell().icon(user()))
                .addCell(dataListCell()
                        .add(span()
                                .id(user.id())
                                .text(user.name()))));

// later, responding to an event or something similar
for (DataListItem item : dl) {
    User user = item.get("user");
    item.toggle("invalid-user", !user.valid());
}


Web Proxy Viewer  |  New URL  |  Original Page