List of usage examples for com.vaadin.shared Position TOP_CENTER
Position TOP_CENTER
To view the source code for com.vaadin.shared Position TOP_CENTER.
Click Source Link
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel notifications() { Panel p = new Panel("Notifications"); VerticalLayout content = new VerticalLayout() { Notification notification = new Notification(""); TextField title = new TextField("Title"); TextArea description = new TextArea("Description"); MenuBar style = new MenuBar(); MenuBar type = new MenuBar(); String typeString = ""; String styleString = ""; TextField delay = new TextField(); {/*from w ww. ja v a2 s .co m*/ setSpacing(true); setMargin(true); title.setInputPrompt("Title for the notification"); title.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (title.getValue() == null || title.getValue().length() == 0) { notification.setCaption(null); } else { notification.setCaption(title.getValue()); } } }); title.setValue("Notification Title"); title.setWidth("100%"); addComponent(title); description.setInputPrompt("Description for the notification"); description.addStyleName("small"); description.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (description.getValue() == null || description.getValue().length() == 0) { notification.setDescription(null); } else { notification.setDescription(description.getValue()); } } }); description.setValue( "A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt."); description.setWidth("100%"); addComponent(description); Command typeCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Humanized")) { typeString = ""; notification.setStyleName(styleString.trim()); } else { typeString = selectedItem.getText().toLowerCase(); notification.setStyleName((typeString + " " + styleString.trim()).trim()); } for (MenuItem item : type.getItems()) { item.setChecked(false); } selectedItem.setChecked(true); } }; type.setCaption("Type"); MenuItem humanized = type.addItem("Humanized", typeCommand); humanized.setCheckable(true); humanized.setChecked(true); type.addItem("Tray", typeCommand).setCheckable(true); type.addItem("Warning", typeCommand).setCheckable(true); type.addItem("Error", typeCommand).setCheckable(true); type.addItem("System", typeCommand).setCheckable(true); addComponent(type); type.addStyleName("small"); Command styleCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { styleString = ""; for (MenuItem item : style.getItems()) { if (item.isChecked()) { styleString += " " + item.getText().toLowerCase(); } } if (styleString.trim().length() > 0) { notification.setStyleName((typeString + " " + styleString.trim()).trim()); } else if (typeString.length() > 0) { notification.setStyleName(typeString.trim()); } else { notification.setStyleName(null); } } }; style.setCaption("Additional style"); style.addItem("Dark", styleCommand).setCheckable(true); style.addItem("Success", styleCommand).setCheckable(true); style.addItem("Failure", styleCommand).setCheckable(true); style.addItem("Bar", styleCommand).setCheckable(true); style.addItem("Small", styleCommand).setCheckable(true); style.addItem("Closable", styleCommand).setCheckable(true); addComponent(style); style.addStyleName("small"); CssLayout group = new CssLayout(); group.setCaption("Fade delay"); group.addStyleName("v-component-group"); addComponent(group); delay.setInputPrompt("Infinite"); delay.addStyleName("align-right"); delay.addStyleName("small"); delay.setWidth("7em"); delay.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { try { notification.setDelayMsec(Integer.parseInt(delay.getValue())); } catch (Exception e) { notification.setDelayMsec(-1); delay.setValue(""); } } }); delay.setValue("1000"); group.addComponent(delay); Button clear = new Button(null, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { delay.setValue(""); } }); clear.setIcon(FontAwesome.TIMES_CIRCLE); clear.addStyleName("last"); clear.addStyleName("small"); clear.addStyleName("icon-only"); group.addComponent(clear); group.addComponent(new Label(" msec", ContentMode.HTML)); GridLayout grid = new GridLayout(3, 3); grid.setCaption("Show in position"); addComponent(grid); grid.setSpacing(true); Button pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); } }; p.setContent(content); return p; }
From source file:com.example.BufferedMongoDemo.java
License:Apache License
public BufferedMongoDemo(MongoOperations mongoOperations) { super(mongoOperations); msgCommit.setStyleName("system success"); msgCommit.setPosition(Position.TOP_CENTER); msgCommit.setDelayMsec(1000);/*w ww .ja v a 2 s . co m*/ msgDiscard.setStyleName("system success"); msgDiscard.setPosition(Position.TOP_CENTER); msgDiscard.setDelayMsec(1000); }
From source file:com.github.daytron.twaattin.presenter.LoginBehaviour.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent event) { try {/*from w w w .j a v a 2s. com*/ String pin = loginField.getValue(); Principal user = new TwitterAuthenticationStrategy().authenticate(pin); VaadinSession.getCurrent().setAttribute(Principal.class, user); TimelineScreen aTimelineScreen = new TimelineScreen(); UI.getCurrent().setContent(aTimelineScreen); Notification authenticatedNotification = new Notification("You're now authenticated to Twaattin!", Notification.Type.TRAY_NOTIFICATION); authenticatedNotification.setPosition(Position.TOP_CENTER); authenticatedNotification.show(Page.getCurrent()); } catch (AuthenticationException e) { Notification errorNotification = new Notification(e.getMessage(), "Cick this box to close.", Notification.Type.ERROR_MESSAGE); errorNotification.show(Page.getCurrent()); } }
From source file:com.github.daytron.twaattin.presenter.LogoutBehaviour.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent event) { VaadinSession.getCurrent().setAttribute(Principal.class, null); UI.getCurrent().setContent(new LoginScreen()); Notification logoutNotification = new Notification("You've been logout", Notification.Type.TRAY_NOTIFICATION); logoutNotification.setPosition(Position.TOP_CENTER); logoutNotification.show(Page.getCurrent()); }
From source file:de.fatalix.app.view.login.LoginView.java
private void showNotification(Notification notification, String style) { // keep the notification visible a little while after moving the // mouse, or until clicked notification.setPosition(Position.TOP_CENTER); notification.setStyleName(ValoTheme.NOTIFICATION_BAR); notification.setDelayMsec(2000);//from w ww. java 2s .c o m notification.show(Page.getCurrent()); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void errorNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);/* w w w . j a va2s.co m*/ not.setPosition(Position.TOP_CENTER); not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL); not.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
public void handlePublishReportsTL() { AppMaster.instance().requestPublishReportsTL(); Notification notification = new Notification("", "Report publication begun", Notification.Type.WARNING_MESSAGE); notification.setPosition(Position.TOP_CENTER); notification.setDelayMsec(5000);/*from w w w .j av a2 s . com*/ notification.show(Page.getCurrent()); GameEventLogger.logRequestReportGenerationTL(Mmowgli2UI.getGlobals().getUserTL()); }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
@SuppressWarnings("serial") @Override// w ww . ja v a2 s.c om 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 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);//w w w .j a v a 2 s. c o m 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);// ww w.j a va 2 s .co m notification.show(Page.getCurrent()); String url = AppMaster.instance().getAppUrlString(); //.toExternalForm(); if (!url.endsWith("/")) url = url + "/"; BrowserWindowOpener.open(url + "reports", "_blank"); }