use of com.vaadin.event.ItemClickEvent.ItemClickListener 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;
}
use of com.vaadin.event.ItemClickEvent.ItemClickListener in project VaadinUtils by rlsutton1.
the class TwinColumnSearchableSelect method createAvailableTable.
private void createAvailableTable() {
availableTable = new SearchableSelectableEntityTable<C>(this.getClass().getSimpleName()) {
private static final long serialVersionUID = 1L;
@Override
public HeadingPropertySet getHeadingPropertySet() {
return new HeadingPropertySet.Builder<C>().addColumn(availableColumnHeader, itemLabel).build();
}
@Override
public Filterable getContainer() {
return availableContainer;
}
@Override
protected Filter getContainerFilter(String filterString, boolean advancedSearchActive) {
Filter searchFilter = null;
if (filterString != null && filterString.length() > 0) {
searchFilter = getSearchFilter(filterString);
}
return NullFilter.and(baselineFilter, selectedFilter, searchFilter);
}
@Override
protected String getTitle() {
return "";
}
};
availableTable.addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
if (event.isDoubleClick()) {
addButton.click();
}
}
});
availableTable.disableSelectable();
availableTable.setWidth(200, Unit.PIXELS);
availableTable.setHeight(300, Unit.PIXELS);
}
use of com.vaadin.event.ItemClickEvent.ItemClickListener in project VaadinUtils by rlsutton1.
the class TwinColumnSelect method createAvailableGrid.
@SuppressWarnings("deprecation")
protected void createAvailableGrid() {
createAvailableContainer();
// TODO: Add proper uniqueId
availableGrid = new SearchableGrid<C, JPAContainer<C>>(this.getClass().getSimpleName(), itemClass) {
private static final long serialVersionUID = 1L;
@Override
public GridHeadingPropertySet<C> getHeadingPropertySet() {
return createAvailableHeadings();
}
@Override
public JPAContainer<C> getContainer() {
return availableContainer;
}
@Override
protected Filter getContainerFilter(String filterString, boolean advancedSearchActive) {
Filter searchFilter = null;
if (filterString != null && filterString.length() > 0) {
searchFilter = getSearchFilter(filterString);
}
return NullFilter.and(baselineFilter, selectedFilter, searchFilter);
}
@Override
protected String getTitle() {
return null;
}
};
// Needs to be here after availableContainer creation,
// otherwise sorting goes away
sortAvailableContainer();
availableGrid.addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
if (event.isDoubleClick()) {
addButton.click();
}
}
});
availableGrid.setWidth(DEFAULT_COLUMN_WIDTH, Unit.PIXELS);
availableGrid.setHeight(DEFAULT_COLUMN_HEIGHT, Unit.PIXELS);
}
use of com.vaadin.event.ItemClickEvent.ItemClickListener in project VaadinUtils by rlsutton1.
the class TwinColumnSelect method createSelectedGrid.
private void createSelectedGrid() {
selectedGrid = new Grid();
selectedGrid.setContainerDataSource(createSelectedContainer());
selectedGrid.setWidth(DEFAULT_COLUMN_WIDTH, Unit.PIXELS);
selectedGrid.setHeight(DEFAULT_COLUMN_HEIGHT, Unit.PIXELS);
selectedGrid.addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
if (event.isDoubleClick()) {
removeButton.click();
}
}
});
createSelectedHeadings().applyToGrid(selectedGrid);
// initialised = true;
}
Aggregations