List of usage examples for com.vaadin.ui AbsoluteLayout addComponent
private void addComponent(Component c, ComponentPosition position) throws IllegalArgumentException
From source file:com.esofthead.mycollab.vaadin.ui.AttachmentDisplayComponent.java
License:Open Source License
public static Component constructAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/* w w w. java2 s . c o m*/ final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setDescription(docName); thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); if (MimeTypesUtil.isImageType(docName)) { thumbnail.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -2853211588120500523L; @Override public void click(MouseEvents.ClickEvent event) { Resource previewResource = VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE); UI.getCurrent().addWindow(new AttachmentPreviewWindow(previewResource)); } }); } CssLayout attachmentNameWrap = new CssLayout(); attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentNameWrap.setStyleName("attachment-name-wrap"); Label attachmentName = new Label(StringUtils.trim(docName, 60, true)); attachmentName.setStyleName("attachment-name"); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); Button trashBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); trashBtn.setIcon(FontAwesome.TRASH_O); trashBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); Button downloadBtn = new Button(); FileDownloader fileDownloader = new FileDownloader( VaadinResourceManager.getResourceManager().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); return attachmentLayout; }
From source file:com.esofthead.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
public void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }// ww w.j a v a2s .c om final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getInstance().getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getInstance().getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul() .appendChild(new Li().appendText("Size: " + FileUtils.getVolumeDisplay(attachment.getSize()))) .setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText( "Last modified: " + AppContext.formatPrettyTime(attachment.getLastModified().getTime()))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); CssLayout attachmentNameWrap = new CssLayout(); attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentNameWrap.setStyleName("attachment-name-wrap"); Label attachmentName = new Label(StringUtils.trim(docName, 60, true)); attachmentName.setStyleName("attachment-name"); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); Button trashBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); trashBtn.setIcon(FontAwesome.TRASH_O); trashBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); Button downloadBtn = new Button(); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.setStyleName("attachment-control"); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:com.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
private void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }//w w w .j a v a2 s . c o m final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul().appendChild(new Li().appendText(UserUIContext.getMessage(FileI18nEnum.OPT_SIZE_VALUE, FileUtils.getVolumeDisplay(attachment.getSize())))).setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED, UserUIContext.formatPrettyTime(attachment.getLastModified().getTime())))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); MCssLayout attachmentNameWrap = new MCssLayout() .withWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH).withStyleName("attachment-name-wrap"); Label attachmentName = new ELabel(docName).withStyleName(UIConstants.TEXT_ELLIPSIS); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); MButton trashBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true, MyCollabUI.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); MButton downloadBtn = new MButton().withIcon(FontAwesome.DOWNLOAD).withStyleName("attachment-control"); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java
License:Apache License
/** * Build the overview tab including the list of all categories and der * overall status.// w ww . ja v a 2 s. c o m * * @param pCategories A list of all categories. * * @return The tab component. */ private Component buildOverviewTab(String[] pCategories) { AbsoluteLayout abLay = new AbsoluteLayout(); UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(4, pCategories.length + 1); updateButton = new Button("Update Status"); updateButton.addClickListener(this); Embedded logo = new Embedded(null, new ThemeResource("img/simon.png")); abLay.addComponent(logo, "top:30px;left:30px;"); Label simonSaysLabel = new Label("", ContentMode.HTML); simonSaysLabel.setHeight("150px"); setSimonSaysContent(simonSaysLabel, "Everything is fine."); abLay.addComponent(simonSaysLabel, "top:30px;left:250px;"); int row = 0; for (String category : pCategories) { HorizontalLayout rowLayout = new HorizontalLayout(); Label name = new Label(category); name.setWidth("200px"); name.setHeight("24px"); List<AbstractProbe> probes = probesByCategory.get(category); Collections.sort(probes, new Comparator<AbstractProbe>() { @Override public int compare(AbstractProbe o1, AbstractProbe o2) { return o1.getCurrentStatus().compareTo(o2.getCurrentStatus()); } }); int failed = 0; int unknown = 0; int unavailable = 0; int charactersPerProbe = 100; if (probes.size() > 0) { charactersPerProbe = (int) Math.rint((700.0 / probes.size()) / 8.0); } for (AbstractProbe probe : probes) { Label probeLabel = new Label(StringUtils.abbreviate(probe.getName(), charactersPerProbe)); probeLabel.setHeight("24px"); switch (probe.getCurrentStatus()) { case UNKNOWN: probeLabel.setDescription(probe.getName() + ": UNKNOWN"); probeLabel.addStyleName("probe-unknown"); unknown++; break; case UPDATING: probeLabel.setDescription(probe.getName() + ": UPDATING"); probeLabel.addStyleName("probe-updating"); break; case UNAVAILABLE: probeLabel.setDescription(probe.getName() + ": UNAVAILABLE"); probeLabel.addStyleName("probe-unavailable"); unavailable++; break; case FAILED: probeLabel.setDescription(probe.getName() + ": FAILED"); probeLabel.addStyleName("probe-failed"); failed++; break; default: probeLabel.setDescription(probe.getName() + ": SUCCESS"); probeLabel.addStyleName("probe-success"); } probeLabel.addStyleName("probe"); rowLayout.addComponent(probeLabel); } if (failed != 0) { setSimonSaysContent(simonSaysLabel, "There are errors!"); } else { if (unknown != 0) { setSimonSaysContent(simonSaysLabel, "There are unknown states. Please select 'Update Status'."); } else { if (unavailable != 0) { setSimonSaysContent(simonSaysLabel, "Some probes are unavailable. Please check their configuration."); } } } rowLayout.setWidth("700px"); layoutBuilder.addComponent(name, Alignment.TOP_LEFT, 0, row, 1, 1).addComponent(rowLayout, Alignment.TOP_LEFT, 1, row, 3, 1); row++; } layoutBuilder.addComponent(updateButton, Alignment.BOTTOM_RIGHT, 3, row, 1, 1); GridLayout tabLayout = layoutBuilder.getLayout(); tabLayout.setSpacing(true); tabLayout.setMargin(true); Panel p = new Panel(); p.setContent(tabLayout); p.setWidth("1024px"); p.setHeight("400px"); abLay.addComponent(p, "top:160px;left:30px;"); abLay.setSizeFull(); return abLay; }
From source file:edu.nps.moves.mmowgli.components.CardSummaryListHeader.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from ww w . j a v a 2s .c om*/ public void initGui() { addStyleName("m-cursor-pointer"); if (bckgrndResource != null) { Embedded bkgnd = new Embedded(null, bckgrndResource); addComponent(bkgnd, "top:0px;left:0px"); } final MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); ct = CardType.getTL(ctId); String textColorStyle = CardStyler.getCardTextColorOverBaseStyle(ct); // nested abslay for the click handler AbsoluteLayout topHalfLay = new AbsoluteLayout(); topHalfLay.setWidth(CARDLISTHEADER_W); topHalfLay.setHeight(HEIGHT_NODRAWER); addComponent(topHalfLay, "top:0px;left:0px"); title.setValue(ct.getTitle()); // .toUpperCase()); title.setHeight(CARDLISTHEADER_TITLE_H); title.setWidth(CARDLISTHEADER_TITLE_W); title.addStyleName("m-cardsummarylist-header-title"); title.addStyleName("m-cursor-pointer"); title.addStyleName("m-vagabond-font"); if (textColorStyle != null) title.addStyleName(textColorStyle); topHalfLay.addComponent(title, CARDLISTHEADER_TITLE_POS); content.setValue(ct.getPrompt()); content.setHeight(CARDLISTHEADER_CONTENT_H); content.setWidth(CARDLISTHEADER_CONTENT_W); content.addStyleName("m-cardsummarylist-header-content"); content.addStyleName("m-cursor-pointer"); if (textColorStyle != null) content.addStyleName(textColorStyle); // cause exception w/ 2 windows? content.setId(CardDebug.getCardCreateClickDebugId(ct)); topHalfLay.addComponent(content, CARDLISTHEADER_CONTENT_POS); boolean cantCreateBecauseHiddenParent = checkNoCreateBecauseHiddenTL(parent); boolean cantCreateBecauseParentMarkedNoChild = false; //todo enable with gameswitch checkNoCreateBecauseParentMarkedNoChild(parent); if (globs.canCreateCard(ct.isIdeaCard())) { markedAsNoCreate = false; if (!cantCreateBecauseHiddenParent && !cantCreateBecauseParentMarkedNoChild) { //Add the text at the bottom Label lab; topHalfLay.addComponent(lab = new Label("click to add new"), "top:130px;left:75px"); lab.addStyleName("m-click-to-add-new"); if (textColorStyle != null) lab.addStyleName(textColorStyle); } } else markedAsNoCreate = true; drawerComponent = new BuilderDrawer(); addComponent(drawerComponent, CARDLISTHEADER_DRAWER_POS); drawerComponent.setVisible(false); setWidth(CARDLISTHEADER_W); setHeight(HEIGHT_NODRAWER); if (!mockupOnly) topHalfLay.addLayoutClickListener(new LayoutClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void layoutClick(LayoutClickEvent event) { HSess.init(); if (checkNoCreateBecauseHiddenTL(parent)) { //todo enable with game switch || checkNoCreateBecauseParentMarkedNoChild(parent)) { if (drawerComponent.isVisible()) closeDrawer(); HSess.close(); return; } if (drawerComponent.isVisible()) closeDrawer(); else { CardPermission cp = globs.cardPermissionsCommon(ct.isIdeaCard()); if (!cp.canCreate) { if (!markedAsNoCreate) handleNoCreate(); Notification.show(cp.whyNot); } else { showDrawer(); handleCanCreate(); // reset tt, etc. if (newCardListener != null) newCardListener.drawerOpenedTL(ctId); } } HSess.close(); } }); if (cantCreateBecauseHiddenParent) handleNoCreate("Can't add card to hidden parent"); else if (cantCreateBecauseParentMarkedNoChild) handleNoCreate("New child cards cannot be added to this card"); else if (!globs.canCreateCard(ct.isIdeaCard())) handleNoCreate(); else setTooltip("Click to add card"); }
From source file:edu.nps.moves.mmowgli.components.Footer.java
License:Open Source License
@Override public void initGui() { setWidth(FOOTER_W);/*from www. j a v a 2 s .co m*/ setHeight("130px"); //room for fouo butt//FOOTER_H); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(FOOTER_W); mainAbsLay.setHeight(FOOTER_H); addComponent(mainAbsLay, FOOTER_OFFSET_POS); MediaLocator medLoc = ((Mmowgli2UI) UI.getCurrent()).getMediaLocator(); Embedded back = new Embedded(null, medLoc.getFooterBackground()); mainAbsLay.addComponent(back, "top:0px;left:0px"); HorizontalLayout outerHorLay = new HorizontalLayout(); addComponent(outerHorLay, "top:45px;left:0px"); outerHorLay.setWidth(FOOTER_W); HorizontalLayout innerHorLay = new HorizontalLayout(); innerHorLay.setSpacing(true); outerHorLay.addComponent(innerHorLay); outerHorLay.setComponentAlignment(innerHorLay, Alignment.MIDDLE_CENTER); Label sp; innerHorLay.addComponent(aboutButt); innerHorLay.addComponent(pingPushLab = new HtmlLabel()); pingPushLab.setWidth("7px"); innerHorLay.addComponent(creditsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(faqsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(fixesButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(glossaryButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(reportsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(termsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(troubleButt); troubleButt.addStyleName("m-red-text"); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(twitterButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(videosButt); GameLinks gl = GameLinks.getTL(); if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) { ; // This is a hack, but I don't want to pollute the db with a bogus boolean...this is a special case just for these folks. } else { HorizontalLayout hl = new HorizontalLayout(); Label lab = null; hl.addComponent(lab = new HtmlLabel("Build " + MMOWGLI_BUILD_ID)); lab.addStyleName("m-footer-servername"); //small text lab.setDescription(Mmowgli2UI.getGlobals().getVaadinSessionCookie()); hl.addComponent(lab = new HtmlLabel(" Vaadin " + VAADIN_BUILD_VERSION)); lab.addStyleName("m-footer-servername"); //small text hl.addComponent(lab = new HtmlLabel(" " + AppMaster.instance().getServerName())); lab.addStyleName("m-footer-servername"); //small text hl.setSizeUndefined(); mainAbsLay.addComponent(hl, "bottom:3px;right:15px;"); } fouoLink = Footer.buildFouoNoticeTL(); addComponent(fouoLink, "top:92px;left:365px"); fouoLink.setVisible(Game.getTL().isShowFouo()); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();//from w w w. ja v a 2 s . c o m setWidth(APPLICATION_SCREEN_WIDTH); // setHeight("855px"); //ACTIONDASHBOARD_H); Label sp; addComponent(sp = new Label()); sp.setHeight("10px"); HorizontalLayout titleHL = new HorizontalLayout(); titleHL.setWidth("95%"); addComponent(titleHL); titleHL.addComponent(sp = new Label()); sp.setWidth("20px"); Component titleC; titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle()); titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT); titleHL.addComponent(sp = new Label()); sp.setWidth("1px"); titleHL.setExpandRatio(sp, 1.0f); titleHL.addComponent(howToWinActionButt); howToWinActionButt.setDescription(howWinAction_tt); AbsoluteLayout absL = new AbsoluteLayout(); addComponent(absL); absL.setWidth(APPLICATION_SCREEN_WIDTH); absL.setHeight(ACTIONDASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(ACTIONDASHBOARD_H); absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS); // Now the background Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground()); backgroundImage.setWidth(ACTIONDASHBOARD_W); backgroundImage.setHeight(ACTIONDASHBOARD_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionDashboardBlackTabs"); tabsHL.setSpacing(false); tabsHL.addComponent(sp = new Label()); sp.setWidth("12px"); TabClickHandler tabHndlr = new TabClickHandler(); actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab"); actionPlansTabButt.addClickListener(tabHndlr); actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB); tabsHL.addComponent(actionPlansTabButt); tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab"); myPlansTabButt.addClickListener(tabHndlr); myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB); tabsHL.addComponent(myPlansTabButt); myPlansTabButt.addStyleName("m-transparent-background"); // initially tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab"); needAuthorsTabButt.addClickListener(tabHndlr); needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB); tabsHL.addComponent(needAuthorsTabButt); needAuthorsTabButt.addStyleName("m-transparent-background"); // initially absL.addComponent(tabsHL, "left:7px;top:8px"); // stack the pages absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); actionPlansTab.initGuiTL(); absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); myPlansTab.initGuiTL(); myPlansTab.setVisible(false); absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS); needAuthorsTab.initGuiTL(); needAuthorsTab.setVisible(false); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<ActionPlan> invitedSet = me.getActionPlansInvited(); if (invitedSet != null && (invitedSet.size()) > 0) { Notification note = new Notification("<center>You're invited to an Action Plan!</center>", "<center> Look for the \"you're invited to join!\" notice.<br/>" + "First, check out the plan. Then, if you want to join,<br/>" + "click the link to become an author." + "</center>", Type.HUMANIZED_MESSAGE, true); // allow html note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(5000);// 5 secs note.show(Page.getCurrent()); } }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabActionPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.addStyleName("m-padding15"); flowLay.setSpacing(true);//from w w w .j a v a 2 s .c om Label titleLab = new Label("All Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("The Action Plans tab displays a list of all action plans in the game."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt.setDescription("Open a page where you can submit a request to create an action plan"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);/*from w ww. ja v a 2 s.c o m*/ Label titleLab = new Label("My Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("Choose a link below to display the filtered list of your choice."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Label lab; flowLay.addComponent(lab = new Label()); lab.setHeight("25px"); Button myPlansButt = new Button("My Plans"); //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK); //flowLay.addComponent(myPlansButt); Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); // Note for the above button request flowLay.addComponent(new Label("(appears in another browser tab)")); ClickListener firstLis; myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-heading { blah:blah;} ) firstLis.buttonClick(null); // loads the table }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabNeedAuthors.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);/*w w w . jav a2 s . com*/ Label titleLab = new Label("Action Plans needing Authors"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("You may sign up for authorship in any of these plans."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }