use of com.vaadin.data.sort.Sort in project VaadinUtils by rlsutton1.
the class ComboBoxWithSearchFieldChooserWindow method getPopupContent2.
@SuppressWarnings("unchecked")
public Component getPopupContent2() {
grid = new SearchableGrid<T, C>() {
/**
*/
private static final long serialVersionUID = 1L;
@Override
public GridHeadingPropertySetIfc<T> getHeadingPropertySet() {
return headingProps;
}
@Override
protected Filter getContainerFilter(String filterString, boolean advancedSearchActive) {
List<Filter> filters = new ArrayList<>();
if (baseFilters != null) {
filters.add(baseFilters);
}
if (filterString.length() > 0) {
filters.add(new SimpleStringFilter(sortColumns[0], filterString, true, false));
}
if (filters.size() == 0) {
return null;
}
return new And(filters.toArray(new Filter[] {}));
}
@Override
protected String getTitle() {
return null;
}
@Override
public C getContainer() {
return localContainer;
}
@Override
protected AbstractLayout getAdvancedSearchLayout() {
if (advancedSearchProvider == null) {
return null;
}
return advancedSearchProvider.getAdvancedSearchLayout();
}
@Override
protected AdvancedSearchListener getAdvancedSearchListener() {
return advancedSearchListener;
}
};
grid.init(caption, (Class<T>) type);
// grid.getGrid().removeHeaderRow(0);
ItemClickListener itemClickListener = new ItemClickListener() {
private static final long serialVersionUID = -4659382639878762429L;
@Override
public void itemClick(ItemClickEvent event) {
listener.selected(event.getItemId());
}
};
Sort sort = Sort.by(sortColumns[0]);
for (int i = 1; i < sortColumns.length; i++) {
sort.then(sortColumns[i]);
}
grid.sort(sort);
grid.setSelectionMode(SelectionMode.SINGLE);
grid.addItemClickListener(itemClickListener);
grid.setSizeFull();
holder = new VerticalLayout();
holder.setWidth("100%");
holder.setHeight("300");
holder.addComponent(grid);
return holder;
}
Aggregations