Example usage for com.vaadin.ui Button setEnabled

List of usage examples for com.vaadin.ui Button setEnabled

Introduction

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

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:rs.pupin.jpo.validation.gui.constraints.IC16.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/* w  w w  .ja va2s  .c o m*/
    Iterator<BindingSet> res = icQuery.getResults();

    @SuppressWarnings("unused")
    final class MeasureOmeasurePair {

        String measure;
        String omeasure;
    }

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, MeasureOmeasurePair> obsMap = new HashMap<String, MeasureOmeasurePair>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        MeasureOmeasurePair pair = new MeasureOmeasurePair();
        pair.measure = set.getValue("measure").stringValue();
        pair.omeasure = set.getValue("omeasure").stringValue();
        obsMap.put(set.getValue("obs").stringValue(), pair);
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - In Data Sets that use a Measure dimension (if there are any) each Observation only has a value for one measure");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue(
            "Following observations belong to data sets that use a Measure dimension and have a value for more than one measure");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells what is the measure dimension and mention the omeasure, perhaps details table
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC17.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from w  ww. java  2  s  . c  o  m
    Iterator<BindingSet> res = icQuery.getResults();

    @SuppressWarnings("unused")
    final class NumMeasuresCountPair {

        String numMeasures;
        String count;
    }

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, NumMeasuresCountPair> obsMap = new HashMap<String, NumMeasuresCountPair>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        NumMeasuresCountPair pair = new NumMeasuresCountPair();
        pair.numMeasures = set.getValue("numMeasures").stringValue();
        pair.count = set.getValue("count").stringValue();
        obsMap.put(set.getValue("obs1").stringValue(), pair);
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue("No problems were detected - In a data set which uses a measure dimension then "
                + "if there is an Observation for some combination of non-measure dimensions then "
                + "there must be other Observations with the same non-measure dimension values for each of the declared measures");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue(
            "Following observations belong to data sets that use a Measure dimension and break a rule that "
                    + "if there is an Observation for some combination of non-measure dimensions then "
                    + "there must be other Observations with the same non-measure dimension values for each of the declared measures");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells what is the difference in counts, maybe even more, perhaps details table
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC18.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from   w  ww . j  av a2  s.  com*/
    Iterator<BindingSet> res = icQuery.getResults();

    @SuppressWarnings("unused")
    final class DataSetSlicePair {

        String dataset;
        String slice;
    }

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, DataSetSlicePair> obsMap = new HashMap<String, DataSetSlicePair>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        DataSetSlicePair pair = new DataSetSlicePair();
        pair.dataset = set.getValue("dataset").stringValue();
        pair.slice = set.getValue("slice").stringValue();
        obsMap.put(set.getValue("obs").stringValue(), pair);
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - If a qb:DataSet D has a qb:slice S, and S has an qb:observation O, then the qb:dataSet corresponding to O must be D");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue("Following observations are missing a link to the appropriate data set");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells which dataset and slice are in question, perhaps details table
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC19.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from   w ww  . j  a  v a2  s  . co  m*/

    final Iterator<BindingSet> res = icQuery.getResults();

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, String> map = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        map.put(set.getValue("v").stringValue(), set.getValue("list").stringValue());
    }

    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue("All values of coded dimensions are linked to the code lists");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following resources should be of type skos:Concept and linked to the appropriate code list");
    rootLayout.addComponent(label);

    final ListSelect listValues = new ListSelect("Resources", map.keySet());
    listValues.setNullSelectionAllowed(false);
    listValues.setImmediate(true);
    rootLayout.addComponent(listValues);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listValues.getValue());
        }
    });

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);

    Button fix = new Button("Quick Fix");
    rootLayout.addComponent(buttonsLayout);
    rootLayout.setExpandRatio(buttonsLayout, 2.0f);
    buttonsLayout.addComponent(fix);
    buttonsLayout.addComponent(editInOW);
    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            String resource = (String) listValues.getValue();
            String codeList = map.get(resource);
            getUI().addWindow(new QuickFixCodesFromCodeLists(resource, codeList));
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC20.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//  w w  w . j  a v a 2 s . com

    final Iterator<BindingSet> res = icQuery.getResults();

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, String> map = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue());
    }

    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "All values of hierarchical dimensions with a non-blank qb:parentChildProperty are reachable from a root of the hierarchy");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following dimensions need to be fixed because some of its values cannot be reached from root of the hierarchy along the qb:parentChildProperty links");
    rootLayout.addComponent(label);

    final ListSelect listValues = new ListSelect("Resources", map.keySet());
    listValues.setNullSelectionAllowed(false);
    listValues.setImmediate(true);
    rootLayout.addComponent(listValues);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listValues.getValue());
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC21.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from  www . jav  a  2  s .c o m*/

    final Iterator<BindingSet> res = icQuery.getResults();

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, String> map = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue());
    }

    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "All values of hierarchical dimensions with an inverse qb:parentChildProperty are reachable from a root of the hierarchy");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following dimensions need to be fixed becaue some of its values cannot be reached from root of the hierarchy along the inverse qb:parentChildProperty links");
    rootLayout.addComponent(label);

    final ListSelect listValues = new ListSelect("Resources", map.keySet());
    listValues.setNullSelectionAllowed(false);
    listValues.setImmediate(true);
    rootLayout.addComponent(listValues);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listValues.getValue());
        }
    });
}

From source file:ru.codeinside.gses.webui.components.HistoricTaskInstancesQuery.java

License:Mozilla Public License

@Override
public List<Item> loadItems(final int startIndex, final int count) {
    List<HistoricTaskInstance> histories = Functions
            .withHistory(new Function<HistoryService, List<HistoricTaskInstance>>() {
                public List<HistoricTaskInstance> apply(HistoryService srv) {
                    return srv.createHistoricTaskInstanceQuery().processInstanceId(processDefinitionId)
                            .listPage(startIndex, count);
                }//ww w. j  a va  2  s  .c o m
            });
    List<Item> items = Lists.newArrayListWithExpectedSize(histories.size());
    for (final HistoricTaskInstance i : histories) {
        String startTime = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(i.getStartTime());
        String endTime = (i.getEndTime() != null)
                ? new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(i.getEndTime())
                : "";
        Bid bid = AdminServiceProvider.get().getBidByTask(taskId);
        String bidId = bid != null ? bid.getId().toString() : "";
        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("id", new ObjectProperty<String>(bidId));
        item.addItemProperty("hid", new ObjectProperty<HistoricTaskInstance>(i));
        item.addItemProperty("name", new ObjectProperty<String>(i.getName()));
        item.addItemProperty("startDate", new ObjectProperty<String>(startTime));
        item.addItemProperty("endDate", new ObjectProperty<String>(endTime));
        item.addItemProperty("assignee",
                new ObjectProperty<String>(i.getAssignee() != null ? i.getAssignee() : ""));
        Date time = i.getEndTime() == null ? i.getStartTime() : i.getEndTime();
        Button button = new Button("?",
                new ArchiveFactory.ShowClickListener(i.getTaskDefinitionKey(), bidId, time));
        button.setEnabled(i.getAssignee() != null);
        item.addItemProperty("form", new ObjectProperty<Component>(button));
        items.add(item);
    }
    return items;
}

From source file:ru.codeinside.gses.webui.form.GridForm.java

License:Mozilla Public License

private void updateCloneButtons(Button plus, Button minus, FieldTree.Entry block) {
    minus.setEnabled(block.cloneMin < block.cloneCount);
    plus.setEnabled(block.cloneCount < block.cloneMax);
}

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/* ww  w.ja  va  2  s.  c  om*/
        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.apsconfigadminweb.gui.vaadin.components.ConfigEnvEditor.java

License:Open Source License

/**
 * Setup for deleting.//from  w  ww  .  java 2 s .c o  m
 */
private void initForDelete() {
    setCaption("Deleting config environment '" + this.configEnv.getName() + "'");
    setStyleName("aps-editing-text");

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);
    verticalLayout.setSpacing(true);
    verticalLayout.setStyleName(CSS.APS_EDITING_TEXT + " " + CSS.APS_CONTENT_PANEL);

    Label nameLabel = new Label("Config environment name:");
    verticalLayout.addComponent(nameLabel);
    Panel confNamePanel = new Panel();
    Label nameValue = new Label(this.configEnv.getName());
    confNamePanel.addComponent(nameValue);
    verticalLayout.addComponent(confNamePanel);

    Label descLabel = new Label("Description of config environment:");
    verticalLayout.addComponent(descLabel);
    Panel confNameDescPanel = new Panel();
    Label descValue = new Label(this.configEnv.getDescription());
    confNameDescPanel.addComponent(descValue);
    verticalLayout.addComponent(confNameDescPanel);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setMargin(false);
    horizontalLayout.setSpacing(true);
    verticalLayout.addComponent(horizontalLayout);

    Button deleteButton = new Button("Delete");
    deleteButton.addListener(new ClickListener() {
        /** click handling. */
        @Override
        public void buttonClick(ClickEvent event) {
            deleteConfigEnv();
        }
    });
    if (this.configEnv.equals(this.configEnvAdmin.getActiveConfigEnvironment())) {
        deleteButton.setEnabled(false);
    }
    horizontalLayout.addComponent(deleteButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.addListener(new ClickListener() {
        /** Click handling. */
        @Override
        public void buttonClick(ClickEvent event) {
            cancel();
        }
    });
    horizontalLayout.addComponent(cancelButton);

    setContent(verticalLayout);

}