Example usage for com.vaadin.ui Window setContent

List of usage examples for com.vaadin.ui Window setContent

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:roart.client.MyVaadinUI.java

private Window getLoginWindow() {
    final Window window = new Window("Login");
    window.setWidth("30%");
    window.setHeight("30%");
    window.center();/*from   w w w. j  a v a2 s .  com*/
    final TextField login = new TextField("Username");
    final PasswordField password = new PasswordField("Password");
    Button button = new Button("Login");
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            tryLogin(login.getValue(), password.getValue());
            window.close();
        }
    });
    VerticalLayout vert = new VerticalLayout();
    vert.addComponent(login);
    vert.addComponent(password);
    vert.addComponent(button);
    window.setContent(vert);
    return window;
}

From source file:ru.codeinside.gses.manager.processdefeniton.ProcessDefenitionQuery.java

License:Mozilla Public License

PropertysetItem createItem(final ProcedureProcessDefinition p) {
    PropertysetItem item = new PropertysetItem();

    ClickListener listener = new ClickListener() {

        private static final long serialVersionUID = -8900212370037948964L;

        @Override/*from   www  .j av  a2 s . com*/
        public void buttonClick(ClickEvent event) {
            Window mainWin = event.getButton().getApplication().getMainWindow();

            ProcessDefinition processDefinition = Functions.withRepository(Flash.login(),
                    new Function<RepositoryService, ProcessDefinition>() {
                        public ProcessDefinition apply(RepositoryService srv) {
                            return srv.createProcessDefinitionQuery()
                                    .processDefinitionId(p.getProcessDefinitionId()).singleResult();
                        }
                    });

            String caption = "?? " + df.format(p.getVersion());
            Window win = Components.createWindow(mainWin, caption);
            win.center();
            ContentWindowChanger changer = new ContentWindowChanger(win);
            ProcessDefinitionShowUi putComponent = new ProcessDefinitionShowUi(processDefinition, changer);
            changer.set(putComponent, caption);
        }

    };
    ObjectProperty<Component> versionProperty = Components.buttonProperty(df.format(p.getVersion()), listener);
    item.addItemProperty("version", versionProperty);

    HorizontalLayout ll = new HorizontalLayout();
    ll.setSpacing(true);
    DefinitionStatus status = p.getStatus();
    final Label label = new Label(status.getLabelName());
    label.setWidth("100px");
    ll.addComponent(label);

    final ComboBox comboBox = new ComboBox();
    comboBox.setWidth("100px");
    comboBox.setNullSelectionAllowed(false);
    for (DefinitionStatus s : status.getAvailableStatus()) {
        comboBox.addItem(s.getLabelName());
        comboBox.setValue(s.getLabelName());
    }
    if (!status.equals(DefinitionStatus.PathToArchive) && !status.getAvailableStatus().isEmpty()) {
        ll.addComponent(comboBox);
        Button c = new Button("ok");
        c.addListener(new ClickListener() {

            private static final long serialVersionUID = 2966059295049064338L;

            @Override
            public void buttonClick(ClickEvent event) {
                Object value = comboBox.getValue();
                final String newValue = value.toString();
                final DefinitionStatus newStatus = DefinitionStatus.getStatusByLabelName(newValue);

                if (DefinitionStatus.Work.equals(newStatus)) {
                    final List<ProcedureProcessDefinition> works = ManagerService.get()
                            .getProcessDefenitionWithStatus(p, DefinitionStatus.Work);
                    if (!works.isEmpty()) {
                        final Window thisWindow = event.getButton().getWindow();
                        comfirmAction(thisWindow, p, label, newValue, newStatus, works);
                        return;

                    }
                }

                ManagerService.get().updateProcessDefinationStatus(p.getProcessDefinitionId(), newStatus);

                label.setValue(null);
                label.setCaption(newValue);
                paramLazyLoadingContainer.fireItemSetChange();
                proceduresContainer.fireItemSetChange();
            }

            private void comfirmAction(final Window thisWindow, final ProcedureProcessDefinition p,
                    final Label label, final String newValue, final DefinitionStatus newStatus,
                    final List<ProcedureProcessDefinition> works) {

                final Window window = new Window();
                window.setModal(true);
                window.setContent(new HorizontalLayout());
                window.setCaption(" ? " + df.format(works.get(0).getVersion())
                        + "       ?   ??  ");
                Button save = new Button("");
                save.addListener(new ClickListener() {

                    private static final long serialVersionUID = 3229924940535642819L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        ManagerService.get().updateProcessDefinationStatus(p.getProcessDefinitionId(),
                                newStatus);
                        label.setValue(null);
                        label.setCaption(newValue);
                        paramLazyLoadingContainer.fireItemSetChange();
                        proceduresContainer.fireItemSetChange();
                        closeWindow(thisWindow, window);
                    }

                });

                window.addComponent(save);
                Button c2 = new Button("?");
                c2.addListener(new ClickListener() {

                    private static final long serialVersionUID = 4502614143261892063L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        closeWindow(thisWindow, window);
                    }
                });
                window.addComponent(c2);
                thisWindow.addWindow(window);
            }
        });
        ll.addComponent(c);
    }
    item.addItemProperty("status", new ObjectProperty<Component>(ll));
    item.addItemProperty("date", Components.stringProperty(formatter.format(p.getDateCreated())));
    Employee creator = p.getCreator();
    item.addItemProperty("user", Components.stringProperty(creator == null ? null : creator.getLogin()));

    Button b = new Button("");

    b.addListener(new ClickListener() {

        private static final long serialVersionUID = 1362078893385574138L;

        @Override
        public void buttonClick(ClickEvent event) {
            StreamSource streamSource = new StreamSource() {

                private static final long serialVersionUID = 456334952891567271L;

                public InputStream getStream() {
                    return Functions.withEngine(new PF<InputStream>() {
                        private static final long serialVersionUID = 1L;

                        public InputStream apply(ProcessEngine s) {
                            return s.getRepositoryService().getProcessModel(p.getProcessDefinitionId());
                        }
                    });
                }
            };
            final Application application = event.getButton().getApplication();
            StreamResource resource = new StreamResource(streamSource, "test" + ".xml", application) {
                private static final long serialVersionUID = -3869546661105572851L;

                public DownloadStream getStream() {
                    final StreamSource ss = getStreamSource();
                    if (ss == null) {
                        return null;
                    }
                    final DownloadStream ds = new DownloadStream(ss.getStream(), getMIMEType(), getFilename());
                    ds.setBufferSize(getBufferSize());
                    ds.setCacheTime(getCacheTime());
                    ds.setParameter("Content-Disposition", "attachment; filename=" + getFilename());
                    return ds;
                }
            };
            Window window = event.getButton().getWindow();
            window.open(resource);
        }
    });
    item.addItemProperty("getRoute", new ObjectProperty<Component>(b));

    ObjectProperty<Component> buttonProperty = null;

    if (status.equals(DefinitionStatus.Debugging)) {
        DeploymentUploadReceiver receiver = new DeploymentUploadReceiver();

        DeploymentSucceededListener succeededListener = new DeploymentSucceededListener(receiver, procedureId,
                p.getProcessDefinitionId());
        succeededListener.addLoadingContainer(paramLazyLoadingContainer);
        succeededListener.addLoadingContainer(proceduresContainer);
        DeploymentAddUi addUi = new DeploymentAddUi(new DeploymentStartListener(), receiver, succeededListener);

        addUi.setSizeFull();
        buttonProperty = new ObjectProperty<Component>(addUi);
    } else {
        ClickListener l = new ClickListener() {

            private static final long serialVersionUID = 1362078893385574138L;

            @Override
            public void buttonClick(ClickEvent event) {

            }
        };
        buttonProperty = Components.buttonProperty("", l);
    }

    item.addItemProperty("download", buttonProperty);
    return item;
}

From source file:ru.codeinside.gses.webui.executor.ArchiveFactory.java

License:Mozilla Public License

static Window createFormWindow(Component su, ActivityImpl ac, String id) {
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);// w  w  w .j  a  v a 2 s.co m
    content.addComponent(su);
    Window window = new Window();
    window.setWidth(800 + 50, Sizeable.UNITS_PIXELS);
    window.setHeight(600 + 100, Sizeable.UNITS_PIXELS);
    window.center();
    window.setContent(content);
    window.setCaption(" ? " + ac.getId() + "  ? #" + id);
    if (su instanceof JsonFormIntegration || su instanceof ExpandRequired) {
        content.setSizeFull();
        content.setExpandRatio(su, 1f);
    } else {
        window.setResizable(false); //  ?  
    }
    return window;
}

From source file:ru.codeinside.gses.webui.supervisor.SupervisorWorkplace.java

License:Mozilla Public License

private void buildListPanel() {
    controlledTasksTable.setHeight("255px");
    controlledTasksTable.setWidth("100%");
    controlledTasksTable.setImmediate(true);
    controlledTasksTable.setSelectable(true);
    controlledTasksTable.setSortDisabled(true);
    controlledTasksTable.addContainerProperty("id", Component.class, null);
    controlledTasksTable.addContainerProperty("dateCreated", String.class, null);
    controlledTasksTable.addContainerProperty("task", String.class, null);
    controlledTasksTable.addContainerProperty("procedure", String.class, null);
    controlledTasksTable.addContainerProperty("declarant", String.class, null);
    controlledTasksTable.addContainerProperty("version", String.class, null);
    controlledTasksTable.addContainerProperty("status", String.class, null);
    controlledTasksTable.addContainerProperty("employee", String.class, null);
    controlledTasksTable.addContainerProperty("priority", String.class, null);
    controlledTasksTable.addContainerProperty("bidDays", String.class, null);
    controlledTasksTable.addContainerProperty("taskDays", String.class, null);
    controlledTasksTable.setVisibleColumns(new Object[] { "id", "dateCreated", "task", "procedure", "declarant",
            "version", "status", "employee", "bidDays", "taskDays" });
    controlledTasksTable.setColumnHeaders(new String[] { "?", "  ?",
            "", "", "?", "??", "?",
            "?", "..", ".?." });
    controlledTasksTable.setColumnExpandRatio("id", 0.05f);
    controlledTasksTable.setColumnExpandRatio("dateCreated", 0.15f);
    controlledTasksTable.setColumnExpandRatio("task", 0.2f);
    controlledTasksTable.setColumnExpandRatio("procedure", 0.25f);
    controlledTasksTable.setColumnExpandRatio("declarant", 0.1f);
    controlledTasksTable.setColumnExpandRatio("version", 0.05f);
    controlledTasksTable.setColumnExpandRatio("status", 0.1f);
    controlledTasksTable.setColumnExpandRatio("employee", 0.1f);
    controlledTasksTable.setCellStyleGenerator(new TaskStylist(controlledTasksTable));
    listPanel.addComponent(controlledTasksTable);
    final Button assignButton = new Button("? ??");
    controlledTasksTable.addListener(new Property.ValueChangeListener() {
        @Override/*  w  w w  . j a  va2 s.c  o m*/
        public void valueChange(Property.ValueChangeEvent event) {
            Table table = (Table) event.getProperty();
            Item item = table.getItem(table.getValue());

            if (item != null && item.getItemProperty("id") != null) {
                final String taskId = item.getItemProperty("taskId").getValue().toString();
                final Component procedureHistoryPanel = new ProcedureHistoryPanel(taskId);
                procedureHistoryPanel.addListener(new Listener() {
                    @Override
                    public void componentEvent(Event event) {
                        HistoricTaskInstance historicTaskInstance = ((ProcedureHistoryPanel.HistoryStepClickedEvent) event)
                                .getHistoricTaskInstance();
                        Date endDateTime = historicTaskInstance.getEndTime();
                        if (endDateTime == null) {
                            taskIdToAssign = findTaskByHistoricInstance(historicTaskInstance);
                            if (taskIdToAssign == null) {
                                alreadyGone();
                                return;
                            }
                            assignButton.setVisible(true);
                        } else {
                            assignButton.setVisible(false);
                        }
                    }
                });
                ((VerticalLayout) item1).removeAllComponents();
                Task task = Flash.flash().getProcessEngine().getTaskService().createTaskQuery().taskId(taskId)
                        .singleResult();
                Bid bid = Flash.flash().getAdminService().getBidByTask(taskId);
                String executionId = task.getExecutionId();
                final ProcessDefinition def = ActivitiBean.get()
                        .getProcessDefinition(task.getProcessDefinitionId(), Flash.login());
                final ShowDiagramComponentParameterObject param = new ShowDiagramComponentParameterObject();
                param.changer = bidChanger;
                param.processDefinitionId = def.getId();
                param.executionId = executionId;
                param.height = "300px";
                param.width = null;
                param.windowHeader = bid == null ? ""
                        : bid.getProcedure().getName() + " v. " + bid.getVersion();
                Button showDiagram = new Button("");
                showDiagram.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        Execution execution = Flash.flash().getProcessEngine().getRuntimeService()
                                .createExecutionQuery().executionId(param.executionId).singleResult();
                        if (execution == null) {
                            alreadyGone();
                            return;
                        }
                        ShowDiagramComponent showDiagramComponent = new ShowDiagramComponent(param);
                        VerticalLayout layout = new VerticalLayout();
                        Button back = new Button("?");
                        back.addListener(new Button.ClickListener() {
                            private static final long serialVersionUID = 4154712522487297925L;

                            @Override
                            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                                bidChanger.back();
                            }
                        });
                        layout.addComponent(back);
                        layout.setSpacing(true);
                        layout.addComponent(showDiagramComponent);
                        bidChanger.set(layout, "showDiagram");
                        bidChanger.change(layout);
                    }
                });

                Button deleteBidButton = new Button(" ?");
                deleteBidButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        final Window mainWindow = getWindow();
                        final Window rejectWindow = new Window();
                        rejectWindow.setWidth("38%");
                        rejectWindow.center();
                        rejectWindow.setCaption("!");
                        final VerticalLayout verticalLayout = new VerticalLayout();
                        verticalLayout.setSpacing(true);
                        verticalLayout.setMargin(true);
                        final Label messageLabel = new Label(
                                "  ? ?");
                        messageLabel.setStyleName("h2");
                        final TextArea textArea = new TextArea();
                        textArea.setSizeFull();
                        HorizontalLayout buttons = new HorizontalLayout();
                        buttons.setSpacing(true);
                        buttons.setSizeFull();
                        final Button ok = new Button("Ok");
                        Button cancel = new Button("Cancel");

                        buttons.addComponent(ok);
                        buttons.addComponent(cancel);
                        buttons.setExpandRatio(ok, 0.99f);
                        verticalLayout.addComponent(messageLabel);
                        verticalLayout.addComponent(textArea);
                        verticalLayout.addComponent(buttons);
                        verticalLayout.setExpandRatio(textArea, 0.99f);
                        rejectWindow.setContent(verticalLayout);
                        mainWindow.addWindow(rejectWindow);

                        Button.ClickListener ok1 = new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {
                                ok.setEnabled(false);
                                verticalLayout.removeComponent(messageLabel);
                                verticalLayout.removeComponent(textArea);
                                final byte[] block;
                                final String textAreaValue = (String) textArea.getValue();
                                if (textAreaValue != null) {
                                    block = textAreaValue.getBytes();
                                } else {
                                    block = null;
                                }
                                Label reason = new Label(textAreaValue);
                                reason.setCaption(" :");
                                verticalLayout.addComponent(reason, 0);
                                event.getButton().removeListener(this);

                                SignApplet signApplet = new SignApplet(new SignAppletListener() {

                                    @Override
                                    public void onLoading(SignApplet signApplet) {

                                    }

                                    @Override
                                    public void onNoJcp(SignApplet signApplet) {
                                        verticalLayout.removeComponent(signApplet);
                                        ReadOnly field = new ReadOnly(
                                                "   ?? ?? ?  JCP",
                                                false);
                                        verticalLayout.addComponent(field);

                                    }

                                    @Override
                                    public void onCert(SignApplet signApplet, X509Certificate certificate) {
                                        boolean ok = false;
                                        String errorClause = null;
                                        try {
                                            boolean link = AdminServiceProvider
                                                    .getBoolProperty(CertificateVerifier.LINK_CERTIFICATE);
                                            if (link) {
                                                byte[] x509 = AdminServiceProvider.get()
                                                        .withEmployee(Flash.login(), new CertificateReader());
                                                ok = Arrays.equals(x509, certificate.getEncoded());
                                            } else {
                                                ok = true;
                                            }
                                            CertificateVerifyClientProvider.getInstance()
                                                    .verifyCertificate(certificate);
                                        } catch (CertificateEncodingException e) {
                                        } catch (CertificateInvalid err) {
                                            errorClause = err.getMessage();
                                            ok = false;
                                        }
                                        if (ok) {
                                            signApplet.block(1, 1);
                                        } else {
                                            NameParts subject = X509.getSubjectParts(certificate);
                                            String fieldValue = (errorClause == null)
                                                    ? " " + subject.getShortName()
                                                            + " "
                                                    : errorClause;
                                            ReadOnly field = new ReadOnly(fieldValue, false);
                                            verticalLayout.addComponent(field, 0);
                                        }
                                    }

                                    @Override
                                    public void onBlockAck(SignApplet signApplet, int i) {
                                        logger().fine("AckBlock:" + i);
                                        signApplet.chunk(1, 1, block);
                                    }

                                    @Override
                                    public void onChunkAck(SignApplet signApplet, int i) {
                                        logger().fine("AckChunk:" + i);
                                    }

                                    @Override
                                    public void onSign(SignApplet signApplet, byte[] sign) {
                                        final int i = signApplet.getBlockAck();
                                        logger().fine("done block:" + i);
                                        if (i < 1) {
                                            signApplet.block(i + 1, 1);
                                        } else {
                                            verticalLayout.removeComponent(signApplet);
                                            NameParts subjectParts = X509
                                                    .getSubjectParts(signApplet.getCertificate());
                                            Label field2 = new Label(subjectParts.getShortName());
                                            field2.setCaption("? ?:");
                                            verticalLayout.addComponent(field2, 0);
                                            ok.setEnabled(true);
                                        }
                                    }

                                    private Logger logger() {
                                        return Logger.getLogger(getClass().getName());
                                    }
                                });
                                byte[] x509 = AdminServiceProvider.get().withEmployee(Flash.login(),
                                        new CertificateReader());
                                if (x509 != null) {
                                    signApplet.setSignMode(x509);
                                } else {
                                    signApplet.setUnboundSignMode();
                                }
                                verticalLayout.addComponent(signApplet, 0);

                                ok.addListener(new Button.ClickListener() {
                                    @Override
                                    public void buttonClick(Button.ClickEvent event) {
                                        Task result = Flash.flash().getProcessEngine().getTaskService()
                                                .createTaskQuery().taskId(taskId).singleResult();
                                        if (result == null) {
                                            alreadyGone();
                                            return;
                                        }
                                        ActivitiBean.get().deleteProcessInstance(taskId, textAreaValue);
                                        AdminServiceProvider.get().createLog(Flash.getActor(), "activiti.task",
                                                taskId, "remove", " ?", true);
                                        fireTaskChangedEvent(taskId, SupervisorWorkplace.this);
                                        infoChanger.change(infoComponent);
                                        controlledTasksTable.setValue(null);
                                        controlledTasksTable.refresh();
                                        mainWindow.removeWindow(rejectWindow);
                                    }
                                });
                            }
                        };
                        ok.addListener(ok1);

                        cancel.addListener(new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {

                                controlledTasksTable.refresh();
                                mainWindow.removeWindow(rejectWindow);
                            }
                        });
                    }
                });

                HorizontalLayout hl = new HorizontalLayout();
                hl.setSizeFull();
                hl.setSpacing(true);
                hl.addComponent(showDiagram);
                hl.addComponent(deleteBidButton);
                hl.setExpandRatio(showDiagram, 0.99f);
                hl.setExpandRatio(deleteBidButton, 0.01f);

                ((VerticalLayout) item1).addComponent(hl);
                ((VerticalLayout) item1).addComponent(procedureHistoryPanel);
                assignButton.setVisible(false);
                assignButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        ((Layout) item3).removeAllComponents();
                        if (taskIdToAssign != null) {
                            ((Layout) item3).addComponent(createAssignerToTaskComponent(taskIdToAssign,
                                    (ProcedureHistoryPanel) procedureHistoryPanel, controlledTasksTable));
                            bidChanger.change(item3);
                        } else {
                            alreadyGone();
                        }
                    }
                });
                ((VerticalLayout) item1).addComponent(assignButton);
                infoChanger.change(bidComponent);
                bidChanger.change(item1);
            } else {
                ((VerticalLayout) item1).removeAllComponents();
            }
        }
    });
}

From source file:se.natusoft.osgi.aps.apsuseradminweb.vaadin.APSUSerAdminWebApp.java

License:Open Source License

/**
 * Creates the application GUI./*from  w  w  w  . j  ava  2 s  .c o  m*/
 */
@Override
public void initGUI() {

    this.setTheme(APSTheme.THEME);

    this.main = new Window("Application Platform Services Simple User Service Administration App");
    this.main.setSizeFull();
    VerticalLayout mainLayout = new VerticalLayout();
    this.main.setContent(mainLayout);
    mainLayout.setMargin(false);
    mainLayout.setSizeFull();

    this.layout = new SidesAndCenterLayout();
    this.main.addComponent(this.layout);

    LeftBar leftBar = new LeftBar();

    this.menuTree = new MenuTree();

    this.menuTree.addListener(new Property.ValueChangeListener() {
        /** Handles input changes in the menu tree. */
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            menuTreeItemHandler(event);
        }
    });

    UsersMenuBuilder usersMenuBuilder = new UsersMenuBuilder(this.userService, this.logger);
    usersMenuBuilder.addRefreshable(this.menuTree);
    usersMenuBuilder.addRefreshable(new MenuRefreshable());
    usersMenuBuilder.setClearCenterRefreshable(new ClearCenterRefreshable());
    this.menuTree.addMenuBuilder(usersMenuBuilder);

    RolesMenuBuilder rolesMenuBuilder = new RolesMenuBuilder(this.userService, this.logger);
    rolesMenuBuilder.addRefreshable(this.menuTree);
    rolesMenuBuilder.addRefreshable(new MenuRefreshable());
    rolesMenuBuilder.setClearCenterRefreshable(new ClearCenterRefreshable());
    this.menuTree.addMenuBuilder(rolesMenuBuilder);

    this.menuTree.refresh();

    this.menuTree.setActionHandler(this);
    leftBar.addComponent(this.menuTree);

    this.layout.setLeft(leftBar);
    this.layout.setCenter(Description.DESCRIPTION_VIEW);
    this.layout.doLayout(); // This is required after contents have been set.

    /* The window to show when an authorized user is not available. */
    Window notAuthWindow = new Window("Application Platform Services Administration App");
    notAuthWindow.setSizeFull();
    VerticalLayout nawvl = new VerticalLayout();
    Label loginMessage = new Label("<font size='+2'>Please login!</font>", Label.CONTENT_XHTML);
    nawvl.addComponent(loginMessage);
    notAuthWindow.setContent(nawvl);

    setMainWindow(notAuthWindow);

}

From source file:ui.button.ShowAchievementsButton.java

License:Apache License

private void showOnWindow() {
    final Window window = new Window();
    window.setWidth("95%");
    window.setHeight("95%");
    window.center();//from w w  w .j ava2s .  co  m
    window.setResizable(true);
    window.setModal(true);
    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            window.close();
        }
    });
    window.setContent(new UserTabSheet(userId, language));
    getUI().addWindow(window);
    window.setStyleName("window");
}

From source file:ui.item.QAView.java

License:Apache License

protected void showDeleteConfirm() {
    ConfirmForm form = new ConfirmForm<T>(item, getList());
    final Window window = new LifetimeWindow(userId, language, "Confirm Delete?");
    window.setContent(form);

    form.getCancel().addClickListener(new Button.ClickListener() {
        @Override//from   w w w  .  j a  v a2  s  .c  om
        public void buttonClick(Button.ClickEvent event) {
            window.close();
        }
    });

    form.getDelete().addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            deleteDataFormServer();
            getList().update();
            window.close();
        }
    });

    window.setSizeUndefined();
    getUI().addWindow(window);
}

From source file:ui.list.LifetimeList.java

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(getAddButton())) {
        LifetimeForm<T> form = getFormNew();
        form.setSizeFull();//from ww  w .j a  v  a  2  s  .co m
        Window window = new LifetimeWindow(userId, language, "Add achievement");
        window.setContent(form);
        getUI().addWindow(window);
    }
    if (event.getButton() == chartButton) {
        Chart chart = getChart();
        chart.setSizeFull();
        Window window = new LifetimeWindow(userId, language, "Charts");
        window.setContent(chart);
        getUI().addWindow(window);
    }
}

From source file:uicomponents.MSSampleMultiplicationTable.java

License:Open Source License

protected void createEnzymeSelectionWindow(String row) {
    Window subWindow = new Window(" Enzyme selection");
    subWindow.setWidth("400px");

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);/*from www .  j av  a 2s  .  c o m*/
    layout.setMargin(true);
    EnzymePanel pan = new EnzymePanel(enzymes);
    Button ok = new Button("Okay.");
    ok.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            List<String> enzymes = pan.getEnzymes();
            ComboBox b = parseBoxRow(row, "Enzyme");
            if (enzymes.isEmpty()) {
                Styles.notification("No enzymes selected", "Please select at least one enzyme!",
                        NotificationType.ERROR);
            } else if (enzymes.size() == 1) {
                b.setValue(enzymes.get(0));
                subWindow.close();
            } else {
                b.addItem("Custom");
                b.setValue("Custom");
                enzymeMap.put(row, enzymes);
                subWindow.close();
            }
        }
    });
    layout.addComponent(pan);
    layout.addComponent(ok);

    subWindow.setContent(layout);
    // Center it in the browser window
    subWindow.center();
    subWindow.setModal(true);
    subWindow.setIcon(FontAwesome.FLASK);
    subWindow.setResizable(false);
    ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent();
    ui.addWindow(subWindow);
}

From source file:views.MetadataUploadView.java

License:Open Source License

private void createNotRightTypeDialogue(String headline, String moreInfo, String barcode) {
    Window subWindow = new Window(" Wrong data type!");
    subWindow.setWidth("400px");

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);/*  ww w .j  a  v  a 2s.  co m*/
    layout.setMargin(true);
    Label preInfo = new Label(
            "Data of barcode " + barcode + " in this column doesn't fit the attribute type. " + moreInfo);
    layout.addComponent(preInfo);
    Button ok = new Button("Ignore Column.");
    Button no = new Button("Select different attribute.");
    ok.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            getActiveTable().removeContainerProperty(headline);
            subWindow.close();
        }
    });
    no.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            resetAttribute(headline);
            subWindow.close();
        }
    });
    layout.addComponent(ok);
    layout.addComponent(no);

    subWindow.setContent(layout);
    // Center it in the browser window
    subWindow.center();
    subWindow.setModal(true);
    subWindow.setIcon(FontAwesome.BOLT);
    subWindow.setResizable(false);
    ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent();
    ui.addWindow(subWindow);
}