use of com.vaadin.ui.AbstractLayout 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.ui.AbstractLayout in project VaadinUtils by rlsutton1.
the class SearchableGrid method buildSearchBar.
protected AbstractLayout buildSearchBar() {
final VerticalLayout layout = new VerticalLayout();
layout.setWidth(100, Unit.PERCENTAGE);
searchField.setWidth(100, Unit.PERCENTAGE);
searchBar = layout;
basicSearchLayout = new HorizontalLayout();
basicSearchLayout.setWidth(100, Unit.PERCENTAGE);
layout.addComponent(basicSearchLayout);
final AbstractLayout advancedSearch = buildAdvancedSearch();
if (advancedSearch != null) {
basicSearchLayout.addComponent(advancedSearchButton);
}
searchField.setInputPrompt("Search");
searchField.setId("searchField");
searchField.setTextChangeEventMode(TextChangeEventMode.LAZY);
searchField.setImmediate(true);
searchField.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(final TextChangeEvent event) {
filterString = event.getText().trim();
triggerFilter(filterString);
}
});
// clear button
final Button clear = createClearButton();
basicSearchLayout.addComponent(clear);
basicSearchLayout.setComponentAlignment(clear, Alignment.MIDDLE_LEFT);
basicSearchLayout.addComponent(searchField);
basicSearchLayout.setExpandRatio(searchField, 1.0f);
return layout;
}
use of com.vaadin.ui.AbstractLayout in project VaadinUtils by rlsutton1.
the class DashBoardView method createRenameButton.
private Button createRenameButton() {
Button rename = new Button(FontAwesome.EDIT);
rename.setDescription("Rename Dashboard");
rename.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
rename.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1058348590862935257L;
@Override
public void buttonClick(ClickEvent event) {
Tblportallayout portalLayout = (Tblportallayout) dashBoardSelector.getValue();
if (portalLayout == null) {
Notification.show("You must select a dashboard first", Type.ERROR_MESSAGE);
return;
}
final TextField primaryFocusField = new TextField("New Dashboard Name");
AbstractLayout form = new FormLayout();
form.setSizeFull();
form.addComponent(primaryFocusField);
InputFormDialogRecipient recipient = new InputFormDialogRecipient() {
@Override
public boolean onOK() {
Tblportallayout portalLayout = (Tblportallayout) dashBoardSelector.getValue();
container.removeItem(portalLayout);
portalLayout = JpaBaseDao.getGenericDao(Tblportallayout.class).findById(portalLayout.getId());
portalLayout.setName(primaryFocusField.getValue());
container.addBean(portalLayout);
dashBoardSelector.select(portalLayout);
dashboardsSlider.setCaption("Dashboards: " + portalLayout.getName());
return true;
}
@Override
public boolean onCancel() {
return true;
}
};
new InputFormDialog(UI.getCurrent(), "Rename " + portalLayout.getName() + " to:", primaryFocusField, form, recipient);
}
});
return rename;
}
use of com.vaadin.ui.AbstractLayout in project VaadinUtils by rlsutton1.
the class DashBoardView method createDashboard.
void createDashboard(Tblportallayout portalLayout) {
if (portalLayout == null) {
portalLayout = new Tblportallayout();
portalLayout.setName("Dashboard " + (getNumberOfPortals() + 1));
portalLayout.setAccount(getAccountId());
EntityManagerProvider.persist(portalLayout);
container.addBean(portalLayout);
}
if (loadJQuery) {
dashBoard = new DashBoard();
} else {
dashBoard = new DashBoardNoJQuery();
}
// this wrapper is necessary so the portals in the dashboard resize
// correctly
VerticalLayout wrapper = new VerticalLayout();
wrapper.setSizeFull();
wrapper.addComponent(dashBoard);
dashBoard.setSizeFull();
dashBoardHolderPanel.setContent(wrapper);
AbstractLayout dashboardToolBar = createToolBar(new DashBoardController(dashBoard), portalLayout.getGuid());
toolbarHolder.removeAllComponents();
toolbarHolder.addComponent(dashboardToolBar);
loading = true;
dashBoardSelector.setValue(portalLayout);
loadDashboard(portalLayout, new DashBoardController(dashBoard));
loading = false;
dashboardsSlider.setCaption(portalLayout.getName());
}
use of com.vaadin.ui.AbstractLayout in project VaadinUtils by rlsutton1.
the class BaseCrudView method buildSearchBar.
private void buildSearchBar() {
AbstractLayout group = new HorizontalLayout();
if (UI.getCurrent().getTheme().equals(ValoTheme.class.getSimpleName())) {
group = new CssLayout();
group.addStyleName("v-component-group");
}
group.setSizeFull();
searchLayout.addComponent(group);
AbstractLayout advancedSearch = buildAdvancedSearch();
if (advancedSearch != null) {
group.addComponent(advancedSearchButton);
}
Button clear = createClearButton();
group.addComponent(clear);
group.addComponent(createRefreshButton());
// searchField.setWidth("80%");
searchField.setId("CrudSearchField");
group.addComponent(searchField);
if (group instanceof HorizontalLayout) {
((HorizontalLayout) group).setExpandRatio(searchField, 1);
}
group.addComponent(searchButton);
searchButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
triggerFilter();
}
});
searchButton.setVisible(!dynamicSearch);
final OnEnterKeyHandler onEnterKeyHandler = new OnEnterKeyHandler() {
@Override
public void enterKeyPressed() {
if (!dynamicSearch) {
searchButton.click();
}
}
};
onEnterKeyHandler.attachTo(searchField);
}
Aggregations