Package com.vaadin.ui

Examples of com.vaadin.ui.Notification


        // Paint notifications
        if (notifications != null) {
            target.startTag("notifications");
            for (final Iterator<Notification> it = notifications.iterator(); it
                    .hasNext();) {
                final Notification n = it.next();
                target.startTag("notification");
                if (n.getCaption() != null) {
                    target.addAttribute(
                            UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION,
                            n.getCaption());
                }
                if (n.getDescription() != null) {
                    target.addAttribute(
                            UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE,
                            n.getDescription());
                }
                if (n.getIcon() != null) {
                    target.addAttribute(
                            UIConstants.ATTRIBUTE_NOTIFICATION_ICON,
                            n.getIcon());
                }
                if (!n.isHtmlContentAllowed()) {
                    target.addAttribute(
                            UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED,
                            true);
                }
                target.addAttribute(
                        UIConstants.ATTRIBUTE_NOTIFICATION_POSITION, n
                                .getPosition().ordinal());
                target.addAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY,
                        n.getDelayMsec());
                if (n.getStyleName() != null) {
                    target.addAttribute(
                            UIConstants.ATTRIBUTE_NOTIFICATION_STYLE,
                            n.getStyleName());
                }
                target.endTag("notification");
            }
            target.endTag("notifications");
            notifications = null;
View Full Code Here


        layout.addComponent(new Label("abc"));
        layout.addComponent(new Button("B", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification n = new Notification("Test");
                getMainWindow().showNotification(n);
            }

        }));
View Full Code Here

                return actions;
            }
        };

        // Notification
        Notification n = new Notification("Hey there!");
        n.setIcon(icon);
        n.setPosition(Position.BOTTOM_CENTER);
        n.setDelayMsec(300000);
        n.show(Page.getCurrent());

        // grid of compoents
        GridLayout gl = new GridLayout(4, 5);
        gl.setSpacing(true);
        layout.addComponent(gl);
View Full Code Here

                    @Override
                    public void buttonClick(ClickEvent event) {
                        if (getUI() == getMainWindow()) {
                            getUI().getPage().showNotification(
                                    new Notification("main"));
                            try {
                                Thread.sleep((5000));
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
View Full Code Here

            @Override
            public void buttonClick(ClickEvent event) {
                try {
                    p3l.addComponent(p2);
                    new Notification("ERROR", "This should have failed",
                            Notification.TYPE_ERROR_MESSAGE).show(Page
                            .getCurrent());
                } catch (Exception e) {
                    new Notification("OK", "threw, as expected",
                            Notification.TYPE_ERROR_MESSAGE).show(Page
                            .getCurrent());
                }
            }

        });
        main.addComponent(b);
        b = new Button("recurse2", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                VerticalLayout layout = new VerticalLayout();
                Panel p = new Panel("dynamic", layout);
                layout.addComponent(p2);
                try {
                    p3l.addComponent(p);
                    new Notification("ERROR", "This should have failed",
                            Notification.TYPE_ERROR_MESSAGE).show(Page
                            .getCurrent());
                } catch (Exception e) {
                    new Notification("OK", "threw, as expected",
                            Notification.TYPE_ERROR_MESSAGE).show(Page
                            .getCurrent());
                }
            }
View Full Code Here

    @Override
    public void receiveBroadcast(final String message) {
        access(new Runnable() {
            @Override
            public void run() {
                Notification n = new Notification("Message received", message,
                        Type.TRAY_NOTIFICATION);
                n.show(getPage());
            }
        });

    }
View Full Code Here

        left.addStyleName("show-middle-left");
        left.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification notification = new Notification("Notification");
                notification.setDelayMsec(10000);
                notification.setPosition(Position.MIDDLE_LEFT);
                notification.show(getUI().getPage());
            }
        });
        addComponent(left);

        Button right = new Button("Show Notification in middle right");
        right.addStyleName("show-middle-right");
        right.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification notification = new Notification("Notification");
                notification.setDelayMsec(10000);
                notification.setPosition(Position.MIDDLE_RIGHT);
                notification.show(getUI().getPage());
            }
        });
        addComponent(right);

    }
View Full Code Here

    protected void setup() {
        Label l = new Label(LoremIpsum.get(10000));
        getLayout().setSizeFull();
        addComponent(l);

        Notification n = new Notification(
                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This should be a <br/><b>SEMI-TRANSPARENT</b><br/> notification",
                Type.WARNING_MESSAGE);
        n.setHtmlContentAllowed(true);
        n.show(Page.getCurrent());
    }
View Full Code Here

    private class SettingHandler implements ClickListener {
        @Override
        public void buttonClick(ClickEvent event) {
            Type typeValue = (Type) type.getValue();

            Notification n = new Notification(tf.getValue(), typeValue);
            n.setDelayMsec(-1);
            n.setHtmlContentAllowed(true);
            NotificationConfiguration notificationConf = UI.getCurrent()
                    .getNotificationConfiguration();
            notificationConf.setAssistivePrefix(typeValue, prefix.getValue());
            notificationConf.setAssistivePostfix(typeValue, postfix.getValue());
            notificationConf.setAssistiveRole(typeValue,
                    (NotificationRole) role.getValue());

            n.show(Page.getCurrent());
        }
View Full Code Here

    }

    private class DefaultHandler implements ClickListener {
        @Override
        public void buttonClick(ClickEvent event) {
            Notification n = new Notification(tf.getValue(),
                    (Type) type.getValue());
            n.setHtmlContentAllowed(true);
            n.show(Page.getCurrent());
        }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Notification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.