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.admin.groupadmin.ui.AbstractContributionView.java

License:Open Source License

private VerticalLayout createCompletion(final Long inCompletionID, final String inCompletionText,
        final String inCompletionState, final CodeList inCodeList, final IPluggable inTask,
        final IMessages inMessages, final String inMsgKey, final String inStyle) {
    final VerticalLayout outLayout = new VerticalLayout();
    outLayout.setStyleName("vif-completion"); //$NON-NLS-1$

    // label and state
    final HorizontalLayout lTitleView = new HorizontalLayout();
    lTitleView.setStyleName("vif-title-bar"); //$NON-NLS-1$
    lTitleView.setSpacing(true);/* w  w w. j a va  2  s . co m*/

    lTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, inStyle, inMessages.getMessage(inMsgKey)),
                    ContentMode.HTML))); //$NON-NLS-1$ //$NON-NLS-1$
    final boolean lEditable = inCompletionState == null || inCompletionState.length() == 0
            || WorkflowAwareContribution.STATE_PRIVATE.equals(inCompletionState);
    final String lStyle = lEditable ? "vif-note-emphasized" : "vif-note"; //$NON-NLS-1$ //$NON-NLS-2$
    final Label lNote = new Label(String.format(VIFViewHelper.TMPL_TITLE, lStyle,
            getState(inCompletionState, inCodeList, inMessages)), ContentMode.HTML); //$NON-NLS-1$
    lTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lNote));
    if (lEditable) {
        final Button lEdit = new Button(inMessages.getMessage("ui.discussion.completion.button.edit")); //$NON-NLS-1$
        lEdit.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent inEvent) {
                if (inTask instanceof AdminQuestionShowTask) {
                    ((AdminQuestionShowTask) inTask).editCompletion(inCompletionID);
                }
            }
        });
        lTitleView.addComponent(lEdit);

        final AbstractDialogWindow lDialogPublish = Dialog.openQuestion(
                inMessages.getMessage("ui.discussion.dialog.title"), //$NON-NLS-1$
                inMessages.getMessage("ui.discussion.dialog.completion.publish"), new Dialog.ICommand() { //$NON-NLS-1$
                    @Override
                    public void execute() {
                        if (inTask instanceof AdminQuestionShowTask) {
                            if (!((AdminQuestionShowTask) inTask).publishCompletion(inCompletionID)) {
                                Notification.show(inMessages.getMessage("errmsg.contribution.publish"), //$NON-NLS-1$
                                        Type.WARNING_MESSAGE);
                            }
                        }
                    }
                });
        final AbstractDialogWindow lDialogDelete = Dialog.openQuestion(
                inMessages.getMessage("ui.discussion.dialog.title"), //$NON-NLS-1$
                inMessages.getMessage("ui.discussion.dialog.completion.delete"), new Dialog.ICommand() { //$NON-NLS-1$
                    @Override
                    public void execute() {
                        if (inTask instanceof AdminQuestionShowTask) {
                            if (!((AdminQuestionShowTask) inTask).deleteCompletion(inCompletionID)) {
                                Notification.show(inMessages.getMessage("errmsg.contribution.delete"), //$NON-NLS-1$
                                        Type.WARNING_MESSAGE);
                            }
                        }
                    }
                });

        final Button lPublish = new Button(inMessages.getMessage("ui.discussion.contribution.button.publish")); //$NON-NLS-1$
        lPublish.addClickListener(Dialog.createClickListener(lDialogPublish, this));
        lTitleView.addComponent(lPublish);

        final Button lDelete = new Button(inMessages.getMessage("ui.discussion.contribution.button.delete")); //$NON-NLS-1$
        lDelete.addClickListener(Dialog.createClickListener(lDialogDelete, this));
        lTitleView.addComponent(lDelete);
    }
    outLayout.addComponent(lTitleView);

    // the completion
    outLayout.addComponent(new Label(inCompletionText, ContentMode.HTML));
    return outLayout;
}

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

License:Open Source License

/**
 * Renders the set of bibliographical entries assigned to the question.
 * /*from ww w  . j ava  2  s  .co m*/
 * @param inLayout
 *            {@link VerticalLayout}
 * @param inBibliography
 *            {@link QueryResult}
 * @param inMessages
 *            {@link IMessages}
 * @param inTask
 *            {@link AbstractAdminTask}
 * @throws VException
 * @throws SQLException
 */
protected void createBibliography(final VerticalLayout inLayout, final QueryResult inBibliography,
        final IMessages inMessages, final AbstractAdminTask inTask) throws VException, SQLException {
    final VerticalLayout lBibliography = new VerticalLayout();
    lBibliography.setStyleName("vif-title-bar"); //$NON-NLS-1$
    lBibliography.addComponent(new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-subtitle", //$NON-NLS-1$
                    inMessages.getMessage("ui.discussion.question.view.label.bibliography")), //$NON-NLS-1$
            ContentMode.HTML));

    boolean hasBibliography = false;
    while (inBibliography.hasMoreElements()) {
        lBibliography.addComponent(createBibliography(inBibliography.next(), inTask, inMessages));
        hasBibliography = true;
    }

    if (hasBibliography) {
        inLayout.addComponent(lBibliography);
    }
}

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

License:Open Source License

public AdminGroupListView(final GroupContainer inGroups, final AdminGroupShowListTask inTask) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);/*w ww  .j a va 2  s  .c o  m*/

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

    final Label lSubtitle = new Label(lMessages.getMessage("ui.discussion.list.view.title.sub"), //$NON-NLS-1$
            ContentMode.HTML);
    lLayout.addComponent(lSubtitle);

    final Table lTable = new Table();
    lTable.setWidth("100%"); //$NON-NLS-1$
    lTable.setContainerDataSource(inGroups);

    lTable.setPageLength(inGroups.size() > TABLE_SIZE ? TABLE_SIZE : 0);
    lTable.setColumnCollapsingAllowed(true);
    lTable.setColumnReorderingAllowed(true);
    lTable.setSelectable(true);
    lTable.setImmediate(true);
    lTable.addValueChangeListener(inTask);

    lTable.setVisibleColumns(GroupContainer.NATURAL_COL_ORDER);
    lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(GroupContainer.COL_HEADERS, lMessages));
    lLayout.addComponent(lTable);
}

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

License:Open Source License

/**
 * Constructor.//from w w  w .j av  a  2 s.co  m
 * 
 * @param inDeletable
 *            {@link ContributionContainer} the deletable entries
 * @param inReferenced
 *            {@link ContributionContainer} the referenced entries with
 *            removalbe references
 * @param inUndeletable
 *            {@link ContributionContainer} the referenced entries with
 *            unremovable references, thus, not deletable by the
 *            administrator
 * @param inTask
 *            {@link BibliographyDeleteTask}
 */
public BibliographyDeleteView(final ContributionContainer inDeletable, final ContributionContainer inReferenced,
        final ContributionContainer inUndeletable, final BibliographyDeleteTask inTask) {
    confirmationMode = false;
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);
    lLayout.setSpacing(true);

    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.bibliography.link.button.delete")), ContentMode.HTML)); //$NON-NLS-1$

    if (inDeletable.hasItems()) {
        final Label lRemarkDeletable = new Label(lMessages.getMessage("ui.bibliography.link.remark.deletable"), //$NON-NLS-1$
                ContentMode.HTML);
        lLayout.addComponent(lRemarkDeletable);
        final Table lTable = createTable(inDeletable, inTask, true);
        lLayout.addComponent(lTable);
        final Button lDelete = new Button(lMessages.getMessage("ui.discussion.contribution.button.delete")); //$NON-NLS-1$
        lDelete.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent inEvent) {
                if (confirmationMode) {
                    if (!inTask.deleteTexts(inDeletable)) {
                        Notification.show(lMessages.getMessage("errmsg.biblio.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                    }
                } else {
                    if (VIFViewHelper.processAction(inDeletable)) {
                        confirmationMode = true;
                        inDeletable.addContainerFilter(new SelectedFilter());
                        lRemarkDeletable
                                .setPropertyDataSource(
                                        new ObjectProperty<String>(
                                                String.format(SUBTITLE_WARNING,
                                                        lMessages.getMessage(
                                                                "ui.contributions.process.warning")), //$NON-NLS-1$
                                                String.class));
                        lTable.setSelectable(false);
                    }
                }
            }
        });
        lLayout.addComponent(lDelete);
        lLayout.addComponent(RiplaViewHelper.createSpacer());
    }

    if (inReferenced.hasItems()) {
        lLayout.addComponent(new Label(lMessages.getMessage("ui.bibliography.link.remark.referenced"))); //$NON-NLS-1$
        lLayout.addComponent(createTable(inReferenced, inTask, true));
        final Button lRemove = new Button(lMessages.getMessage("ui.bibliography.link.button.removeR")); //$NON-NLS-1$
        lRemove.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent inEvent) {
                if (VIFViewHelper.processAction(inReferenced)) {
                    if (!inTask.removeReferences(inReferenced)) {
                        Notification.show(lMessages.getMessage("errmsg.biblio.remove.ref"), //$NON-NLS-1$
                                Type.WARNING_MESSAGE);
                    }
                }
            }
        });
        lLayout.addComponent(lRemove);
        lLayout.addComponent(RiplaViewHelper.createSpacer());
    }

    if (inUndeletable.hasItems()) {
        lLayout.addComponent(new Label(lMessages.getMessage("ui.bibliography.link.remark.undeletable"))); //$NON-NLS-1$
        lLayout.addComponent(createTable(inUndeletable, inTask, false));
    }
}

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

License:Open Source License

/** View constructor.
 *
 * @param inQuestion {@link Question} the actual question, possibly the question the bibliography will be linked
 *            with//from w  w w.j av  a 2  s.c  om
 * @param inGroup {@link Group} the actual group
 * @param inTitles {@link IndexedContainer} the titles of existing bibliography entries, to be filled in the combo
 *            box
 * @param inAuthors {@link IndexedContainer} the authors of existing bibliography entries, to be filled in the combo
 *            box
 * @param inTask {@link BibliographyHandleTask} the task (controller) of this view */
public BibliographySearchView(final Question inQuestion, final Group inGroup, final IndexedContainer inTitles,
        final IndexedContainer inAuthors, final BibliographyHandleTask inTask) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);
    lLayout.setSpacing(true);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    final String lTitle = lMessages.getFormattedMessage("ui.bibliography.link.title.page", //$NON-NLS-1$
            BeanWrapperHelper.getPlain(QuestionHome.KEY_QUESTION, inQuestion),
            BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion));
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$

    lLayout.addComponent(new Label(lMessages.getMessage("ui.bibliography.link.remark"), ContentMode.HTML)); //$NON-NLS-1$

    final LabelValueTable lTable = new org.ripla.web.util.LabelValueTable();
    title = createComboBox(inTitles);
    title.focus();
    lTable.addRow(lMessages.getMessage("ui.bibliography.label.title"), title); //$NON-NLS-1$

    author = createComboBox(inAuthors);
    lTable.addRow(lMessages.getMessage("ui.bibliography.label.author"), author); //$NON-NLS-1$
    lLayout.addComponent(lTable);

    final Button lSearch = new Button(lMessages.getMessage("ui.bibliography.link.button.search")); //$NON-NLS-1$
    final Button lCreate = new Button(lMessages.getMessage("ui.bibliography.link.button.create")); //$NON-NLS-1$
    lCreate.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.createNew(title.getValue(), author.getValue())) {
                Notification.show(Activator.getMessages().getMessage("errmsg.save.general"), //$NON-NLS-1$
                        Type.WARNING_MESSAGE);
            }
        }
    });
    lCreate.setVisible(false);

    final ResultView lResultView = new ResultView(inTask);
    lResultView.setVisible(false);

    lSearch.setClickShortcut(KeyCode.ENTER);
    lSearch.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (inTask.searchFor(title.getValue(), author.getValue())) {
                lCreate.setVisible(true);
                lResultView.fillTable(inTask.getTexts());
                lResultView.setVisible(true);
            }
        }
    });

    lLayout.addComponent(RiplaViewHelper.createButtons(lSearch, lCreate));
    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lLayout.addComponent(lResultView);
}

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

License:Open Source License

/** Constructor to edit the values of a bibliography entry.
 *
 * @param inText {@link Text}//ww w .  jav  a2s  .co  m
 * @param inDownloads {@link QueryResult}
 * @param inAuthors {@link QueryResult}
 * @param inReviewers {@link QueryResult}
 * @param inCodeList {@link CodeList}
 * @param inCreateVersion boolean <code>true</code> if the form should create a new (private) version of the
 *            published entry, <code>false</code> in case of editing an unpublished version.
 * @param inTask {@link IBibliographyTask}
 * @throws SQLException
 * @throws VException */
public BibliographyView(final Text inText, final QueryResult inDownloads, final QueryResult inAuthors,
        final QueryResult inReviewers, final CodeList inCodeList, final boolean inCreateVersion,
        final IBibliographyTask inTask) throws SQLException, VException {
    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.bibliography.editor.title.page")), ContentMode.HTML)); //$NON-NLS-1$

    final FormCreator lForm = BibliographyViewHelper.createBiblioForm(inText,
            new UploadComponent(inDownloads, inTask),
            getState(BeanWrapperHelper.getString(TextHome.KEY_STATE, inText), inCodeList, lMessages));
    lLayout.addComponent(lForm.createForm());
    final Button lSave = new Button(lMessages.getMessage("ui.button.save")); //$NON-NLS-1$

    // author/reviewer
    final AuthorReviewerRenderer lRenderer = AuthorReviewerRenderHelper.createRenderer(inAuthors, inReviewers,
            inTask);
    lLayout.addComponent(lRenderer.render(lMessages.getMessage("ui.discussion.question.view.label.author"), //$NON-NLS-1$
            lMessages.getMessage("ui.discussion.question.view.label.reviewer"))); //$NON-NLS-1$ //$NON-NLS-2$

    // add buttons
    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            try {
                lForm.commit();
                acutalizeType(inText, lForm.getTypes());
                if (!inTask.saveText(inText, inCreateVersion)) {
                    Notification.show(lMessages.getMessage("errmsg.save.general"), //$NON-NLS-1$
                            Notification.Type.WARNING_MESSAGE);
                }
            } catch (final CommitException exc) {
                // intentionally left empty
            }
        }
    });
    lLayout.addComponent(lSave);
}

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

License:Open Source License

/** @param inGroup
 * @param inMessages/*from   w  w w .  jav a 2  s .  c  o m*/
 * @return VerticalLayout */
private VerticalLayout createLayout(final Group inGroup, final IMessages inMessages) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    final String lTitle = String.format(inMessages.getFormattedMessage("ui.discussion.question.view.title.page", //$NON-NLS-1$
            BeanWrapperHelper.getString(GroupHome.KEY_ID, inGroup),
            BeanWrapperHelper.getString(GroupHome.KEY_NAME, inGroup)));
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$
    return lLayout;
}

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

License:Open Source License

/** View constructor
 * /* w ww . j ava2  s.c o m*/
 * @param inGroup {@link Group}
 * @param inQuestions {@link GroupContentContainer}
 * @param inTask {@link AdminQuestionListTask} */
public GroupContentView(final Group inGroup, final GroupContentContainer inQuestions,
        final AdminQuestionListTask inTask) {
    task = inTask;
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-table"); //$NON-NLS-1$
    final String lTitle = lMessages.getFormattedMessage("ui.discussion.questions.view.title.page", //$NON-NLS-1$
            BeanWrapperHelper.getLong(GroupHome.KEY_ID, inGroup),
            BeanWrapperHelper.getString(GroupHome.KEY_NAME, inGroup));
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ //$NON-NLS-2$

    final Label lSubtitle = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-description", //$NON-NLS-1$
            lMessages.getMessage("ui.discussion.questions.view.title.sub")), ContentMode.HTML); //$NON-NLS-1$
    lLayout.addComponent(lSubtitle);

    final Tree lTree = new Tree();
    lTree.focus();
    lTree.setContainerDataSource(inQuestions);
    lLayout.addComponent(lTree);

    for (final GroupContentWrapper lNode : inQuestions.getExpandedNodes()) {
        lTree.expandItem(lNode);
    }

    lTree.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(final ItemClickEvent inEvent) {
            task.processSelection((GroupContentWrapper) inEvent.getItemId());
        }
    });
    lTree.addShortcutListener(new ExtendedShortcutListener("enter", KeyCode.ENTER)); //$NON-NLS-1$
}

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

License:Open Source License

/** @param inGroup
 * @param inMessages/*from w  w w  .  j  a v  a 2s. c  om*/
 * @return */
private VerticalLayout createLayout(final Group inGroup, final IMessages inMessages) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    final String lTitle = inMessages.getFormattedMessage("ui.discussion.question.view.title.activ", //$NON-NLS-1$
            BeanWrapperHelper.getLong(GroupHome.KEY_ID, inGroup),
            BeanWrapperHelper.getString(GroupHome.KEY_NAME, inGroup));
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ //$NON-NLS-2$
    return lLayout;
}

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

License:Open Source License

/** @param inGroup
 * @param inMessages/*  w w  w  .ja  va2  s . com*/
 * @return VerticalLayout */
private VerticalLayout createLayout(final Group inGroup, final IMessages inMessages) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    final String lTitle = inMessages.getFormattedMessage("ui.discussion.question.view.title.page", //$NON-NLS-1$
            BeanWrapperHelper.getLong(GroupHome.KEY_ID, inGroup),
            BeanWrapperHelper.getString(GroupHome.KEY_NAME, inGroup));
    lLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ //$NON-NLS-2$
    return lLayout;
}