List of usage examples for com.vaadin.ui Notification setPosition
public void setPosition(Position position)
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
@SuppressWarnings("serial") @Override// w w w . j a va2 s. c o 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);// w ww . ja va 2s. co m notif.show(Page.getCurrent()); }
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);/*from www . ja v a 2 s .c om*/ notif.show(Page.getCurrent()); }
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);//from w w w .ja v a 2 s. c om 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 a2 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.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 www .j a va 2s . co m notif.show(Page.getCurrent()); return true; } return false; }
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);//ww w . ja va2 s . c om 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);/*from ww w. j av a 2s .c o m*/ notif.setPosition(Position.MIDDLE_CENTER); notif.setHtmlContentAllowed(true); 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); }
From source file:edu.vserver.exercises.videoMcq.QuestionWindow.java
License:Apache License
/** * Sets a Notification about the correctness of the given answer to the browser window. * /* ww w . j av a 2s .com*/ * @param question latest answered question. */ private void informUser(Question question) { if (this.isInformative()) { Notification n; if (question.isCorrectAnswer()) { n = new Notification("CORRECT", Notification.Type.HUMANIZED_MESSAGE); n.setIcon(new ThemeResource(SPH_Theme.CORRECT_ICON_48PX)); n.setStyleName("correctAnswer"); } else { n = new Notification("INCORRECT", Notification.Type.HUMANIZED_MESSAGE); n.setIcon(new ThemeResource(SPH_Theme.INCORRECT_ICON_48PX)); n.setStyleName("incorrectAnswer"); } if (question.containsAnswerDescription()) { n.setDescription(question.getAnswerDescription()); n.setDelayMsec(Notification.DELAY_FOREVER); } else { n.setDelayMsec(500); } n.setPosition(com.vaadin.shared.Position.MIDDLE_CENTER); n.show(Page.getCurrent()); } }
From source file:eu.maxschuster.vaadin.autocompletetextfield.demo.DemoUI.java
License:Apache License
private void onAutocompleteValueChange(Property.ValueChangeEvent event) { String text = "Value changed to: " + event.getProperty().getValue(); Notification notification = new Notification(text, Notification.Type.TRAY_NOTIFICATION); notification.setPosition(Position.BOTTOM_LEFT); notification.show(Page.getCurrent()); }