Example usage for com.vaadin.ui Label setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.hip.vif.admin.groupadmin.ui.AbstractContributionView.java

License:Open Source License

private Component createBibliography(final GeneralDomainObject inBibliography, final AbstractAdminTask inTask,
        final IMessages inMessages) throws VException {
    final HorizontalLayout out = new HorizontalLayout();
    out.setWidth("100%"); //$NON-NLS-1$
    out.setStyleName("vif-bibliography"); //$NON-NLS-1$

    final Long lBiblioID = BeanWrapperHelper.getLong(TextHome.KEY_ID, inBibliography);

    final Button lRemove = new Button(inMessages.getMessage("ui.bibliography.link.button.remove")); //$NON-NLS-1$
    lRemove.addClickListener(new Button.ClickListener() {
        @Override/*from ww w .ja va2  s .c  o  m*/
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.unlinkBibliography(lBiblioID)) {
                Notification.show(inMessages.getMessage("errmsg.biblio.remove"), Type.WARNING_MESSAGE); //$NON-NLS-1$
            }
        }
    });
    out.addComponent(lRemove);

    final Button lLink = LinkButtonHelper.createLinkButton(
            BeanWrapperHelper.getString(TextHome.KEY_REFERENCE, inBibliography),
            LinkButtonHelper.LookupType.BIBLIOGRAPHY, lBiblioID, inTask);
    lLink.setStyleName(BaseTheme.BUTTON_LINK);
    out.addComponent(lLink);

    final BibliographyFormatter lFormatter = new BibliographyFormatter(
            new BibliographyAdapter(inBibliography, TextHome.KEY_BIBLIO_TYPE));
    final Label lLabel = new Label(lFormatter.renderHtml(), ContentMode.HTML);
    lLabel.setWidth("100%"); //$NON-NLS-1$
    out.addComponent(lLabel);
    out.setExpandRatio(lLabel, 1.0f);

    return out;
}

From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java

License:Open Source License

private VerticalLayout createQuestionLayout(final Question inQuestion, final String inTitle,
        final HorizontalLayout inTitleView, final CodeList inCodeList, final IMessages inMessages) {
    final VerticalLayout outLayout = new VerticalLayout();
    outLayout.setWidth("100%"); //$NON-NLS-1$

    // question title and state
    inTitleView.setStyleName("vif-title-bar"); //$NON-NLS-1$

    final Label lLabel = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", inTitle), //$NON-NLS-1$
            ContentMode.HTML);/*from w ww  .  ja  va 2  s.  com*/
    inTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lLabel)); //$NON-NLS-1$
    final String lState = getState(BeanWrapperHelper.getString(QuestionHome.KEY_STATE, inQuestion), inCodeList,
            inMessages);
    final Label lNote = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-note", lState), //$NON-NLS-1$
            ContentMode.HTML);
    lNote.setWidth("100%"); //$NON-NLS-1$
    inTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lNote));
    inTitleView.setComponentAlignment(lNote, Alignment.BOTTOM_LEFT);
    inTitleView.setExpandRatio(lLabel, 1);
    inTitleView.setExpandRatio(lNote, 6);

    outLayout.addComponent(inTitleView);

    addProperQuestion(inQuestion, inMessages, outLayout);
    return outLayout;
}

From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java

License:Open Source License

private void addBibliographyText(final GeneralDomainObject inBibliography, final HorizontalLayout inLayout)
        throws VException {
    final BibliographyFormatter lFormatter = new BibliographyFormatter(
            new BibliographyAdapter(inBibliography, TextHome.KEY_BIBLIO_TYPE));
    final Label lLabel = new Label(lFormatter.renderHtml(), ContentMode.HTML);
    lLabel.setWidth("100%"); //$NON-NLS-1$
    inLayout.addComponent(lLabel);/*  w  ww .  j a  v  a2s  .  c  o m*/
    inLayout.setExpandRatio(lLabel, 1.0f);
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildWelcomeScreen() {
    VerticalLayout layoutForWelcomeTab = new VerticalLayout();
    layoutForWelcomeTab.setMargin(true);
    layoutForWelcomeTab.setSpacing(true);
    layoutForWelcomeTab.setCaption("Welcome");
    layoutForWelcomeTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);//ww w  . j  a  v  a 2 s .  com
    cssLayout.setWidth("100%");
    layoutForWelcomeTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("Welcome to Genotyping Data Management");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);

    String strIntroPara1 = "<p>The Genotyping Data Management System aims to provide a comprehensive public repository "
            + "for genotype, linkage map and QTL data from crop species relevant in the semi-arid tropics.</p>";

    String strIntroPara2 = "<p>This system is developed in Java and the database is MySQL. The initial release record "
            + "details of current genotype datasets generated for GCP mandate crops along with details of "
            + "molecular markers and related metadata. The Retrieve tab is a good starting point to browse "
            + "or query the database contents. The datasets available for each crop species can be queried. "
            + "Access to data sets requires a login.</p>";

    String strIntroPara3 = "<p>Data may be currently exported to the following formats: 2x2 matrix and flapjack software formats. "
            + "Data submission is through templates; upload templates are available for genotype, QTL and "
            + "map data(type of markers - SSR, SNP and DArt). The templates are in the form of excel sheets with built-in "
            + "validation functions.</p>";

    Label lblPara = new Label(strIntroPara1 + strIntroPara2 + strIntroPara3, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    //Spacer
    lblPara = new Label("");
    lblPara.setWidth("20px");
    horizLayoutForIntroPara.addComponent(lblPara);

    ThemeResource themeResource = new ThemeResource("images/FlowChart.jpg");
    Embedded headerImage = new Embedded("", themeResource);

    headerImage.setWidth("500px");
    headerImage.setHeight("400px");
    horizLayoutForIntroPara.addComponent(headerImage);

    return layoutForWelcomeTab;
}

From source file:org.ikasan.dashboard.ui.framework.panel.PersistanceSetupPanel.java

License:BSD License

protected void createNotCreatedView() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth("100%");
    verticalLayout.setHeight("100%");
    verticalLayout.setMargin(true);// ww  w  .j ava  2  s .c o m

    Label ikasanWelcomeLabel1 = new Label("Welcome to Ikasan!");
    ikasanWelcomeLabel1.setStyleName("xlarge");
    ikasanWelcomeLabel1.setWidth("100%");
    ikasanWelcomeLabel1.setHeight("30px");

    Label ikasanWelcomeLabel2 = new Label("It appears that you are setting up Ikasan for the"
            + " first time and we need to create some database tables. If this is not the first time accessing the "
            + "Ikasan Console, it appears that there is an issue with the Ikasan database. If this is the case please "
            + "contact your local database administrator.");

    ikasanWelcomeLabel2.setStyleName("large");
    ikasanWelcomeLabel2.setWidth("60%");
    ikasanWelcomeLabel2.setHeight("70px");

    verticalLayout.addComponent(ikasanWelcomeLabel1);
    verticalLayout.addComponent(ikasanWelcomeLabel2);

    verticalLayout.addComponent(persistanceStoreTypeCombo);
    persistanceStoreTypeCombo.setHeight("30px");

    Button button = new Button("Create");
    button.setStyleName(ValoTheme.BUTTON_SMALL);
    button.setHeight("30px");

    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            String persistenceProvider = (String) PersistanceSetupPanel.this.persistanceStoreTypeCombo
                    .getValue();

            if (persistenceProvider == null) {
                Notification.show("Please select a database type!");
                return;
            }

            PersistenceService persistanceService = persistenceServiceFactory
                    .getPersistenceService(persistenceProvider);

            try {
                persistanceService.createPersistence();
                persistanceService.createAdminAccount();
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Error trying to create Ikasan database!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);
            }

            Notification.show("Database successfully created!");
        }
    });

    verticalLayout.addComponent(button);
    this.setContent(verticalLayout);
}

From source file:org.ikasan.dashboard.ui.framework.panel.PersistanceSetupPanel.java

License:BSD License

protected void createAlreadyCreatedView() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth("100%");
    verticalLayout.setHeight("100%");
    verticalLayout.setMargin(true);/*from   w  ww . java2 s.co m*/

    Label ikasanWelcomeLabel1 = new Label("Welcome to Ikasan!");
    ikasanWelcomeLabel1.setStyleName("xlarge");
    ikasanWelcomeLabel1.setWidth("100%");
    ikasanWelcomeLabel1.setHeight("30px");

    Label ikasanWelcomeLabel2 = new Label(
            "It appears as thoug the Ikasan database has already been created. If you believe that this is not the case there may be an issue. "
                    + "Please contact your local database administrator or Ikasan/Middleware support.");

    ikasanWelcomeLabel2.setStyleName("large");
    ikasanWelcomeLabel2.setWidth("60%");
    ikasanWelcomeLabel2.setHeight("60px");

    verticalLayout.addComponent(ikasanWelcomeLabel1);
    verticalLayout.addComponent(ikasanWelcomeLabel2);

    //        verticalLayout.addComponent(persistanceStoreTypeCombo);

    this.setContent(verticalLayout);
}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

public Component buildServerComponent() {
    Panel component = new Panel();
    component.setSizeFull();//from w  w  w  . j  av a2 s . c om
    component.addStyleName(ValoTheme.PANEL_BORDERLESS);

    GridLayout layout = new GridLayout(2, 4);
    layout.setSizeFull();
    layout.setMargin(true);

    Label serverNameLabel = new Label(server.getName());
    serverNameLabel.setStyleName(ValoTheme.LABEL_LARGE);
    serverNameLabel.setWidth("100%");
    Label serverDescriptionLabel = new Label(server.getDescription());
    serverDescriptionLabel.setWidth("100%");
    serverDescriptionLabel.setStyleName(ValoTheme.LABEL_LARGE);
    Label serverUrlLabel = new Label(server.getUrl() + ":" + server.getPort());
    serverUrlLabel.setStyleName(ValoTheme.LABEL_LARGE);
    serverUrlLabel.setWidth("100%");

    layout.addComponent(serverNameLabel, 0, 0);
    layout.addComponent(serverDescriptionLabel, 0, 1);
    layout.addComponent(serverUrlLabel, 0, 2);

    statusLabel.setCaptionAsHtml(true);

    MonitorIcons icon = MonitorIcons.SERVER;
    icon.setSizePixels(64);

    Label serverLabel = new Label();
    serverLabel.setCaption(icon.getHtml());
    serverLabel.setCaptionAsHtml(true);

    layout.addComponent(serverLabel, 1, 0, 1, 2);
    layout.setComponentAlignment(serverLabel, Alignment.MIDDLE_CENTER);

    layout.addComponent(statusLabel, 0, 3, 1, 3);
    layout.setComponentAlignment(statusLabel, Alignment.MIDDLE_CENTER);

    buildFilterTable();

    component.setContent(layout);

    Component contentWrapper = createContentWrapper(component, buildFilterTable());

    contentWrapper.addStyleName("top10-revenue");
    return contentWrapper;
}

From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(4, 7);
    layout.setWidth("100%");
    layout.setSpacing(true);//from  w w w .  j  ava  2 s  .co m
    layout.setColumnExpandRatio(0, .10f);
    layout.setColumnExpandRatio(1, .30f);
    layout.setColumnExpandRatio(2, .05f);
    layout.setColumnExpandRatio(3, .30f);

    Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML);
    Label errorCategoryLabel = new Label();

    if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.BLOCKER)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.CRITICAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.MAJOR)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.TRIVIAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML);
    }

    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    Label errorMessageLabel = new Label("Error Message:");
    errorMessageLabel.setSizeUndefined();
    layout.addComponent(errorMessageLabel, 0, 5);
    layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT);

    final TextArea errorMessageTextArea = new TextArea();
    errorMessageTextArea.setWidth("650px");
    errorMessageTextArea.setRows(6);
    errorMessageTextArea
            .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription());

    layout.addComponent(errorMessageTextArea, 1, 5, 3, 5);

    AceEditor editor = new AceEditor();
    editor.setCaption("Error Details");
    editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    label = new Label("Error Category:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    layout.addComponent(errorCategoryLabel, 3, 1);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT);

    label = new Label("System Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField systemAction = new TextField();
    systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction());
    systemAction.setReadOnly(true);
    systemAction.setWidth("80%");
    layout.addComponent(systemAction, 3, 2);

    label = new Label("User Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField userAction = new TextField();
    userAction.setValue("");
    userAction.setReadOnly(true);
    userAction.setWidth("80%");
    layout.addComponent(userAction, 3, 3);

    label = new Label("User Action By:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    Label userActionBy = new Label();
    userActionBy.setValue("");
    userActionBy.setReadOnly(true);
    userActionBy.setWidth("80%");
    layout.addComponent(userActionBy, 3, 4);

    AceEditor eventEditor = new AceEditor();
    eventEditor.setCaption("Event Payload");

    if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) {
        eventEditor
                .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(300, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    //      wrapperLayout.addComponent(vSplitPanel, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.jdal.vaadin.ui.Box.java

License:Apache License

/**
 * Try to imitate a HorizalGlue of Swing BoxLayout.
 * A invisible component that get all extra space.
 * @param layout layout to add glue// w w  w .j av  a 2  s .co m
 */
public static void addHorizontalGlue(AbstractOrderedLayout layout) {
    Label label = new Label();
    label.setWidth("100%");
    layout.addComponent(label);
    layout.setExpandRatio(label, 1.0f);
}

From source file:org.jdal.vaadin.ui.Box.java

License:Apache License

/**
 * Try to imitate HorizontalStruct on Swing BoxLayout
 * @param layout Layout to add the struct
 * @param width struct withd/*from w  w  w.j  av  a2 s  .c  o m*/
 */
public static void addHorizontalStruct(AbstractOrderedLayout layout, int width) {
    Label label = new Label();
    label.setWidth(width + "px");
    layout.addComponent(label);
    layout.setExpandRatio(label, 0f);
}