Example usage for com.vaadin.ui Panel setContent

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

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:org.vaadin.tori.component.DebugControlPanel.java

License:Apache License

@Override
public void popupVisibilityChange(final PopupVisibilityEvent event) {
    final ContextData data = getContextData();
    if (event.isPopupVisible()) {
        Panel panel = (Panel) event.getPopupView().getContent().getPopupComponent();
        panel.setContent(createControlPanel(data));
    }/*from  w  w w.  ja  v  a 2s. c o m*/
}

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();/*www .ja  v a2  s . co m*/
        }
    }
    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 ww .  j a  v a2 s .c om
    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.adm.ui.employee.CertificateBlock.java

License:Mozilla Public License

public CertificateBlock(UserItem userItem) {
    this.x509 = userItem.getX509();
    Component root = new HorizontalLayout();
    if (x509 != null) {
        X509Certificate x509Certificate = X509.decode(x509);
        if (x509Certificate != null) {
            HorizontalLayout h = new HorizontalLayout();
            h.setSpacing(true);// w  w w.  j a v a2  s .  c  o m
            h.setMargin(true);
            h.setSizeUndefined();

            NameParts subjectParts = X509.getSubjectParts(x509Certificate);

            Label certLabel = new Label(subjectParts.getShortName());
            h.addComponent(certLabel);
            h.setComponentAlignment(certLabel, Alignment.MIDDLE_CENTER);

            Button remove = new Button("? ?  ?");
            remove.setStyleName(Reindeer.BUTTON_SMALL);
            h.addComponent(remove);
            h.setComponentAlignment(remove, Alignment.MIDDLE_CENTER);

            remove.addListener((Button.ClickListener) new CertificateCleaner(remove, certLabel));

            Panel panel = new Panel();
            panel.setCaption("? ?:");
            panel.setContent(h);
            panel.setSizeUndefined();
            root = panel;
        } else {
            certificateWasRemoved = true;
        }
    }
    setCompositionRoot(root);
    setSizeUndefined();
}

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

License:Mozilla Public License

LogSettings() {

    logErrors = new OptionGroup("? ? :", Arrays.asList(Status.FAILURE.name()));
    logErrors.setItemCaption(Status.FAILURE.name(), "");
    logErrors.setImmediate(true);//  w w w . jav a  2  s . c o  m
    logErrors.setMultiSelect(true);

    logStatus = new OptionGroup("?  ?  '':", statusKeys());
    logStatus.setItemCaption(Status.REQUEST.name(), "?");
    logStatus.setItemCaption(Status.RESULT.name(), "");
    logStatus.setItemCaption(Status.PING.name(), "?");
    logStatus.setMultiSelect(true);
    logStatus.setImmediate(true);

    ipSet = new TextArea("? IP ?:");
    ipSet.setWordwrap(true);
    ipSet.setNullRepresentation("");
    ipSet.setWidth(100f, UNITS_PERCENTAGE);
    ipSet.setRows(10);

    tf = new TextField(" , :");
    tf.setRequired(true);
    tf.addValidator(new Validator() {
        public void validate(Object value) throws InvalidValueException {
            if (!isValid(value)) {
                throw new InvalidValueException(
                        "  ? ");
            }
        }

        public boolean isValid(Object value) {
            return value instanceof String && ((String) value).matches("[1-9][0-9]*");
        }
    });

    b1 = new Block("") {

        @Override
        void onLayout(Layout layout) {
            layout.addComponent(logErrors);
            layout.addComponent(logStatus);
        }

        @Override
        void onChange() {
            logErrors.setReadOnly(false);
            logStatus.setReadOnly(false);
        }

        @Override
        void onRefresh() {
            boolean _logErrors = AdminServiceProvider.getBoolProperty(API.LOG_ERRORS);
            if (_logErrors) {
                logErrors.setReadOnly(false);
                logErrors.setValue(Arrays.asList(Status.FAILURE.name()));
            } else {
                logErrors.setValue(Collections.emptySet());
            }
            logErrors.setReadOnly(true);

            String _logStatus = AdminServiceProvider.get().getSystemProperty(API.LOG_STATUS);
            if (_logStatus != null) {
                Set<String> set = new HashSet<String>();
                for (String key : statusKeys()) {
                    if (_logStatus.contains(key)) {
                        set.add(key);
                    }
                }
                logStatus.setReadOnly(false);
                logStatus.setValue(set);
            } else {
                logStatus.setValue(Collections.emptySet());
            }
            logStatus.setReadOnly(true);
        }

        @Override
        void onApply() {
            Collection logErrorsValue = (Collection) logErrors.getValue();
            boolean errorsEnabled = logErrorsValue.contains(Status.FAILURE.name());
            AdminServiceProvider.get().saveSystemProperty(API.LOG_ERRORS, Boolean.toString(errorsEnabled));
            LogCustomizer.setShouldWriteServerLogErrors(errorsEnabled);

            Collection logStatusValue = (Collection) logStatus.getValue();

            Set<Status> statuses = new TreeSet<Status>();

            if (logStatusValue.contains(Status.REQUEST.name())) {
                statuses.add(Status.REQUEST);
                statuses.add(Status.ACCEPT);
                statuses.add(Status.CANCEL);
            }

            if (logStatusValue.contains(Status.RESULT.name())) {
                statuses.add(Status.RESULT);
                statuses.add(Status.REJECT);
                statuses.add(Status.STATE);
                statuses.add(Status.NOTIFY);
            }

            if (logStatusValue.contains(Status.PING.name())) {
                statuses.add(Status.PING);
                statuses.add(Status.PROCESS);
                statuses.add(Status.PACKET);
            }

            StringBuilder statusBuilder = new StringBuilder();
            for (Status status : statuses) {
                if (statusBuilder.length() > 0) {
                    statusBuilder.append(", ");
                }
                statusBuilder.append(status);
            }
            String status = statusBuilder.toString();

            AdminServiceProvider.get().saveSystemProperty(API.LOG_STATUS, status);
            LogCustomizer.setServerLogStatus(status);

            boolean enabled = !status.isEmpty();
            LogCustomizer.setShouldWriteServerLog(enabled);
            AdminServiceProvider.get().saveSystemProperty(API.ENABLE_CLIENT_LOG, Boolean.toString(enabled));
        }
    };

    b2 = new Block("? ") {
        @Override
        void onLayout(Layout layout) {
            layout.addComponent(ipSet);
        }

        @Override
        void onRefresh() {
            String ips = AdminServiceProvider.get().getSystemProperty(API.SKIP_LOG_IPS);
            ipSet.setReadOnly(false);
            ipSet.setValue(ips);
            ipSet.setReadOnly(true);
        }

        @Override
        void onChange() {
            ipSet.setReadOnly(false);
        }

        @Override
        void onApply() {
            String value = (String) ipSet.getValue();
            TreeSet<String> items = new TreeSet<String>();
            if (value != null) {
                for (String item : value.split("[,;\\s]+")) {
                    items.add(item);
                }
                StringBuilder sb = new StringBuilder();
                for (String item : items) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(item);
                }
                value = sb.toString();
            }
            AdminServiceProvider.get().saveSystemProperty(API.SKIP_LOG_IPS, value);
            LogCustomizer.setIgnoreSet(items);
        }
    };

    b3 = new Block("?   ") {
        @Override
        void onButtons(Layout layout) {
            layout.addComponent(new Button("? ", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    LogScheduler.cleanLog();
                    getWindow().showNotification("?? ",
                            Window.Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }));
        }

        @Override
        void onLayout(Layout layout) {
            layout.addComponent(tf);
        }

        @Override
        void onRefresh() {
            String logDepth = AdminServiceProvider.get().getSystemProperty(API.LOG_DEPTH);
            tf.setReadOnly(false);
            if (logDepth != null && logDepth.matches("[1-9][0-9]*")) {
                tf.setValue(logDepth);
            } else {
                tf.setValue(String.valueOf(API.DEFAULT_LOG_DEPTH));
            }
            tf.setReadOnly(true);
        }

        @Override
        void onChange() {
            tf.setReadOnly(false);
        }

        @Override
        void onApply() {
            tf.validate();
            AdminServiceProvider.get().saveSystemProperty(API.LOG_DEPTH, tf.getValue().toString());
        }
    };

    final CheckBox logSpSign = new CheckBox(" ? ");
    logSpSign.setValue(Boolean.valueOf(AdminServiceProvider.get().getSystemProperty(API.LOG_SP_SIGN)));
    logSpSign.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            AdminServiceProvider.get().saveSystemProperty(API.LOG_SP_SIGN,
                    String.valueOf(valueChangeEvent.getProperty().getValue()));
            notifySuccess();
        }
    });
    logSpSign.setImmediate(true);

    final CheckBox logOvSign = new CheckBox(" ? ");
    logOvSign.setValue(Boolean.valueOf(AdminServiceProvider.get().getSystemProperty(API.LOG_OV_SIGN)));
    logOvSign.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            AdminServiceProvider.get().saveSystemProperty(API.LOG_OV_SIGN,
                    String.valueOf(valueChangeEvent.getProperty().getValue()));
            notifySuccess();
        }
    });
    logOvSign.setImmediate(true);

    Label userSignsLabel = new Label("? ?");
    userSignsLabel.addStyleName(Reindeer.LABEL_H2);

    VerticalLayout userSignsVl = new VerticalLayout();
    userSignsVl.setMargin(true);
    userSignsVl.setSpacing(true);
    userSignsVl.addComponent(userSignsLabel);
    userSignsVl.addComponent(logSpSign);
    userSignsVl.addComponent(logOvSign);

    Panel userSingsWrapper = new Panel();
    userSingsWrapper.setScrollable(true);
    userSingsWrapper.setContent(userSignsVl);
    userSingsWrapper.setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(b1);
    vl.addComponent(userSingsWrapper);
    vl.setExpandRatio(b1, 0.7f);
    vl.setExpandRatio(userSingsWrapper, 0.3f);
    vl.setSizeFull();

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.addComponent(vl);
    layout.addComponent(b2);
    layout.addComponent(b3);
    layout.setSizeFull();
    layout.setExpandRatio(vl, 0.333f);
    layout.setExpandRatio(b2, 0.333f);
    layout.setExpandRatio(b3, 0.333f);

    Panel wrapper = new Panel(" ", layout);
    wrapper.addStyleName(Reindeer.PANEL_LIGHT);
    wrapper.setSizeFull();

    setCompositionRoot(wrapper);
    setSizeFull();
}

From source file:ru.codeinside.gses.webui.CertificateSelection.java

License:Mozilla Public License

public CertificateSelection(String userLogin, CertificateListener certificateListener) {
    this.certificateListener = certificateListener;

    String userName = StringUtils
            .trimToNull(Flash.flash().getAdminService().findEmployeeByLogin(userLogin).getFio());
    if (userName == null) {
        userName = userLogin;//from   w w  w .  j av  a2  s.com
    }

    Label header = new Label(" ?");
    header.setStyleName(Reindeer.LABEL_H1);

    Label hint = new Label("<b>" + userName
            + "</b>, ? ?   ? ?? ? "
            + "   ?,     ??? ? "
            + "<a target='_blank' href='http://ru.wikipedia.org/wiki/"
            + "%D0%AD%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D1%8C'"
            + ">? ?</a></i> ??  .",
            Label.CONTENT_XHTML);

    SignApplet applet = new SignApplet(new Protocol());
    applet.setName(" ?");
    applet.setCaption(null);
    applet.setBindingMode();

    appletHint = new Label("??  <b>Java</b>  "
            + Flash.getActor().getBrowser() + "   <b> JCP</b>.<br/> "
            + "   ?  ?  ?? "
            + "   <a target='_blank' href='http://ca.oep-penza.ru/'"
            + ">??  ?   ?</a>.",
            Label.CONTENT_XHTML);

    Button logout = new Button(" ( ?   )",
            new Logout());
    logout.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    buttons.addComponent(logout);

    VerticalLayout flow = new VerticalLayout();
    flow.setSizeUndefined();
    flow.setMargin(true);
    flow.setSpacing(true);
    flow.addComponent(header);
    flow.addComponent(hint);
    flow.addComponent(applet);
    flow.addComponent(appletHint);
    flow.addComponent(buttons);

    Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(flow);

    VerticalLayout center = new VerticalLayout();
    center.addComponent(panel);
    center.setExpandRatio(panel, 1f);
    center.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    center.setSizeFull();

    setCompositionRoot(center);

    setSizeFull();
}

From source file:steps.FinishStep.java

License:Open Source License

public FinishStep(final Wizard w, AttachmentConfig attachmentConfig) {
    this.w = w;//from   w  w  w .j  a va2  s . co m
    this.attachConfig = attachmentConfig;

    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    Label header = new Label("Summary and File Upload");
    main.addComponent(Styles.questionize(header,
            "Here you can download spreadsheets of the samples in your experiment "
                    + "and upload informative files belonging to your project, e.g. treatment information. "
                    + "It might take a few minutes for your files to show up in our project browser.",
            "Last Step"));
    summary = new Label();
    summary.setContentMode(ContentMode.PREFORMATTED);
    Panel summaryPane = new Panel();
    summaryPane.setContent(summary);
    summaryPane.setWidth("550px");
    main.addComponent(summaryPane);

    downloads = new VerticalLayout();
    downloads.setCaption("Download Spreadsheets:");
    downloads.setSpacing(true);
    dlEntities = new Button("Sample Sources");
    dlExtracts = new Button("Sample Extracts");
    dlPreps = new Button("Sample Preparations");
    dlEntities.setEnabled(false);
    dlExtracts.setEnabled(false);
    dlPreps.setEnabled(false);
    downloads.addComponent(dlEntities);
    downloads.addComponent(dlExtracts);
    downloads.addComponent(dlPreps);

    this.bar = new ProgressBar();
    this.info = new Label();
    info.setCaption("Preparing Spreadsheets");
    main.addComponent(bar);
    main.addComponent(info);
    main.addComponent(downloads);

    browserLink = new Button("Show in Project Browser");
    main.addComponent(browserLink);

    attach = new CheckBox("Upload Additional Files");
    // attach.setVisible(false);
    attach.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            uploads.setVisible(attach.getValue());
            w.getFinishButton().setVisible(!attach.getValue());
        }
    });
    main.addComponent(Styles.questionize(attach,
            "Upload one or more small files pertaining to the experimental design of this project.",
            "Upload Attachments"));
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) {

    Panel p = new Panel(v7.getMessage("reviewTab.review"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(3, 4);
    grid.setSizeFull();/* w  w  w .  jav a 2s. c o  m*/
    p.setContent(grid);
    grid.setSpacing(true);
    Locale l = v7.getLocale();
    SchemaDefinition sd = r.getSchemaDefinition();
    grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0);
    p.addComponent(new Label("<b>" + LocalizedString
            .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>",
            Label.CONTENT_XHTML));
    p.addComponent(new Label(sd.getFieldCaption("p", l)));
    p.addComponent(new Label("[" + proj.getId() + "]"));
    grid.addComponent(new Label(proj.getName()));
    p.addComponent(new Label(sd.getFieldCaption("reviewee", l)));
    p.addComponent(new Label(r.getReviewee().getId()));
    grid.addComponent(new Label(r.getReviewee().getName()));
    p.addComponent(new Label(sd.getFieldCaption("t", l)));
    grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3);
    p.addComponent(new Label(v7.getMessage("reviewTab.directLink")));
    Link link = new Link(linkUrl, new ExternalResource(linkUrl));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    grid.addComponent(link);
    return p;

}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) {
    if (svn == null)
        return null;
    Locale l = v7.getLocale();/*  ww w. j a v a2 s.c om*/
    Panel p = new Panel(v7.getMessage("reviewTab.subversion"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(4, 4);
    grid.setSizeFull();
    p.setContent(grid);
    grid.setSpacing(true);
    p.addComponent(new Label(sd.getFieldCaption("svn.rev", l)));
    p.addComponent(new Label("" + svn.getRevision()));
    p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate())));
    p.addComponent(new Label(svn.getAuthor()));
    Link link = new Link(v7.getMessage("reviewTab.viewChanges"),
            new ExternalResource(proj.getChangesetViewUrl(svn.getRevision())));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    p.addComponent(link);
    grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1);

    Map<String, SVNLogEntryPath> changed = svn.getChangedPaths();

    if (changed != null) {
        Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")");
        Set<String> paths = changed.keySet();
        for (String s : changed.keySet()) {
            changeTree.addItem(s);
            changeTree.setChildrenAllowed(s, false);
            changeTree.setItemCaption(s, changed.get(s).getType() + " " + s);
        }
        if (paths.size() > 5) {
            compressTree(changeTree, paths);
        }

        grid.addComponent(changeTree, 0, 2, 3, 2);
    }
    return p;
}