List of usage examples for com.vaadin.ui VerticalLayout addStyleName
@Override public void addStyleName(String style)
From source file:de.symeda.sormas.ui.task.TaskListEntry.java
License:Open Source License
public TaskListEntry(TaskIndexDto task) { this.task = task; setMargin(false);/*from ww w.jav a2 s.c o m*/ setSpacing(true); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST_ENTRY); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setMargin(false); topLayout.setSpacing(false); topLayout.setWidth(100, Unit.PERCENTAGE); addComponent(topLayout); setExpandRatio(topLayout, 1); // TOP LEFT VerticalLayout topLeftLayout = new VerticalLayout(); topLeftLayout.setMargin(false); topLeftLayout.setSpacing(false); Label taskTypeLabel = new Label(DataHelper.toStringNullable(task.getTaskType())); CssStyles.style(taskTypeLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topLeftLayout.addComponent(taskTypeLabel); Label suggestedStartLabel = new Label( I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.SUGGESTED_START) + ": " + DateHelper.formatLocalShortDate(task.getSuggestedStart())); topLeftLayout.addComponent(suggestedStartLabel); Label dueDateLabel = new Label(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.DUE_DATE) + ": " + DateHelper.formatLocalShortDate(task.getDueDate())); topLeftLayout.addComponent(dueDateLabel); topLayout.addComponent(topLeftLayout); // TOP RIGHT VerticalLayout topRightLayout = new VerticalLayout(); topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT); topRightLayout.setMargin(false); topRightLayout.setSpacing(false); Label statusLabel = new Label(DataHelper.toStringNullable(task.getTaskStatus())); CssStyles.style(statusLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topRightLayout.addComponent(statusLabel); Label priorityLabel = new Label( DataHelper.toStringNullable(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.PRIORITY) + ": " + task.getPriority())); if (TaskPriority.HIGH == task.getPriority()) { priorityLabel.addStyleName(CssStyles.LABEL_IMPORTANT); } else if (TaskPriority.NORMAL == task.getPriority()) { priorityLabel.addStyleName(CssStyles.LABEL_NEUTRAL); } topRightLayout.addComponent(priorityLabel); Label userLabel = new Label(I18nProperties.getPrefixCaption(TaskDto.I18N_PREFIX, TaskDto.ASSIGNEE_USER) + ": " + task.getAssigneeUser().getCaption()); topRightLayout.addComponent(userLabel); topLayout.addComponent(topRightLayout); topLayout.setComponentAlignment(topRightLayout, Alignment.TOP_RIGHT); String statusStyle; switch (task.getTaskStatus()) { case DONE: statusStyle = CssStyles.LABEL_DONE; break; case NOT_EXECUTABLE: statusStyle = CssStyles.LABEL_NOT; break; case REMOVED: statusStyle = CssStyles.LABEL_DISCARDED; break; default: statusStyle = null; } if (statusStyle != null) { taskTypeLabel.addStyleName(statusStyle); suggestedStartLabel.addStyleName(statusStyle); dueDateLabel.addStyleName(statusStyle); statusLabel.addStyleName(statusStyle); priorityLabel.addStyleName(statusStyle); userLabel.addStyleName(statusStyle); } }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultCompoundSearchView.java
License:Apache License
protected Component createSearchInfo() { Table table = createColumnInfoTable(); Label syntaxReference = new Label(getMessage("portlet.crud.compoundsearch.syntaxReference"), ContentMode.HTML);//from w w w . j a v a 2 s.co m VerticalLayout boxLayout = new VerticalLayout(table, syntaxReference); boxLayout.addStyleName("compsearchinfo"); boxLayout.setWidth("350px"); boxLayout.setSpacing(true); return boxLayout; }
From source file:dhbw.clippinggorilla.userinterface.views.ArchiveView.java
public void createClippingViewByProfile(Clipping clipping) { clippingArticlesLayout.removeAllComponents(); if (clipping.getArticles().keySet().isEmpty() && clipping.getArticlesFromGroup().keySet().isEmpty()) { Label labelNoProfile = new Label(); Language.setCustom(Word.NO_PROFILE_PRESENT, s -> labelNoProfile.setValue(s)); labelNoProfile.addStyleName(ValoTheme.LABEL_H2); clippingArticlesLayout.addComponent(labelNoProfile); } else {/*from www .j av a 2 s. c o m*/ clipping.getArticles().entrySet().stream().forEach(p -> { VerticalLayout layoutProfile = new VerticalLayout(); layoutProfile.setSpacing(true); layoutProfile.setMargin(true); layoutProfile.addStyleName("tags"); layoutProfile.setWidth("100%"); if (p.getValue().isEmpty()) { Label labelNoArticles = new Label(); Language.setCustom(Word.NO_ARTICLES_PRESENT, s -> labelNoArticles.setValue(s)); labelNoArticles.addStyleName(ValoTheme.LABEL_H3); layoutProfile.addComponent(labelNoArticles); } else { p.getValue().forEach(a -> layoutProfile.addComponent(createClippingRow(a))); } Panel panelProfile = new Panel(p.getKey().getName(), layoutProfile); clippingArticlesLayout.addComponent(panelProfile); }); clipping.getArticlesFromGroup().entrySet().stream().forEach(p -> { VerticalLayout layoutProfile = new VerticalLayout(); layoutProfile.setSpacing(true); layoutProfile.setMargin(true); layoutProfile.addStyleName("tags"); layoutProfile.setWidth("100%"); if (p.getValue().isEmpty()) { Label labelNoArticles = new Label(); Language.setCustom(Word.NO_ARTICLES_PRESENT, s -> labelNoArticles.setValue(s)); labelNoArticles.addStyleName(ValoTheme.LABEL_H3); layoutProfile.addComponent(labelNoArticles); } else { p.getValue().forEach(a -> layoutProfile.addComponent(createClippingRow(a))); } Panel panelProfile = new Panel(Language.get(Word.GROUP) + " " + p.getKey().getGroup().getName() + ": " + p.getKey().getName(), layoutProfile); Language.setCustom(Word.GROUP, s -> panelProfile .setCaption(s + " " + p.getKey().getGroup().getName() + ": " + p.getKey().getName())); clippingArticlesLayout.addComponent(panelProfile); }); } }
From source file:dhbw.clippinggorilla.userinterface.views.ClippingView.java
public void createClippingViewByProfile(Clipping clipping) { clippingArticlesLayout.removeAllComponents(); clipping.getArticles().entrySet().stream().forEach(p -> { VerticalLayout layoutProfile = new VerticalLayout(); layoutProfile.setSpacing(true);/*from ww w.j a va2 s . c om*/ layoutProfile.setMargin(true); layoutProfile.addStyleName("tags"); layoutProfile.setWidth("100%"); if (p.getValue().isEmpty()) { Label labelNoArticles = new Label(); Language.setCustom(Word.NO_ARTICLES_PRESENT, s -> labelNoArticles.setValue(s)); labelNoArticles.addStyleName(ValoTheme.LABEL_H3); layoutProfile.addComponent(labelNoArticles); } else { p.getValue().forEach(a -> layoutProfile.addComponent(createClippingRow(a))); } Panel panelProfile = new Panel(p.getKey().getName(), layoutProfile); clippingArticlesLayout.addComponent(panelProfile); }); clipping.getArticlesFromGroup().entrySet().stream().forEach(p -> { VerticalLayout layoutProfile = new VerticalLayout(); layoutProfile.setSpacing(true); layoutProfile.setMargin(true); layoutProfile.addStyleName("tags"); layoutProfile.setWidth("100%"); if (p.getValue().isEmpty()) { Label labelNoArticles = new Label(); Language.setCustom(Word.NO_ARTICLES_PRESENT, s -> labelNoArticles.setValue(s)); labelNoArticles.addStyleName(ValoTheme.LABEL_H3); layoutProfile.addComponent(labelNoArticles); } else { p.getValue().forEach(a -> layoutProfile.addComponent(createClippingRow(a))); } Panel panelProfile = new Panel( Language.get(Word.GROUP) + " " + p.getKey().getGroup().getName() + ": " + p.getKey().getName(), layoutProfile); Language.setCustom(Word.GROUP, s -> panelProfile .setCaption(s + " " + p.getKey().getGroup().getName() + ": " + p.getKey().getName())); clippingArticlesLayout.addComponent(panelProfile); }); }
From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java
public Component getTags(InterestProfile profile) { GridLayout allTagsLayout = new GridLayout(2, 1); Panel allTagsPanel = new Panel(allTagsLayout); allTagsPanel.setWidth("100%"); allTagsPanel.setHeight("265px"); allTagsPanel.setCaption(Language.get(Word.TAGS)); Language.setCustom(Word.TAGS, s -> allTagsPanel.setCaption(s)); VerticalLayout includedTagsLayout = new VerticalLayout(); includedTagsLayouts.put(profile, includedTagsLayout); includedTagsLayout.setWidth("100%"); includedTagsLayout.addStyleName("tags"); Label labelIncludedTags = new Label(Language.get(Word.INCLUDE_TAGS));//Evtl only included Language.setCustom(Word.INCLUDE_TAGS, s -> labelIncludedTags.setValue(s)); Component addIncludeTagGroup = getAddTagGroup(profile, true); includedTagsLayout.addComponents(labelIncludedTags, addIncludeTagGroup); includedTagsLayout.setComponentAlignment(labelIncludedTags, Alignment.MIDDLE_CENTER); includedTagsLayout.setComponentAlignment(addIncludeTagGroup, Alignment.MIDDLE_CENTER); VerticalLayout excludedTagsLayout = new VerticalLayout(); excludedTagsLayouts.put(profile, excludedTagsLayout); excludedTagsLayout.setWidth("100%"); excludedTagsLayout.addStyleName("tags"); Label labelExcludedTags = new Label(Language.get(Word.EXCLUDE_TAGS));//Evtl only included Language.setCustom(Word.EXCLUDE_TAGS, s -> labelExcludedTags.setValue(s)); Component addExcludeTagGroup = getAddTagGroup(profile, false); excludedTagsLayout.addComponents(labelExcludedTags, addExcludeTagGroup); excludedTagsLayout.setComponentAlignment(labelExcludedTags, Alignment.MIDDLE_CENTER); excludedTagsLayout.setComponentAlignment(addExcludeTagGroup, Alignment.MIDDLE_CENTER); profile.getTags().forEach((tag, included) -> addRow(profile, included, tag)); allTagsLayout.addComponents(includedTagsLayout, excludedTagsLayout); allTagsLayout.setWidth("100%"); return allTagsPanel; }
From source file:dhbw.clippinggorilla.userinterface.windows.ConfirmationDialog.java
public ConfirmationDialog(String confirmationText, Runnable onOk, Runnable onCancel) { addCloseListener(ce -> onCancel.run()); setCaption(Language.get(Word.CONFIRMATION)); VerticalLayout root = new VerticalLayout(); root.setSpacing(false);/*from w ww . j a v a 2 s.co m*/ root.setMargin(false); root.setSizeFull(); Label text = new Label(confirmationText); text.setStyleName(ValoTheme.LABEL_H3); text.setWidth("100%"); VerticalLayout layoutText = new VerticalLayout(text); layoutText.setSizeFull(); layoutText.addStyleName("tags"); layoutText.setSpacing(false); root.addComponent(layoutText); Label ignoreMe = new Label(); Button ok = new Button(Language.get(Word.OK)); ok.addClickListener(c -> { close(); onOk.run(); }); ok.addStyleName(ValoTheme.BUTTON_DANGER); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.addClickListener(c -> { close(); onCancel.run(); }); cancel.addStyleName(ValoTheme.BUTTON_FRIENDLY); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth("100%"); footer.addStyleName("menubar"); footer.addComponents(ignoreMe, ok, cancel); footer.setColumnExpandRatio(0, 5); footer.setComponentAlignment(ok, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); root.setExpandRatio(layoutText, 5); root.addComponent(footer); setContent(root); setModal(true); center(); setDraggable(false); setResizable(false); setWidth("350px"); setHeight("200px"); UI.getCurrent().addWindow(this); }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
public Component getTags(GroupInterestProfile profile, boolean isAdmin) { GridLayout allTagsLayout = new GridLayout(2, 1); Panel allTagsPanel = new Panel(allTagsLayout); allTagsPanel.setWidth("100%"); allTagsPanel.setHeight("265px"); allTagsPanel.setCaption(Language.get(Word.TAGS)); Language.setCustom(Word.TAGS, s -> allTagsPanel.setCaption(s)); VerticalLayout includedTagsLayout = new VerticalLayout(); includedTagsLayouts.put(profile, includedTagsLayout); includedTagsLayout.setWidth("100%"); includedTagsLayout.addStyleName("tags"); Label labelIncludedTags = new Label(Language.get(Word.INCLUDE_TAGS));//Evtl only included Language.setCustom(Word.INCLUDE_TAGS, s -> labelIncludedTags.setValue(s)); if (isAdmin) { Component addIncludeTagGroup = getAddTagGroup(profile, true); includedTagsLayout.addComponents(labelIncludedTags, addIncludeTagGroup); includedTagsLayout.setComponentAlignment(addIncludeTagGroup, Alignment.MIDDLE_CENTER); } else {//w w w . j a v a 2 s . c o m includedTagsLayout.addComponents(labelIncludedTags); } includedTagsLayout.setComponentAlignment(labelIncludedTags, Alignment.MIDDLE_CENTER); VerticalLayout excludedTagsLayout = new VerticalLayout(); excludedTagsLayouts.put(profile, excludedTagsLayout); excludedTagsLayout.setWidth("100%"); excludedTagsLayout.addStyleName("tags"); Label labelExcludedTags = new Label(Language.get(Word.EXCLUDE_TAGS));//Evtl only included Language.setCustom(Word.EXCLUDE_TAGS, s -> labelExcludedTags.setValue(s)); if (isAdmin) { Component addExcludeTagGroup = getAddTagGroup(profile, false); excludedTagsLayout.addComponents(labelExcludedTags, addExcludeTagGroup); excludedTagsLayout.setComponentAlignment(addExcludeTagGroup, Alignment.MIDDLE_CENTER); } else { excludedTagsLayout.addComponents(labelExcludedTags); } excludedTagsLayout.setComponentAlignment(labelExcludedTags, Alignment.MIDDLE_CENTER); profile.getTags().forEach((tag, included) -> addRow(profile, included, tag, isAdmin)); allTagsLayout.addComponents(includedTagsLayout, excludedTagsLayout); allTagsLayout.setWidth("100%"); return allTagsPanel; }
From source file:edu.kit.dama.ui.admin.MainControlPanel.java
License:Apache License
/** * Create a new cell for the UI. Each cell contains an image located in the * provided resource and a help label for the cell adverse to it. * Furthermore, a style is provided which can be 'help-left' or 'help-right' * depending on which side the help text should be aligned (help in left col * -> align right).//from w ww. j a va 2 s. c o m * * @param pResourceString The image resource string. * @param The alignment of the image (TOP_LEFT or TOP_RIGHT, depending on * the column) * @param cellNumber The cell number (0-3) counting from top left to bottom * right * @param pHelp The help string which may contain HTML tags. * @param pStyle The help label style ('help-left' or 'help-right'). * * @return The cell layout. */ private VerticalLayout createCell(String pResourceString, Alignment pAlignment, int cellNumber, String pHelp, String pStyle) { final String cellHeight = "132px"; //create the cell image Image cellImage = new Image(null, new ThemeResource(pResourceString)); cellImage.addStyleName("border"); //create the cell image wrapper, which provides the shadow and this show/hide functionality VerticalLayout imageWrapper = new VerticalLayout(cellImage); imageWrapper.addComponent(cellImage); imageWrapper.setComponentAlignment(cellImage, Alignment.MIDDLE_CENTER); imageWrapper.setWidth(cellHeight); imageWrapper.setHeight(cellHeight); imageWrapper.addStyleName("shadow"); imageWrapper.addStyleName("visible"); //help label for the cell adverse to the current cell Label oppositeCellHelp = new Label(pHelp, ContentMode.HTML); oppositeCellHelp.addStyleName(pStyle); oppositeCellHelp.setSizeFull(); oppositeCellHelp.addStyleName("invisible"); oppositeCellHelp.setHeight(cellHeight); //the cell layout containing image and help label VerticalLayout cell = new VerticalLayout(); cell.addComponent(imageWrapper); cell.setComponentAlignment(imageWrapper, pAlignment); cell.setMargin(true); cell.addComponent(oppositeCellHelp); cell.setComponentAlignment(oppositeCellHelp, Alignment.MIDDLE_CENTER); //define component ids depending on the provided cell number //--------- //| 0 | 1 | //| 2 | 3 | //--------- //Each cell gets the id 'image<cellNumber>' //The currently created wrapper and help label are getting the cellId of the adverse cell (0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2). //These ids are used then by edu.kit.dama.ui.admin.client.HelpConnector to show/hide elements on mouse over. switch (cellNumber) { case 0: cellImage.setId("image0"); //this cell contains the help for cell 1 imageWrapper.setId("image1_wrapper"); oppositeCellHelp.setId("image1_help"); break; case 1: cellImage.setId("image1"); //this cell contains the help for cell 0 imageWrapper.setId("image0_wrapper"); oppositeCellHelp.setId("image0_help"); break; case 2: cellImage.setId("image2"); //this cell contains the help for cell 3 imageWrapper.setId("image3_wrapper"); oppositeCellHelp.setId("image3_help"); break; case 3: cellImage.setId("image3"); //this cell contains the help for cell 2 imageWrapper.setId("image2_wrapper"); oppositeCellHelp.setId("image2_help"); break; } //link the HelpExtension to the image new HelpExtension().extend(cellImage); return cell; }
From source file:edu.nps.moves.mmowgli.components.VideoWithRightTextPanel.java
License:Open Source License
public void initGui() { addStyleName("m-calltoaction-novideo"); // m-calltoaction"); // puts up background setMargin(false);// ww w .ja v a 2s .c o m setSpacing(false); setWidth("988px"); Label lab; addComponent(lab = new Label()); lab.setHeight("41px"); HorizontalLayout horLay = new HorizontalLayout(); horLay.setSpacing(false); horLay.setMargin(false); horLay.setWidth("100%"); addComponent(horLay); horLay.addComponent(lab = new Label()); lab.setWidth("38px"); if (vidMedia != null && vidMedia.getUrl() != null && vidMedia.getUrl().trim().length() > 0) { if (vidMedia.getType() == MediaType.YOUTUBE) { try { Flash ytp = new Flash(); ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + vidMedia.getUrl())); ytp.setParameter("allowFullScreen", "true"); ytp.setParameter("showRelated", "false"); ytp.setWidth(539.0f, Unit.PIXELS); //VID_W_PX,Unit.PIXELS); ytp.setHeight(342.0f, Unit.PIXELS); //VID_H_PX,Unit.PIXELS); player = ytp; } catch (Exception ex) { System.err.println("Exception instantiating YouTubePlayer: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } else { System.err.println("Bad media file in VideoWithRightTextPanel"); player = new Label("missing video"); } VerticalLayout plyrLinkWrap = new VerticalLayout(); plyrLinkWrap.setMargin(false); plyrLinkWrap.setSpacing(true); plyrLinkWrap.setSizeUndefined(); VerticalLayout playerVL = new VerticalLayout(); //AbsoluteLayout(); playerVL.setWidth("539px"); playerVL.setHeight("342px"); playerVL.addStyleName("m-boxshadow-5"); playerVL.addComponent(player); plyrLinkWrap.addComponent(playerVL); Link link = getAlternateVideoLink(vidMedia); if (link != null) { plyrLinkWrap.addComponent(link); plyrLinkWrap.setComponentAlignment(link, Alignment.BOTTOM_CENTER); } horLay.addComponent(plyrLinkWrap); horLay.addComponent(lab = new Label()); lab.setWidth("22px"); } VerticalLayout rightColVLayout = new VerticalLayout(); horLay.addComponent(rightColVLayout); horLay.setExpandRatio(rightColVLayout, 1.0f); horLay.addComponent(lab = new Label()); lab.setWidth("35px"); rightColVLayout.setSpacing(true); if (headerImg != null) { // Image takes priority over text rightColVLayout.addComponent(headerImg); } else { headingLab = new HtmlLabel(heading); if (largerText) headingLab.addStyleName("m-orientation-heading"); else headingLab.addStyleName("m-calltoaction-thesituation-heading"); rightColVLayout.addComponent(headingLab); } summaryLab = new HtmlLabel(summary); if (largerText) summaryLab.addStyleName("m-orientation-summary"); else summaryLab.addStyleName("m-calltoaction-thesituation-summary"); rightColVLayout.addComponent(summaryLab); // text = text.replace("\n", "<br/><br/>"); // pure html with <p> tags seems to work well textLab = new HtmlLabel(text); if (largerText) textLab.addStyleName("m-orientation-text"); else textLab.addStyleName("m-calltoaction-thesituation-text"); rightColVLayout.addComponent(textLab); // Move 2, no room /* * if (promptImg != null) { // Image priority over text rightColVLayout.addComponent(promptImg); } else if (prompt != null){ promptLab = new Label(prompt); * promptLab.setContentMode(Label.CONTENT_XHTML); if(largerText) promptLab.addStyleName("m-orientation-prompt"); else * promptLab.addStyleName("m-calltoaction-thesituation-prompt"); rightColVLayout.addComponent(promptLab); } */ // spacer so background doesn't look cut-off addComponent(lab = new Label()); lab.setHeight("25px"); }
From source file:edu.nps.moves.mmowgli.Mmowgli2UI.java
License:Open Source License
public void setRunningApplicationFrameworkTL(User u) { VerticalLayout layout = (VerticalLayout) getContent(); layout.removeAllComponents();/*from ww w .j a va2 s . co m*/ layout.addStyleName("m-background"); layout.setMargin(false); // This is the layout that fills the browser window // layout spans browser window and tracks its resize // the outerframe below is centered layout.setWidth("100%"); outerFr = new MmowgliOuterFrame(u); // contains header and footer layout.addComponent(outerFr); layout.setComponentAlignment(outerFr, Alignment.TOP_CENTER); navigator = new Navigator(this, getContentContainer()); getSessionGlobals().getController().setupNavigator(navigator); Game g = Game.getTL(); showOrHideFouoButton(g.isShowFouo()); uiFullyInitted = true; }