Example usage for com.vaadin.ui Panel setHeight

List of usage examples for com.vaadin.ui Panel setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setHeight.

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:org.universAAL.ucc.windows.LicenceWindow.java

public LicenceWindow(UccUI app, ArrayList<License> licenses, AALService aal, UAPP installApp)
        throws IOException {
    res = ResourceBundle.getBundle(base);
    setCaption(res.getString("license.capt"));
    this.app = app;
    this.installingApplication = installApp;
    modus = Arrays.asList(new String[] { res.getString("agree.radio"), res.getString("dontAgree.radio") });
    vl = new VerticalLayout();
    vl.setSizeFull();//from w  ww.j  a  v  a 2 s  . c  o  m
    vl.setSpacing(true);
    vl.setMargin(true);
    hp = new HorizontalSplitPanel();
    hp.setSplitPosition(150, Sizeable.UNITS_PIXELS);
    hp.setStyleName(Reindeer.SPLITPANEL_SMALL);
    hp.setLocked(true);

    hp.setSizeFull();
    tree = new Tree();
    tree.setImmediate(true);
    tree.setNullSelectionAllowed(true);
    tree.setNewItemsAllowed(false);
    for (License l : licenses) {
        tree.addItem(l.getAppName());
        tree.setChildrenAllowed(l.getAppName(), true);
        tree.expandItemsRecursively(l.getAppName());
        for (File f : l.getLicense()) {
            tree.addItem(f.getName());
            tree.setParent(f.getName(), l.getAppName());
            tree.setChildrenAllowed(f.getName(), false);
        }
    }
    if (licenses.size() > 0) {
        tree.select(licenses.get(0).getLicense().get(0).getName());
    }
    Panel panel = new Panel();
    panel.setHeight("400px");
    VerticalLayout layout = (VerticalLayout) panel.getContent();
    layout.setSpacing(true);
    layout.setMargin(true);
    for (License l : licenses) {
        if (l.getSlaList().size() > 0) {
            for (File slaFile : l.getSlaList()) {
                FileReader fr = new FileReader(slaFile);
                // SLA makes problems
                BufferedReader reader = new BufferedReader(fr);
                String line = null;
                while ((line = reader.readLine()) != null) {
                    panel.addComponent(new Label(line));
                }
            }
        } else if (l.getLicense().size() > 0) {
            for (File lFile : l.getLicense()) {
                FileReader fr = new FileReader(lFile);
                BufferedReader reader = new BufferedReader(fr);
                String line = null;
                while ((line = reader.readLine()) != null) {
                    panel.addComponent(new Label(line));
                }
            }
        }
    }
    hp.setFirstComponent(tree);
    vl.addComponent(panel);
    setContent(hp);
    op = new OptionGroup("", modus);
    op.setNullSelectionAllowed(false);
    op.select(res.getString("dontAgree.radio"));
    op.setImmediate(true);
    vl.addComponent(op);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    cancel = new Button(res.getString("cancel.button"));
    go = new Button(res.getString("finish.button"));
    go.setEnabled(false);
    hl.addComponent(cancel);
    hl.addComponent(go);
    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT);
    setWidth("700px");
    setHeight("600px");
    setModal(true);
    center();
    hp.setSecondComponent(vl);
    setClosable(false);
    lic = new LicenseController(app, this, licenses, aal, installingApplication);
    tree.addListener(lic);
    op.addListener(lic);
}

From source file:org.universAAL.ucc.windows.LicenceWindow.java

public void createSecondComponent(Panel p) {
    modus = Arrays.asList(new String[] { res.getString("agree.radio"), res.getString("dontAgree.radio") });
    vl = new VerticalLayout();
    vl.setSizeFull();/*www  .  j av  a2 s . co m*/
    vl.setSpacing(true);
    vl.setMargin(true);
    p.setHeight("400px");
    VerticalLayout layout = (VerticalLayout) p.getContent();
    layout.setSpacing(true);
    layout.setMargin(true);
    vl.addComponent(p);
    op = new OptionGroup("", modus);
    op.setNullSelectionAllowed(false);
    op.select(res.getString("dontAgree.radio"));
    op.setImmediate(true);
    vl.addComponent(op);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    cancel = new Button(res.getString("cancel.button"));
    go = new Button(res.getString("finish.button"));
    cancel.addListener((Button.ClickListener) lic);
    go.addListener((Button.ClickListener) lic);
    go.setEnabled(false);
    hl.addComponent(cancel);
    hl.addComponent(go);
    vl.addComponent(hl);
    vl.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT);
    op.addListener(lic);
    hp.setSecondComponent(vl);

}

From source file:org.vaadin.dialogs.DefaultConfirmDialogFactory.java

License:Mozilla Public License

public ConfirmDialog create(final String caption, final String message, final String okCaption,
        final String cancelCaption) {

    // Create a confirm dialog
    final ConfirmDialog confirm = new ConfirmDialog();
    confirm.setCaption(caption != null ? caption : DEFAULT_CAPTION);

    // Close listener implementation
    confirm.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1971800928047045825L;

        public void windowClose(CloseEvent ce) {

            // Only process if still enabled
            if (confirm.isEnabled()) {
                confirm.setEnabled(false); // avoid double processing
                confirm.setConfirmed(false);
                if (confirm.getListener() != null) {
                    confirm.getListener().onClose(confirm);
                }/*from   w ww. j a  va 2  s.  c  o  m*/
            }
        }
    });

    // Create content
    VerticalLayout c = (VerticalLayout) confirm.getContent();
    c.setSizeFull();
    c.setSpacing(true);

    // Panel for scrolling lengthty messages.
    Panel scroll = new Panel(new VerticalLayout());
    scroll.setScrollable(true);
    c.addComponent(scroll);
    scroll.setWidth("100%");
    scroll.setHeight("100%");
    scroll.setStyleName(Reindeer.PANEL_LIGHT);
    c.setExpandRatio(scroll, 1f);

    // Always HTML, but escape
    Label text = new Label("", Label.CONTENT_RAW);
    scroll.addComponent(text);
    confirm.setMessageLabel(text);
    confirm.setMessage(message);

    HorizontalLayout buttons = new HorizontalLayout();
    c.addComponent(buttons);
    buttons.setSpacing(true);

    buttons.setHeight(format(BUTTON_HEIGHT) + "em");
    buttons.setWidth("100%");
    Label spacerLeft = new Label("");
    buttons.addComponent(spacerLeft);
    spacerLeft.setWidth("100%");
    buttons.setExpandRatio(spacerLeft, 1f);

    final Button cancel = new Button(cancelCaption != null ? cancelCaption : DEFAULT_CANCEL_CAPTION);
    cancel.setData(false);
    cancel.setClickShortcut(KeyCode.ESCAPE, null);
    buttons.addComponent(cancel);

    confirm.setCancelButton(cancel);

    final Button ok = new Button(okCaption != null ? okCaption : DEFAULT_OK_CAPTION);
    ok.setData(true);
    ok.setClickShortcut(KeyCode.ENTER, null);
    ok.focus();
    buttons.addComponent(ok);
    confirm.setOkButton(ok);

    Label spacerRight = new Label("");
    buttons.addComponent(spacerRight);
    spacerRight.setWidth("100%");
    buttons.setExpandRatio(spacerRight, 1f);
    // Create a listener for buttons
    Button.ClickListener cb = new Button.ClickListener() {
        private static final long serialVersionUID = 3525060915814334881L;

        public void buttonClick(ClickEvent event) {
            // Copy the button date to window for passing through either
            // "OK" or "CANCEL". Only process id still enabled.
            if (confirm.isEnabled()) {
                confirm.setEnabled(false); // Avoid double processing

                confirm.setConfirmed(event.getButton() == ok);

                // We need to cast this way, because of the backward
                // compatibility issue in 6.4 series.
                Component parent = confirm.getParent();
                if (parent instanceof Window) {
                    try {
                        Method m = Window.class.getDeclaredMethod("removeWindow", Window.class);
                        m.invoke(parent, confirm);
                    } catch (Exception e) {
                        throw new RuntimeException(
                                "Failed to remove confirmation dialog from the parent window.", e);
                    }
                }

                // This has to be invoked as the window.close
                // event is not fired when removed.
                if (confirm.getListener() != null) {
                    confirm.getListener().onClose(confirm);
                }
            }

        }

    };
    cancel.addListener(cb);
    ok.addListener(cb);

    // Approximate the size of the dialog
    double[] dim = getDialogDimensions(message, ConfirmDialog.CONTENT_TEXT_WITH_NEWLINES);
    confirm.setWidth(format(dim[0]) + "em");
    confirm.setHeight(format(dim[1]) + "em");
    confirm.setResizable(false);

    return confirm;
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupRecombineDiseaseGroups.java

private void initPopupLayout() {

    int h = 0;//(default_DiseaseCat_DiseaseGroupMap.size() * 33) + 300;
    for (Map<String, String> m : default_DiseaseCat_DiseaseGroupMap.values()) {
        if (h < m.size()) {
            h = m.size();/*  ww  w.  ja va2s . com*/
        }
    }
    h = (h * 26) + 200;
    int w = 700;
    if (Page.getCurrent().getBrowserWindowHeight() - 280 < h) {
        h = Page.getCurrent().getBrowserWindowHeight() - 280;
    }
    if (Page.getCurrent().getBrowserWindowWidth() < w) {
        w = Page.getCurrent().getBrowserWindowWidth();
    }

    popupWindow.setWidth(w + "px");
    popupWindow.setHeight(h + "px");

    popupBodyLayout.setWidth((w - 50) + "px");

    Set<String> diseaseSet = Quant_Central_Manager.getDiseaseCategorySet();

    diseaseTypeSelectionList.setDescription("Select disease category");

    for (String disease : diseaseSet) {
        diseaseTypeSelectionList.addItem(disease);
        diseaseTypeSelectionList.setItemCaption(disease, (disease));

    }

    HorizontalLayout diseaseCategorySelectLayout = new HorizontalLayout();
    diseaseCategorySelectLayout.setWidthUndefined();
    diseaseCategorySelectLayout.setHeight("50px");
    diseaseCategorySelectLayout.setSpacing(true);
    diseaseCategorySelectLayout.setMargin(true);

    popupBodyLayout.addComponent(diseaseCategorySelectLayout);
    popupBodyLayout.setComponentAlignment(diseaseCategorySelectLayout, Alignment.TOP_LEFT);

    Label title = new Label("Disease Category");
    title.setStyleName(Reindeer.LABEL_SMALL);
    diseaseCategorySelectLayout.addComponent(title);

    diseaseCategorySelectLayout.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    diseaseTypeSelectionList.setWidth("200px");
    diseaseTypeSelectionList.setNullSelectionAllowed(false);
    diseaseTypeSelectionList.setValue("All");
    diseaseTypeSelectionList.setImmediate(true);
    diseaseCategorySelectLayout.addComponent(diseaseTypeSelectionList);
    diseaseCategorySelectLayout.setComponentAlignment(diseaseTypeSelectionList, Alignment.TOP_LEFT);
    diseaseTypeSelectionList.setStyleName("diseaseselectionlist");
    diseaseTypeSelectionList.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            boolean showAll = false;
            String value = event.getProperty().getValue().toString();
            if (value.equalsIgnoreCase("All")) {
                showAll = true;
            }
            for (String dName : diseaseGroupsGridLayoutMap.keySet()) {
                if (dName.equalsIgnoreCase(value) || showAll) {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(true);
                } else {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(false);
                }
            }

        }
    });

    VerticalLayout diseaseGroupsNamesContainer = new VerticalLayout();
    diseaseGroupsNamesContainer.setWidth("100%");
    diseaseGroupsNamesContainer.setHeightUndefined();
    popupBodyLayout.addComponent(diseaseGroupsNamesContainer);
    diseaseGroupsNamesContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    GridLayout diseaseNamesHeader = new GridLayout(2, 1);
    diseaseNamesHeader.setWidth("100%");
    diseaseNamesHeader.setHeightUndefined();
    diseaseNamesHeader.setSpacing(true);
    diseaseNamesHeader.setMargin(new MarginInfo(true, false, true, false));
    diseaseGroupsNamesContainer.addComponent(diseaseNamesHeader);
    Label col1Label = new Label("Group Name");
    diseaseNamesHeader.addComponent(col1Label, 0, 0);
    col1Label.setStyleName(Reindeer.LABEL_SMALL);

    Label col2Label = new Label("Suggested Name");
    diseaseNamesHeader.addComponent(col2Label, 1, 0);
    col2Label.setStyleName(Reindeer.LABEL_SMALL);

    Panel diseaseGroupsNamesFrame = new Panel();
    diseaseGroupsNamesFrame.setWidth("100%");
    diseaseGroupsNamesFrame.setHeight((h - 200) + "px");
    diseaseGroupsNamesContainer.addComponent(diseaseGroupsNamesFrame);
    diseaseGroupsNamesFrame.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout diseaseNamesUpdateContainerLayout = new VerticalLayout();
    for (String diseaseCategory : diseaseSet) {
        if (diseaseCategory.equalsIgnoreCase("All")) {
            continue;
        }

        HorizontalLayout diseaseNamesUpdateContainer = initDiseaseNamesUpdateContainer(diseaseCategory);
        diseaseNamesUpdateContainerLayout.addComponent(diseaseNamesUpdateContainer);
        diseaseGroupsGridLayoutMap.put(diseaseCategory, diseaseNamesUpdateContainer);
    }
    diseaseGroupsNamesFrame.setContent(diseaseNamesUpdateContainerLayout);

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

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");

    resetFiltersBtn.setDescription("Reset group names to default");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToDefault();
        }
    });
    Button resetToOriginalBtn = new Button("Publications Names");
    resetToOriginalBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetToOriginalBtn);
    resetToOriginalBtn.setWidth("150px");
    resetToOriginalBtn.setHeight("24px");

    resetToOriginalBtn.setDescription("Reset group names to original publication names");
    resetToOriginalBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToPublicationsNames();
        }
    });

    Button applyFilters = new Button("Update");
    applyFilters.setDescription("Update disease groups with the selected names");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateGroups();

        }
    });

    popupBodyLayout.addComponent(btnLayout);
    popupBodyLayout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT);
    resetToDefault();

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.popupreordergroups.SortableLayoutContainer.java

public SortableLayoutContainer(int w, int subH, final String strTitle, Set<String> labels,
        Map<String, String> diseaseStyleMap) {
    this.diseaseStyleMap = diseaseStyleMap;

    this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setSpacing(true);
    this.strTitle = strTitle;
    this.groupSelectionMap = new HashMap<String, Boolean>();
    this.selectionSet = new LinkedHashSet<String>();
    //        this.fullSelectionSet = new LinkedHashSet<String>();
    HorizontalLayout headerLayoutI = new HorizontalLayout();
    Label titileI = new Label(strTitle);
    titileI.setStyleName("custLabel");
    headerLayoutI.addComponent(titileI);
    this.addComponent(headerLayoutI);
    int containerWidth = ((w) / 2) - 20;

    this.setWidth(containerWidth + "px");
    int height = subH - 15;
    headerLayoutI.setWidth(containerWidth + "px");

    clearBtn = new Button("Clear");
    clearBtn.setStyleName(Reindeer.BUTTON_LINK);
    clearBtn.setWidth("40px");
    clearBtn.setHeight("18px");
    clearBtn.setEnabled(false);/*from   w w w  .jav  a 2s  . c o  m*/
    headerLayoutI.addComponent(clearBtn);
    headerLayoutI.setComponentAlignment(clearBtn, Alignment.TOP_RIGHT);
    clearBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            //                autoClear = true;
            singleSelected = false;
            diseaseGroupSelectOption.setValue(null);

        }
    });

    Panel bodyPanel = new Panel();
    HorizontalLayout bodyLayout = new HorizontalLayout();
    bodyLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    bodyPanel.setContent(bodyLayout);
    this.addComponent(bodyPanel);
    bodyPanel.setHeight(subH + "px");
    bodyPanel.setWidth((containerWidth) + "px");

    counterLayoutContainer = new VerticalLayout();
    bodyLayout.addComponent(counterLayoutContainer);
    counterLayoutContainer.setHeight(height + "px");
    counterLayoutContainer.setWidth("30px");
    counterLayoutContainer.setStyleName(Reindeer.LAYOUT_WHITE);

    counterLayout = new VerticalLayout();
    counterLayoutContainer.addComponent(counterLayout);
    counterLayout.setWidth("30px");
    counterLayout.setSpacing(false);
    counterLayout.setStyleName("countcontainer");

    int sortableItremWidth = containerWidth - 26 - 6 - 15;
    sortableDiseaseGroupLayout = new SortableLayout();
    bodyLayout.addComponent(sortableDiseaseGroupLayout);
    sortableDiseaseGroupLayout.setWidth(sortableItremWidth + "px");

    sortableDiseaseGroupLayout.setData(strTitle);
    sortableDiseaseGroupLayout.addStyleName("no-horizontal-drag-hints");

    checkboxLayout = new VerticalLayout();
    bodyLayout.addComponent(checkboxLayout);

    checkboxLayout.setSpacing(false);
    checkboxLayout.setEnabled(false);
    checkboxLayout.setHeight(height + "px");
    checkboxLayout.setStyleName("countcontainer");
    checkboxLayout.setMargin(new MarginInfo(false, false, false, false));

    diseaseGroupSelectOption = new OptionGroup();
    checkboxLayout.addComponent(diseaseGroupSelectOption);
    checkboxLayout.setComponentAlignment(diseaseGroupSelectOption, Alignment.TOP_LEFT);
    //        diseaseGroupSelectOption.setWidth("20px");
    diseaseGroupSelectOption.setNullSelectionAllowed(true); // user can not 'unselect'
    diseaseGroupSelectOption.setMultiSelect(true);
    diseaseGroupSelectOption.addStyleName("sortablelayoutselect");
    diseaseGroupSelectOption.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (autoClear) {
                autoClear = false;
                return;
            }
            for (String key : groupSelectionMap.keySet()) {
                groupSelectionMap.put(key, Boolean.FALSE);
            }
            getSelectionSet().clear();
            singleSelected = false;
            int counter = 0;
            for (Object key : ((Set) diseaseGroupSelectOption.getValue())) {
                if (((Integer) key) >= groupsIds.size()) {
                    continue;
                }
                groupSelectionMap.put(groupsIds.get((Integer) key), Boolean.TRUE);
                singleSelected = true;
                counter++;
                getSelectionSet().add(groupsIds.get((Integer) key));
            }
            if (counter == groupsIds.size()) {
                singleSelected = false;
            }

        }

    });

    itemWidth = sortableItremWidth - 10;
    initLists(labels);
}

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 v a  2  s  .c o 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.manager.DirectoryPanel.java

License:Mozilla Public License

static Component createDirectoryPanel() {
    HorizontalSplitPanel horSplit = new HorizontalSplitPanel();
    horSplit.setSizeFull();//from  w  w  w  .ja  v  a  2s  . c  o m
    horSplit.setMargin(true);

    Panel panel00 = new Panel();
    Panel panel01 = new Panel();

    Panel panel10 = new Panel();

    horSplit.setFirstComponent(panel00);

    VerticalLayout vl = new VerticalLayout();
    horSplit.setSecondComponent(vl);

    vl.addComponent(panel01);
    vl.addComponent(panel10);

    vl.setSpacing(true);

    horSplit.setWidth("100%");
    vl.setHeight("100%");

    panel00.setHeight("100%");
    panel00.setWidth("100%");

    panel01.setWidth("100%");
    panel01.setHeight("100%");
    panel10.setHeight("100%");
    horSplit.setSplitPosition(35);
    vl.setExpandRatio(panel01, 0.25f);
    vl.setExpandRatio(panel10, 0.75f);

    final Table dirMapTable = ManagerWorkplace.createDirectoryMapTable();
    final FilterTable directoryTable = ManagerWorkplace.createDirectoryTable();
    dirMapTable.setVisible(false);

    final Form createFieldForm = new Form();
    createFieldForm.setCaption(" ?  ?");

    final TextField keyField = new TextField("");
    keyField.setRequired(true);
    keyField.setMaxLength(254);
    createFieldForm.addField("key", keyField);

    final TextField valField = new TextField("");
    valField.setRequired(true);
    valField.setMaxLength(1022);
    createFieldForm.addField("val", valField);
    createFieldForm.setVisible(false);

    Button addButton = new Button("",
            new AddTupleButtonListener(createFieldForm, directoryTable, keyField, valField, dirMapTable));
    createFieldForm.addField("submit", addButton);

    directoryTable.addListener(new DirectoryTableChangeListener(createFieldForm, directoryTable, dirMapTable));

    ManagerWorkplace.buildContainer(directoryTable, createFieldForm, dirMapTable);
    directoryTable.setColumnHeaders(new String[] { "?", "", "" });

    final Form createDirectory = new Form();
    createDirectory.setCaption(" ?");
    final TextField field = new TextField("?");
    field.setRequired(true);
    field.setMaxLength(255);
    field.setRequiredError("  ?");
    createDirectory.addField("name", field);
    Button createButton = new Button("",
            new CreateDirectoryButtonListener(field, createDirectory, directoryTable));
    createDirectory.addField("submit", createButton);

    Panel loadPanel = new Panel();
    loadPanel.setCaption(" ?");

    UploadDirectory events = new UploadDirectory(directoryTable, dirMapTable);

    Upload c = new Upload("", events);
    c.addListener(events);

    c.setButtonCaption("");
    loadPanel.addComponent(c);

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(loadPanel);
    verticalLayout.addComponent(createDirectory);
    verticalLayout.addComponent(directoryTable);

    panel00.addComponent(verticalLayout);

    panel01.addComponent(createFieldForm);

    dirMapTable.setSizeFull();
    dirMapTable.setPageLength(13);
    panel10.addComponent(dirMapTable);

    return horSplit;
}

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

License:Mozilla Public License

private Component createProcedurePanel1() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);/*from   w  ww  .  j  a v a2s. co m*/
    hl.setWidth("100%");
    hl.setHeight("100%");
    Panel panel00 = new Panel();
    panel00.setHeight("100%");
    panel00.setWidth("100%");
    Panel panel01 = new Panel();
    panel01.setWidth("100%");
    panel01.setHeight("100%");
    Panel panel10 = new Panel();
    panel10.setSizeFull();
    panel10.setScrollable(false);
    hl.addComponent(panel00);
    hl.addComponent(panel01);

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

    hl.setExpandRatio(panel00, 0.33f);
    hl.setExpandRatio(panel01, 0.77f);
    vl.setExpandRatio(hl, 0.6f);
    vl.setExpandRatio(panel10, 0.4f);

    procedureForm = new ProcedureForm();
    procedureTable = new ProcedureTable(procedureForm);
    filter = createFilteringForm(procedureTable);
    panel00.addComponent(filter);
    panel01.addComponent(procedureForm);
    panel10.addComponent(procedureTable);
    ap.addItemSetChangeListener(filter);
    ap.addItemSetChangeListener(procedureForm);
    return vl;
}

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 w w. j  a va  2s .  co 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:uk.q3c.krail.testapp.view.ViewBaseGrid.java

License:Apache License

@Override
public void doBuild() {
    GridLayout grid = new GridLayout(3, 4);
    Panel topMarginPanel = new Panel();
    topMarginPanel.setHeight(topMargin + "px");
    topMarginPanel.setWidth("100%");

    grid.setSizeFull();/* w w w.  j a v  a 2 s . c om*/
    grid.setColumnExpandRatio(0, 0.400f);
    grid.setColumnExpandRatio(1, 0.20f);
    grid.setColumnExpandRatio(2, 0.40f);

    grid.setRowExpandRatio(1, 0.40f);
    grid.setRowExpandRatio(2, 0.20f);
    grid.setRowExpandRatio(3, 0.40f);
    setRootComponent(grid);
}