Example usage for com.vaadin.ui HorizontalLayout setSizeFull

List of usage examples for com.vaadin.ui HorizontalLayout setSizeFull

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:ru.codeinside.adm.ui.AdminApp.java

License:Mozilla Public License

private Panel createEmailDatesPanel() {
    VerticalLayout emailDates = new VerticalLayout();
    emailDates.setSpacing(true);/*from ww w . ja v  a2  s  . c o  m*/
    emailDates.setMargin(true);
    emailDates.setSizeFull();
    Panel panel2 = new Panel(" ? ??", emailDates);
    panel2.setSizeFull();

    final TextField emailToField = new TextField("e-mail ?:");
    emailToField.setValue(get(API.EMAIL_TO));
    emailToField.setRequired(true);
    emailToField.setReadOnly(true);
    emailToField.addValidator(new EmailValidator("  e-mail ?"));

    final TextField receiverNameField = new TextField("? ?:");
    receiverNameField.setValue(get(API.RECEIVER_NAME));
    receiverNameField.setRequired(true);
    receiverNameField.setReadOnly(true);

    final TextField emailFromField = new TextField("e-mail ?:");
    emailFromField.setValue(get(API.EMAIL_FROM));
    emailFromField.setRequired(true);
    emailFromField.setReadOnly(true);
    emailFromField.addValidator(new EmailValidator("  e-mail ?"));

    final TextField senderLoginField = new TextField(" ?:");
    senderLoginField.setValue(get(API.SENDER_LOGIN));
    senderLoginField.setRequired(true);
    senderLoginField.setReadOnly(true);

    final TextField senderNameField = new TextField("? ?:");
    senderNameField.setValue(get(API.SENDER_NAME));
    senderNameField.setRequired(true);
    senderNameField.setReadOnly(true);

    final PasswordField passwordField = new PasswordField(":");
    passwordField.setValue(API.PASSWORD);
    passwordField.setRequired(true);
    passwordField.setReadOnly(true);

    final TextField hostField = new TextField("SMTP ?:");
    String host = get(API.HOST);
    hostField.setValue(host == null ? "" : host);
    hostField.setRequired(true);
    hostField.setReadOnly(true);

    final TextField portField = new TextField(":");
    String port = get(API.PORT);
    portField.setValue(port == null ? "" : port);
    portField.setRequired(true);
    portField.setReadOnly(true);
    portField.addValidator(new IntegerValidator(" "));

    final CheckBox tls = new CheckBox("? TLS",
            AdminServiceProvider.getBoolProperty(API.TLS));
    tls.setReadOnly(true);

    final Button save = new Button("");
    save.setVisible(false);
    final Button cancel = new Button("");
    cancel.setVisible(false);
    final Button change = new Button("");
    final Button check = new Button("");
    check.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            String emailTo = get(API.EMAIL_TO);
            String receiverName = get(API.RECEIVER_NAME);
            String hostName = get(API.HOST);
            String port = get(API.PORT);
            String senderLogin = get(API.SENDER_LOGIN);
            String password = get(API.PASSWORD);
            String emailFrom = get(API.EMAIL_FROM);
            String senderName = get(API.SENDER_NAME);
            if (emailTo.isEmpty() || receiverName.isEmpty() || hostName.isEmpty() || port.isEmpty()
                    || senderLogin.isEmpty() || password.isEmpty() || emailFrom.isEmpty()
                    || senderName.isEmpty()) {
                check.getWindow().showNotification("? ? ");
                return;
            }
            Email email = new SimpleEmail();
            try {
                email.setSubject("? ?");
                email.setMsg("? ?");
                email.addTo(emailTo, receiverName);
                email.setHostName(hostName);
                email.setSmtpPort(Integer.parseInt(port));
                email.setTLS(AdminServiceProvider.getBoolProperty(API.TLS));
                email.setAuthentication(senderLogin, password);
                email.setFrom(emailFrom, senderName);
                email.setCharset("utf-8");
                email.send();
            } catch (EmailException e) {
                check.getWindow().showNotification(e.getMessage());
                e.printStackTrace();
                return;
            }
            check.getWindow().showNotification("? ? ");
        }
    });
    change.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            emailToField.setReadOnly(false);
            receiverNameField.setReadOnly(false);
            emailFromField.setReadOnly(false);
            senderLoginField.setReadOnly(false);
            senderNameField.setReadOnly(false);
            passwordField.setReadOnly(false);
            hostField.setReadOnly(false);
            portField.setReadOnly(false);
            tls.setReadOnly(false);

            change.setVisible(false);
            check.setVisible(false);
            save.setVisible(true);
            cancel.setVisible(true);
        }
    });
    save.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (StringUtils.isEmpty((String) emailToField.getValue())
                    || StringUtils.isEmpty((String) receiverNameField.getValue())
                    || StringUtils.isEmpty((String) emailFromField.getValue())
                    || StringUtils.isEmpty((String) senderNameField.getValue())
                    || StringUtils.isEmpty((String) senderLoginField.getValue())
                    || StringUtils.isEmpty((String) passwordField.getValue())
                    || StringUtils.isEmpty((String) hostField.getValue()) || portField.getValue() == null) {
                emailToField.getWindow().showNotification(" ?",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
                return;
            }
            boolean errors = false;
            try {
                emailToField.validate();
            } catch (Validator.InvalidValueException ignore) {
                errors = true;
            }
            try {
                emailFromField.validate();
            } catch (Validator.InvalidValueException ignore) {
                errors = true;
            }
            try {
                portField.validate();
            } catch (Validator.InvalidValueException ignore) {
                errors = true;
            }
            if (errors) {
                return;
            }
            set(API.EMAIL_TO, emailToField.getValue());
            set(API.RECEIVER_NAME, receiverNameField.getValue());
            set(API.EMAIL_FROM, emailFromField.getValue());
            set(API.SENDER_LOGIN, senderLoginField.getValue());
            set(API.SENDER_NAME, senderNameField.getValue());
            set(API.PASSWORD, passwordField.getValue());
            set(API.HOST, hostField.getValue());
            set(API.PORT, portField.getValue());
            set(API.TLS, tls.getValue());

            emailToField.setReadOnly(true);
            receiverNameField.setReadOnly(true);
            emailFromField.setReadOnly(true);
            senderLoginField.setReadOnly(true);
            senderNameField.setReadOnly(true);
            passwordField.setReadOnly(true);
            hostField.setReadOnly(true);
            portField.setReadOnly(true);
            tls.setReadOnly(true);

            save.setVisible(false);
            cancel.setVisible(false);
            change.setVisible(true);
            check.setVisible(true);
            emailToField.getWindow().showNotification("?? ?",
                    Window.Notification.TYPE_HUMANIZED_MESSAGE);
        }
    });
    cancel.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            emailToField.setValue(get(API.EMAIL_TO));
            receiverNameField.setValue(get(API.RECEIVER_NAME));
            emailFromField.setValue(get(API.EMAIL_FROM));
            senderLoginField.setValue(get(API.SENDER_LOGIN));
            senderNameField.setValue(get(API.SENDER_NAME));
            passwordField.setValue(get(API.PASSWORD));
            hostField.setValue(get(API.HOST));
            portField.setValue(get(API.PORT));
            tls.setValue(AdminServiceProvider.getBoolProperty(API.TLS));

            emailToField.setReadOnly(true);
            receiverNameField.setReadOnly(true);
            emailFromField.setReadOnly(true);
            senderLoginField.setReadOnly(true);
            senderNameField.setReadOnly(true);
            passwordField.setReadOnly(true);
            hostField.setReadOnly(true);
            portField.setReadOnly(true);
            tls.setReadOnly(true);

            save.setVisible(false);
            cancel.setVisible(false);
            change.setVisible(true);
            check.setVisible(true);
        }
    });

    FormLayout fields1 = new FormLayout();
    fields1.setSizeFull();
    fields1.addComponent(senderLoginField);
    fields1.addComponent(passwordField);
    fields1.addComponent(hostField);
    fields1.addComponent(portField);
    fields1.addComponent(tls);

    FormLayout fields2 = new FormLayout();
    fields2.setSizeFull();
    fields2.addComponent(emailToField);
    fields2.addComponent(receiverNameField);
    fields2.addComponent(emailFromField);
    fields2.addComponent(senderNameField);

    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.setSizeFull();
    fields.addComponent(fields1);
    fields.addComponent(fields2);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(change);
    buttons.addComponent(save);
    buttons.addComponent(cancel);
    buttons.addComponent(check);

    Label label = new Label("?? ");
    label.addStyleName(Reindeer.LABEL_H2);
    emailDates.addComponent(label);
    emailDates.addComponent(fields);
    emailDates.addComponent(buttons);
    emailDates.setExpandRatio(fields, 1f);
    return panel2;
}

From source file:ru.codeinside.adm.ui.AdminApp.java

License:Mozilla Public License

private Panel createMilTaskConfigPanel() {
    VerticalLayout mailConfig = new VerticalLayout();
    mailConfig.setSpacing(true);/* ww w .  jav  a2 s . c o  m*/
    mailConfig.setMargin(true);
    mailConfig.setSizeFull();
    Panel emailTaskPanel = new Panel("?? SMTP ? Email Task", mailConfig);
    emailTaskPanel.setSizeFull();

    final TextField mtDefaultFrom = new TextField("email  :");
    mtDefaultFrom.setValue(get(API.MT_DEFAULT_FROM));
    mtDefaultFrom.setRequired(true);
    mtDefaultFrom.setReadOnly(true);
    mtDefaultFrom.addValidator(new EmailValidator("  e-mail ?"));

    final TextField mtSenderLoginField = new TextField(" ?:");
    mtSenderLoginField.setValue(get(API.MT_SENDER_LOGIN));
    mtSenderLoginField.setRequired(true);
    mtSenderLoginField.setReadOnly(true);

    final PasswordField mtPasswordField = new PasswordField(":");
    mtPasswordField.setValue(API.MT_PASSWORD);
    mtPasswordField.setRequired(true);
    mtPasswordField.setReadOnly(true);

    final TextField mtHostField = new TextField("SMTP ?:");
    String host = get(API.MT_HOST);
    mtHostField.setValue(host == null ? "" : host);
    mtHostField.setRequired(true);
    mtHostField.setReadOnly(true);

    final TextField mtPortField = new TextField(":");
    String port = get(API.MT_PORT);
    mtPortField.setValue(port == null ? "" : port);
    mtPortField.setRequired(true);
    mtPortField.setReadOnly(true);
    mtPortField.addValidator(new IntegerValidator(" "));

    final CheckBox mtTls = new CheckBox("? TLS",
            AdminServiceProvider.getBoolProperty(API.MT_TLS));
    mtTls.setReadOnly(true);

    final Button save = new Button("");
    save.setVisible(false);
    final Button cancel = new Button("");
    cancel.setVisible(false);
    final Button change = new Button("");

    change.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            mtSenderLoginField.setReadOnly(false);
            mtDefaultFrom.setReadOnly(false);
            mtPasswordField.setReadOnly(false);
            mtHostField.setReadOnly(false);
            mtPortField.setReadOnly(false);
            mtTls.setReadOnly(false);

            change.setVisible(false);
            save.setVisible(true);
            cancel.setVisible(true);
        }
    });
    save.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (StringUtils.isEmpty((String) mtSenderLoginField.getValue())
                    || StringUtils.isEmpty((String) mtDefaultFrom.getValue())
                    || StringUtils.isEmpty((String) mtPasswordField.getValue())
                    || StringUtils.isEmpty((String) mtHostField.getValue()) || mtPortField.getValue() == null) {
                mtSenderLoginField.getWindow().showNotification(" ?",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
                return;
            }
            boolean errors = false;
            try {
                mtDefaultFrom.validate();
            } catch (Validator.InvalidValueException ignore) {
                errors = true;
            }
            try {
                mtPortField.validate();
            } catch (Validator.InvalidValueException ignore) {
                errors = true;
            }
            if (errors) {
                return;
            }
            set(API.MT_SENDER_LOGIN, mtSenderLoginField.getValue());
            set(API.MT_DEFAULT_FROM, mtDefaultFrom.getValue());
            set(API.MT_PASSWORD, mtPasswordField.getValue());
            set(API.MT_HOST, mtHostField.getValue());
            set(API.MT_PORT, mtPortField.getValue());
            set(API.MT_TLS, mtTls.getValue());

            mtSenderLoginField.setReadOnly(true);
            mtDefaultFrom.setReadOnly(true);
            mtPasswordField.setReadOnly(true);
            mtHostField.setReadOnly(true);
            mtPortField.setReadOnly(true);
            mtTls.setReadOnly(true);

            save.setVisible(false);
            cancel.setVisible(false);
            change.setVisible(true);
            mtSenderLoginField.getWindow().showNotification("?? ?",
                    Window.Notification.TYPE_HUMANIZED_MESSAGE);
        }
    });
    cancel.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            mtSenderLoginField.setValue(get(API.MT_SENDER_LOGIN));
            mtDefaultFrom.setValue(get(API.MT_DEFAULT_FROM));
            mtPasswordField.setValue(get(API.MT_PASSWORD));
            mtHostField.setValue(get(API.MT_HOST));
            mtPortField.setValue(get(API.MT_PORT));
            mtTls.setValue(AdminServiceProvider.getBoolProperty(API.MT_TLS));

            mtSenderLoginField.setReadOnly(true);
            mtDefaultFrom.setReadOnly(true);
            mtPasswordField.setReadOnly(true);
            mtHostField.setReadOnly(true);
            mtPortField.setReadOnly(true);
            mtTls.setReadOnly(true);

            save.setVisible(false);
            cancel.setVisible(false);
            change.setVisible(true);
        }
    });

    FormLayout leftFields = new FormLayout();
    leftFields.setSizeFull();
    leftFields.addComponent(mtSenderLoginField);
    leftFields.addComponent(mtDefaultFrom);
    leftFields.addComponent(mtPasswordField);
    leftFields.addComponent(mtHostField);
    leftFields.addComponent(mtPortField);

    FormLayout rightFields = new FormLayout();
    rightFields.setSizeFull();
    rightFields.addComponent(mtTls);

    HorizontalLayout fieldsLayout = new HorizontalLayout();
    fieldsLayout.setSpacing(true);
    fieldsLayout.setSizeFull();
    fieldsLayout.addComponent(leftFields);
    fieldsLayout.addComponent(rightFields);
    fieldsLayout.setExpandRatio(leftFields, 0.6f);
    fieldsLayout.setExpandRatio(rightFields, 0.4f);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(change);
    buttons.addComponent(save);
    buttons.addComponent(cancel);

    Label label = new Label("?? Email Task");
    label.addStyleName(Reindeer.LABEL_H2);
    mailConfig.addComponent(label);
    mailConfig.addComponent(fieldsLayout);
    mailConfig.addComponent(buttons);
    mailConfig.setExpandRatio(fieldsLayout, 1f);
    return emailTaskPanel;
}

From source file:ru.codeinside.adm.ui.BusinessCalendar.java

License:Mozilla Public License

public BusinessCalendar() {
    Upload upload = new Upload();
    upload.setImmediate(false);/*from ww w.j a va2 s . com*/
    upload.setButtonCaption("  ");
    upload.setReceiver(this);
    upload.addListener(this);

    datesTable = new BusinessDatesTable();
    removeButton = createButton("");

    VerticalLayout vr = new VerticalLayout();
    vr.setSizeFull();
    vr.setSpacing(true);
    vr.setMargin(true);

    HorizontalLayout horLayout = new HorizontalLayout();
    horLayout.setSizeFull();
    horLayout.setSpacing(true);
    horLayout.setMargin(true);
    horLayout.addComponent(upload);
    horLayout.addComponent(removeButton);
    vr.addComponent(horLayout);
    vr.addComponent(datesTable);

    addComponent(vr);
    vr.setExpandRatio(horLayout, .1f);
    vr.setExpandRatio(datesTable, .9f);
    datesTable.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            removeButton.setVisible(event.getProperty().getValue() != null);
        }
    });
    setSizeFull();
}

From source file:ru.codeinside.adm.ui.employee.EmployeeWidget.java

License:Mozilla Public License

public EmployeeWidget(boolean lockedFilterValue, TreeTable table) {
    this.table = table;
    Upload upload = new Upload();
    upload.setImmediate(false);//from  ww  w  . j  ava2  s .com
    upload.setButtonCaption("  ");
    upload.setReceiver(this);
    upload.addListener(this);
    /*    Panel panel1 = new Panel();
        Button button = new Button("??? ", new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            try {
              URL url = new URL(getApplication().getURL(), "/registry/structures");
              loadEmployeeData(url.openStream());
            } catch (MalformedURLException e) {
              getWindow().showNotification(" " + e.getMessage());
            } catch (IOException e) {
              getWindow().showNotification(" " + e.getMessage());
            }
          }
        });
        panel1.addComponent(button);*/
    tableEmployee = new TableAllEmployee(lockedFilterValue);
    tableEmployee.setSizeFull();
    HorizontalLayout hr = new HorizontalLayout();
    hr.setSizeFull();
    hr.setHeight("70px");
    hr.setSpacing(true);
    hr.setMargin(true);
    hr.addComponent(upload);
    addComponent(hr);
    addComponent(tableEmployee);
    tableEmployee.addButtonToLayout(hr);
    setExpandRatio(hr, 0.01f);
    setExpandRatio(tableEmployee, 0.99f);
    setSizeFull();
}

From source file:ru.codeinside.gses.activiti.ReadOnly.java

License:Mozilla Public License

public ReadOnly(String labelValue, String value, boolean valid) {
    this.valid = valid;
    if (value == null || value.length() < 4000) {
        setSizeFull();//  w w  w  .j  a v  a 2  s . c  o m
        Label label = new Label(labelValue);
        label.setSizeFull();
        label.setStyleName("left");
        HorizontalLayout layout = new HorizontalLayout(); //   GridLayout
        layout.setSizeFull();
        layout.addComponent(label);
        layout.setExpandRatio(label, 1f);
        setCompositionRoot(layout);
    } else {
        setSizeFull();
        TextArea area = new TextArea();
        area.setValue(value);
        area.setReadOnly(true);
        area.setSizeFull();
        area.setRows(25);
        setCompositionRoot(area);
    }
    if (valid) {
        setValue(value);
    }
}

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

License:Mozilla Public License

public static Component create() {
    final FilterTable bidsTable = createBidsTable();
    final FilterTable phaseTable = createPhaseTable();
    bidsTable.addGeneratedColumn("id", new IdColumnGenerator(bidsTable, phaseTable));

    final HorizontalLayout bidsLayout = new HorizontalLayout();
    bidsLayout.setSizeFull();
    bidsLayout.setMargin(true);/* w  w w.ja v  a 2s.co m*/
    bidsLayout.setSpacing(true);
    bidsLayout.addComponent(bidsTable);

    final VerticalLayout candidateLayout = new VerticalLayout();
    candidateLayout.setSizeFull();
    candidateLayout.setMargin(true);
    candidateLayout.addComponent(phaseTable);

    final TasksSplitter vSplitter = new TasksSplitter(new TableRefresh(bidsTable),
            new TableRefresh(phaseTable));
    vSplitter.setSizeFull();
    vSplitter.setFirstComponent(bidsLayout);
    vSplitter.setSecondComponent(candidateLayout);
    vSplitter.setSplitPosition(57);

    return vSplitter;
}

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

License:Mozilla Public License

public static Component create(final Changer changer, final TabSheet tabs) {

    final ItemBuilder<Task> assigneeBuilder = new BatchItemBuilder<Task>() {
        private static final long serialVersionUID = 1L;

        transient Durations durations;

        @Override//from w ww.j a  va 2 s.  co m
        public void batchStart() {
            durations = new Durations();
        }

        @Override
        public void batchFinish() {
            durations = null;
        }

        @Override
        public Item createItem(final Task task) {
            final String taskId = task.getId();
            final ProcessDefinition def = ActivitiBean.get().getProcessDefinition(task.getProcessDefinitionId(),
                    Flash.login());
            String procedureName = Flash.flash().getExecutorService()
                    .getProcedureNameByDefinitionId(def.getId());
            final PropertysetItem item = new PropertysetItem();
            final Bid bid = getBid(task);
            final String bidId = bid.getId() == null ? "" : bid.getId().toString();
            item.addItemProperty("id", buttonProperty(bidId, new TaskGraphListener(changer, task)));
            item.addItemProperty("name", stringProperty(task.getName()));
            item.addItemProperty("startDate", stringProperty(formatter.format(bid.getDateCreated())));
            item.addItemProperty("declarant", stringProperty(bid.getDeclarant()));
            if (bid.getTag() == null || bid.getTag().isEmpty()) {
                item.addItemProperty("process", stringProperty(procedureName));
            } else {
                item.addItemProperty("process", stringProperty(bid.getTag() + " - " + procedureName));
            }
            item.addItemProperty("version", stringProperty(bid.getVersion()));
            final Button b = new Button("", new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        showForm(tabs, taskId);
                    } catch (Exception e) {
                        Components.showException(event.getButton().getWindow(), e);
                    }
                }
            });
            b.setStyleName(Reindeer.BUTTON_SMALL);
            item.addItemProperty("claim", new ObjectProperty<Component>(b));
            item.addItemProperty("priority", stringProperty(String.valueOf(task.getPriority())));
            TaskDates td = AdminServiceProvider.get().getTaskDatesByTaskId(taskId);
            durations.fillBidAndTask(bid, td, item);
            return item;
        }

        private Bid getBid(final Task task) {
            Bid bid = AdminServiceProvider.get().getBidByTask(task.getId());

            if (bid == null) {
                bid = new Bid();
                bid.setDeclarant("");
                bid.setVersion("");
                bid.setStatus(BidStatus.Execute);
            }
            return bid;
        }

    };
    final AssigneeTaskListQuery assigneeTaskQuery = new AssigneeTaskListQuery(assigneeBuilder);
    final TableForExecutor assignee = new TableForExecutor(assigneeTaskQuery);
    assignee.setCaption("?? ?");
    assignee.addContainerProperty("id", Component.class, null);
    assignee.addContainerProperty("name", String.class, null);
    assignee.addContainerProperty("startDate", String.class, null);
    assignee.addContainerProperty("declarant", String.class, null);
    assignee.addContainerProperty("process", String.class, null);
    assignee.addContainerProperty("version", String.class, null);
    assignee.addContainerProperty("status", String.class, null);
    assignee.addContainerProperty("claim", Component.class, null);
    assignee.addContainerProperty("priority", String.class, null);
    assignee.addContainerProperty("bidDays", String.class, null);
    assignee.addContainerProperty("taskDays", String.class, null);
    assignee.setVisibleColumns(new Object[] { "id", "name", "startDate", "declarant", "process", "version",
            "claim", "bidDays", "taskDays" });
    assignee.setColumnHeaders(new String[] { "?", "", "  ?",
            "?", "", "v", "", "..", ".?." });
    assignee.setSelectable(false);
    assignee.setSortDisabled(true);

    assignee.setColumnAlignment("id", Table.ALIGN_RIGHT);
    assignee.setColumnExpandRatio("id", 0.3f);
    assignee.setColumnExpandRatio("name", 1f);
    assignee.setColumnExpandRatio("process", 1.2f);
    assignee.setColumnExpandRatio("bidDays", 0.2f);
    assignee.setColumnExpandRatio("taskDays", 0.2f);

    assignee.setCellStyleGenerator(new TaskStylist(assignee));

    final ItemBuilder<Task> claimBuilder = new BatchItemBuilder<Task>() {
        private static final long serialVersionUID = 1L;

        Durations durations;

        @Override
        public void batchStart() {
            durations = new Durations();
        }

        @Override
        public void batchFinish() {
            durations = null;
        }

        @Override
        public Item createItem(final Task task) {
            final String taskId = task.getId();
            final ProcessDefinition def = ActivitiBean.get().getProcessDefinition(task.getProcessDefinitionId(),
                    Flash.login());
            String procedureName = Flash.flash().getExecutorService()
                    .getProcedureNameByDefinitionId(def.getId());
            PropertysetItem item = new PropertysetItem();
            final Bid bid = getBid(task);
            ObjectProperty idProperty;
            if (bid.getId() == null) {
                idProperty = new ObjectProperty<String>("");
            } else {
                idProperty = buttonProperty(bid.getId().toString(), new TaskGraphListener(changer, task));
            }
            item.addItemProperty("id", idProperty);
            item.addItemProperty("name", stringProperty(task.getName()));
            item.addItemProperty("startDate", stringProperty(formatter.format(bid.getDateCreated())));
            item.addItemProperty("declarant", stringProperty(bid.getDeclarant()));
            if (bid.getTag() == null || bid.getTag().isEmpty()) {
                item.addItemProperty("process", stringProperty(procedureName));
            } else {
                item.addItemProperty("process", stringProperty(bid.getTag() + " - " + procedureName));
            }
            item.addItemProperty("version", stringProperty(bid.getVersion()));
            item.addItemProperty("status", stringProperty(bid.getStatus().getName()));
            final Button b = new Button("", new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    final String login = Flash.login();
                    final String errMessage = ActivitiBean.get().claim(taskId, login, login, false);
                    if (!StringUtils.isEmpty(errMessage)) {
                        event.getButton().getWindow().showNotification("", errMessage,
                                Notification.TYPE_ERROR_MESSAGE);
                    }
                    fireTaskChangedEvent(taskId, this);
                }
            });
            b.setStyleName(Reindeer.BUTTON_SMALL);
            item.addItemProperty("claim", new ObjectProperty<Component>(b));
            item.addItemProperty("priority", stringProperty(String.valueOf(task.getPriority())));
            TaskDates td = AdminServiceProvider.get().getTaskDatesByTaskId(taskId);
            durations.fillBidAndTask(bid, td, item);
            return item;
        }

        private Bid getBid(final Task task) {
            Bid bid = AdminServiceProvider.get().getBidByTask(task.getId());

            if (bid == null) {
                bid = new Bid();
                bid.setDeclarant("");
                bid.setVersion("");
                bid.setStatus(BidStatus.Execute);
            }
            return bid;
        }

    };
    final CandidateTaskListQuery candidateTaskQuery = new CandidateTaskListQuery(claimBuilder, Flash.login());
    final TableForExecutor candidate = new TableForExecutor(candidateTaskQuery);
    candidate.setCaption(" ?");
    candidate.addContainerProperty("id", Component.class, null);
    candidate.addContainerProperty("name", String.class, null);
    candidate.addContainerProperty("startDate", String.class, null);
    candidate.addContainerProperty("declarant", String.class, null);
    candidate.addContainerProperty("process", String.class, null);
    candidate.addContainerProperty("version", String.class, null);
    candidate.addContainerProperty("status", String.class, null);
    candidate.addContainerProperty("claim", Component.class, null);
    candidate.addContainerProperty("priority", String.class, null);
    candidate.addContainerProperty("bidDays", String.class, null);
    candidate.addContainerProperty("taskDays", String.class, null);
    candidate.setVisibleColumns(new Object[] { "id", "name", "startDate", "declarant", "process", "version",
            "status", "claim", "bidDays", "taskDays" });
    candidate.setColumnHeaders(new String[] { "?", "", "  ?",
            "?", "", "v", "?", "", "..", ".?." });
    candidate.setSelectable(false);
    candidate.setSortDisabled(true);

    candidate.setColumnAlignment("id", Table.ALIGN_RIGHT);
    candidate.setColumnExpandRatio("name", 1f);
    candidate.setColumnExpandRatio("process", 1f);

    candidate.setCellStyleGenerator(new TaskStylist(candidate));

    final Form filter = new TaskFilter(candidateTaskQuery, candidate, assigneeTaskQuery, assignee,
            TaskFilter.Mode.Executor);

    HorizontalLayout asigneeLayout = new HorizontalLayout();
    asigneeLayout.setSizeFull();
    asigneeLayout.setMargin(true);
    asigneeLayout.setSpacing(true);
    asigneeLayout.addComponent(assignee);

    Panel filterPanel = new Panel();
    filterPanel.setHeight("100%");
    filterPanel.addComponent(filter);
    final HorizontalSplitPanel hSplitter = new HorizontalSplitPanel();
    hSplitter.setSizeFull();
    hSplitter.setFirstComponent(filterPanel);
    hSplitter.setSecondComponent(asigneeLayout);
    hSplitter.setSplitPosition(35);

    VerticalLayout candidateLayout = new VerticalLayout();
    candidateLayout.setSizeFull();
    candidateLayout.setMargin(true);
    candidateLayout.addComponent(candidate);

    final TasksSplitter vSplitter = new TasksSplitter(assignee, candidate);
    vSplitter.setSizeFull();
    vSplitter.setFirstComponent(hSplitter);
    vSplitter.setSecondComponent(candidateLayout);
    vSplitter.setSplitPosition(57);
    return vSplitter;
}

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

License:Mozilla Public License

static void showTask(final Changer changer, final Task task, final ProcessDefinitionEntity def) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*  ww  w.  j a va2s  .  com*/
    layout.setSpacing(true);
    layout.setSizeFull();
    final Button cancel = new Button("?", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            changer.back();
        }
    });
    cancel.setClickShortcut(KeyCode.ESCAPE, 0);
    layout.addComponent(cancel);

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

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    vl.setSpacing(true);
    hl.addComponent(vl);

    final String procedureName = Flash.flash().getExecutorService().getProcedureNameByDefinitionId(def.getId());
    vl.addComponent(new ProcedureHistoryPanel(task.getId()));

    ShowDiagramComponentParameterObject parameterObject = new ShowDiagramComponentParameterObject();
    final String procVersion = def.getVersion() + "";
    parameterObject.windowHeader = procedureName + "v. " + procVersion;
    parameterObject.width = "600px";
    parameterObject.executionId = task.getExecutionId();
    parameterObject.changer = changer;
    parameterObject.processDefinitionId = def.getId();
    parameterObject.caption = "";
    ShowDiagramComponent showDiagramComponent = new ShowDiagramComponent(parameterObject);
    hl.addComponent(showDiagramComponent);
    hl.setExpandRatio(vl, 0.5f);
    hl.setExpandRatio(showDiagramComponent, 0.5f);

    changer.change(layout);
    cancel.focus();
}

From source file:ru.codeinside.gses.webui.manager.ManagerWorkplace.java

License:Mozilla Public License

private VerticalLayout createServicePanel() {
    final VerticalLayout serviceVerticalLayout = new VerticalLayout();
    serviceVerticalLayout.setSizeFull();
    ap = new ApServiceForm();
    Panel apForm = new Panel();
    apForm.addComponent(ap);/*from   w  ww  .  j ava  2 s.c o  m*/
    apForm.setHeight("350px");
    Panel importForm = new Panel();
    ApServiceTable apServiceTable = new ApServiceTable(ap);
    apServiceTable.setSizeFull();
    Form form = new Form(new ServiceWidget(apServiceTable));
    form.setCaption(" ?");
    importForm.addComponent(form);
    importForm.setHeight("350px");
    HorizontalLayout hr = new HorizontalLayout();
    hr.setSizeFull();
    hr.setSpacing(true);
    hr.addComponent(apForm);
    hr.addComponent(importForm);
    serviceVerticalLayout.addComponent(hr);
    Panel apTable = new Panel("? ? ?");
    apTable.addComponent(apServiceTable);
    apTable.setSizeFull();
    serviceVerticalLayout.addComponent(apTable);
    serviceVerticalLayout.setSpacing(true);
    serviceVerticalLayout.setMargin(true);
    return serviceVerticalLayout;
}

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

License:Mozilla Public License

public ConfirmWindow(String confirmMessage) {
    setCaption("!");
    setWidth("30%");
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();/*from   w  w w .j  a va  2  s  .c o  m*/
    vl.setSpacing(true);
    Label messageLabel = new Label(confirmMessage);
    messageLabel.setStyleName("h1");
    vl.addComponent(messageLabel);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();
    hl.setSpacing(true);
    Button okButton = new Button("");
    Button noButton = new Button("?");
    okButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            fireEvent(new ConfirmOkEvent(event.getComponent()));
            close();
        }
    });
    noButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });
    hl.addComponent(okButton);
    hl.addComponent(noButton);
    hl.setExpandRatio(okButton, 0.99f);
    vl.addComponent(hl);
    addComponent(vl);
    center();
}