Interface Ordered<E extends Element, B extends TypedBuilder<E,B>, S extends IsElement<? extends HTMLElement>>
- Type Parameters:
E- the type of the main elementB- the type of the builder for chaining methodsS- the type of components being ordered
- All Superinterfaces:
HasItems<E,,B, S> IsElement<E>,Iterable<S>,TypedBuilder<E,B>
- All Known Implementing Classes:
DataList,DescriptionList,List,MenuList,SimpleList,SimpleListGroup,Tbody
public interface Ordered<E extends Element, B extends TypedBuilder<E,B>, S extends IsElement<? extends HTMLElement>>
extends HasItems<E,B,S>
The Ordered interface can be implemented by components that maintain its elements in a specific order. It extends the
B>, S extends IsElement<? extends HTMLElement>> attribute. The order is maintained as elements are
added to the component.
HasItems interface. By default, the order is determined by the defaultOrder() method which in turn
determines the order based on the elements data "order"<E extends Element, B extends TypedBuilder<E,-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddOrdered(ElementContainerMethods<?, ?> container, S item) Adds an item to the specified container in a predefined order.Retrieves the comparator used for ordering elements in a component.default Comparator<S> Provides a default comparator for ordering elements based on their "order"<E extends Element, B extends TypedBuilder<E,B>, S extends IsElement<? extends HTMLElement>> dataset value. default Bordered()Orders the elements contained in the component using the default comparator.ordered(Comparator<S> comparator) Orders the elements contained in the component using the specified comparator.Methods inherited from interface org.patternfly.component.HasItems
add, addItem, addItems, clear, contains, isEmpty, item, items, onAdd, onRemove, removeItem, sizeMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.jboss.elemento.TypedBuilder
that
-
Field Details
-
DATA_ORDER
- See Also:
-
-
Method Details
-
addOrdered
Adds an item to the specified container in a predefined order. If a comparator is provided, the order is determined based on the comparator; otherwise, the item is added directly to the container.- Parameters:
container- the container to which the item should be addeditem- the item to be added to the container
-
defaultOrder
Provides a default comparator for ordering elements based on their "order"<E extends Element, B extends TypedBuilder<E,B>, S extends IsElement<? extends HTMLElement>> dataset value. - Returns:
- a comparator that compares elements using the "order"<E extends Element, B extends TypedBuilder<E,
B>, S extends IsElement<? extends HTMLElement>> attribute from their dataset
-
ordered
Orders the elements contained in the component using the default comparator. The default comparator is based on the "order"<E extends Element, B extends TypedBuilder<E,B>, S extends IsElement<? extends HTMLElement>> dataset attribute of the elements. - Returns:
- the builder instance with the elements ordered
-
ordered
Orders the elements contained in the component using the specified comparator. The comparator determines the order in which the elements are arranged.- Parameters:
comparator- the comparator used to define the ordering of the elements- Returns:
- the builder instance with the elements ordered
-
comparator
Comparator<S> comparator()Retrieves the comparator used for ordering elements in a component.- Returns:
- the comparator that determines the order of elements
-