List of usage examples for com.vaadin.ui VerticalLayout setStyleName
@Override public void setStyleName(String style)
From source file:org.hip.vif.admin.permissions.ui.PermissionEditView.java
License:Open Source License
/** Constructor * * @param inPermissions {@link LoadedPermissionContainer} the permissions * @param inRoles {@link CodeList} the roles * @param inTask {@link PermissionsEditTask} */ public PermissionEditView(final LoadedPermissionContainer inPermissions, final CodeList inRoles, final PermissionsEditTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);/*from w w w . ja v a2 s .c om*/ 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("component.menu.title")), //$NON-NLS-1$ ContentMode.HTML)); final Label lSubtitle = new Label( String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.permission.remark.delete")), //$NON-NLS-1$ ContentMode.HTML); lLayout.addComponent(lSubtitle); lSubtitle.setVisible(false); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setStyleName("vif-permission-table"); //$NON-NLS-1$ lTable.setContainerDataSource(inPermissions); // generate column checkbox for delete lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_CHECK, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { if (Constants.PERMISSION_EDIT.equals(((LoadedPermissionBean) inItemId).getLabel())) { return new Label(); } return VIFViewHelper.createCheck((ISelectableBean) inItemId, new VIFViewHelper.IConfirmationModeChecker() { @Override public boolean inConfirmationMode() { return confirmationMode; } }); } }); // generate column label lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_LABEL, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { final LoadedPermissionBean lPermission = (LoadedPermissionBean) inItemId; return new Label(String.format(TMPL_LABEL, lPermission.getDescription(), lPermission.getLabel()), ContentMode.HTML); } }); // generate column checkbox for roles lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_SU, new ColumnCheckBoxGenerator(Role.SU)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_ADMIN, new ColumnCheckBoxGenerator(Role.ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GROUPADMIN, new ColumnCheckBoxGenerator(Role.GROUP_ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_PARTICIPANT, new ColumnCheckBoxGenerator(Role.PARTICIPANT)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_MEMBER, new ColumnCheckBoxGenerator(Role.MEMBER)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GUEST, new ColumnCheckBoxGenerator(Role.GUEST)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_EXCLUDED, new ColumnCheckBoxGenerator(Role.EXCLUDED)); lTable.setPageLength(inPermissions.size() > TABLE_SIZE ? TABLE_SIZE : 0); lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.setVisibleColumns(LoadedPermissionContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(getHeaders(inRoles, lMessages)); lTable.setColumnExpandRatio(LoadedPermissionContainer.FIELD_LABEL, 1); lLayout.addComponent(lTable); final Button lDelete = new Button(lMessages.getMessage("ui.permission.button.delete")); //$NON-NLS-1$ final Button lSave = new Button(lMessages.getMessage("ui.permission.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.saveChanges()) { Notification.show(lMessages.getMessage("errmsg.permissions.save"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lDelete, lSave)); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Component lInput = createInput(inTask, lMessages); lLayout.addComponent(lInput); // add button click listeners lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deletePermissions()) { Notification.show(lMessages.getMessage("errmsg.permissions.delete"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } else { if (VIFViewHelper.processAction(inPermissions)) { confirmationMode = true; inPermissions.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); lInput.setVisible(false); lSave.setVisible(false); } } } }); }
From source file:org.hip.vif.admin.permissions.ui.PermissionEditView.java
License:Open Source License
private Component createInput(final PermissionsEditTask inTask, final IMessages inMessages) { final VerticalLayout out = new VerticalLayout(); out.setStyleName("vif-view"); //$NON-NLS-1$ out.addComponent(new Label( String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$ inMessages.getMessage("ui.permission.subtitle.create")), //$NON-NLS-1$ ContentMode.HTML));//from w ww. ja v a 2 s . c o m final PermissionBean lPermission = new PermissionBean(); final FormCreator lForm = new FormCreator(lPermission); out.addComponent(lForm.createForm()); final Button lNew = new Button(inMessages.getMessage("ui.permission.button.create")); //$NON-NLS-1$ lNew.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { try { lForm.commit(); if (!inTask.createPermission(lPermission.getLabel(), lPermission.getDescription())) { Notification.show(inMessages.getMessage("errmsg.permissions.create"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } catch (final ExternIDNotUniqueException exc) { Notification.show(inMessages.getMessage("errmsg.permissions.not.unique"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } catch (final CommitException exc) { // intentionally left empty } } }); out.addComponent(lNew); return out; }
From source file:org.hip.vif.forum.groups.ui.AbstractContributionsProcessView.java
License:Open Source License
/** @param inFirstname String * @param inFamilyname String/*from ww w. j av a 2s. co m*/ * @param inGroupTitle String * @param inMessages {@link IMessages} * @param inTitleKey String * @return {@link VerticalLayout} */ protected VerticalLayout initComponent(final String inFirstname, final String inFamilyname, // NOPMD final String inGroupTitle, final IMessages inMessages, final String inTitleKey) { final VerticalLayout outLayout = new VerticalLayout(); setCompositionRoot(outLayout); outLayout.setStyleName("vif-view"); //$NON-NLS-1$ final String lTitle = String .format(inMessages.getFormattedMessage(inTitleKey, inFirstname, inFamilyname, inGroupTitle)); //$NON-NLS-1$ outLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ return outLayout; }
From source file:org.hip.vif.forum.groups.ui.AbstractContributionView.java
License:Open Source License
private VerticalLayout createCompletion(final String inCompletionText, final String inCompletionState, final CodeList inCodeList, 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);/*from www .j a v a 2 s . com*/ lTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth( new Label(String.format(VIFViewHelper.TMPL_TITLE, inStyle, inMessages.getMessage(inMsgKey)), ContentMode.HTML))); //$NON-NLS-1$ //$NON-NLS-1$ if (WorkflowAwareContribution.isUnpublished(inCompletionState)) { final Label lNote = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-note", //$NON-NLS-1$ getState(inCompletionState, inCodeList, inMessages)), ContentMode.HTML); lTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lNote)); } outLayout.addComponent(lTitleView); // the completion outLayout.addComponent(new Label(inCompletionText, ContentMode.HTML)); return outLayout; }
From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java
License:Open Source License
private void createBiblioLayout(final VerticalLayout inLayout, final QueryResult inBibliography, final IMessages inMessages, final IPluggableWithLookup inTask, final IComponentCreator inCreator) 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.question.view.label.bibliography")), ContentMode.HTML)); //$NON-NLS-1$ boolean hasBibliography = false; while (inBibliography.hasMoreElements()) { lBibliography.addComponent(inCreator.createComponent(inBibliography.next(), inTask)); hasBibliography = true;/*from w w w . j av a 2 s . c o m*/ } if (hasBibliography) { inLayout.addComponent(lBibliography); } }
From source file:org.hip.vif.forum.groups.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 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 Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.createNew(title.getValue(), author.getValue())) { Notification.show(Activator.getMessages().getMessage("errmsg.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lCreate.setVisible(false); final ResultView lResultView = new ResultView(inTask); lResultView.setVisible(false); lSearch.setClickShortcut(KeyCode.ENTER); lSearch.addClickListener(new Button.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.forum.groups.ui.BibliographyView.java
License:Open Source License
/** Constructor to edit the values of a bibliography entry. * * @param inText//from w w w. ja v a 2 s.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 save = new Button(lMessages.getMessage("ui.button.save")); //$NON-NLS-1$ // author/reviewer final AuthorReviewerRenderer lRenderer = AuthorReviewerRenderHelper.createRenderer(inAuthors, inReviewers, inTask, true); lLayout.addComponent(lRenderer.render(lMessages.getMessage("ui.question.view.label.author"), //$NON-NLS-1$ lMessages.getMessage("ui.question.view.label.reviewer"))); //$NON-NLS-1$ //$NON-NLS-2$ // add buttons lLayout.addComponent(RiplaViewHelper.createSpacer()); save.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"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } catch (final CommitException exc) { // intentionally left empty } } }); lLayout.addComponent(save); }
From source file:org.hip.vif.forum.groups.ui.CompletionView.java
License:Open Source License
/** Constructor * * @param inCompletion String the completion text * @param inCompletionID Long/* www . jav a2 s . c o m*/ * @param inQuestion {@link DomainObject} the question the completion is belonging to * @param inCompletions {@link QueryResult} other completions belonging to the question * @param inGroup {@link Group} the discussion group the question belongs to * @param inCodeList {@link CodeList} the code list for the contributions' workflow states * @param inTask {@link AbstractCompletionTask} * @throws VException * @throws SQLException */ public CompletionView(final String inCompletion, final Long inCompletionID, final DomainObject inQuestion, final QueryResult inCompletions, final Group inGroup, final CodeList inCodeList, final AbstractCompletionTask inTask) throws VException, SQLException { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ final String lTitle = String.format(lMessages.getFormattedMessage("ui.completion.group.title", //$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-title", lTitle), ContentMode.HTML)); //$NON-NLS-1$ final String lSubTitle = String.format(lMessages.getFormattedMessage("ui.completion.title", //$NON-NLS-1$ BeanWrapperHelper.getPlain(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion))); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lSubTitle), ContentMode.HTML)); //$NON-NLS-1$ addProperQuestion(inQuestion, lMessages, lLayout); // completions while (inCompletions.hasMoreElements()) { final GeneralDomainObject lCompletionBO = inCompletions.next(); final Long lCompletionID = BeanWrapperHelper.getLong(CompletionHome.KEY_ID, lCompletionBO); // we have to filter out the actual completion in the edit case because this completion is displayed in the // editor if (!lCompletionID.equals(inCompletionID)) { lLayout.addComponent(createCompletion(lCompletionBO, inCodeList, lMessages, false, inTask)); } } lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-subtitle", //$NON-NLS-1$ lMessages.getMessage("ui.completion.label")), ContentMode.HTML)); //$NON-NLS-1$ completionEditor = new RichTextArea(); completionEditor.setWidth("70%"); //$NON-NLS-1$ completionEditor.setHeight(250, Unit.PIXELS); completionEditor.setValue(inCompletion); completionEditor.setStyleName("vif-editor"); //$NON-NLS-1$ lLayout.addComponent(completionEditor); final Button lSave = new Button(lMessages.getMessage("ui.button.save")); //$NON-NLS-1$ lLayout.addComponent(lSave); lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { final String lValue = completionEditor.getValue(); if (checkEditorInput(lValue)) { //$NON-NLS-1$ completionEditor.setValue(""); //$NON-NLS-1$ Notification.show(lMessages.getMessage("errmsg.completion.not.empty"), Type.WARNING_MESSAGE); //$NON-NLS-1$ return; } if (!inTask.saveCompletion(lValue)) { Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); }
From source file:org.hip.vif.forum.groups.ui.GroupContentView.java
License:Open Source License
/** Constructor * * @param inGroup {@link Group}/*ww w . j a v a 2 s . com*/ * @param inContent {@link GroupContentContainer} * @param inTask {@link GroupShowTask} * @throws VException */ public GroupContentView(final Group inGroup, final GroupContentContainer inContent, final GroupShowTask inTask) throws VException { task = inTask; final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); lLayout.setStyleName("vif-table"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$ Activator.getMessages().getFormattedMessage("ui.group.content.view.title.page", //$NON-NLS-1$ inGroup.get(GroupHome.KEY_NAME).toString())), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(new Label( String.format(VIFViewHelper.TMPL_TITLE, "vif-description", //$NON-NLS-1$ inGroup.get(GroupHome.KEY_DESCRIPTION).toString()), ContentMode.HTML)); questionTree = new Tree(); questionTree.focus(); questionTree.setContainerDataSource(inContent); lLayout.addComponent(questionTree); for (final GroupContentWrapper lNode : inContent.getExpandedNodes()) { questionTree.expandItem(lNode); } questionTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(final ItemClickEvent inEvent) { task.processSelection((GroupContentWrapper) inEvent.getItemId()); } }); questionTree.addShortcutListener(new ExtendedShortcutListener("enter", KeyCode.ENTER)); //$NON-NLS-1$ }
From source file:org.hip.vif.forum.groups.ui.GroupListView.java
License:Open Source License
/** Constructor * * @param inGroups {@link GroupContainer} the groups to display in the table * @param inTask {@link GroupShowListTask} */ public GroupListView(final GroupContainer inGroups, final GroupShowListTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);/* w w w. j a v a2 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-title", //$NON-NLS-1$ lMessages.getMessage("ui.group.list.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setContainerDataSource(inGroups); 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); }