Example usage for com.vaadin.ui VerticalLayout setWidth

List of usage examples for com.vaadin.ui VerticalLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:infodoc.ui.module.help.AboutWindow.java

License:Open Source License

public AboutWindow() {
    super(InfodocConstants.uiAbout);
    addStyleName(InfodocTheme.WINDOW_OPAQUE);
    setIcon(new ThemeResource(InfodocTheme.iconAbout));
    setSizeUndefined();//from   ww w .  ja  v a  2s.  co m
    setWidth("580px");
    setResizable(false);

    String installedModules = InfodocConstants.infodocModules.replace(" ", "");
    String installedModulesHtml = "";

    for (String module : installedModules.split(",")) {
        installedModulesHtml += "<span style='margin-left: 20px;'>" + module + "</span><br/>";
    }

    String top = "<h2><i>InfoDoc " + InfodocConstants.infodocVersion + "</i></h2>" + "Modules:" + "<pre><small>"
            + installedModulesHtml + "</small></pre>" + "<br/>License granted to:"
            + "<pre><small><span style='margin-left: 20px;'>" + InfodocConstants.infodocCompanyName + "</span>"
            + (InfodocConstants.infodocCompanyId == null ? ""
                    : "<br/><span style='margin-left: 20px;'> " + InfodocConstants.infodocCompanyId + "</span>")
            + (InfodocConstants.infodocCompanyAddress == null ? ""
                    : "<br/><span style='margin-left: 20px;'>" + InfodocConstants.infodocCompanyAddress
                            + "</span></pre></small>")
            + "<br/><br/>";

    String lower = "<br/>Contact the developer: <a href='" + InfodocConstants.infodocDeveloperUrl + "'>"
            + InfodocConstants.infodocDeveloperUrl + "</a>," + "<br/><b>All rights reserved</b>.";

    Label topLabel = new Label(top, Label.CONTENT_XHTML);
    Label lowerLabel = new Label(lower, Label.CONTENT_XHTML);
    lowerLabel.addStyleName(InfodocTheme.LABEL_TINY);

    VerticalLayout rightLayout = new VerticalLayout();
    rightLayout.setMargin(true);
    rightLayout.setStyleName(InfodocTheme.PANEL_LIGHT);
    rightLayout.addStyleName(InfodocTheme.PANEL_BORDERLESS);
    rightLayout.addStyleName(InfodocTheme.COOL_FONT);
    rightLayout.addComponent(topLabel);
    rightLayout.addComponent(lowerLabel);

    VerticalLayout leftLayout = new VerticalLayout();
    leftLayout.setWidth("130px");
    leftLayout.addComponent(new Label("<h2></h2>", Label.CONTENT_XHTML));
    leftLayout.addComponent(new Embedded(null, new ThemeResource(InfodocTheme.infodocBoxImage)));

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.addComponent(leftLayout);
    layout.addComponent(rightLayout);
    layout.setExpandRatio(rightLayout, 1);

    Panel panel = new Panel();
    panel.addComponent(layout);

    setContent(panel);
}

From source file:jp.primecloud.auto.ui.DialogConfirm.java

License:Open Source License

public DialogConfirm(String caption, String message, Buttons buttons, Layout optionLayout) {
    super(caption);

    setModal(true);/*from ww w.java2 s .c  om*/
    setResizable(false);
    setClosable(false);
    setWidth("380px");
    addStyleName("dialog-confirm");
    setIcon(Icons.DLGWARNING.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    if (message != null && message.length() > 0) {

        // ?"\n"?"\t"???????"PREFORMATTED"??
        Label lbl;
        if (message.indexOf("\n") != -1 || message.indexOf("\t") != -1) {
            lbl = new Label(message, Label.CONTENT_PREFORMATTED);
        } else {
            lbl = new Label(message, Label.CONTENT_TEXT);
        }
        lbl.addStyleName("dialog-message");
        layout.addComponent(lbl);
    }

    // ????
    if (optionLayout != null) {
        optionLayout.addStyleName("dialog-confirm-option");
        addComponent(optionLayout);
        layout.setComponentAlignment(optionLayout, Alignment.MIDDLE_CENTER);
    }

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);

    // 
    okButton = new Button(ViewProperties.getCaption("button.ok"), this, "buttonClick");
    okButton.setDescription(ViewProperties.getCaption("description.ok"));
    okButton.setData(Result.OK);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    cancelButton = new Button(ViewProperties.getCaption("button.cancel"), this, "buttonClick");
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.setData(Result.Cancel);

    switch (buttons) {
    case OK:
        hl.addComponent(okButton);
        break;
    case OKCancel:
        hl.addComponent(okButton);
        hl.addComponent(cancelButton);
        break;
    case OKCancelConfirm:
        hl.addComponent(okButton);
        hl.addComponent(cancelButton);
        okButton.setEnabled(false);

        confirm = new ComboBox();
        confirm.setWidth("200px");
        confirm.setImmediate(true);
        confirm.addStyleName("dialog-confirm");
        confirm.setInputPrompt(ViewProperties.getCaption("description.dialogConfirmComboBox"));
        confirm.addItem(ViewProperties.getCaption("field.dialogConfirmComboBox"));
        confirm.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (confirm.getValue() != null) {
                    okButton.setEnabled(true);
                } else {
                    okButton.setEnabled(false);
                }
            }
        });
        layout.addComponent(confirm);
        layout.setComponentAlignment(confirm, Alignment.MIDDLE_CENTER);
        break;
    default:
        break;
    }

    layout.addComponent(hl);
    layout.setComponentAlignment(hl, Alignment.BOTTOM_CENTER);
}

From source file:jp.primecloud.auto.ui.ServerDesc.java

License:Open Source License

public ServerDesc() {
    setWidth("100%");
    setHeight("100%");
    setCaption(ViewProperties.getCaption("panel.serverDesc"));
    addStyleName(Reindeer.PANEL_LIGHT);/*from  w ww .  jav a 2 s. c  om*/
    addStyleName("server-desc-panel");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setMargin(false);
    layout.setSpacing(false);
    layout.addStyleName("server-desc-layout");
    tabDesc.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabDesc.setWidth("100%");
    tabDesc.setHeight("100%");
    tabDesc.addTab(serverDescBasic, ViewProperties.getCaption("tab.serverDescBasic"), Icons.BASIC.resource());
    tabDesc.addTab(serverDescDetail, ViewProperties.getCaption("tab.serverDescDetail"),
            Icons.DETAIL.resource());
    //
    tabDesc.addListener(TabSheet.SelectedTabChangeEvent.class, this, "selectedTabChange");
    addComponent(tabDesc);
}

From source file:jp.primecloud.auto.ui.ServerDescBasic.java

License:Open Source License

public ServerDescBasic() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);/*  ww  w.  j  a  v  a2s . c  om*/

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-basic");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-basic");
    //        setContent(hlPanels);

    left.setWidth("100%");
    right.setHeight("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    hlPanels.addComponent(left);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(right);
    hlPanels.setExpandRatio(left, 40);
    hlPanels.setExpandRatio(right, 60);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);

}

From source file:jp.primecloud.auto.ui.ServerDescDetail.java

License:Open Source License

public ServerDescDetail() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);//  w  w w.j  ava2 s .co  m

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-detail");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-detail");
    //        setContent(hlPanels);

    left.setWidth("200px");
    right.setWidth("100%");
    right.setHeight("100%");

    hlPanels.addComponent(left);
    hlPanels.addComponent(right);

    hlPanels.setExpandRatio(right, 100);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);
}

From source file:jp.primecloud.auto.ui.ServiceDesc.java

License:Open Source License

public ServiceDesc() {
    setWidth("100%");
    setHeight("100%");
    setCaption(ViewProperties.getCaption("panel.serviceDesc"));
    addStyleName("service-desc-panel");
    addStyleName(Reindeer.PANEL_LIGHT);//w w  w. j a v  a2  s  .c  om

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setMargin(false);
    layout.setSpacing(false);
    layout.addStyleName("service-desc-layout");
    tabDesc.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabDesc.setWidth("100%");
    tabDesc.setHeight("100%");

    tabDesc.addTab(serviceDescBasic, ViewProperties.getCaption("tab.serviceDescBasic"), Icons.BASIC.resource());
    tabDesc.addTab(serviceDescDetail, ViewProperties.getCaption("tab.serviceDescDetail"),
            Icons.DETAIL.resource());
    //
    tabDesc.addListener(TabSheet.SelectedTabChangeEvent.class, this, "selectedTabChange");
    addComponent(tabDesc);
}

From source file:jp.primecloud.auto.ui.ServiceDescBasic.java

License:Open Source License

public ServiceDescBasic() {

    addStyleName(Reindeer.PANEL_LIGHT);/* w ww . ja  v  a  2s.c om*/

    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-basic");
    setContent(hlPanels);

    left.setWidth("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("100%");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    VerticalLayout layRight = new VerticalLayout();
    layRight.setMargin(false);
    layRight.setSpacing(false);
    layRight.setWidth("100%");
    layRight.setHeight("100%");
    layRight.addComponent(right);
    layRight.addComponent(serverOpe);
    layRight.setExpandRatio(right, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(layRight);
    hlPanels.setExpandRatio(layLeft, 40);
    hlPanels.setExpandRatio(layRight, 60);
}

From source file:jp.primecloud.auto.ui.ServiceDescDetail.java

License:Open Source License

public ServiceDescDetail() {
    addStyleName(Reindeer.PANEL_LIGHT);//from   w  w  w  . j a va 2  s . c o m
    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-detail");
    setContent(hlPanels);

    left.setWidth("250px");
    right.setWidth("100%");
    right.setHeight("100%");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("250px");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(right);

    hlPanels.setExpandRatio(right, 100);

}

From source file:lifetime.component.welcome.HomeView.java

License:Apache License

private Component getSearchView() {
    searchText.setWidth("50%");
    VerticalLayout layout = new VerticalLayout(searchText, searchButton);
    layout.setWidth("100%");
    layout.setHeightUndefined();/*w  ww.j  a  va2 s. com*/
    layout.setMargin(true);
    layout.setComponentAlignment(searchText, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(searchButton, Alignment.MIDDLE_CENTER);
    return layout;
}

From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    final VaadinTestApplication app = (VaadinTestApplication) getApplication();
    logger.info("Getting attached to. Displaying " + processingStatus);
    final Processing processing = processingStatus.getProcessing();
    if (processingStatus == null || processing == null) {
        return;/*from   www  .  ja v  a 2  s  .  com*/
    }

    setDataSource(processingStatus);
    setData(processingStatus);
    logger.info("Continuing being attached to. Displaying " + processingStatus.getStatus() + " for "
            + processing.getDescription() + " with status " + processing.getStatus());

    removeAllComponents();

    addLabelField("processing.description", "Description");
    addLabelField("processing.date", "Creation date");
    final String processingUpdateDate = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
            .format(userDataService.getLastestUpdate(processing)); // when the status is last updated

    //dataelements
    if (processingStatus.getSubmissionIOs().size() != 0) {
        Label space = new Label("<div>&nbsp;</div>", Label.CONTENT_XHTML);
        space.setWidth("100%");
        space.setHeight("10px");
        getLayout().addComponent(space);
        submissionTable = new Table();
        submissionTable.setWidth("100%");
        submissionTable.setHeight("300px");
        submissionTable.setSelectable(true);
        submissionTable.setMultiSelect(true);
        submissionTable.setImmediate(true);
        submissionTable.addContainerProperty("input", Label.class, null);
        submissionTable.addContainerProperty("output", Label.class, null);
        submissionTable.addContainerProperty("view history", VerticalLayout.class, null);
        submissionTable.addContainerProperty("status", VerticalLayout.class, null);
        submissionTable.setColumnExpandRatio("input", 30f);
        submissionTable.setColumnExpandRatio("output", 20f);
        submissionTable.setColumnExpandRatio("view history", 20f);
        submissionTable.setColumnExpandRatio("status", 30f);

        for (Map<List<SubmissionIO>, List<SubmissionIO>> map : processingStatus.getSubmissionIOs()) {
            for (List<SubmissionIO> submissionIOinputs : map.keySet()) {
                if (submissionIOinputs.isEmpty()) {
                    logger.error("Skipping a submission with no inputs in processing: "
                            + processingStatus.getProcessing().getDbId());

                    continue;
                }

                //inputs
                StringBuffer inputValue = new StringBuffer();

                for (SubmissionIO submissionIOinput : submissionIOinputs) {
                    DataElement inputElement = submissionIOinput.getDataElement();

                    inputValue.append("<a href='" + userDataService.getDownloadURI(inputElement.getDbId())
                            + "' target='_blank'>" + inputElement.getName() + "</a><br />");
                }

                Label input = new Label(inputValue.toString(), Label.CONTENT_XHTML);
                input.setWidth("-1px");

                //outputs
                VerticalLayout historyLayout = new VerticalLayout();
                historyLayout.setWidth("100%");

                StringBuffer downloadValue = new StringBuffer();
                Label download = null;

                final List<SubmissionIO> outputs = map.get(submissionIOinputs);

                if (outputs.isEmpty()) {
                    download = new Label("No output available", Label.CONTENT_XHTML);
                } else {
                    for (SubmissionIO submissionIOoutput : outputs) {
                        final DataElement outputElement = submissionIOoutput.getDataElement();

                        if (submissionIOoutput.getDataElement().getExisting()) {
                            downloadValue.append("<a href='")
                                    .append(userDataService.getDownloadURI(outputElement.getDbId()))
                                    .append("' target='_blank'>download output</a><br />");
                        }

                        NativeButton viewHistoryButton = new NativeButton("history");

                        viewHistoryButton.addListener(new Button.ClickListener() {
                            private static final long serialVersionUID = 4280267926508263057L;

                            @Override
                            public void buttonClick(ClickEvent event) {
                                final String htmlContent = userDataService
                                        .getDataHistory(outputElement.getDbId());
                                showHTML(htmlContent, app);
                            }
                        });

                        historyLayout.addComponent(viewHistoryButton);
                    }

                    download = new Label(downloadValue.toString(), Label.CONTENT_XHTML);
                    download.setWidth("-1px");
                }

                // status
                VerticalLayout statusLayout = makeSubmissionStatusLayout(submissionIOinputs, processing, app);

                //add table item
                submissionTable.addItem(new Object[] { input, download, historyLayout, statusLayout }, null);
            }
        }

        getLayout().addComponent(submissionTable);
    }

    //total status
    Label space = new Label("<div>&nbsp;</div>", Label.CONTENT_XHTML);

    space.setWidth("100%");
    space.setHeight("10px");

    getLayout().addComponent(space);

    LabelField f = new LabelField();
    LabelField lastUpdateDateFieled = new LabelField();

    lastUpdateDateFieled.setLabelValue("<span style='font-size: 12px'><b>Last updated on:</b>&nbsp;</span>",
            processingUpdateDate);
    f.setLabelValue("<span style='font-size: 12px'><b>Overall status:</b>&nbsp;</span>",
            getStatus(processingStatus.getStatus(), null, false));

    getLayout().addComponent(f);
    getLayout().addComponent(lastUpdateDateFieled);
}