List of usage examples for com.vaadin.ui Notification setDelayMsec
public void setDelayMsec(int delayMsec)
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
public void handleAboutMmowgli(MenuBar menubar) { Notification notif = new Notification("<center><span style='color:#777'>Mmowgli</span></center>", "<center>Build " + MMOWGLI_BUILD_ID + "<br/>Vaadin " + VAADIN_BUILD_VERSION + "<br/><br/><span style='color:#777;font-size:70%'>Click to close</span></center>"); notif.setHtmlContentAllowed(true);/*from w w w . j av a 2 s .com*/ notif.setDelayMsec(-1); // user must click notif.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from w ww.jav a 2 s.co m*/ public void initGui() { setWidth(HEADER_W); setHeight(HEADER_H); Game g = Game.getTL(); GameLinks gl = GameLinks.getTL(); Embedded embedded = new Embedded(null, mediaLoc.getHeaderBackground()); addComponent(embedded, "top:0px;left:0px"); if (g.isActionPlansEnabled()) { embedded = new Embedded(null, mediaLoc.getImage("scoretext200w50h.png")); addComponent(embedded, "top:52px;left:63px"); addComponent(explorPtsLab, "top:55px;left:260px"); addComponent(implPtsLab, "top:79px;left:247px"); } else { embedded = new Embedded(null, mediaLoc.getImage("scoretextoneline200w50h.png")); addComponent(embedded, "top:52px;left:73px"); addComponent(explorPtsLab, "top:65px;left:205px"); } Resource res = mediaLoc.getHeaderBanner(g); if (res != null) { embedded = new Embedded(null, res); addComponent(embedded, pos_banner); } HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(false); buttHL.setMargin(false); buttHL.setWidth("291px"); buttHL.setHeight("45px"); addComponent(buttHL, "top:1px;left:687px"); Label lab; boolean armyHack = gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech"); if (armyHack) buttonChars = buttonChars - 3 + 9; // Replace "Map" with "Resources buttHL.addComponent(lab = new Label()); lab.setWidth("1px"); buttHL.setExpandRatio(lab, 0.5f); buttHL.addComponent(leaderBoardButt); buttHL.setComponentAlignment(leaderBoardButt, Alignment.MIDDLE_CENTER); addDivider(buttHL, buttonChars); // Hack if (armyHack) { //Hack Link resourceLink = makeSmallLink("Resources", "", "http://futures.armyscitech.com/resources/"); buttHL.addComponent(resourceLink); buttHL.setComponentAlignment(resourceLink, Alignment.MIDDLE_CENTER); } else { buttHL.addComponent(mapButt); buttHL.setComponentAlignment(mapButt, Alignment.MIDDLE_CENTER); } addDivider(buttHL, buttonChars); buttHL.addComponent(liveBlogButt); buttHL.setComponentAlignment(liveBlogButt, Alignment.MIDDLE_CENTER); addDivider(buttHL, buttonChars); buttHL.addComponent(learnMoreButt); buttHL.setComponentAlignment(learnMoreButt, Alignment.MIDDLE_CENTER); buttHL.addComponent(lab = new Label()); lab.setWidth("1px"); buttHL.setExpandRatio(lab, 0.5f); addComponent(playIdeaButt, pos_playIdeaButt); if (g.isActionPlansEnabled()) { addComponent(takeActionButt, pos_takeActionButt); toggleTakeActionButt(true); // everbody can click it me.isGameMaster()); } else if (armyHack) { embedded = new Embedded(null, mediaLoc.getImage("armylogoxpntbg80w80h.png")); addComponent(embedded, "top:54px;left:864px"); } Serializable uid = Mmowgli2UI.getGlobals().getUserID(); refreshUser(uid, HSess.get()); // assume in vaadin transaction here avatar.setWidth(HEADER_AVATAR_W); avatar.setHeight(HEADER_AVATAR_H); avatar.setDescription(user_profile_tt); avatar.addClickListener(new MouseEvents.ClickListener() { @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { userNameButt.buttonClick(new ClickEvent(userNameButt)); } }); userNameButt.setDescription(user_profile_tt); addComponent(userNameButt, HEADER_USERNAME_POS); addComponent(avatar, "top:13px;left:6px"); //HEADER_AVATAR_POS); searchField.setWidth("240px"); // searchField.setHeight("18px"); // this causes a text _area_ to be used, giving me two lines, default height is good, style removes borders searchField.setInputPrompt("Search"); searchField.setImmediate(true); searchField.setTextChangeEventMode(TextChangeEventMode.LAZY); searchField.setTextChangeTimeout(5000); // ms searchField.addStyleName("m-header-searchfield"); searchField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); handleSearchClickTL(); HSess.close(); /* searchButt.focus(); // make the white go away String s = event.getProperty().getValue().toString(); if (s.length() > 0) { MmowgliController controller = Mmowgli2UI.getGlobals().getController(); controller.handleEvent(SEARCHCLICK, s, searchField); } */ } }); searchButt.enableAction(false); // want a local listener searchButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); handleSearchClickTL(); HSess.close(); } }); addComponent(searchField, "top:107px;left:74px"); //"top:110px;left:74px"); addComponent(signOutButt, "top:25px;left:250px"); //"top:18px;left:250px"); addComponent(searchButt, "top:105px;left:30px"); //"top:100px;left:180px"); MessageUrl mu = MessageUrl.getLastTL(); if (mu != null) decorateBlogHeadlinesLink(mu); addBlogHeadlinesLink("top:147px;left:20px"); String headline = blogHeadlinesLink.getCaption(); if (headline != null && headline.length() > 0) { // Add Window.Notification relaying the same info as the BlogHeadLinesLink Notification note = new Notification("Today's News", "<br/>" + headline, Notification.Type.WARNING_MESSAGE, true); note.setPosition(Position.TOP_CENTER); note.setDelayMsec(5 * 1000); // Yellow is more an attention getter note.setStyleName("m-blue"); note.show(Page.getCurrent()); } addComponent(callToActionButt, "top:0px;left:333px"); /* The css has a height, width and even a background, but stupid IE will only properly size the button if an image is * used. Therefore we use an a transparent png of the proper size */ MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); callToActionButt.setIcon(medLoc.getEmpty353w135h()); Move move = g.getCurrentMove(); if (g.isShowHeaderBranding()) { Media brand = g.getHeaderBranding(); if (brand != null) { Embedded bremb = new Embedded(null, mediaLoc.locate(brand)); addComponent(bremb, "top:0px;left:333px"); } else { brandingLab.setHeight("30px"); setBrandingLabelText(move, g); addComponent(brandingLab, "top:0px;left:333px"); //HEADER_MOVETITLE_POS); //"top:151px;left:476px"; } } if (move.isShowMoveBranding()) { moveNumLab.setValue(move.getName()); addComponent(moveNumLab, "top:103px;left:333px"); } /* if(user != null && (user.isAdministrator() || user.isGameMaster() || user.isDesigner() )) { // has a menu // fouoLink.addStyleName("m-absolutePositioning"); addComponent(fouoLink,"top:-10px;left:400px"); } else addComponent(fouoLink,"top:0px;left:400px"); fouoLink.setVisible(g.isShowFouo()); */ }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void showStartNotification(String exportType) { Notification notif = new Notification("", "Export of " + exportType + " begun. Results may appear in another browser window (unless popups blocked).", Notification.Type.WARNING_MESSAGE); // not warning, but want yellow notif.setPosition(Position.MIDDLE_CENTER); notif.setDelayMsec(-1); notif.show(Page.getCurrent());/*from w w w .ja v a 2 s. co m*/ }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void showEndNotification(String exportType) { Notification notif = new Notification("", "Export of " + exportType + " complete. Results may appear in another browser window (unless popups blocked).", Notification.Type.WARNING_MESSAGE); notif.setPosition(Position.TOP_CENTER); notif.setDelayMsec(5000); notif.show(Page.getCurrent());//from w ww . j a va 2 s . c om }
From source file:edu.nps.moves.mmowgli.export.GameExporter.java
License:Open Source License
@Override public void exportToBrowser(String title) { AppMaster.instance().pokeReportGenerator(); //Doesn't show for very long Notification notification = new Notification("", "Report publication initiated", Notification.Type.WARNING_MESSAGE); notification.setPosition(Position.TOP_CENTER); notification.setDelayMsec(5000); notification.show(Page.getCurrent()); String url = AppMaster.instance().getAppUrlString(); //.toExternalForm(); if (!url.endsWith("/")) url = url + "/"; BrowserWindowOpener.open(url + "reports", "_blank"); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();/*from w ww.j av a2s . 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.ActionPlanPage2.java
License:Open Source License
@Override public boolean actionPlanEditBeginEvent(Serializable apId, String msg) { if (apId != this.apId) return false; if (imAuthor) { Notification notif = new Notification("", "", Notification.Type.HUMANIZED_MESSAGE); notif.setPosition(Position.TOP_LEFT); notif.setStyleName("m-actionplan-edit-notification"); notif.setDelayMsec(3000); // 3 secs to disappear notif.setCaption(""); notif.setDescription(msg);//from w w w. j av a 2 s . com notif.show(Page.getCurrent()); return true; } return false; }
From source file:edu.nps.moves.mmowgli.modules.actionplans.RfeDialog.java
License:Open Source License
@HibernateSessionThreadLocalConstructor @SuppressWarnings("serial") public RfeDialog(Object aplnId) { this.apId = aplnId; setCaption("Request for Expertise"); setModal(true);//from w w w . j ava2 s.c om setSizeUndefined(); setWidth("500px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); IDButton searchButt = new IDButton("Option 1: Search for players with needed expertise", SEARCHCLICK, null); searchButt.enableAction(false); // do manually searchButt.addClickListener(new SearchListener()); vLay.addComponent(searchButt); VerticalLayout nuts = new VerticalLayout(); vLay.addComponent(nuts); nuts.setSizeFull(); vLay.setExpandRatio(nuts, 1.0f); Label lab; /*vLay*/nuts.addComponent(lab = new Label("Option 2: Post help-wanted notice to action plan")); lab.addStyleName("m-font-bold11"); final VerticalLayout helpWantedPan = new VerticalLayout(); /*vLay*/nuts.addComponent(helpWantedPan); helpWantedPan.addStyleName("m-greyborder"); helpWantedPan.setWidth("99%"); helpWantedPan.setHeight("99%"); helpWantedPan.setSpacing(true); helpWantedPan.setMargin(true); /*vLay*/nuts.setExpandRatio(helpWantedPan, 1.0f); helpWantedTA = new TextArea("Current posting"); helpWantedTA.setWidth("100%"); helpWantedTA.setHeight("100%"); helpWantedTA.setNullRepresentation(""); helpWantedPan.addComponent(helpWantedTA); helpWantedPan.setExpandRatio(helpWantedTA, 1.0f); HorizontalLayout buttLay = new HorizontalLayout(); helpWantedPan.addComponent(buttLay); buttLay.setSpacing(true); buttLay.setWidth("100%"); buttLay.addComponent(lab = new Label()); lab.setWidth("10px"); clearButt = new Button("Clear"); buttLay.addComponent(clearButt); clearButt.addClickListener(clearButtLis = new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); ActionPlan ap = ActionPlan.getTL(apId); helpWantedTA.setValue(null); if (null != ap.getHelpWanted()) { ap.setHelpWanted(null); ActionPlan.updateTL(ap); Notification notif = new Notification("Cleared"); notif.setDelayMsec(3000); notif.show(Page.getCurrent()); GameEventLogger.logHelpWantedTL(ap); notifyAuthorsOfChangeTL(ap); } HSess.close(); } }); buttLay.addComponent(lab = new Label()); buttLay.setExpandRatio(lab, 1.0f); postButt = new Button("Post"); buttLay.addComponent(postButt); postButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { Object val = helpWantedTA.getValue(); if (val == null || val.toString().length() <= 0) { clearButtLis.buttonClick(event); return; } HSess.init(); String s = val.toString(); ActionPlan ap = ActionPlan.getTL(apId); if (s == null ? ap.getHelpWanted() != null : !s.equals(ap.getHelpWanted())) { ap.setHelpWanted(s); ActionPlan.updateTL(ap); Notification notif = new Notification("Posted"); notif.setDelayMsec(3000); notif.show(Page.getCurrent()); GameEventLogger.logHelpWantedTL(ap); notifyAuthorsOfChangeTL(ap); } HSess.close(); } }); buttLay.addComponent(lab = new Label()); lab.setWidth("10px"); helpWantedPan.addComponent(lab = new Label()); lab.setHeight("10px"); IDButton troubleButt = new IDButton("Option 3: Post Trouble Report", POSTTROUBLECLICK, null); troubleButt.enableAction(false); // managed manually troubleButt.addClickListener(new TroubleListener()); vLay.addComponent(troubleButt); Button closeButt = new Button("Close"); vLay.addComponent(closeButt); closeButt.addClickListener(new CloseListener()); vLay.setComponentAlignment(closeButt, Alignment.MIDDLE_RIGHT); ActionPlan ap = ActionPlan.getTL(apId); String s = ap.getHelpWanted(); helpWantedTA.setValue(s); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
private void doCACNotif(String title, String text) { Notification notif = new Notification(title, text, Notification.Type.HUMANIZED_MESSAGE); notif.setPosition(Position.BOTTOM_CENTER); notif.setHtmlContentAllowed(true);//from w ww . j ava 2s. co m notif.setDelayMsec(2000); notif.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.signupServer.SignupServer.java
License:Open Source License
private void doRedirNotification(final String url) { Notification notif = new Notification("<center>Welcome to MMOWGLI!<center>", "<br/><center>We're taking you directly to the game.<center>", Notification.Type.HUMANIZED_MESSAGE); notif.setDelayMsec(5000); notif.setPosition(Position.MIDDLE_CENTER); notif.setHtmlContentAllowed(true);// www. java 2 s. co m notif.setStyleName("m-green-notification"); notif.show(Page.getCurrent()); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { UI.getCurrent().access(new Runnable() { @Override public void run() { quitUIAndGoTo(url); } }); } }, 4000); }