Example usage for com.vaadin.ui Notification show

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

Introduction

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

Prototype

public static Notification show(String caption) 

Source Link

Document

Shows a notification message on the middle of the current page.

Usage

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

public LoginView() {
    System.out.println("LOAD LLOGIN");
    setSizeFull();/*from ww  w . j a v  a 2 s.c  o m*/
    Component loginForm = buildLoginForm();
    addComponent(loginForm);
    setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER);

    Notification notification = new Notification("Welcome to Dashboard Demo");
    notification.setDescription(
            "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>");
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("tray dark small closable login-help");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setDelayMsec(20000);
    notification.show(Page.getCurrent());
}

From source file:com.wintindustries.pfserver.uploads.PFUploadUnit.java

public void upload() {
    final ProgressIndicator pi = new ProgressIndicator();
    pi.setCaption(html5File.getFileName());
    progress.setCaption(html5File.getFileName());
    getprogressBarsLayout().addComponent(pi);
    final FileBuffer receiver = createReceiver();
    html5File.setStreamVariable(new StreamVariable() {

        private String name;
        private String mime;

        public OutputStream getOutputStream() {
            return receiver.receiveUpload(name, mime);
        }//from  w w  w.j  a v a  2 s.  c o m

        public boolean listenProgress() {
            return true;
        }

        public void onProgress(StreamVariable.StreamingProgressEvent event) {
            float p = (float) event.getBytesReceived() / (float) event.getContentLength();
            pi.setValue(p);
            progress.setProgress(p);
        }

        public void streamingStarted(StreamVariable.StreamingStartEvent event) {
            name = event.getFileName();
            mime = event.getMimeType();
            progress.setProgressState(progress.kUPLOADPROGRESS_UPLOADING);

        }

        public void streamingFinished(StreamVariable.StreamingEndEvent event) {
            getprogressBarsLayout().removeComponent(pi);
            handleFile(receiver.getFile(), html5File.getFileName(), html5File.getType(),
                    html5File.getFileSize());
            receiver.setValue(null);
            progress.setProgressState(progress.kUPLOADPROGRESS_DONE);
        }

        public void streamingFailed(StreamVariable.StreamingErrorEvent event) {
            getprogressBarsLayout().removeComponent(pi);
            progress.setProgressState(progress.kUPLOADPROGRESS_ERROR);
            progress.setErrmsg(event.toString());
            Notification note = new Notification("Upload Failed", event.toString(),
                    Notification.Type.ERROR_MESSAGE);
            note.show(Page.getCurrent());

        }

        public boolean isInterrupted() {
            return false;
        }
    });
}

From source file:com.wintindustries.pfserver.uploads.PFUploadUnit.java

@Override
protected void handleFile(File file, String fileName, String mimeType, long length) {
    Notification note = new Notification(fileName + " Uploaded", Notification.Type.TRAY_NOTIFICATION);
    note.show(Page.getCurrent());

    // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

From source file:com.yoncabt.ebr.ui.ReportStatusWindow.java

private Grid makeGrid() {
    Grid ret = new Grid();
    ret.setId("reportsGrid");
    ret.addColumn("uuid", String.class);
    ret.addColumn("data source", String.class);
    ret.addColumn("report", String.class);
    ret.addColumn("ext", String.class);
    ret.addColumn("started", String.class);
    ret.addColumn("ended", String.class);
    ret.addColumn("iptal", String.class)
            .setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickEvent e) -> {
                String uuid = (String) grid.getContainerDataSource().getItem(e.getItemId())
                        .getItemProperty("uuid").getValue();
                reportWS.cancel(uuid);//from  www .  jav  a  2 s .  c  o  m
                Notification.show(uuid + " durduruldu");
            }));
    ret.addColumn("gster", String.class)
            .setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickEvent e) -> {
                String uuid = (String) grid.getContainerDataSource().getItem(e.getItemId())
                        .getItemProperty("uuid").getValue();
                if (reportWS.status(uuid) == Status.FINISH) {
                    Page.getCurrent().open("/ebr/ws/1.0/output/" + uuid, "_new", false);
                } else {
                    Notification.show("Bitmi bir rapor yok");
                }
            }));
    ret.addColumn("durum", String.class);
    ret.addColumn("exception", String.class);
    ret.setSizeFull();
    return ret;
}

From source file:customcomponent.CustomcomponentUI.java

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*w ww.j  av a  2 s. co  m*/
    setContent(layout);

    Label terms = new Label("You agree with us on everything.");

    Panel panel = new Panel("LICENSE TERMS:");
    panel.setContent(terms);
    layout.addComponent(panel);

    AcceptTermsButton button = new AcceptTermsButton("Yeah right. I do accept that.", "Install");

    button.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("Software installed.");
        }
    });

    layout.addComponent(button);
}

From source file:cz.iivos.todo.components.InputFormLayout.java

/**
 * Vytvo, inicializuje a pid tla?tka OK-CANCEL.
 *
 *//*w  w w.ja  va  2  s  .co  m*/
private void addButtons() {

    buttonsHL = new HorizontalLayout();
    buttonsHL.setMargin(true);
    buttonsHL.setSpacing(true);

    okBT = new Button("Ok");
    cancelBT = new Button("Cancel");
    cancelBT.setEnabled(true);
    okBT.setEnabled(true);

    okBT.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isNew) {
                User user = securityService.getCurrentUser();
                sqlContainer.removeAllContainerFilters();
                sqlContainer.getItem(itemId).getItemProperty("id_lur").setValue(user.getId());
                sqlContainer.getItem(itemId).getItemProperty("deleted").setValue(Boolean.FALSE);
                sqlContainer.getItem(itemId).getItemProperty("completed").setValue(Boolean.FALSE);
                sqlContainer.getItem(itemId).getItemProperty("creation_date").setValue(new Date());
                okCancelListener.obnovFilter();
            }

            // ulozenie zmien do DB:
            try {
                fg.commit();
                sqlContainer.commit();
                fieldsFL.setEnabled(false);
                okCancelListener.doAdditionalOkAction();

                Notification.show("kol byl spen uloen!");
            } catch (SQLException | UnsupportedOperationException | CommitException e) {
                logger.warn(e.getLocalizedMessage(), e);
            }
        }
    });

    cancelBT.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okBT.setEnabled(true);
            if (isNew) {
                sqlContainer.removeItem(itemId);
            }
            okCancelListener.doAdditionalCancelAction();
        }
    });
    TodosView s;
    buttonsHL.addComponent(okBT);
    buttonsHL.addComponent(cancelBT);

    this.addComponent(buttonsHL);

}