List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
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();/* w w w .j a v a 2 s .c o 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. * /* 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 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 w ww . j a va 2 s. c om*/ * @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 ww . j a v a 2 s . c om*/ * @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. * // ww w .jav a 2s . co m * @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; }
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 . c o m*/ * @param label * The label in front of the control. * @param accordion * The accordion 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 * @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 Accordion accordion, 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)); } final Panel pan = new Panel(); pan.setSizeFull(); // Have it take all space available in the layout. accordion.setSizeFull(); // Some components to put in the Accordion. final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n\t<X>\n\t\t<today>\n\t\t</today>\n\t\t<today/>\n\t\t<today/>\n\t</X>\n</root>"; for (int i = 0; i < 30; i++) { accordion.addTab(new Label(xml, Label.CONTENT_PREFORMATTED), "Tab" + i, null); } pan.addComponent(accordion); // pan.setSizeUndefined(); pan.setWidth(accordion.getWidth() + Constants.PX); // pan.setHeight("500px"); pan.setStyleName(Reindeer.PANEL_LIGHT); hor.addComponent(pan); hor.setComponentAlignment(pan, 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. Two labels with different size in front of two components. * /* ww w . j ava 2 s .c o m*/ * @param labelLeft * the left (leading) label. * @param labelRight * the right (leading) label. * @param compLeft * the left component. * @param compRight * the right component. * @param widthLeft * the width of the left label. * @param widthRight * the width of the right label. * @param required * true if the component is required, otherwise false. * @return the customized component placed in a horizontal layout. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Component compLeft, final Component compRight, final int widthLeft, final int widthRight, final boolean required) { // foo final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(Constants.DEFAULT_HEIGHT); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + labelLeft + Constants.P; Label ll, lr; hor.addComponent(ll = new Label(text, Label.CONTENT_XHTML)); ll.setSizeUndefined(); ll.setWidth(widthLeft + Constants.PX); hor.setComponentAlignment(ll, 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(compLeft); hor.setComponentAlignment(compLeft, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); final String text2 = Constants.P_ALIGN_RIGHT + labelRight + Constants.P; hor.addComponent(lr = new Label(text2, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(widthRight + Constants.PX); hor.setComponentAlignment(lr, 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(compRight); hor.setComponentAlignment(compRight, 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
/** * /*from ww w . j av a 2 s. c o m*/ * @param labelLeft * @param labelRight * @param compLeft * @param compRight * @param widthLeft * @param widthRight * @param required * @return the constructed result. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Label compLeft, final Label compRight, final int widthLeft, final int widthRight, final boolean required) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setHeight(Constants.DEFAULT_HEIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final Label leftLabel = new Label(Constants.P_ALIGN_RIGHT + labelLeft + Constants.P, Label.CONTENT_XHTML); leftLabel.setWidth(111, Sizeable.UNITS_PIXELS); hLayout.addComponent(leftLabel); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); hLayout.addComponent(compLeft); hLayout.setComponentAlignment(compLeft, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final Label c = new Label(Constants.P_ALIGN_RIGHT + labelRight + Constants.P, Label.CONTENT_XHTML); hLayout.addComponent(c); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); hLayout.addComponent(compRight); hLayout.setComponentAlignment(compRight, Alignment.BOTTOM_RIGHT); return hLayout; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method for placing components. * //from w w w .jav a2 s .co m * @param labelLeft * the left (leading) label. * @param labelRight * the right (leading) label. * @param compLeft * the left component. * @param compRight * the right component. * @param width * the width of the label. * @param required * true if the component is required, otherwise false. * @return the customized component placed in a horizontal layout. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Component compLeft, final Component compRight, 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 + labelLeft + Constants.P; Label ll, lr; hor.addComponent(ll = new Label(text, Label.CONTENT_XHTML)); ll.setSizeUndefined(); ll.setWidth(width + Constants.PX); hor.setComponentAlignment(ll, 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(compLeft); hor.setComponentAlignment(compLeft, Alignment.MIDDLE_RIGHT); hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); final String text2 = Constants.P_ALIGN_RIGHT + labelRight + Constants.P; hor.addComponent(lr = new Label(text2, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(width + Constants.PX); hor.setComponentAlignment(lr, 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(compRight); hor.setComponentAlignment(compRight, 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
public static Component foo(final String captionForleftLabel, final String captionForRightLabel, final Label leftLabel, final Label rightLabel, final int widthLeft, final int widthRight, final boolean required) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setHeight("30px"); hLayout.addComponent(new Label(" ")); final Label ll = new Label(Constants.P_ALIGN_RIGHT + captionForleftLabel + Constants.P, Label.CONTENT_XHTML); ll.setSizeUndefined();/*from w ww . j a v a 2s .co m*/ ll.setWidth(widthLeft + Constants.PX); hLayout.addComponent(ll); hLayout.setComponentAlignment(ll, Alignment.MIDDLE_RIGHT); if (required) { hLayout.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hLayout.addComponent(leftLabel); hLayout.setComponentAlignment(leftLabel, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Label lr; hLayout.addComponent( lr = new Label(Constants.P_ALIGN_RIGHT + captionForRightLabel + Constants.P, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(widthRight + Constants.PX); hLayout.setComponentAlignment(lr, Alignment.BOTTOM_RIGHT); if (required) { hLayout.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hLayout.addComponent(rightLabel); hLayout.setComponentAlignment(rightLabel, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ")); hLayout.setSpacing(false); return hLayout; }