List of usage examples for com.vaadin.ui VerticalLayout setStyleName
@Override public void setStyleName(String style)
From source file:org.hip.vif.forum.groups.ui.QuestionEditor.java
License:Open Source License
/** Constructor * * @param inQuestion String/*from w ww. j a v a 2 s . c om*/ * @param inRemark String * @param inParentQuestion {@link Question} * @param inGroup {@link Group} * @param inCompletions {@link QueryResult} the parent question's completions * @param inBibliography {@link QueryResult} the parent question's texts * @param inAuthors {@link QueryResult} the parent question's authors * @param inReviewers {@link QueryResult} the parent question's reviewers * @param inCodeList {@link CodeList} * @param inTask {@link AbstractQuestionTask} * @throws VException * @throws SQLException */ public QuestionEditor(final String inQuestion, final String inRemark, final Question inParentQuestion, final Group inGroup, final QueryResult inCompletions, final QueryResult inBibliography, final QueryResult inAuthors, final QueryResult inReviewers, final CodeList inCodeList, final AbstractQuestionTask 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.getMessage("ui.question.editor.title.page"), //$NON-NLS-1$ inGroup.get(GroupHome.KEY_NAME).toString()); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ // parent question final String lLabel = String.format(lMessages.getMessage("ui.question.editor.title.question"), //$NON-NLS-1$ BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inParentQuestion)); lLayout.addComponent(createQuestion(inParentQuestion, lLabel, inCodeList, inAuthors, inReviewers, lMessages, false, inTask)); // parent question: completions while (inCompletions.hasMoreElements()) { lLayout.addComponent(createCompletion(inCompletions.next(), inCodeList, lMessages, false, inTask)); } // parent question: texts createBibliography(lLayout, inBibliography, lMessages, inTask); lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$ lMessages.getMessage("ui.question.editor.label.question")), ContentMode.HTML)); //$NON-NLS-1$ questionEditor = createEditField(inQuestion, 150); lLayout.addComponent(questionEditor); lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-subtitle", //$NON-NLS-1$ lMessages.getMessage("ui.question.editor.label.remark")), ContentMode.HTML)); //$NON-NLS-1$ remarkEditor = createEditField(inRemark, 250); lLayout.addComponent(remarkEditor); 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 lQuestion = questionEditor.getValue(); final String lRemark = remarkEditor.getValue(); if (checkEditorInput(lQuestion) || checkEditorInput(lRemark)) { Notification.show(lMessages.getMessage("errmsg.question.not.empty"), Type.WARNING_MESSAGE); //$NON-NLS-1$ return; } if (!inTask.saveQuestion(lQuestion, lRemark)) { Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); }
From source file:org.hip.vif.forum.groups.ui.QuestionView.java
License:Open Source License
/** Constructor for normal view. * * @param inGroup {@link Group} the discussion group the question belongs to * @param inQuestion {@link Question} the question to display its content * @param inCodeList {@link CodeList} the list of codes for the question state * @param inParent {@link QuestionContainer} the question's parent * @param inChildren {@link QuestionContainer} the question's follow up questions * @param inAuthors {@link QueryResult}/*ww w . j a v a 2 s .c o m*/ * @param inReviewers {@link QueryResult} * @param inCompletions List<Completion> * @param inBibliography {@link QueryResult} * @param inSwitchHelper {@link SwitchHelper} * @param isGuest boolean if the user is guest, we provide less functionality (i.e. less information about * authors/reviewers) * @param inTask {@link QuestionShowTask} this view's controller * @throws VException * @throws SQLException */ public QuestionView(final Group inGroup, final Question inQuestion, final CodeList inCodeList, final QuestionContainer inParent, final QuestionContainer inChildren, final QueryResult inAuthors, final QueryResult inReviewers, final List<Completion> inCompletions, final QueryResult inBibliography, final SwitchHelper inSwitchHelper, final boolean isGuest, final QuestionShowTask 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.getMessage("ui.question.view.title.page"), //$NON-NLS-1$ inGroup.get(GroupHome.KEY_NAME).toString()); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ if (!isGuest) { createSubscribeBookmarkButtons(inQuestion, inSwitchHelper, lMessages, lLayout, inTask); } // question final String lLabel = String.format(lMessages.getMessage("ui.question.view.title.question"), //$NON-NLS-1$ BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion)); lLayout.addComponent( createQuestion(inQuestion, lLabel, inCodeList, inAuthors, inReviewers, lMessages, isGuest, inTask)); // completions for (final Completion lCompletion : inCompletions) { lLayout.addComponent(createCompletion(lCompletion, inCodeList, lMessages, isGuest, inTask)); } // texts createBibliography(lLayout, inBibliography, lMessages, inTask); lLayout.addComponent(RiplaViewHelper.createSpacer()); // parent question if (!inQuestion.isRoot()) { lLayout.addComponent(createParent(inParent, inTask, lMessages)); } // follow up questions if (!inChildren.isEmpty()) { lLayout.addComponent(createChildren(inChildren, inTask, lMessages)); } }
From source file:org.hip.vif.forum.groups.ui.QuestionView.java
License:Open Source License
/** Constructor for view of question in lookup window. * * @param inQuestion {@link Question} the question to display its content * @param inCodeList {@link CodeList} the list of codes for the question state * @param inAuthors/* w w w. j a v a2 s. com*/ * @param inReviewers * @param inCompletions * @param inBibliography * @throws VException * @throws SQLException */ public QuestionView(final Question inQuestion, final CodeList inCodeList, final QueryResult inAuthors, final QueryResult inReviewers, final List<Completion> inCompletions, final QueryResult inBibliography) throws VException, SQLException { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ // question final String lLabel = String.format(lMessages.getMessage("ui.question.view.title.question"), //$NON-NLS-1$ BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion)); lLayout.addComponent(createQuestion(inQuestion, lLabel, inCodeList, inAuthors, inReviewers, lMessages)); // completions for (final Completion lCompletion : inCompletions) { lLayout.addComponent(createCompletionPlain(lCompletion, inCodeList, lMessages)); } // texts createBibliography(lLayout, inBibliography, lMessages); }
From source file:org.hip.vif.forum.groups.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(//from w w w. j av a 2s . c o m 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_ID, 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_ID, 1); lTable.addValueChangeListener((ValueChangeListener) inTask); tables.add(lTable); out.addComponent(lTable); return out; }
From source file:org.hip.vif.forum.groups.ui.StateChangeView.java
License:Open Source License
/** Constructor * * @param inQuestion {@link Question} the question which's state has to be changed * @param inMsgKeyTitle String the view's title * @param inMsgKeyQuestion String the view's message * @param inMsgKeyButton String the action button's caption * @param inTask {@link StateChangePrepareTask} */ public StateChangeView(final Question inQuestion, final String inMsgKeyTitle, final String inMsgKeyQuestion, final String inMsgKeyButton, final StateChangePrepareTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);/*from w w w. ja va 2 s. c om*/ final IMessages lMessages = Activator.getMessages(); lLayout.addComponent(new Label( String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lMessages.getMessage(inMsgKeyTitle)), //$NON-NLS-1$ ContentMode.HTML)); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ final String lLabel = String.format(lMessages.getMessage("ui.question.view.title.question"), //$NON-NLS-1$ BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion)); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", lLabel), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent( new Label(BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION, inQuestion), ContentMode.HTML)); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(new Label(lMessages.getMessage(inMsgKeyQuestion))); final Button lProcess = new Button(lMessages.getMessage(inMsgKeyButton), new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.processStateChange()) { Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(lProcess); }
From source file:org.hip.vif.forum.member.ui.EditPersonalDataView.java
License:Open Source License
/** Constructor * * @param inMember {@link Member} the member model to display * @param inRatings {@link RatingsHelper} the helper object containing the ratings to display * @param inTask {@link PersonalDataEditTask} the task controlling this view */ public EditPersonalDataView(final Member inMember, final RatingsHelper inRatings, final PersonalDataEditTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);//w ww . j a v a2s . c om 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.member.view.title.page", //$NON-NLS-1$ BeanWrapperHelper.getString(MemberHome.KEY_USER_ID, inMember))), ContentMode.HTML)); //$NON-NLS-2$ final FormCreator lForm = new FormCreator(inMember); lLayout.addComponent(lForm.createForm()); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lSave = new Button(lMessages.getMessage("ui.member.button.save")); //$NON-NLS-1$ lLayout.addComponent(lSave); lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { try { lForm.commit(); actualizeAddress(inMember, lForm.getAddress()); if (inTask.saveMember(inMember)) { Notification.show(lMessages.getMessage("msg.task.data.changed"), Type.TRAY_NOTIFICATION); //$NON-NLS-1$ } else { Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } catch (final CommitException exc) { // intentionally left empty } } }); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(new RatingsTable(inRatings)); }
From source file:org.hip.vif.forum.member.ui.EditPwrdView.java
License:Open Source License
/** View to display message that password change is disabled. */ public EditPwrdView() { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);/*from ww w. ja v a 2 s. c o m*/ lLayout.setStyleName("vif-view"); //$NON-NLS-1$ lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", "ui.pwrd.view.title.disabled"), //$NON-NLS-1$//$NON-NLS-2$ ContentMode.HTML)); }
From source file:org.hip.vif.forum.member.ui.EditPwrdView.java
License:Open Source License
/** Displays the password edit form. * * @param inUserID String the user id// ww w . j a v a2 s. co m * @param inTask {@link PwrdEditTask} this view's controller */ public EditPwrdView(final String inUserID, final PwrdEditTask 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.pwrd.view.title.page", inUserID)), ContentMode.HTML)); //$NON-NLS-1$ //$NON-NLS-2$ final LabelValueTable lTable = new LabelValueTable(); final PasswordField lOld = createPasswordField(DFT_WIDTH_INPUT); lOld.focus(); lTable.addRow(lMessages.getMessage("ui.pwrd.editor.label.old"), lOld); //$NON-NLS-1$ final PasswordField lNew1 = createPasswordField(DFT_WIDTH_INPUT); lTable.addRow(lMessages.getMessage("ui.pwrd.editor.label.new"), lNew1); //$NON-NLS-1$ final PasswordField lNew2 = createPasswordField(DFT_WIDTH_INPUT); lTable.addRow(lMessages.getMessage("ui.pwrd.editor.label.confirm"), lNew2); //$NON-NLS-1$ lLayout.addComponent(lTable); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lSave = new Button(lMessages.getMessage("ui.member.button.save")); //$NON-NLS-1$ lLayout.addComponent(lSave); lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (new PasswordInputChecker(lNew1, lNew2).checkInput()) { try { if (!inTask.savePwrd(lOld.getValue().toString(), lNew1.getValue().toString(), lNew2.getValue().toString())) { Notification.show(lMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } catch (final InvalidAuthenticationException exc) { Notification.show(lMessages.getMessage("errmsg.pwrd.invalid"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } } }); }
From source file:org.hip.vif.forum.register.ui.GroupListRegisterView.java
License:Open Source License
/** Constructor * * @param inGroups {@link GroupContainer} the groups to display in the table * @param inTask {@link RegisterShowListTask} */ public GroupListRegisterView(final GroupContainer inGroups, final RegisterShowListTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);/*ww w.j av 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.register.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ table = createTable(inGroups, lMessages); lLayout.addComponent(table); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lButton = new Button(lMessages.getMessage("ui.register.view.button")); //$NON-NLS-1$ lButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (VIFViewHelper.processAction(inGroups)) { final Feedback lFeedback = inTask.saveRegisterings(); // refresh the view, we do this to display the correct number of participants final Table lOld = table; table = createTable(lFeedback.groups, lMessages); lLayout.replaceComponent(lOld, table); table.markAsDirty(); // give feedback Notification.show(lFeedback.message, lFeedback.notificationType); } } }); lLayout.addComponent(lButton); }
From source file:org.hip.vif.forum.search.ui.SearchContentView.java
License:Open Source License
/** View constructor. * * @param inHelpContent URL// ww w. j ava 2 s . co m * @param inTask {@link SearchContentTask} */ public SearchContentView(final URL inHelpContent, final SearchContentTask 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.search.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final HorizontalLayout lInput = new HorizontalLayout(); lInput.setMargin(new MarginInfo(true, true, true, false)); final Label lLabel = new Label( String.format("%s: ", lMessages.getMessage("ui.search.view.label.input")), ContentMode.HTML); //$NON-NLS-1$ //$NON-NLS-2$ lInput.addComponent(RiplaViewHelper.makeUndefinedWidth(lLabel)); lInput.setComponentAlignment(lLabel, Alignment.MIDDLE_LEFT); final TextField lSearch = new TextField(); lSearch.setColumns(50); lSearch.focus(); lInput.addComponent(lSearch); lInput.addComponent( new HelpButton(lMessages.getMessage("ui.search.view.button.help"), inHelpContent, 700, 620)); //$NON-NLS-1$ lLayout.addComponent(lInput); final Table lSearchResult = new Table(); final Button lButton = new Button(lMessages.getMessage("ui.search.view.button.search")); //$NON-NLS-1$ lButton.setClickShortcut(KeyCode.ENTER); lButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { final String lQuery = lSearch.getValue().toString().trim(); if (lQuery.length() <= MIN_INPUT) { Notification.show(lMessages.getMessage("errmsg.search.noInput"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } else { try { initTable(inTask.search(lQuery), lSearchResult); lSearchResult.setVisible(true); } catch (final NoHitsException exc) { lSearchResult.setVisible(false); Notification.show( lMessages.getFormattedMessage("errmsg.search.noHits", exc.getQueryString()), //$NON-NLS-1$ Type.WARNING_MESSAGE); } catch (final Exception exc) { lSearchResult.setVisible(false); Notification.show(lMessages.getMessage("errmsg.search.wrongInput"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } } }); lLayout.addComponent(lButton); lLayout.addComponent(RiplaViewHelper.createSpacer()); lSearchResult.setVisible(false); lSearchResult.setWidth("100%"); //$NON-NLS-1$ lSearchResult.setColumnCollapsingAllowed(true); lSearchResult.setColumnReorderingAllowed(true); lSearchResult.setSelectable(true); lSearchResult.setImmediate(true); lSearchResult.addValueChangeListener(inTask); lLayout.addComponent(lSearchResult); }