main.setBodyBorder(false);
main.setLayout(new FitLayout());
main.setHeaderVisible(false);
ToolBar bar = new ToolBar();
bar.add(new LabelToolItem("Filter:"));
StoreFilterField<BeanModel> field = new StoreFilterField<BeanModel>() {
@Override
protected boolean doSelect(Store<BeanModel> store, BeanModel parent, BeanModel record, String property,
String filter) {
Photo photo = record.getBean();
String name = photo.getName().toLowerCase();
if (name.indexOf(filter.toLowerCase()) != -1) {
return true;
}
return false;
}
@Override
protected void onFilter() {
super.onFilter();
view.getSelectionModel().select(0, false);
}
};
field.setWidth(100);
field.bind(store);
bar.add(field);
bar.add(new SeparatorToolItem());
bar.add(new LabelToolItem("Sort By:"));
sort = new SimpleComboBox<String>();
sort.setTriggerAction(TriggerAction.ALL);
sort.setEditable(false);
sort.setForceSelection(true);