List of usage examples for com.vaadin.ui Notification setStyleName
public void setStyleName(String styleName)
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
@SuppressWarnings("serial") @Override/* w w w . ja v a 2s. com*/ 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.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 2 s. co m notif.show(Page.getCurrent()); return true; } return false; }
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);//w w w. j av a2 s.c om 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. * //from ww w . j a v a 2 s.c o m * @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:facs.components.BookAdmin.java
License:Open Source License
private void showErrorNotification(String title, String description) { Notification notify = new Notification(title, description); notify.setDelayMsec(15000);/*from w w w. j a va2s . co m*/ notify.setPosition(Position.TOP_CENTER); notify.setIcon(FontAwesome.FROWN_O); notify.setStyleName(ValoTheme.NOTIFICATION_ERROR + " " + ValoTheme.NOTIFICATION_CLOSABLE); notify.show(Page.getCurrent()); }
From source file:facs.components.BookAdmin.java
License:Open Source License
private void Notification(String title, String description, String type) { Notification notify = new Notification(title, description); notify.setPosition(Position.TOP_CENTER); if (type.equals("error")) { notify.setDelayMsec(16000);/*w ww .j a v a 2 s . co m*/ notify.setIcon(FontAwesome.FROWN_O); notify.setStyleName(ValoTheme.NOTIFICATION_ERROR + " " + ValoTheme.NOTIFICATION_CLOSABLE); } else if (type.equals("success")) { notify.setDelayMsec(8000); notify.setIcon(FontAwesome.SMILE_O); notify.setStyleName(ValoTheme.NOTIFICATION_SUCCESS + " " + ValoTheme.NOTIFICATION_CLOSABLE); } else { notify.setDelayMsec(8000); notify.setIcon(FontAwesome.MEH_O); notify.setStyleName(ValoTheme.NOTIFICATION_TRAY + " " + ValoTheme.NOTIFICATION_CLOSABLE); } notify.show(Page.getCurrent()); }
From source file:facs.components.Booking.java
License:Open Source License
private void showErrorNotification(String title, String description) { Notification notify = new Notification(title, description); notify.setDelayMsec(16000);//from w ww . j a v a2 s. c o m notify.setPosition(Position.TOP_CENTER); notify.setIcon(FontAwesome.FROWN_O); notify.setStyleName(ValoTheme.NOTIFICATION_ERROR + " " + ValoTheme.NOTIFICATION_CLOSABLE); notify.show(Page.getCurrent()); }
From source file:facs.components.Booking.java
License:Open Source License
private void showNotification(String title, String description) { Notification notify = new Notification(title, description); notify.setDelayMsec(8000);/*from w w w . j a va2 s. c o m*/ notify.setPosition(Position.TOP_CENTER); notify.setIcon(FontAwesome.MEH_O); notify.setStyleName(ValoTheme.NOTIFICATION_TRAY + " " + ValoTheme.NOTIFICATION_CLOSABLE); notify.show(Page.getCurrent()); }
From source file:facs.components.Booking.java
License:Open Source License
private void showSuccessfulNotification(String title, String description) { Notification notify = new Notification(title, description); notify.setDelayMsec(8000);// w ww. j a v a2s. c o m notify.setPosition(Position.TOP_CENTER); notify.setIcon(FontAwesome.SMILE_O); notify.setStyleName(ValoTheme.NOTIFICATION_SUCCESS + " " + ValoTheme.NOTIFICATION_CLOSABLE); notify.show(Page.getCurrent()); }
From source file:helpers.Utils.java
License:Open Source License
public static void Notification(String title, String description, String type) { Notification notify = new Notification(title, description); notify.setPosition(Position.TOP_CENTER); if (type.equals("error")) { notify.setDelayMsec(16000);//from ww w . j a v a 2 s . c o m notify.setIcon(FontAwesome.FROWN_O); notify.setStyleName(ValoTheme.NOTIFICATION_ERROR + " " + ValoTheme.NOTIFICATION_CLOSABLE); } else if (type.equals("success")) { notify.setDelayMsec(8000); notify.setIcon(FontAwesome.SMILE_O); notify.setStyleName(ValoTheme.NOTIFICATION_SUCCESS + " " + ValoTheme.NOTIFICATION_CLOSABLE); } else { notify.setDelayMsec(8000); notify.setIcon(FontAwesome.COMMENT); notify.setStyleName(ValoTheme.NOTIFICATION_TRAY + " " + ValoTheme.NOTIFICATION_CLOSABLE); } notify.show(Page.getCurrent()); }