List of usage examples for com.vaadin.ui.themes ValoTheme WINDOW_BOTTOM_TOOLBAR
String WINDOW_BOTTOM_TOOLBAR
To view the source code for com.vaadin.ui.themes ValoTheme WINDOW_BOTTOM_TOOLBAR.
Click Source Link
From source file:org.jumpmind.vaadin.ui.common.PromptDialog.java
License:Open Source License
public PromptDialog(String caption, String text, String defaultValue, final IPromptListener promptListener) { setCaption(caption);//from w w w. j ava 2 s.c o m setModal(true); setResizable(false); setSizeUndefined(); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); setContent(layout); if (isNotBlank(text)) { layout.addComponent(new Label(text)); } final TextField field = new TextField(); field.setWidth(100, Unit.PERCENTAGE); field.setNullRepresentation(""); field.setValue(defaultValue); if (defaultValue != null) { field.setSelectionRange(0, defaultValue.length()); } layout.addComponent(field); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSpacing(true); buttonLayout.setWidth(100, Unit.PERCENTAGE); Label spacer = new Label(" "); buttonLayout.addComponent(spacer); buttonLayout.setExpandRatio(spacer, 1); Button cancelButton = new Button("Cancel"); cancelButton.setClickShortcut(KeyCode.ESCAPE); cancelButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(PromptDialog.this); } }); buttonLayout.addComponent(cancelButton); Button okButton = new Button("Ok"); okButton.setStyleName(ValoTheme.BUTTON_PRIMARY); okButton.setClickShortcut(KeyCode.ENTER); okButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (promptListener.onOk(field.getValue())) { UI.getCurrent().removeWindow(PromptDialog.this); } } }); buttonLayout.addComponent(okButton); layout.addComponent(buttonLayout); field.focus(); }
From source file:org.jumpmind.vaadin.ui.common.ReadOnlyTextAreaDialog.java
License:Open Source License
public ReadOnlyTextAreaDialog(final String title, final String value, Table table, Object[] primaryKeys, IDatabasePlatform platform, boolean isEncodedInHex, boolean isLob) { super(title); this.table = table; this.primaryKeys = primaryKeys; this.platform = platform; this.column = table == null ? null : table.getColumnWithName(title); wrapper = new VerticalLayout(); wrapper.setMargin(true);/*ww w. j av a2 s . c o m*/ wrapper.setSizeFull(); textField = new TextArea(); textField.setSizeFull(); textField.setWordwrap(false); wrapper.addComponent(textField); addComponent(wrapper, 1); buttonLayout = new HorizontalLayout(); buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSpacing(true); buttonLayout.setWidth(100, Unit.PERCENTAGE); addComponent(buttonLayout); if (value != null && isEncodedInHex) { displayBox = new ComboBox("Display As"); displayBox.addItem("Hex"); displayBox.addItem("Text"); displayBox.addItem("Decimal"); displayBox.setNullSelectionAllowed(false); displayBox.select("Hex"); displayBox.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { updateTextField((String) displayBox.getValue(), value); } }); buttonLayout.addComponent(displayBox); } if (table != null && isLob) { buildUploadButton(title, value); buildDownloadButton(title); } Label spacer = new Label(); buttonLayout.addComponent(spacer); buttonLayout.setExpandRatio(spacer, 1); Button closeButton = buildCloseButton(); buttonLayout.addComponent(closeButton); buttonLayout.setComponentAlignment(closeButton, Alignment.BOTTOM_RIGHT); textField.setValue(value); textField.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { if (displayBox != null) { updateTextField((String) displayBox.getValue(), value); } else { textField.setValue(value); } } }); }
From source file:org.jumpmind.vaadin.ui.common.ResizableWindow.java
License:Open Source License
protected HorizontalLayout buildButtonFooter(Button[] toTheLeftButtons, Button... toTheRightButtons) { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true);//www. j av a2 s .c om footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); if (toTheLeftButtons != null) { footer.addComponents(toTheLeftButtons); } Label footerText = new Label(""); footerText.setSizeUndefined(); footer.addComponents(footerText); footer.setExpandRatio(footerText, 1); if (toTheRightButtons != null) { footer.addComponents(toTheRightButtons); } return footer; }
From source file:org.openthinclient.web.pkgmngr.ui.view.PackageDetailsWindow.java
public PackageDetailsWindow(PackageDetailsPresenter.View target, Component viewComponent) { this.target = target; final VerticalLayout contents = new VerticalLayout(); contents.setMargin(true);//ww w . j a v a 2s. c o m contents.addComponent(viewComponent); contents.setExpandRatio(viewComponent, 1); contents.setSizeFull(); final HorizontalLayout footer = new HorizontalLayout(); footer.addStyleNames(ValoTheme.WINDOW_BOTTOM_TOOLBAR); actionBar = new CssLayout(); footer.addComponent(actionBar); footer.setWidth("100%"); footer.setExpandRatio(actionBar, 1); footer.setComponentAlignment(actionBar, Alignment.TOP_RIGHT); final Button closeButton = new Button(); closeButton.addStyleNames(ValoTheme.BUTTON_QUIET); closeButton.setIcon(VaadinIcons.CLOSE); closeButton.setCaption("Close"); closeButton.addClickListener(e -> hide()); footer.addComponent(closeButton); contents.addComponent(footer); setContent(contents); }
From source file:org.tylproject.vaadin.addon.fields.drilldown.DrillDownWindow.java
License:Apache License
public Layout makeLayout(ZoomField<T> field) { btnClose.setStyleName(ValoTheme.BUTTON_PRIMARY); content.addStyleName(ValoTheme.PANEL_BORDERLESS); Component dialogContents = field.getZoomDialog().getDialogContents(); content.setContent(dialogContents);//from w ww. j ava2 s. c o m content.setSizeFull(); buttonBar.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonBar.setWidth("100%"); buttonBar.setSpacing(true); buttonBar.setExpandRatio(spacer, 1); rootLayout.setSizeFull(); rootLayout.setExpandRatio(content, 1); rootLayout.setMargin(new MarginInfo(true, false, true, false)); return rootLayout; }
From source file:org.tylproject.vaadin.addon.fields.search.SearchWindow.java
License:Apache License
public SearchWindow(final SearchForm searchForm) { this.searchForm = searchForm; searchForm.setSizeUndefined();/*from ww w .jav a 2 s.c o m*/ this.setContent(rootLayout); setClosable(false); setModal(true); setDraggable(false); setResizable(false); rootLayout.setMargin(true); btnApply.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonLayout.setSizeFull(); buttonLayout.setExpandRatio(spacer, 1f); rootLayout.addComponents(searchForm, buttonLayout); btnApply.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { apply(); } }); btnClear.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { clear(); } }); btnCancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { cancel(); } }); }
From source file:org.tylproject.vaadin.addon.fields.zoom.ZoomWindow.java
License:Apache License
public void show() { buttonBar.removeAllComponents();/*w ww . java2s . c o m*/ // initialize buttons depending on null selection option // should be moved somewhere else, but it cannot be done during initialization if (field.isNullSelectionEnabled()) { buttonBar.addComponents(spacer, btnSelect, btnSelectNone, btnCancel); btnSelectNone.setClickShortcut(ShortcutAction.KeyCode.ENTER, ShortcutAction.ModifierKey.SHIFT); } else { buttonBar.addComponents(spacer, btnSelect, btnCancel); } buttonBar.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); buttonBar.setWidth("100%"); buttonBar.setSpacing(true); buttonBar.setExpandRatio(spacer, 1); field.getZoomDialog().show(this.field.getValue()); UI.getCurrent().addWindow(this); center(); focus(); }
From source file:org.vaadin.addons.core.window.DialogWindow.java
License:Apache License
private VerticalLayout buildContent(String title, VaadinIcons type, Component content, ButtonType[] buttonTypes) {// ww w. j av a2s. com VerticalLayout root = new VerticalLayout(); root.setMargin(false); root.setSpacing(false); float width = -1; float height = 0; if (title != null) { HorizontalLayout header = new HorizontalLayout(); header.setMargin(true); header.setHeightUndefined(); header.setWidth("100%"); header.addStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); Label l = new Label("<font size=\"4\">" + title + "</font>", ContentMode.HTML); width = l.getWidth(); header.addComponent(l); header.setComponentAlignment(l, Alignment.MIDDLE_LEFT); if (type != null) { Label i = new Label(type.getHtml(), ContentMode.HTML); header.addComponent(i); header.setComponentAlignment(i, Alignment.MIDDLE_RIGHT); } height = header.getHeight(); root.addComponent(header); } if (content != null) { content.setSizeFull(); HorizontalLayout contentRoot = new HorizontalLayout(content); contentRoot.setMargin(true); root.addComponent(contentRoot); height = height + contentRoot.getHeight(); } HorizontalLayout footer = new HorizontalLayout(); footer.setHeightUndefined(); footer.setWidth("100%"); footer.setMargin(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); HorizontalLayout buttons = new HorizontalLayout(); if (buttonTypes != null) { Stream.of(buttonTypes).forEach(buttonType -> { Button b = new Button(buttonType.getCaption()); if (buttonType.getIcon() != null) { b.setIcon(buttonType.getIcon()); } if (buttonType.getDescription() != null) { b.setDescription(buttonType.getDescription()); } if (buttonType.getStyle() != null) { b.addStyleName(buttonType.getStyle()); } b.addClickListener(event -> buttonType.getActions().forEach(buttonAction -> { ButtonTypeClickEvent event1 = new ButtonTypeClickEvent(buttonType, DialogWindow.this); buttonAction.getListener().buttonClick(event1); })); buttons.addComponent(b); }); } buttons.setSizeUndefined(); buttons.setMargin(false); buttons.setSpacing(true); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); if (buttons.getWidth() > width) { width = buttons.getWidth(); } root.addComponent(footer); root.setComponentAlignment(footer, Alignment.BOTTOM_LEFT); height = height + footer.getHeight(); root.setHeight(height, Unit.PIXELS); root.setWidth(width, Unit.PIXELS); return root; }