Example usage for com.vaadin.ui Label setSizeUndefined

List of usage examples for com.vaadin.ui Label setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui Label setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java

/**
 * Adds post informations/*from   w w w  . ja va 2s.c  o m*/
 */
private void addPostInfo() {

    Label likeIMG = new Label();
    likeIMG.setIcon(new ThemeResource("./images/like.png"));
    likeIMG.setSizeUndefined();
    layout.addComponent(likeIMG, "picture-like");

    layout.addComponent(likes, "like");
    likes.setCaption(getLikesCaption());

    Label dislikeIMG = new Label();
    dislikeIMG.setIcon(new ThemeResource("./images/dislike.png"));
    dislikeIMG.setSizeUndefined();
    layout.addComponent(dislikeIMG, "picture-disagree");
    layout.addComponent(disagrees, "disagree");
    disagrees.setCaption(getDisagreeCaption());

    layout.addComponent(timestamp, "timestamp");

}

From source file:de.escidoc.admintool.view.user.UserAddView.java

License:Open Source License

private Component createLayout(final VerticalLayout build) {
    final HorizontalLayout hLayout = new HorizontalLayout();

    final Label textLabel = new Label(
            Constants.P_ALIGN_RIGHT + ViewConstants.ORGANIZATION_UNITS_LABEL + Constants.P,
            Label.CONTENT_XHTML);
    hLayout.addComponent(textLabel);/* w  w  w  . j a va 2 s. c  o m*/
    textLabel.setSizeUndefined();
    textLabel.setWidth(111 + Constants.PX);

    hLayout.addComponent(textLabel);
    hLayout.addComponent(build);
    return hLayout;
}

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();
    textLabel.setWidth(labelWidth + Constants.PX);
    hLayout.addComponent(textLabel);//from w w w  .  ja  v  a2s  .  co m
    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 w  w 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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", 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  . jav  a2 s  . com*/
 * @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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", 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.
 * /* www.java  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(
                "&nbsp;<span style=\"color:red; position:relative; top:" + (height / 2 - 13) + "px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", 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 w w  w. ja  va 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(
                "&nbsp;<span style=\"color:red; position:relative; top:" + (height / 2 - 13) + "px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hLayout.addComponent(new Label("&nbsp;&nbsp;", Label.CONTENT_XHTML));
    }
    hLayout.addComponent(comp);
    hLayout.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT);
    hLayout.addComponent(new Label(" &nbsp; ", Label.CONTENT_XHTML));

    final VerticalLayout vLayout = new VerticalLayout();
    vLayout.addComponent(hLayout);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    vLayout.addComponent(buttonLayout);

    final Label la = new Label("&nbsp;", 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.
 * /* 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(
                "&nbsp;<span style=\"color:red; position:relative; top:" + (height / 2 - 13) + "px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", 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.
 * //from  ww w.j av a2  s.  c om
 * @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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", Label.CONTENT_XHTML));
    }
    hor.addComponent(compLeft);
    hor.setComponentAlignment(compLeft, Alignment.BOTTOM_RIGHT);
    hor.addComponent(new Label("&nbsp;", 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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", 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

/**
 * Helper method for placing components.
 * //from   w w w . j  a  v a2 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 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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", Label.CONTENT_XHTML));
    }
    hor.addComponent(compLeft);
    hor.setComponentAlignment(compLeft, Alignment.MIDDLE_RIGHT);
    hor.addComponent(new Label("&nbsp;", 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("&nbsp;<span style=\"color:red; position:relative; top:13px;\">*</span>",
                Label.CONTENT_XHTML));
    } else {
        hor.addComponent(new Label("&nbsp;&nbsp;", Label.CONTENT_XHTML));
    }
    hor.addComponent(compRight);
    hor.setComponentAlignment(compRight, Alignment.BOTTOM_RIGHT);
    hor.addComponent(new Label(" "));
    hor.setSpacing(false);

    return hor;
}