use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class CubaTokenList method initField.
protected void initField() {
if (editor == null) {
editor = new CssLayout();
editor.setWidthUndefined();
editor.setStyleName(TOKENLIST_EDITOR_STYLENAME);
}
editor.removeAllComponents();
if (!owner.isSimple()) {
owner.lookupPickerField.setWidthAuto();
editor.addComponent(WebComponentsHelper.getComposition(owner.lookupPickerField));
}
owner.lookupPickerField.setVisible(!owner.isSimple());
owner.addButton.setVisible(owner.isSimple());
owner.addButton.setStyleName(ADD_BTN_STYLENAME);
if (addButtonSub != null) {
addButtonSub.remove();
}
if (!owner.isSimple()) {
addButtonSub = owner.addButton.addClickListener(e -> {
if (owner.isEditableWithParent()) {
owner.addValueFromLookupPickerField();
}
owner.addButton.focus();
});
} else {
addButtonSub = owner.addButton.addClickListener(e -> owner.openLookup(() -> owner.addButton.focus()));
}
Button vAddButton = owner.addButton.unwrapOrNull(Button.class);
if (vAddButton != null) {
editor.addComponent(vAddButton);
}
owner.clearButton.setVisible(owner.clearEnabled);
owner.clearButton.setStyleName(CLEAR_BTN_STYLENAME);
if (clearBtnClickSubscription != null) {
clearBtnClickSubscription.remove();
}
clearBtnClickSubscription = owner.clearButton.addClickListener(e -> {
clearValue();
owner.clearButton.focus();
});
com.vaadin.ui.Button vClearButton = owner.clearButton.unwrapOrNull(com.vaadin.ui.Button.class);
editor.addComponent(vClearButton);
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class CubaFileUploadWrapper method initLayout.
protected void initLayout(UploadComponent uploadComponent) {
this.uploadButton = uploadComponent;
container = new CssLayout();
container.addStyleName("c-fileupload-container");
fileNameButton = new CubaButton();
fileNameButton.setWidth(100, Unit.PERCENTAGE);
fileNameButton.addStyleName(ValoTheme.BUTTON_LINK);
fileNameButton.addStyleName("c-fileupload-filename");
setFileNameButtonCaption(null);
container.addComponent(fileNameButton);
container.addComponent(uploadComponent);
clearButton = new CubaButton("");
clearButton.setStyleName("c-fileupload-clear");
container.addComponent(clearButton);
setShowClearButton(showClearButton);
setShowFileName(false);
setWidthUndefined();
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class WindowBreadCrumbs method createLinksLayout.
protected Layout createLinksLayout() {
CssLayout linksLayout = new CssLayout();
linksLayout.setPrimaryStyleName("c-breadcrumbs");
return linksLayout;
}
use of com.vaadin.ui.CssLayout 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);
}
use of com.vaadin.ui.CssLayout in project charts by vaadin.
the class ChartsDemoUI method init.
@Override
protected void init(VaadinRequest request) {
initGATracker();
tabSheet = new TabSheet();
tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
@Override
public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
com.vaadin.ui.JavaScript.eval("setTimeout(function(){prettyPrint();},300);");
}
});
tabSheet.setSizeFull();
tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
Link homepage = new Link("Home Page", new ExternalResource("https://vaadin.com/components/vaadin-charts"));
Link javadoc = new Link("JavaDoc", new ExternalResource("https://vaadin.com/api/com.vaadin/vaadin-charts/" + getVersion() + "/"));
Link manual = new Link("Manual", new ExternalResource("https://vaadin.com/docs/v8/charts/charts-overview.html"));
Link pricing = new Link("Pricing", new ExternalResource("https://vaadin.com/pricing"));
Label version = new Label("Version " + getVersion());
version.addStyleName("version");
HorizontalLayout links = new HorizontalLayout(homepage, pricing, javadoc, manual);
links.setSpacing(true);
links.addStyleName("links");
final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
horizontalSplitPanel.setSecondComponent(tabSheet);
horizontalSplitPanel.setSplitPosition(300, Unit.PIXELS);
horizontalSplitPanel.addStyleName("main-layout");
ChartOptions.get().setTheme(new ValoLightTheme());
themeSelector = new ComboBox("Charts Theme:");
themeSelector.addStyleName("theme-selector");
themeSelector.addStyleName(ValoTheme.COMBOBOX_SMALL);
themeSelector.setTextInputAllowed(false);
com.vaadin.addon.charts.model.style.Theme defaultTheme = new ValoLightTheme();
Map<com.vaadin.addon.charts.model.style.Theme, String> mapThemes = new HashMap<>();
com.vaadin.addon.charts.model.style.Theme[] themes = new com.vaadin.addon.charts.model.style.Theme[] { defaultTheme, new ValoDarkTheme(), new VaadinTheme(), new HighChartsDefaultTheme(), new GridTheme(), new GrayTheme(), new SkiesTheme() };
mapThemes.put(themes[0], "Valo Light");
mapThemes.put(themes[1], "Valo Dark");
mapThemes.put(themes[2], "Vaadin");
mapThemes.put(themes[3], "HighCharts");
mapThemes.put(themes[4], "Grid");
mapThemes.put(themes[5], "Gray");
mapThemes.put(themes[6], "Skies");
themeSelector.setEmptySelectionAllowed(false);
themeSelector.setItems(themes);
themeSelector.setSelectedItem(defaultTheme);
themeSelector.setItemCaptionGenerator(mapThemes::get);
themeSelector.addSelectionListener(e -> {
ChartOptions.get().setTheme(e.getValue());
});
final HierarchicalContainer container = getContainer();
VerticalLayout content = new VerticalLayout();
content.setSpacing(true);
content.setMargin(false);
Label logo = new Label("Vaadin Charts for Vaadin 8");
logo.setWidth("100%");
logo.addStyleName("h3");
logo.addStyleName("logo");
TextField filterField = new TextField();
filterField.setPlaceholder("Filter examples");
filterField.setIcon(FontAwesome.SEARCH);
filterField.addStyleName("filter");
filterField.setWidth("100%");
filterField.addValueChangeListener(e -> {
container.removeAllContainerFilters();
String text = e.getValue();
if (text != null && !text.isEmpty()) {
expandForFiltering();
container.addContainerFilter("searchName", text, true, false);
} else {
restoreExpandedStates();
}
});
tree = new Tree();
tree.setImmediate(true);
tree.setContainerDataSource(container);
tree.setItemCaptionPropertyId("displayName");
tree.setNullSelectionAllowed(false);
tree.setWidth("100%");
tree.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
Object value = event.getProperty().getValue();
if (value instanceof Class) {
updateTabSheet((Class) value);
} else {
tree.expandItemsRecursively(value);
}
}
});
Button trial = new Button("Start Free Trial");
trial.addStyleName(ValoTheme.BUTTON_PRIMARY);
trial.addStyleName(ValoTheme.BUTTON_TINY);
trial.addClickListener(e -> {
getUI().getPage().open("https://vaadin.com/trial", "_blank");
});
content.addComponents(logo, links, trial, filterField, tree, version);
content.setComponentAlignment(trial, Alignment.MIDDLE_CENTER);
horizontalSplitPanel.setFirstComponent(content);
selectItem();
Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {
@Override
public void uriFragmentChanged(Page.UriFragmentChangedEvent event) {
selectItem();
}
});
setContent(new CssLayout() {
{
setSizeFull();
addComponent(horizontalSplitPanel);
addComponent(themeSelector);
}
});
if (tracker != null) {
tracker.trackPageview("/charts");
}
}
Aggregations