@Override public void sort(Object[] propertyId, boolean[] ascending) { sortProperties = propertyId; sortAscending = ascending; if (hasGroups()) { Sort sort = createSort(propertyId, ascending); doGroupSort(sort); } else { super.sort(propertyId, ascending); } }
@Override public Object getItem(Object itemId) { return ContainerTableItems.this.getItem(itemId); }
@Override public Object getItemValue(MetaPropertyPath property, Object itemId) { return ContainerTableItems.this.getItemValue(itemId, property); } };
@SuppressWarnings("unchecked") @Override public void setDatasource(CollectionDatasource datasource) { if (datasource == null) { setItems(null); } else { TableItems<E> tableItems; if (datasource instanceof CollectionDatasource.Sortable) { tableItems = new SortableDatasourceTableItems((CollectionDatasource.Sortable) datasource); } else { tableItems = new DatasourceTableItems(datasource); } setItems(tableItems); } }
@Override public List<GroupInfo> getGroupPath(E entity) { return getGroupDatasource().getGroupPath(entity); }
@SuppressWarnings("unchecked") @Override public boolean hasChildren(Object itemId) { return getTreeDatasource().hasChildren((K) itemId); }
@Override public Object getGroupProperty(GroupInfo groupId) { if (containsGroup(groupId)) { return groupId.getProperty(); } return null; }
@SuppressWarnings("unchecked") @Override protected ContainerTableItems createContainerTableSource(CollectionContainer container) { return new ContainerGroupTableItems(container); } }
@SuppressWarnings("unchecked") protected ContainerTableItems createContainerTableSource(CollectionContainer container) { return new ContainerTableItems(container); }
@Override public List<GroupInfo> rootGroups() { if (hasGroups()) { return Collections.unmodifiableList(roots); } return Collections.emptyList(); }
@Override public void resetSortOrder() { getSortableDatasource().resetSortOrder(); } }
public ContainerTableItems(CollectionContainer<E> container) { this.container = container; this.container.addItemChangeListener(this::containerItemChanged); this.container.addCollectionChangeListener(this::containerCollectionChanged); this.container.addItemPropertyChangeListener(this::containerItemPropertyChanged); this.aggregatableDelegate = createAggregatableDelegate(); }
@Override public void groupBy(Object[] properties) { getGroupDatasource().groupBy(properties); }
@SuppressWarnings("unchecked") @Override public Object getParent(Object itemId) { return getTreeDatasource().getParent((K) itemId); }
@Override public Object getGroupPropertyValue(GroupInfo groupId) { if (containsGroup(groupId)) { return groupId.getValue(); } return null; }
@Override public Collection<?> getGroupProperties() { return getGroupDatasource().getGroupProperties(); }
@SuppressWarnings("unchecked") @Override public Collection<?> getChildren(Object itemId) { return getTreeDatasource().getChildren((K) itemId); }
@Override public boolean containsGroup(GroupInfo groupId) { return getGroupDatasource().containsGroup(groupId); } }