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.QuestionView.java

License:Open Source License

private VerticalLayout createTable(final String inCaption, final Container inDataSource,
        final IPluggable inTask) {
    final VerticalLayout out = new VerticalLayout();
    out.setStyleName("vif-question-table"); //$NON-NLS-1$

    out.addComponent(//  w  w w .  ja  v a 2s  .com
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-caption", inCaption), ContentMode.HTML)); //$NON-NLS-1$

    final Table lTable = new Table();
    lTable.setStyleName("vif-table"); //$NON-NLS-1$
    lTable.setWidth("100%"); //$NON-NLS-1$
    lTable.setColumnCollapsingAllowed(true);
    lTable.setColumnReorderingAllowed(true);
    lTable.setSelectable(true);
    lTable.setImmediate(true);
    lTable.setPageLength(0);

    lTable.setContainerDataSource(inDataSource);
    lTable.setVisibleColumns(QuestionContainer.NATURAL_COL_ORDER);
    lTable.setColumnHeaders(
            VIFViewHelper.getColumnHeaders(QuestionContainer.COL_HEADERS, Activator.getMessages()));
    lTable.addGeneratedColumn(QuestionContainer.QUESTION, new Table.ColumnGenerator() {
        @Override
        public Component generateCell(final Table inSource, final Object inItemId, final Object inColumnId) {
            return new Label(((QuestionWrapper) inItemId).getQuestion(), ContentMode.HTML);
        }
    });
    lTable.setColumnExpandRatio(QuestionContainer.QUESTION, 1);

    lTable.addValueChangeListener((ValueChangeListener) inTask);

    out.addComponent(lTable);
    return out;
}

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

License:Open Source License

/**
 * Constructor/*  w w  w . ja  v  a 2 s.  c om*/
 * 
 * @param inQuestions
 *            ContributionContainer
 * @param inWidth
 *            int
 * @param inHeight
 *            int
 */
public ReferencingQuestionLookup(final ContributionContainer inQuestions, final int inWidth,
        final int inHeight) {
    final IMessages lMessages = Activator.getMessages();
    lookup = new Window(lMessages.getMessage("lookup.window.title.referencing")); //$NON-NLS-1$
    lookup.addStyleName("vif-lookup"); //$NON-NLS-1$
    lookup.setWidth(inWidth, Unit.PIXELS);
    lookup.setHeight(inHeight, Unit.PIXELS);

    final VerticalLayout lLayout = (VerticalLayout) lookup.getContent();
    lLayout.setStyleName("vif-lookup"); //$NON-NLS-1$
    lLayout.setMargin(true);
    lLayout.setSpacing(true);

    lLayout.addComponent(createTable(inQuestions));

    final Button lClose = new Button(lMessages.getMessage("lookup.window.button.close"), //$NON-NLS-1$
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent inEvent) {
                    lookup.close();
                }
            });
    lClose.setClickShortcut(KeyCode.ESCAPE);
    lClose.setImmediate(true);
    lClose.setStyleName("vif-lookup-close"); //$NON-NLS-1$
    lLayout.addComponent(lClose);
}

From source file:org.hip.vif.admin.groupedit.ui.GroupListView.java

License:Open Source License

/** Constructor
 *
 * @param inGroups {@link GroupContainer} the groups to display
 * @param inTask {@link GroupShowTask} the controller */
public GroupListView(final GroupContainer inGroups, final GroupShowListTask inTask) {
    confirmationMode = false;//w  w w .  j a  v a2s  . co m
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    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.group.list.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$

    final Label lSubtitle = new Label(
            String.format(VIFViewHelper.TMPL_WARNING, lMessages.getMessage("ui.group.delete.warning")), //$NON-NLS-1$
            ContentMode.HTML);
    lSubtitle.setVisible(false);
    lLayout.addComponent(lSubtitle);

    final Table lTable = new Table();
    lTable.setWidth("100%"); //$NON-NLS-1$
    lTable.setContainerDataSource(inGroups);
    lTable.addGeneratedColumn(GroupContainer.GROUP_CHECK, new Table.ColumnGenerator() {
        @Override
        public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) {
            return createCheck((GroupWrapper) inItemId);
        }
    });

    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);

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    final Button lDelete = new Button(lMessages.getMessage("ui.group.editor.button.delete")); //$NON-NLS-1$
    lDelete.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (confirmationMode) {
                if (!inTask.deleteGroups()) {
                    Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                }
            } else {
                if (VIFViewHelper.processAction(inGroups)) {
                    confirmationMode = true;
                    inGroups.addContainerFilter(new SelectedFilter());
                    lSubtitle.setVisible(true);
                    lTable.setSelectable(false);
                    lTable.setPageLength(0);
                }
            }
        }
    });
    lLayout.addComponent(lDelete);
}

From source file:org.hip.vif.admin.groupedit.ui.GroupStateChangeNotificationView.java

License:Open Source License

/** View constructor.
 *
 * @param inGroupName String//from   w  w w .j av a  2s .  c  o  m
 * @param inSubject String
 * @param inBody String
 * @param inTask {@link GroupStateChangeNotificationTask} */
public GroupStateChangeNotificationView(final String inGroupName, final String inSubject, final String inBody,
        final GroupStateChangeNotificationTask inTask) {
    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.getFormattedMessage("ui.group.notify.view.title.page", inGroupName)), //$NON-NLS-1$
            ContentMode.HTML));

    lLayout.addComponent(new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-remark", //$NON-NLS-1$
                    lMessages.getMessage("ui.group.notify.label.remark")), //$NON-NLS-1$
            ContentMode.HTML));

    final PropertysetItem lMail = new PropertysetItem();
    lMail.addItemProperty(FLD_SUBJECT, new ObjectProperty<String>(""));
    lMail.addItemProperty(FLD_BODY, new ObjectProperty<String>(""));
    final FieldGroup lForm = new FieldGroup(lMail);
    final VerticalLayout lFormLayout = new VerticalLayout();

    String lLabel = lMessages.getMessage("ui.group.notify.label.subject"); //$NON-NLS-1$
    lFormLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", lLabel), ContentMode.HTML)); //$NON-NLS-1$
    final TextField lSubject = RiplaViewHelper.createTextField(inSubject, DEF_WIDTH,
            new NotEmptyValidator(lLabel, lMessages));
    addField(lLabel, lSubject, lFormLayout, lMessages);

    lLabel = lMessages.getMessage("ui.group.notify.label.body"); //$NON-NLS-1$
    lFormLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", lLabel), ContentMode.HTML)); //$NON-NLS-1$
    final RichTextArea lBody = VIFViewHelper.createTextArea(inBody, DEF_WIDTH, DEF_HEIGHT,
            new NotEmptyValidator(lLabel, lMessages));
    addField(lLabel, lBody, lFormLayout, lMessages);
    lForm.bind(lSubject, FLD_SUBJECT);
    lForm.bind(lBody, FLD_BODY);
    lLayout.addComponent(lFormLayout);

    final Button lNotify = new Button(lMessages.getMessage("ui.group.notify.button.notify")); //$NON-NLS-1$
    lNotify.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            try {
                lForm.commit();
                if (!inTask.doNotification(lMail.getItemProperty(FLD_SUBJECT).getValue().toString(),
                        lMail.getItemProperty(FLD_BODY).getValue().toString())) {
                    Notification.show(lMessages.getMessage("errmsg.notification.send"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                }
            } catch (InvalidValueException | CommitException exc) {
                // intentionally left empty
            }
        }
    });
    final Button lContinue = new Button(lMessages.getMessage("ui.group.notify.button.continue")); //$NON-NLS-1$
    lContinue.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            inTask.doContinue();
        }
    });
    lLayout.addComponent(RiplaViewHelper.createButtons(lNotify, lContinue));
}

From source file:org.hip.vif.admin.groupedit.ui.GroupView.java

License:Open Source License

private VerticalLayout initializeLayout(final String inTitleKey, final IMessages inMessages) {
    final VerticalLayout outLayout = new VerticalLayout();
    setCompositionRoot(outLayout);/*w  ww  .  j  av a2 s. c  om*/

    outLayout.setStyleName("vif-view"); //$NON-NLS-1$
    outLayout.addComponent(new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", inMessages.getMessage(inTitleKey)), //$NON-NLS-1$
            ContentMode.HTML)); //$NON-NLS-2$
    return outLayout;
}

From source file:org.hip.vif.admin.groupedit.ui.ParticipantListView.java

License:Open Source License

/** View constructor.
 *
 * @param inParticipants {@link ParticipantContainer}
 * @param inGroupName String/*from  ww  w.  j ava 2 s  . c  om*/
 * @param inEnableDelete boolean
 * @param inTask {@link ParticipantListTask} */
public ParticipantListView(final ParticipantContainer inParticipants, final String inGroupName,
        final boolean inEnableDelete, final ParticipantListTask inTask) {
    confirmationMode = false;
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    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.getFormattedMessage("ui.group.participants.view.title.page", inGroupName)), //$NON-NLS-1$
            ContentMode.HTML));

    final Label lSubtitle = new Label(
            String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.participants.delete.warning")), //$NON-NLS-1$
            ContentMode.HTML);
    lSubtitle.setVisible(false);
    lLayout.addComponent(lSubtitle);

    final Table lTable = new Table();
    lTable.setWidth("100%"); //$NON-NLS-1$
    lTable.setContainerDataSource(inParticipants);
    if (inEnableDelete) {
        lTable.addGeneratedColumn(ParticipantContainer.ENTRY_CHECK, new Table.ColumnGenerator() {
            @Override
            public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) {
                return createCheck((ParticipantBean) inItemId, new VIFViewHelper.IConfirmationModeChecker() {
                    @Override
                    public boolean inConfirmationMode() {
                        return confirmationMode;
                    }
                });
            }
        });
        lTable.setVisibleColumns(VIFViewHelper.getModifiedArray(ParticipantContainer.ENTRY_CHECK,
                ParticipantContainer.NATURAL_COL_ORDER));
        lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(
                VIFViewHelper.getModifiedArray("", (Object[]) ParticipantContainer.COL_HEADERS), lMessages)); //$NON-NLS-1$
    } else {
        lTable.setVisibleColumns(ParticipantContainer.NATURAL_COL_ORDER);
        lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(ParticipantContainer.COL_HEADERS, lMessages));
    }
    lTable.setPageLength(inParticipants.size() > TABLE_SIZE ? TABLE_SIZE : 0);
    lTable.setColumnCollapsingAllowed(true);
    lTable.setColumnReorderingAllowed(true);
    lTable.setSelectable(true);
    lTable.setImmediate(true);
    lTable.setColumnWidth(ParticipantContainer.PARTICIPANT_PLACE, 200);
    lTable.setColumnWidth(ParticipantContainer.PARTICIPANT_MAIL, 200);
    lTable.addValueChangeListener(inTask);

    lLayout.addComponent(lTable);

    if (inEnableDelete) {
        lLayout.addComponent(RiplaViewHelper.createSpacer());
        final Button lDelete = new Button(lMessages.getMessage("ui.participants.button.delete")); //$NON-NLS-1$
        lDelete.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent inEvent) {
                if (confirmationMode) {
                    if (!inTask.deleteParticipants()) {
                        Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                    }
                } else {
                    if (VIFViewHelper.processAction(inParticipants)) {
                        confirmationMode = true;
                        inParticipants.addContainerFilter(new SelectedFilter());
                        lSubtitle.setVisible(true);
                        lTable.setSelectable(false);
                        lTable.setPageLength(0);
                    }
                }
            }
        });
        lLayout.addComponent(lDelete);
    }
}

From source file:org.hip.vif.admin.member.ui.MemberListView.java

License:Open Source License

/** Constructor
 *
 * @param inMembers {@link MemberContainer}
 * @param inIsDeletable boolean <code>true</code> if the member entries are deletable and, therefore, a delete
 *            button is displayed//from www .  j a  v a  2s  .  c  o m
 * @param inTask {@link MemberShowListTask} */
public MemberListView(final MemberContainer inMembers, final boolean inIsDeletable,
        final AbstractMemberSearchTask inTask) {
    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.member.list.title.page")), ContentMode.HTML)); //$NON-NLS-1$

    final Label lSubtitle = new Label(
            String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.member.delete.warning")), //$NON-NLS-1$
            ContentMode.HTML);
    lSubtitle.setVisible(false);
    lLayout.addComponent(lSubtitle);

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

    if (inIsDeletable) {
        // generate check box
        lTable.addGeneratedColumn(MemberContainer.MEMBER_CHECK,
                new VIFViewHelper.CheckBoxColumnGenerator(new VIFViewHelper.IConfirmationModeChecker() {
                    @Override
                    public boolean inConfirmationMode() {
                        return confirmationMode;
                    }
                }));
        lTable.setVisibleColumns(VIFViewHelper.getModifiedArray(MemberContainer.MEMBER_CHECK,
                MemberContainer.NATURAL_COL_ORDER));
        lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(
                VIFViewHelper.getModifiedArray("", (Object[]) MemberContainer.COL_HEADERS), lMessages)); //$NON-NLS-1$
    } else {
        lTable.setVisibleColumns(MemberContainer.NATURAL_COL_ORDER);
        lTable.setColumnHeaders(VIFViewHelper.getColumnHeaders(MemberContainer.COL_HEADERS, lMessages));
    }

    lTable.setColumnCollapsingAllowed(true);
    lTable.setColumnReorderingAllowed(true);
    lTable.setSelectable(true);
    lTable.setImmediate(true);
    lTable.setPageLength(inMembers.size() > PAGE_LENGTH ? PAGE_LENGTH : 0);
    lTable.setColumnExpandRatio(MemberContainer.MEMBER_NAME, 1);
    lTable.setColumnWidth(MemberContainer.MEMBER_STREET, 200);
    lTable.setColumnWidth(MemberContainer.MEMBER_PLACE, 200);
    lTable.setColumnWidth(MemberContainer.MEMBER_MAIL, 200);
    lTable.addValueChangeListener(inTask);
    lLayout.addComponent(lTable);

    if (inIsDeletable) {
        lLayout.addComponent(RiplaViewHelper.createSpacer());
        final Button lDelete = new Button(lMessages.getMessage("ui.member.button.delete")); //$NON-NLS-1$
        lDelete.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent inEvent) {
                if (confirmationMode) {
                    if (!inTask.deleteMember()) {
                        Notification.show(lMessages.getMessage("errmsg.process.delete"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                    }
                } else {
                    if (VIFViewHelper.processAction(inMembers)) {
                        confirmationMode = true;
                        inMembers.addContainerFilter(new SelectedFilter());
                        lSubtitle.setVisible(true);
                        lTable.setSelectable(false);
                        lTable.setPageLength(0);
                    }
                }
            }
        });
        lLayout.addComponent(lDelete);
    }
}

From source file:org.hip.vif.admin.member.ui.MemberSearchView.java

License:Open Source License

private VerticalLayout createLayout(final String inTitle) {
    final VerticalLayout outLayout = new VerticalLayout();
    setCompositionRoot(outLayout);/*from  w ww  . ja v a 2 s  .c  o  m*/

    outLayout.setStyleName("vif-search"); //$NON-NLS-1$
    outLayout.addComponent(
            new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", inTitle), ContentMode.HTML)); //$NON-NLS-1$ //$NON-NLS-2$

    return outLayout;
}

From source file:org.hip.vif.admin.member.ui.MemberView.java

License:Open Source License

/** Constructor for the view to edit the member's role.
 *
 * @param inMember {@link Member}/* w w  w .  j a  va  2  s  .c om*/
 * @param inRoles {@link RoleContainer}
 * @param inRatings {@link RatingsHelper}
 * @param inTask {@link MemberShowTask} */
public MemberView(final Member inMember, final RoleContainer inRoles, final RatingsHelper inRatings,
        final MemberShowTask inTask) {
    final IMessages lMessages = Activator.getMessages();
    final VerticalLayout lLayout = initLayout(lMessages, "ui.member.edit.title.page"); //$NON-NLS-1$

    final Button lSave = createSaveButton(lMessages);
    final VerticalLayout lMemberLayout = new VerticalLayout();
    lMemberLayout.setStyleName("vif-view-member"); //$NON-NLS-1$
    lLayout.addComponent(lMemberLayout);

    final LabelValueTable lTable = displayMember(inMember, lMessages);

    lMemberLayout.addComponent(lTable);
    final OptionGroup lRoles = createRolesOptions(inRoles);
    lTable.addRowEmphasized(lMessages.getMessage("ui.member.editor.label.role"), lRoles); //$NON-NLS-1$

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lLayout.addComponent(lSave);
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (!inRoles.hasChecked()) {
                Notification.show(lMessages.getMessage("errmsg.member.role.empty"), Type.ERROR_MESSAGE); //$NON-NLS-1$
            } else {
                if (!inTask.saveRoles(inMember, inRoles)) {
                    Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$
                }
            }
        }
    });

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lLayout.addComponent(RiplaViewHelper.createSpacer());
    lLayout.addComponent(new RatingsTable(inRatings));
}

From source file:org.hip.vif.admin.member.ui.SelectMemberLookup.java

License:Open Source License

/** View constructor.
 *
 * @param inSubtitle String/* w  ww . java2 s  . c o  m*/
 * @param inRightColumnTitle String
 * @param inMembers {@link MemberBeanContainer} the available members to select from
 * @param inAdmins {@link Collection} the collection of members already selected (must be a subset of
 *            <code>inMembers</code>)
 * @param inTask {@link AbstrachtMemberLookupTask} */
public SelectMemberLookup(final String inSubtitle, final String inRightColumnTitle,
        final MemberBeanContainer inMembers, final Collection<MemberBean> inAdmins,
        final AbstrachtMemberLookupTask inTask) {
    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.member.lookup.title.page")), ContentMode.HTML)); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-description", inSubtitle), //$NON-NLS-1$
            ContentMode.HTML));

    final TwinColSelect lSelect = new TwinColSelect();
    lSelect.setContainerDataSource(inMembers);
    lSelect.setValue(inAdmins);

    lSelect.setLeftColumnCaption(lMessages.getMessage("ui.member.lookup.available")); //$NON-NLS-1$
    lSelect.setRightColumnCaption(inRightColumnTitle); //$NON-NLS-1$

    lSelect.setWidth(650, Unit.PIXELS);
    lSelect.setRows(19);
    lSelect.setImmediate(true);
    lLayout.addComponent(lSelect);
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    final Button lSave = new Button(lMessages.getMessage("ui.member.button.save")); //$NON-NLS-1$
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        @SuppressWarnings("unchecked")
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.selectMembers((Collection<MemberBean>) lSelect.getValue())) {
                Notification.show(lMessages.getMessage("ui.member.lookup.error.msg"), Type.WARNING_MESSAGE); //$NON-NLS-1$
            }
        }
    });
    lLayout.addComponent(lSave);
}