Example usage for com.vaadin.ui VerticalLayout setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.hip.vif.forum.suspend.ui.SuspendView.java

License:Open Source License

/** Constructor
 *
 * @param inGroups {@link GroupContainer} the groups that are affected
 * @param inDates {@link DatePrepare} an initial or earlier suspend period
 * @param inTask {@link SuspendTask} */
public SuspendView(final GroupContainer inGroups, final DatePrepare inDates, final SuspendTask inTask) {
    super();// w  w  w . ja v  a 2s.co m
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$
            lMessages.getMessage("ui.suspend.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$

    final Button lSuspend = new Button(lMessages.getMessage("ui.suspend.view.button.suspend")); //$NON-NLS-1$
    final Button lClear = new Button(lMessages.getMessage("ui.suspend.view.button.clear")); //$NON-NLS-1$

    final String lDatePattern = PreferencesHandler.INSTANCE.getDatePattern();
    final LabelValueTable lTable = new LabelValueTable();
    final PopupDateField lFrom = createDateField(inDates.getFromDate(), lDatePattern);
    lFrom.addValidator(new DateFieldValidator());
    lFrom.focus();
    lTable.addRow(lMessages.getFormattedMessage("ui.suspend.view.label.from", lDatePattern), lFrom); //$NON-NLS-1$

    final PopupDateField lTo = createDateField(inDates.getToDate(), lDatePattern);
    lTo.addValidator(new DateFieldValidator(lFrom));
    lTable.addRow(lMessages.getFormattedMessage("ui.suspend.view.label.to", lDatePattern), lTo); //$NON-NLS-1$

    lLayout.addComponent(lTable);
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    lSuspend.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) { // NOPMD
            final DateFieldValidator lValidator = new DateFieldValidator(lFrom, lTo);
            try {
                lValidator.validate();
                if (inTask.saveSuspendDates(lFrom.getValue(), lTo.getValue())) {
                    Notification.show(lMessages.getMessage("msg.data.saved"), Type.TRAY_NOTIFICATION); //$NON-NLS-1$
                    lClear.setVisible(true);
                } else {
                    Notification.show(lMessages.getMessage("errmsg.general"), Type.ERROR_MESSAGE); //$NON-NLS-1$
                }
            } catch (final InvalidValueException exc) {
                Notification.show(exc.getMessage(), Type.WARNING_MESSAGE);
            }
        }
    });
    lSuspend.setClickShortcut(KeyCode.ENTER);

    lClear.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) { // NOPMD
            if (inTask.clearSuspendDates()) {
                Notification.show(lMessages.getMessage("msg.data.cleared"), Type.TRAY_NOTIFICATION); //$NON-NLS-1$
                lFrom.setValue(new Date());
                lFrom.focus();
                lTo.setValue(null);
                lClear.setVisible(false);
            } else {
                Notification.show(lMessages.getMessage("errmsg.general"), Type.ERROR_MESSAGE); //$NON-NLS-1$
            }
        }
    });

    lLayout.addComponent(RiplaViewHelper.createButtons(lSuspend, lClear));

    // Clear button is visible only if there's something to clear.
    lClear.setVisible(inDates.getSuspendDateState() == SuspendState.HAS_DATES);

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-subtitle", //$NON-NLS-1$
            lMessages.getMessage("ui.suspend.view.subtitle")), ContentMode.HTML)); //$NON-NLS-1$
    lLayout.addComponent(createTable(inGroups));
}

From source file:org.hip.vif.forum.usersettings.ui.AbstactUsersettingsView.java

License:Open Source License

/** @param inMessages {@link IMessages}
 * @param inSubtitle {@link Label}/*from   ww  w  .ja v  a  2s  .  co m*/
 * @param inMsgKey
 * @return {@link VerticalLayout} */
protected VerticalLayout createLayout(final IMessages inMessages, final Label inSubtitle,
        final String inMsgKey) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    lLayout.setStyleName("vif-table"); //$NON-NLS-1$
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", inMessages.getMessage(inMsgKey)), //$NON-NLS-1$
                    ContentMode.HTML));

    inSubtitle.setVisible(false);
    lLayout.addComponent(inSubtitle);
    return lLayout;
}

From source file:org.hip.vif.forum.usersettings.ui.ShowCompletedRatingView.java

License:Open Source License

/** Constructor for view to display the feedback that the rating is not displayed yet.
 *
 * @param inMessage String *///from  w  w  w  .  java  2s.  c  o  m
public ShowCompletedRatingView(final String inMessage) {
    final VerticalLayout lLayout = new VerticalLayout();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(TMPL_FEEDBACK, inMessage), ContentMode.HTML));
    setCompositionRoot(lLayout);
}

From source file:org.hip.vif.forum.usersettings.ui.ShowCompletedRatingView.java

License:Open Source License

/** Constructor for view to display the completed ratings given.
 *
 * @param inRatings {@link QueryResult} the participants involved in the review and rating process
 * @param inQuestions {@link QueryResult} the reviewed questions
 * @param inCompletions {@link QueryResult} the reviewed completions
 * @param inTexts {@link QueryResult} the reviewed texts
 * @param inTask {@link IPluggableWithLookup} the controlling task
 * @throws VException//from  w w  w .j  a  v  a 2 s .com
 * @throws SQLException */
public ShowCompletedRatingView(final QueryResult inRatings, final QueryResult inQuestions,
        final QueryResult inCompletions, final QueryResult inTexts, final IPluggableWithLookup inTask)
        throws VException, SQLException {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$
            lMessages.getMessage("ratings.completed.title")), ContentMode.HTML)); //$NON-NLS-1$

    lLayout.addComponent(new Label(lMessages.getMessage("ui.rated.subtitle"), ContentMode.HTML)); //$NON-NLS-1$
    listContributions(inQuestions, inCompletions, inTexts, inTask, lLayout, lMessages);
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    final GridLayout lRatings = new GridLayout(5, 3);
    lRatings.setStyleName("vif-rating"); //$NON-NLS-1$
    lRatings.setWidth("100%"); //$NON-NLS-1$
    lRatings.setColumnExpandRatio(4, 1);
    lLayout.addComponent(lRatings);

    // headers
    lRatings.addComponent(new Label("")); //$NON-NLS-1$
    addComponentSized(new Label(lMessages.getMessage("ui.rated.column.correctness"), ContentMode.HTML), //$NON-NLS-1$
            lRatings);
    addComponentSized(new Label(lMessages.getMessage("ui.rated.column.efficiency"), ContentMode.HTML), //$NON-NLS-1$
            lRatings);
    addComponentSized(new Label(lMessages.getMessage("ui.rated.column.etiquette"), ContentMode.HTML), lRatings); //$NON-NLS-1$
    Label lRemark = new Label(lMessages.getMessage("ui.rated.column.remark"), ContentMode.HTML); //$NON-NLS-1$
    lRemark.setStyleName("vif-colhead vif-padding-left"); //$NON-NLS-1$
    lRatings.addComponent(lRemark);
    lRatings.getComponent(0, 0).setWidth(350, Unit.PIXELS);

    // ratings
    final Map<Long, String> lParticipants = new HashMap<Long, String>();
    final List<Line> lLines = new Vector<ShowCompletedRatingView.Line>();
    while (inRatings.hasMoreElements()) {
        final GeneralDomainObject lRating = inRatings.nextAsDomainObject();
        setParticipant(lRating, lParticipants);
        lLines.add(new Line(lRating));
    }

    for (final Line lLine : lLines) {
        lRatings.addComponent(new Label(lLine.getInvolved(lParticipants, lMessages), ContentMode.HTML));
        addComponentAligened(lLine.getCorrectness(), lRatings);
        addComponentAligened(lLine.getEfficiency(), lRatings);
        addComponentAligened(lLine.getEtiquette(), lRatings);
        lRemark = new Label(lLine.getRemark(), ContentMode.HTML);
        lRemark.setStyleName("vif-padding-left"); //$NON-NLS-1$
        lRatings.addComponent(lRemark);
    }
}

From source file:org.hip.vif.forum.usersettings.ui.ShowRatingView.java

License:Open Source License

/** Constructor for the rating form.
 *
 * @param inRating {@link JoinRatingsToRater}
 * @param inTask {@link RatingUserTask}/*from   w  ww  . j  a  v a  2  s .c o m*/
 * @throws VException
 * @throws SQLException */
public ShowRatingView(final JoinRatingsToRater inRating, final RatingUserTask inTask)
        throws VException, SQLException {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$
                    lMessages.getFormattedMessage("ui.rating.title", inRating.getFullName())), //$NON-NLS-1$
            ContentMode.HTML));

    lLayout.addComponent(new Label(lMessages.getFormattedMessage("ui.rating.subtitle", inRating.getFullName()), //$NON-NLS-1$
            ContentMode.HTML));
    listContributions(inRating.getQuestionsToBeRated(), inRating.getCompletionsToBeRated(),
            inRating.getTextsToBeRated(), inTask, lLayout, lMessages);

    lLayout.setStyleName("vif-ratings"); //$NON-NLS-1$
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    final UserTaskFormCreator lForm = new UserTaskFormCreator(inRating);
    lLayout.addComponent(lForm.createForm());

    final Button lSend = new Button(lMessages.getMessage("ui.rating.button.send")); //$NON-NLS-1$
    lSend.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            try {
                lForm.commit();
                if (!inTask.saveRatings(inRating)) {
                    Notification.show(lMessages.getMessage("errmsg.ratings.save"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                }
            } catch (final CommitException exc) {
                // notification
            }
        }
    });
    lLayout.addComponent(lSend);
}

From source file:org.hip.vif.web.components.AbstractConfigurationPopup.java

License:Open Source License

/** @return {@link VerticalLayout} the configured layout of the popup window */
public static VerticalLayout createLayout() {
    final VerticalLayout out = new VerticalLayout();
    out.setStyleName("vif-lookup"); //$NON-NLS-1$
    out.setMargin(true);/*from  w ww  .  j a v  a 2  s .co m*/
    out.setSpacing(true);
    out.setSizeFull();
    return out;
}

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  a2s  . c o m
    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.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildAboutScreen() {
    VerticalLayout layoutForAboutTab = new VerticalLayout();
    layoutForAboutTab.setMargin(true);//w w w  .  j  a va 2s.c  o m
    layoutForAboutTab.setSpacing(true);
    layoutForAboutTab.setCaption("About");
    layoutForAboutTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);
    cssLayout.setWidth("100%");
    layoutForAboutTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("About GDMS Version");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    //horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);
    //_main.getApplication().getContext().getBaseDirectory();
    WebApplicationContext ctx = (WebApplicationContext) _main.getApplication().getContext();
    //System.out.println(ctx.getHttpSession().getServletContext().getRealPath("\\"));

    final String strTemplateFolderPath = ctx.getHttpSession().getServletContext().getRealPath("\\");
    final String strFileName = "License Agreement for software rev.doc";

    final String licensePath = strTemplateFolderPath + "\\" + strFileName;
    final String strApplicationVersion = "<p>Application Version : 2.1.10</p>";
    final String strLicense = "";

    String strDBVersion = "<p>Database Verison : IBDBv2</p>";
    String strContact = "<p>Contact : <a href='mailto:bioinformatics@cgiar.org'>bioinformatics@cgiar.org </a></p>";
    Label lblPara = new Label(strApplicationVersion + strDBVersion + strContact, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    HorizontalLayout horizLayout = new HorizontalLayout();
    horizLayout.setSpacing(true);
    //horizLayout.setWidth("50%");
    horizLayout.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayout);
    //cssLayout.setWidth("600px");

    btnDownloadMarker = new Button("License Information");
    btnDownloadMarker.setImmediate(true);
    btnDownloadMarker.setStyleName(Reindeer.BUTTON_LINK);
    btnDownloadMarker.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            //strLicense = "License Information";

            File strFileLoc = new File(strTemplateFolderPath + "\\" + strFileName);
            FileResource fileResource = new FileResource(strFileLoc, _main.getApplication());
            if (strFileName.endsWith(".doc")) {
                _main.getWindow().open(fileResource, "", true);
            }
        }

    });
    //Spacer
    lblPara = new Label("");
    //lblPara.setWidth("20px");
    horizLayout.addComponent(lblPara);
    horizLayout.addComponent(btnDownloadMarker);
    horizLayout.setComponentAlignment(btnDownloadMarker, Alignment.MIDDLE_LEFT);

    return layoutForAboutTab;
}

From source file:org.kani.Application.java

License:Apache License

private Window getAboutDialog() {
    if (aboutWindow == null) {
        aboutWindow = new Window("About...");
        aboutWindow.setModal(true);//from w w  w . j a v  a 2  s . c  o  m
        aboutWindow.setWidth("400px");

        VerticalLayout layout = (VerticalLayout) aboutWindow.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName("blue");

        CssLayout titleLayout = new CssLayout();
        H2 title = new H2("Dynamic Vaadin OSGi Demo");
        titleLayout.addComponent(title);
        SmallText description = new SmallText("<br>Copyright ?? and others.<br>"
                + "The icons are from the Silk icon set by Mark James<br>"
                + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>");
        description.setSizeUndefined();
        description.setContentMode(Label.CONTENT_XHTML);

        titleLayout.addComponent(description);
        aboutWindow.addComponent(titleLayout);

        Button close = new Button("Close", new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                (aboutWindow.getParent()).removeWindow(aboutWindow);
            }

        });
        layout.addComponent(close);
        layout.setComponentAlignment(close, Alignment.MIDDLE_RIGHT);
    }
    return aboutWindow;
}

From source file:org.lunifera.examples.runtime.gyrex.vaadin.Vaadin7DemoUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {

    // push = new ICEPush();
    // push.extend(this);

    VerticalLayout layout = new VerticalLayout(new Label("Hi - that's the amazing vaadin 7 demo UI!"));
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setSizeFull();//from w  w w . j a  v a2s  .c o m
    layout.setMargin(true);
    setContent(layout);
}