Example usage for com.vaadin.ui Notification Notification

List of usage examples for com.vaadin.ui Notification Notification

Introduction

In this page you can find the example usage for com.vaadin.ui Notification Notification.

Prototype

public Notification(String caption, String description, Type type, boolean htmlContentAllowed) 

Source Link

Document

Creates a notification message of the specified type, with a bigger caption and smaller description.

Usage

From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java

public static void middleInforNotification(String caption, String descripton) {
    Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true);
    not.setDelayMsec(1000);// ww  w . j  a v  a2s . c  om
    not.setPosition(Position.MIDDLE_CENTER);
    not.show(Page.getCurrent());
}

From source file:edu.nps.moves.mmowgli.components.Header.java

License:Open Source License

@SuppressWarnings("serial")
@Override//from   www  .  j a va  2s . 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.modules.actionplans.ActionDashboard.java

License:Open Source License

public void initGuiTL() {
    setSizeUndefined();// ww w  .j a  v  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.administration.MapGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
@SuppressWarnings("serial")
public MapGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    Game g = Game.getTL();/*ww w .ja  v a2 s.c  om*/
    TextArea titleTA;
    final Serializable uid = Mmowgli2UI.getGlobals().getUserID();

    titleTA = (TextArea) addEditLine("Map Title", "Game.mapTitle", g, g.getId(), "MapTitle").ta;
    titleTA.setValue(g.getMapTitle());
    titleTA.setRows(1);

    latTA = addEditLine("Map Initial Latitude", "Game.mmowgliMapLatitude");
    boolean lastRO = latTA.isReadOnly();
    latTA.setReadOnly(false);
    latTA.setValue("" + g.getMapLatitude());
    latTA.setRows(1);
    latTA.setReadOnly(lastRO);
    latTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                double lat = Double.parseDouble(val);
                Game g = Game.getTL();
                g.setMapLatitude(lat);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map latitude", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper decimal format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });

    lonTA = addEditLine("Map Initial Longitude", "Game.mmowgliMapLongitude");
    lastRO = lonTA.isReadOnly();
    lonTA.setReadOnly(false);
    lonTA.setValue("" + g.getMapLongitude());
    lonTA.setRows(1);
    lonTA.setReadOnly(lastRO);
    lonTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            //System.out.println("lon valueChange");
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                double lon = Double.parseDouble(val);
                Game g = Game.getTL();
                g.setMapLongitude(lon);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map longitude", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper decimal format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });

    zoomTA = addEditLine("Map Initial Zoom", "Game.mmowgliMapZoom");
    lastRO = zoomTA.isReadOnly();
    zoomTA.setReadOnly(false);
    zoomTA.setValue("" + g.getMapZoom());
    zoomTA.setRows(1);
    zoomTA.setReadOnly(lastRO);
    zoomTA.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                int zoom = Integer.parseInt(val);
                Game g = Game.getTL();
                g.setMapZoom(zoom);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Map zoom", val, uid);
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "Check for proper integer format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });
    Button b;
    this.addComponentLine(b = new Button("Set to generic Mmowgli Map Defaults", new MapDefaultSetter()));
    b.setEnabled(!globs.readOnlyCheck(false));
}

From source file:edu.nps.moves.mmowgli.modules.administration.ReportsGameDesignPanel.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
@SuppressWarnings("serial")
public ReportsGameDesignPanel(GameDesignGlobals globs) {
    super(false, globs);
    Game g = Game.getTL();/* w w w  .  j  ava 2 s.c  o m*/
    long period = g.getReportIntervalMinutes();

    TextArea ta;

    ta = addEditLine("1 Game Reports publishing interval (minutes)", "Game.reportIntervalMinutes");
    boolean lastRO = ta.isReadOnly();
    ta.setReadOnly(false);
    ta.setValue("" + period);
    ta.setRows(1);
    ta.setReadOnly(lastRO);
    ta.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void valueChange(ValueChangeEvent event) {
            //System.out.println("msid valueChange");
            HSess.init();
            try {
                String val = event.getProperty().getValue().toString();
                long lg = Long.parseLong(val);
                if (lg < 0)
                    throw new Exception();

                MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
                Game gm = Game.getTL(1L);
                gm.setReportIntervalMinutes(lg);
                Game.updateTL();
                GameEventLogger.logGameDesignChangeTL("Report interval", "" + "" + lg, globs.getUserID());

                // Wake it up
                AppMaster.instance().pokeReportGenerator();
            } catch (Exception ex) {
                new Notification("Parameter error",
                        "<html>Check for proper positive integer format.</br>New value not committed.",
                        Notification.Type.WARNING_MESSAGE, true).show(Page.getCurrent());
            }
            HSess.close();
        }
    });
    addEditBoolean("2 Indicate PDF reports available", "Game.pdfAvailable", g, 1L, "PdfAvailable");
    addEditBoolean("2 Show hidden cards", "Game.reportsShowHiddenCards", g, 1L, "ReportsShowHiddenCards");
}

From source file:edu.vserver.exercises.videoMcq.QuestionForm.java

License:Apache License

/**
 * Sets the listeners to the buttons.//from   w  w w .j a  v  a 2  s  .c om
 */
private void setListeners() {
    this.vjs.addVideojsListener(Videojs.VjsListener.ANY_EVENT, new Videojs.VjsListener() {

        private static final long serialVersionUID = 8427274367098667303L;

        @Override
        public void on(String eventName, Videojs source, Double triggerTime) {
            timeLabel.setValue(Time.convertToTimeString(triggerTime));
        }
    });
    this.vjs.addVideojsListener(Videojs.VjsListener.DURATIONCHANGE_EVENT, new Videojs.VjsListener() {

        private static final long serialVersionUID = -7568539997745781255L;

        @Override
        public void on(String eventName, Videojs source, Double triggerTime) {
            double duration = source.getDuration();
            if (duration > 0) {
                durationLabel.setValue(Time.convertToTimeString(duration));
            } else {
                durationLabel.setValue("??:??:??");
            }
        }
    });
    this.newQuestionBtn.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 4746159071748280285L;

        @Override
        public void buttonClick(ClickEvent event) {
            newQuestionBtn.setEnabled(false);
            cancelButton.setEnabled(true);
            saveButton.setEnabled(true);
            toggleQuestionFields(true);
            setFields(new Question());
            operationType = QuestionForm.NEW_QUESTION;
        }
    });
    this.cancelButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 3774334826140277183L;

        @Override
        public void buttonClick(ClickEvent event) {
            newQuestionBtn.setEnabled(true);
            cancelButton.setEnabled(false);
            saveButton.setEnabled(false);
            setFields(new Question());
            toggleQuestionFields(false);
        }
    });
    this.saveButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8736827762492077607L;

        @Override
        public void buttonClick(ClickEvent event) {
            Question q = getQuestion();
            if (isValid() && vjs.isPaused()) {
                newQuestionBtn.setEnabled(true);
                cancelButton.setEnabled(false);
                saveButton.setEnabled(false);
                toggleQuestionFields(false);
                if (operationType == QuestionForm.EDIT_QUESTION) {
                    Notification n = new Notification("Question edited",
                            "<strong>Question:</strong> '" + q.getQuestion() + "' was edited succesfully!",
                            Notification.Type.TRAY_NOTIFICATION, true);
                    n.show(Page.getCurrent());
                    eventManager.callListeners(QuestionFormListener.QUESTION_EDITED_EVENT, QuestionForm.this,
                            getQuestion());
                } else {
                    Notification n = new Notification("New question added",
                            "<strong>Question:</strong> '" + q.getQuestion() + "' was added succesfully!",
                            Notification.Type.TRAY_NOTIFICATION, true);
                    n.show(Page.getCurrent());
                    eventManager.callListeners(QuestionFormListener.QUESTION_CREATED_EVENT, QuestionForm.this,
                            getQuestion());
                }
            } else {
                Notification n = new Notification("Saving failed!",
                        "<strong>Question form </strong> contains some errors!",
                        Notification.Type.WARNING_MESSAGE, true);
                n.show(Page.getCurrent());
            }
        }
    });
    this.addIncorrectAnswer.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 4746159071748280285L;

        @Override
        public void buttonClick(ClickEvent event) {
            wrongAnswerHandler.addWrongAnswerRow("");
        }
    });
    this.clearIncorrectAnswers.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 3632221052083079517L;

        @Override
        public void buttonClick(ClickEvent event) {
            wrongAnswerHandler.clear();
        }
    });
}

From source file:eu.eco2clouds.portal.component.apwizard.APText.java

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    try {/*from   w  w  w .  j av  a 2s  .c om*/

        ApplicationProfileParserManager parser = new ApplicationProfileParserManager();

        //layout.addComponent(new Label("As soon as it is ready, we will send the application profile to the scheduler. Please be patient"));
        System.out.println("I submit \n" + this.textArea.getValue());
        ApplicationProfile applicationProfileObj = parser.parse(this.textArea.getValue());
        Logger.getLogger(E2CPortal.class.getName()).log(Level.FINER, this.textArea.getValue());

        SchedulerManager sm = SchedulerManagerFactory.getInstance();

        sm.submitApplicationProfile(applicationProfileObj);

        Notification okNotification = new Notification("Success",
                "<br/>Application Profile has been correctly <br/>sent to the Scheduler",
                Notification.Type.HUMANIZED_MESSAGE, true);
        okNotification.show(Page.getCurrent());

    } catch (JsonMappingException ex) {

        Notification errorNotification = new Notification("Error", "<br/>Application Profile is not valid",
                Notification.Type.ERROR_MESSAGE, true);
        errorNotification.show(Page.getCurrent());
        Logger.getLogger(E2CPortal.class.getName()).log(Level.SEVERE, null, ex);

    } catch (IOException ex) {

        Notification errorNotification = new Notification("Error", "<br/>Application Profile is not valid",
                Notification.Type.ERROR_MESSAGE, true);
        errorNotification.show(Page.getCurrent());
        Logger.getLogger(E2CPortal.class.getName()).log(Level.SEVERE, null, ex);

    } catch (E2CPortalException ex) {

        Notification errorNotification = new Notification("Error",
                "<br/>Problems while communicating with the Scheduler", Notification.Type.ERROR_MESSAGE, true);
        errorNotification.show(Page.getCurrent());
        Logger.getLogger(E2CPortal.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:eu.eco2clouds.portal.page.HomeLayout.java

License:Apache License

public HomeLayout() {
    super();/*from w ww.  ja  v  a2s  . c  o m*/

    String loggedUser = ((E2CPortal) UI.getCurrent()).getSessionStatus().getLoggedUser();
    String loggedGroup = ((E2CPortal) UI.getCurrent()).getSessionStatus().getLoggedGroup();

    BeanItemContainer<ExperimentTableBean> userActiveContainer = new BeanItemContainer<ExperimentTableBean>(
            ExperimentTableBean.class);
    BeanItemContainer<ExperimentTableBean> groupActiveContainer = new BeanItemContainer<ExperimentTableBean>(
            ExperimentTableBean.class);
    BeanItemContainer<ExperimentTableBean> terminatedContainer = new BeanItemContainer<ExperimentTableBean>(
            ExperimentTableBean.class);

    SchedulerManager scheduler;
    Collection<Experiment> experiments = null;
    try {
        scheduler = new SchedulerManager(Configuration.schedulerUrl, Configuration.keystoreFilename,
                Configuration.keystorePwd);
        experiments = scheduler.getExperiments();
    } catch (Exception ex) {
        Logger.getLogger(ExperimentTable.class.getName()).log(Level.SEVERE, null, ex);
        new Notification("Error", "A problem occurred while connecting to the Eco2Clouds scheduler",
                Notification.Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    }

    //System.out.println("xx" + loggedGroup + " " + loggedUser);
    if (experiments != null) {
        for (Experiment e : experiments) {
            //System.out.println(e.getHref() + " " + e.getBonfireGroupId() + " " + e.getBonfireUserId() + " " + e.getStatus());
            if (e.getStatus() != null) {
                if (!e.getStatus().equalsIgnoreCase("terminated") && e.getBonfireUserId().equals(loggedUser)) {
                    userActiveContainer.addBean(new ExperimentTableBean(e));
                } else if (!e.getStatus().equalsIgnoreCase("terminated")
                        && e.getBonfireGroupId().equals(loggedGroup)) {
                    groupActiveContainer.addBean(new ExperimentTableBean(e));

                } else if (e.getStatus().equalsIgnoreCase("terminated")) {
                    terminatedContainer.addBean(new ExperimentTableBean(e));
                }
            } else {
                Logger.getLogger(HomeLayout.class.getName()).log(Level.INFO,
                        "experiment " + e.getId() + " with status null");
            }

        }
    }

    this.userActiveExperimentTable = new ExperimentTable(userActiveContainer);

    this.groupActiveExperimentTable = new ExperimentTable(groupActiveContainer);

    this.terminatedExperimentTable = new ExperimentTable(terminatedContainer);

    this.render();
}

From source file:fr.amapj.view.engine.notification.NotificationHelper.java

License:Open Source License

static public void displayNotification(String message) {

    Notification notification = new Notification("Erreur", message, Type.ERROR_MESSAGE, true);
    notification.setPosition(Position.TOP_CENTER);
    notification.setDelayMsec(1000);//from   w ww  . j  a  v a2  s . c om
    notification.show(Page.getCurrent());
}

From source file:fr.univlorraine.mondossierweb.MdwTouchkitUI.java

License:Apache License

/**
 * Affiche du message d'intro/*ww  w  . java  2  s.c  o m*/
 */
private void afficherMessageIntro(String text) {

    Notification note = new Notification(text, "", Notification.TYPE_TRAY_NOTIFICATION, true);
    note.setPosition(Position.MIDDLE_CENTER);
    note.setDelayMsec(6000);
    note.show(this.getPage());

    /**
     * ANCIENNE VERSION AVEC POPUP WINDOW
     */
    /*
    //Recuperer dans la base si l'utilisateur a une prfrence pour l'affichage le message
    String val  = userController.getPreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE);
            
    //Par dfaut on affiche le message
    boolean afficherMessage = true;
            
    //Si on a une prfrence pour l'utilisateur en ce qui concerne l'affichage du message d'accueil mobile
    if(StringUtils.hasText(val)){
       //On rcupre ce choix dans afficherMessage
       afficherMessage = Boolean.valueOf(val);
    }
            
    //Si on doit afficher le message
    if(afficherMessage){
            
       //Cration de la pop-pup contenant le message
       HelpMobileWindow hbw = new HelpMobileWindow(text,applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),true);
            
       //Sur la fermeture de la fentre
       hbw.addCloseListener(g->{
    //On va enregistrer en base que l'utilisateur ne souhaite plus afficher le message si la checkbox propose par la pop-up a t coche
    boolean choix = hbw.getCheckBox().getValue();
    //Test si l'utilisateur a coch la case pour ne plus afficher le message
    if(choix){
       //mettre a jour dans la base de donnes
       userController.updatePreference(Utils.SHOW_MESSAGE_INTRO_MOBILE_PREFERENCE, "false");
    }
       });
            
       //Affichage de la pop_up
       UI.getCurrent().addWindow(hbw);
            
    }
     */
}