List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:de.decidr.ui.view.windows.StartConfigurationWindow.java
License:Apache License
private void init() { VerticalLayout mainVerticalLayout = new VerticalLayout(); HorizontalLayout buttonHorizontalLayout = new HorizontalLayout(); checkBox = new CheckBox(); this.setContent(mainVerticalLayout); this.setCaption("Start configuration window"); this.setModal(true); this.setWidth("800px"); this.setHeight("500px"); this.setResizable(false); mainVerticalLayout.setSpacing(true); mainVerticalLayout.setMargin(true);// w ww. j a v a 2 s .c om if (workflow.getVariables() != null && workflow.getVariables().getVariable().size() > 0) { configVariableForm = new ConfigVariableForm(workflow.getVariables()); configVariableForm.setCaption("Configuration variables"); configVariableForm.setWriteThrough(false); configVariableForm.setInvalidCommitted(false); } if (workflow.getRoles() != null) { configRoles = new ConfigRoles(workflow.getRoles()); } if (configRoles != null && configVariableForm != null) { // Set up split panel. SplitPanel splitPanel = new SplitPanel(); splitPanel.setOrientation(SplitPanel.ORIENTATION_HORIZONTAL); splitPanel.setSplitPosition(450, Sizeable.UNITS_PIXELS); splitPanel.setHeight("400px"); splitPanel.setLocked(true); splitPanel.setFirstComponent(configRoles); splitPanel.setSecondComponent(configVariableForm); mainVerticalLayout.addComponent(splitPanel); } else { // At least one of the components is unneeded, so no split panel this.setWidth("600px"); if (configRoles != null) { mainVerticalLayout.addComponent(configRoles); } else if (configVariableForm != null) { mainVerticalLayout.addComponent(configVariableForm); } } okButton = new Button("OK", new SaveStartConfigurationAction(configRoles, configVariableForm, tConfiguration, workflowModelId, checkBox.booleanValue())); cancelButton = new Button("Cancel", new HideDialogWindowAction()); mainVerticalLayout.addComponent(buttonHorizontalLayout); buttonHorizontalLayout.setSpacing(true); buttonHorizontalLayout.addComponent(checkBox); checkBox.setCaption("Start Immediately"); buttonHorizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT); buttonHorizontalLayout.addComponent(okButton); buttonHorizontalLayout.addComponent(cancelButton); }
From source file:de.escidoc.admintool.view.admintask.AbstractAdminTaskView.java
License:Open Source License
private void init() { setCompositionRoot(mainLayout);/* ww w . j a v a2 s . co m*/ cssLayout.setHeight(100, UNITS_PERCENTAGE); cssLayout.setMargin(true); cssLayout.setWidth(ViewConstants._100_PERCENT); mainLayout.addComponent(cssLayout); final HorizontalLayout texts = new HorizontalLayout(); texts.setSpacing(true); texts.setWidth(ViewConstants._100_PERCENT); texts.setMargin(false, false, true, false); cssLayout.addComponent(texts); }
From source file:de.escidoc.admintool.view.EscidocPagedTable.java
License:Open Source License
public HorizontalLayout createControls() { // final Label itemsPerPageLabel = new Label("Items per page:"); final Label pageLabel = new Label("Page: ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); final Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { @SuppressWarnings("boxing") final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page);/*from w ww . j a v a 2 s.co m*/ } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); final HorizontalLayout controlBar = new HorizontalLayout(); final HorizontalLayout pageSize = new HorizontalLayout(); final HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(0); } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(final ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(BaseTheme.BUTTON_LINK); previous.setStyleName(BaseTheme.BUTTON_LINK); next.setStyleName(BaseTheme.BUTTON_LINK); last.setStyleName(BaseTheme.BUTTON_LINK); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @SuppressWarnings("boxing") public void pageChanged(final PagedTableChangeEvent event) { previous.setEnabled(true); next.setEnabled(true); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); } }); return controlBar; }
From source file:de.escidoc.admintool.view.MainView.java
License:Open Source License
private void show(final Button button) { final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setMargin(true);/* www .j av a2 s . c o m*/ layout.addComponent(new Label("eSciDoc AdminTool " + "1.1.2-SNAPSHOT", Label.CONTENT_XHTML)); layout.addComponent(new Label("|", Label.CONTENT_XHTML)); layout.addComponent( new Label("<b>User: " + currentUser.getProperties().getLoginName() + "</b>", Label.CONTENT_XHTML)); layout.addComponent(new Label("|", Label.CONTENT_XHTML)); layout.addComponent(button); toolbar = factory.createToolbar(layout); }
From source file:de.escidoc.admintool.view.user.UserAddView.java
License:Open Source License
private Component createLayout(final String nameLabel, final AbstractTextField textField, final int leftMargin, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(37, UNITS_PIXELS);/*w w w. java 2 s .co m*/ hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + nameLabel + Constants.P; Label l; hor.addComponent(l = new Label(text, Label.CONTENT_XHTML)); l.setWidth(leftMargin + Constants.PX); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(textField); hor.setComponentAlignment(textField, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.user.UserEditForm.java
License:Open Source License
private VerticalLayout createLayout(final String rolesLabel, final Table table, final int labelWidth, final int roleListHeight, final boolean b, final Button[] buttons) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setHeight(roleListHeight + Constants.PX); hLayout.addComponent(new Label(" ")); final Label textLabel = new Label(Constants.P_ALIGN_RIGHT + rolesLabel + " " + Constants.P, Label.CONTENT_XHTML); textLabel.setSizeUndefined();//ww w.j a va2s.co m textLabel.setWidth(labelWidth + Constants.PX); hLayout.addComponent(textLabel); hLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); hLayout.addComponent(table); hLayout.setComponentAlignment(table, Alignment.MIDDLE_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final VerticalLayout vLayout = new VerticalLayout(); vLayout.addComponent(hLayout); final HorizontalLayout hl = new HorizontalLayout(); final Label la = new Label(" ", Label.CONTENT_XHTML); la.setSizeUndefined(); la.setWidth(labelWidth + Constants.PX); hl.addComponent(la); for (final Button button : buttons) { hl.addComponent(button); } vLayout.addComponent(hl); hLayout.setSpacing(false); return vLayout; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method. Puts a blank in front of a component. * //from ww w . j av a 2 s .c o m * @param label * The label in front of the control. * @param comp * The component to display. * @param width * the fixed size of the label. The parameter has to be in CSS style, i.e. 400px for instance. * @param required * should it be marked with an asterisk. * @return The component in an horizontal layout. A blank in front and afterwards is inserted. */ public static synchronized HorizontalLayout create(final String label, final Component comp, final int width, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(Constants.DEFAULT_HEIGHT); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + label + Constants.P; Label l; hor.addComponent(l = new Label(text, Label.CONTENT_XHTML)); l.setSizeUndefined(); l.setWidth(width + Constants.PX); hor.setComponentAlignment(l, Alignment.BOTTOM_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(comp); hor.setComponentAlignment(comp, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method. Puts a blank in front of a component. * //from ww w .j av a2s .co m * @param label * The label in front of the control. * @param comp * The component to display. * @param width * the fixed size of the label. The parameter has to be in CSS style, i.e. 400px for instance. * @param required * should it be marked with an asterisk. * @return The component in an horizontal layout. A blank in front and afterwards is inserted. */ public static synchronized HorizontalLayout create(final String label, final CheckBox comp, final int width, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(Constants.DEFAULT_HEIGHT); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + label + Constants.P; Label l; hor.addComponent(l = new Label(text, Label.CONTENT_XHTML)); l.setSizeUndefined(); l.setWidth(width + Constants.PX); hor.setComponentAlignment(l, Alignment.MIDDLE_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(comp); hor.setComponentAlignment(comp, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method. Puts a blank in front of a component. * //from w w w .j a v a2 s . co m * @param label * The label in front of the control. * @param comp * The component to display. * @param width * the fixed size of the label. The parameter has to be in CSS style, i.e. 400px for instance. * @param height * the height of the layout * @param required * should it be marked with an asterisk. * @return The component in an horizontal layout. A blank in front and afterwards is inserted. */ public static synchronized HorizontalLayout create(final String label, final Component comp, final int width, final int height, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(height + Constants.PX); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + label + Constants.P; Label l; hor.addComponent(l = new Label(text, Label.CONTENT_XHTML)); l.setSizeUndefined(); l.setWidth(width + Constants.PX); hor.setComponentAlignment(l, Alignment.MIDDLE_RIGHT); if (required) { hor.addComponent(new Label( " <span style=\"color:red; position:relative; top:" + (height / 2 - 13) + "px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(comp); hor.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method. Puts a blank in front of a component. * /*from www .j a v a 2 s. com*/ * @param label * The label in front of the control. * @param comp * The component to display. * @param labelWidth * the fixed size of the label. The parameter has to be in CSS style, i.e. 400px for instance. * @param height * @param required * should it be marked with an asterisk. * @param buttons * @return The component in an horizontal layout. A blank in front and afterwards is inserted. */ public static synchronized VerticalLayout create(final String label, final Component comp, final int labelWidth, final int height, final boolean required, final Button[] buttons) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSpacing(false); hLayout.setHeight(height + Constants.PX); hLayout.addComponent(new Label(" ")); final Label textLabel = new Label(Constants.P_ALIGN_RIGHT + label + Constants.P, Label.CONTENT_XHTML); hLayout.addComponent(textLabel); textLabel.setSizeUndefined(); textLabel.setWidth(labelWidth + Constants.PX); hLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT); if (required) { hLayout.addComponent(new Label( " <span style=\"color:red; position:relative; top:" + (height / 2 - 13) + "px;\">*</span>", Label.CONTENT_XHTML)); } else { hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hLayout.addComponent(comp); hLayout.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final VerticalLayout vLayout = new VerticalLayout(); vLayout.addComponent(hLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); vLayout.addComponent(buttonLayout); final Label la = new Label(" ", Label.CONTENT_XHTML); la.setSizeUndefined(); la.setWidth(labelWidth + 7 + Constants.PX); buttonLayout.addComponent(la); for (final Button b : buttons) { buttonLayout.addComponent(b); } return vLayout; }