Example usage for com.vaadin.ui CheckBox CheckBox

List of usage examples for com.vaadin.ui CheckBox CheckBox

Introduction

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

Prototype

public CheckBox() 

Source Link

Document

Creates a new checkbox.

Usage

From source file:de.metas.ui.web.vaadin.window.editor.CheckboxEditor.java

License:Open Source License

@Override
protected AbstractField<Boolean> createValueField() {
    final String caption = getCaption();
    final CheckBox checkbox = new CheckBox();
    checkbox.setCaption(caption);//w  w w  .ja  v  a  2  s .c  om
    return checkbox;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.datatypes.AbstractDataType.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
protected CheckBox createCheckBox(Class<?> type, String checkedValue, String uncheckedValue, Format format) {
    CheckBox checkBox = new CheckBox();
    checkBox.setReadOnly(isReadonly());//from w w  w  .jav  a  2s .  c  om

    CheckboxPropertyConverter checkboxConverter = new CheckboxPropertyConverter(checkedValue, uncheckedValue);
    Converter<String, ?> formatter = createFormatter(type, format);
    if (formatter != null) {
        ChainedConverter<Boolean, String, ?> converter = new ChainedConverter(checkboxConverter, formatter);
        checkBox.setConverter(converter);
    } else {
        checkBox.setConverter(checkboxConverter);
    }

    return checkBox;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultFormView.java

License:Apache License

private Field<Boolean> createCheckBox(FormField field, int columns) {
    CheckBoxFormField checkBoxFormField = (CheckBoxFormField) field;

    Layout checkboxLayout = null;/*from w w  w.  j av  a  2  s.com*/
    if (columns == 1) {
        checkboxLayout = new HorizontalLayout();
        checkboxLayout.setCaption(field.getTitle());
    } else {
        checkboxLayout = new VerticalLayout();
        Label checkBoxLabel = new Label(field.getTitle());
        checkboxLayout.addComponent(checkBoxLabel);
    }

    CheckBox checkBoxField = new CheckBox();
    checkboxLayout.addComponent(checkBoxField);

    checkBoxField.setConverter(checkBoxFormField.getConverter());
    checkBoxField.setPropertyDataSource(checkBoxFormField.getProperty());
    checkBoxField.setImmediate(true);
    checkBoxField.addStyleName(field.getName());

    // addField(field.getName(), checkBoxField);
    fieldLayout.addComponent(checkboxLayout);

    return checkBoxField;
}

From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java

License:Open Source License

/**
 * The constructor should first build the main layout, set the composition
 * root and then do any custom initialization.
 * //from ww w .  j a  v a 2  s. com
 * The constructor will not be automatically regenerated by the visual
 * editor.
 */
public GoldstandardGUI() {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // user code

    for (Type t : BoaAnnotation.Type.values()) {
        comboBoxTypes.addItem(t);
    }
    comboBoxTypes.setTextInputAllowed(false);
    listSelectAnnotations.setMultiSelect(false);
    comboBoxTypes.setNullSelectionAllowed(false);
    listSelectAnnotations.setNullSelectionAllowed(false);

    // with this layout components will get wrapped
    cssLayoutTokens = new CssLayout() {
        @Override
        protected String getCss(Component c) {
            return "float:left;margin-right:5px;";
        }
    };
    cssLayoutTokens.setWidth("100%");
    // auto; becomes vertical scroll-able since verticalLayout_tokens height
    // is also auto
    cssLayoutTokens.setHeight(SIZE_UNDEFINED, 0);
    verticalLayoutTokens.addComponent(cssLayoutTokens);

    resetComponents();

    buttonNext.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (sentence != null) {
                SentenceServer.returnSentence(sentence);
            }

            resetComponents();
            sentence = SentenceServer.getSentence();

            if (sentence == null) {
                getWindow().showNotification("No more senentences.", Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            // create new check boxes for tokens
            CheckBox checkbox;
            Label label;
            VerticalLayout vertLayout;
            for (int i = 0; i < sentence.getTokens().size(); i++) {
                checkbox = new CheckBox();
                checkbox.setImmediate(true);
                checkbox.addListener(new Property.ValueChangeListener() {
                    public void valueChange(ValueChangeEvent event) {
                        Iterator<Component> iterator = cssLayoutTokens.getComponentIterator();
                        Label l;
                        CheckBox cb;
                        VerticalLayout vl;
                        String s = "";
                        while (iterator.hasNext()) {
                            vl = (VerticalLayout) iterator.next();
                            l = (Label) vl.getComponent(0);
                            cb = (CheckBox) vl.getComponent(1);
                            if (cb.booleanValue()) {
                                s += l.getValue();
                            }
                        }
                        if (s.isEmpty())
                            s = "";
                        textFieldLabel.setReadOnly(false);
                        textFieldLabel.setValue(s);
                        textFieldLabel.setReadOnly(true);
                    }
                });
                label = new Label(sentence.getTokens().get(i));
                label.setSizeUndefined();
                vertLayout = new VerticalLayout();
                vertLayout.addComponent(label);
                vertLayout.addComponent(checkbox);
                vertLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
                vertLayout.setComponentAlignment(checkbox, Alignment.MIDDLE_CENTER);
                vertLayout.setSizeUndefined();
                cssLayoutTokens.addComponent(vertLayout);
            }
        }
    });

    buttonDiscard.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (sentence != null) {
                SentenceServer.discardSentence(sentence);
                resetComponents();
            }
        }
    });

    buttonAddAnno.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (!textFieldLabel.getValue().equals("") && comboBoxTypes.getValue() != null) {
                Iterator<Component> iterator = cssLayoutTokens.getComponentIterator();
                Label l;
                CheckBox cb;
                VerticalLayout vl;
                ArrayList<String> selected = new ArrayList<String>();
                while (iterator.hasNext()) {
                    vl = (VerticalLayout) iterator.next();
                    l = (Label) vl.getComponent(0);
                    cb = (CheckBox) vl.getComponent(1);
                    if (cb.booleanValue()) {
                        selected.add((String) l.getValue());
                        cb.setValue(false);
                    }
                }
                BoaAnnotation anno = new BoaAnnotation((Type) comboBoxTypes.getValue(), selected);
                boolean isDuplicate = false;
                boolean isColliding = false;
                for (BoaAnnotation a : sentence.getAnnotations()) {
                    if (a.getTokens().size() == anno.getTokens().size()) {
                        boolean sameTokens = true;
                        for (int i = 0; i < a.getTokens().size(); i++) {
                            sameTokens = a.getTokens().get(i) == anno.getTokens().get(i);
                            if (!sameTokens)
                                break;
                        }
                        if (sameTokens) {
                            isColliding = !(isDuplicate = a.getType().equals(anno.getType()));
                            break;
                        }
                    }
                }
                if (isDuplicate) {
                    getWindow().showNotification("Duplicate was dismissed.", Notification.TYPE_WARNING_MESSAGE);
                } else if (isColliding) {
                    getWindow().showNotification("Label is already assigned to<br/> a different type.",
                            Notification.TYPE_ERROR_MESSAGE);
                } else {
                    sentence.getAnnotations().add(anno);
                    listSelectAnnotations.addItem(anno);
                }
            } else
                getWindow().showNotification("Label or type is inavlid.", Notification.TYPE_ERROR_MESSAGE);
        }
    });

    buttonDelAnno.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (listSelectAnnotations.getValue() != null) {
                sentence.getAnnotations().remove(listSelectAnnotations.getValue());
                listSelectAnnotations.removeItem(listSelectAnnotations.getValue());
            }
        }
    });
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

public void registerDatasetInTable(DataSet d, FileInfoDssDTO[] filelist,
        HierarchicalContainer dataset_container, String project, String sample, Timestamp ts, String sampleType,
        Object parent) {/* ww w . ja  v  a2s  . c  o  m*/
    if (filelist[0].isDirectory()) {

        Object new_ds = dataset_container.addItem();

        String folderPath = filelist[0].getPathInDataSet();
        FileInfoDssDTO[] subList = d.listFiles(folderPath, false);

        dataset_container.setChildrenAllowed(new_ds, true);
        String download_link = filelist[0].getPathInDataSet();
        String[] splitted_link = download_link.split("/");
        String file_name = download_link.split("/")[splitted_link.length - 1];
        // System.out.println(file_name);

        dataset_container.getContainerProperty(new_ds, "Select").setValue(new CheckBox());

        dataset_container.getContainerProperty(new_ds, "Project").setValue(project);
        dataset_container.getContainerProperty(new_ds, "Sample").setValue(sample);
        dataset_container.getContainerProperty(new_ds, "Sample Type")
                .setValue(this.getOpenBisClient().getSampleByIdentifier(sample).getSampleTypeCode());
        dataset_container.getContainerProperty(new_ds, "File Name").setValue(file_name);
        dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder");
        dataset_container.getContainerProperty(new_ds, "Dataset Type").setValue("-");
        dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_ds, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_ds, "dl_link").setValue(
                d.getDataSetDss().tryGetInternalPathInDataStore() + "/" + filelist[0].getPathInDataSet());
        dataset_container.getContainerProperty(new_ds, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_ds, "file_size_bytes").setValue(filelist[0].getFileSize());

        // System.out.println("Now it should be a folder: " + filelist[0].getPathInDataSet());

        if (parent != null) {
            dataset_container.setParent(new_ds, parent);
        }

        for (FileInfoDssDTO file : subList) {
            FileInfoDssDTO[] childList = { file };
            registerDatasetInTable(d, childList, dataset_container, project, sample, ts, sampleType, new_ds);
        }

    } else {
        // System.out.println("Now it should be a file: " + filelist[0].getPathInDataSet());

        Object new_file = dataset_container.addItem();
        dataset_container.setChildrenAllowed(new_file, false);
        String download_link = filelist[0].getPathInDataSet();
        String[] splitted_link = download_link.split("/");
        String file_name = download_link.split("/")[splitted_link.length - 1];
        // String file_name = download_link.split("/")[1];
        String fileSize = DashboardUtil.humanReadableByteCount(filelist[0].getFileSize(), true);

        dataset_container.getContainerProperty(new_file, "Select").setValue(new CheckBox());
        dataset_container.getContainerProperty(new_file, "Project").setValue(project);
        dataset_container.getContainerProperty(new_file, "Sample").setValue(sample);
        dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType);
        dataset_container.getContainerProperty(new_file, "File Name").setValue(file_name);
        dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getDataSetTypeCode());
        dataset_container.getContainerProperty(new_file, "Dataset Type").setValue(d.getDataSetTypeCode());
        dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_file, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_file, "File Size").setValue(fileSize);
        dataset_container.getContainerProperty(new_file, "dl_link").setValue(
                d.getDataSetDss().tryGetInternalPathInDataStore() + "/" + filelist[0].getPathInDataSet());
        dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(filelist[0].getFileSize());
        if (parent != null) {
            dataset_container.setParent(new_file, parent);
        }
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetComponent.java

License:Open Source License

public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_container, String project,
        String sample, String ts, Object parent, String secName) {

    UglyToPrettyNameMapper mapper = new UglyToPrettyNameMapper();

    if (d.hasChildren()) {

        Object new_ds = dataset_container.addItem();

        List<DatasetBean> subList = d.getChildren();

        dataset_container.setChildrenAllowed(new_ds, true);

        dataset_container.getContainerProperty(new_ds, "Select").setValue(new CheckBox());

        dataset_container.getContainerProperty(new_ds, "Project").setValue(project);
        dataset_container.getContainerProperty(new_ds, "Sample").setValue(sample);
        dataset_container.getContainerProperty(new_ds, "Description").setValue(secName);
        // dataset_container.getContainerProperty(new_ds, "Sample Type").setValue(
        // d.getSample().getType());
        dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName());
        dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder");
        dataset_container.getContainerProperty(new_ds, "Dataset Type")
                .setValue(prettyNameMapper.getPrettyName(d.getType()) + " Folder");
        dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_ds, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_ds, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_ds, "file_size_bytes").setValue(d.getFileSize());
        dataset_container.getContainerProperty(new_ds, "isDirectory").setValue(true);

        if (parent != null) {
            dataset_container.setParent(new_ds, parent);
        }//w  ww .ja v  a  2s .  c  om

        // LOGGER.debug(d+" has files/folders:");
        for (DatasetBean file : subList) {
            // LOGGER.debug(file.getFileName());
            registerDatasetInTable(file, dataset_container, project, sample, ts, new_ds, secName);
        }

    } else {
        // LOGGER.debug("(no more subfolders)");
        // sut.println("Now it should be a file: " + filelist[0].getPathInDataSet());

        Object new_file = dataset_container.addItem();
        dataset_container.setChildrenAllowed(new_file, false);
        dataset_container.getContainerProperty(new_file, "Select").setValue(new CheckBox());
        dataset_container.getContainerProperty(new_file, "Project").setValue(project);
        dataset_container.getContainerProperty(new_file, "Sample").setValue(sample);
        dataset_container.getContainerProperty(new_file, "Description").setValue(secName);
        // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType);
        dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName());
        dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType());
        dataset_container.getContainerProperty(new_file, "Dataset Type")
                .setValue(prettyNameMapper.getPrettyName(d.getType()));
        dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_file, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_file, "File Size")
                .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true));
        dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize());
        dataset_container.getContainerProperty(new_file, "isDirectory").setValue(false);
        if (parent != null) {
            dataset_container.setParent(new_file, parent);
        }
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetView.java

License:Open Source License

public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_container, String project,
        String sample, Timestamp ts, Object parent) {
    if (d.hasChildren()) {

        Object new_ds = dataset_container.addItem();

        List<DatasetBean> subList = d.getChildren();

        dataset_container.setChildrenAllowed(new_ds, true);

        dataset_container.getContainerProperty(new_ds, "Select").setValue(new CheckBox());

        dataset_container.getContainerProperty(new_ds, "Project").setValue(project);
        dataset_container.getContainerProperty(new_ds, "Sample").setValue(sample);
        // dataset_container.getContainerProperty(new_ds, "Sample Type").setValue(
        // d.getSample().getType());
        dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName());
        dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder");
        dataset_container.getContainerProperty(new_ds, "Dataset Type").setValue(d.getType());
        dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_ds, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_ds, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_ds, "file_size_bytes").setValue(d.getFileSize());

        if (parent != null) {
            dataset_container.setParent(new_ds, parent);
        }/*from w w  w  .ja  va 2s . c o  m*/

        for (DatasetBean file : subList) {
            registerDatasetInTable(file, dataset_container, project, sample, ts, new_ds);
        }

    } else {
        // System.out.println("Now it should be a file: " + filelist[0].getPathInDataSet());

        Object new_file = dataset_container.addItem();
        dataset_container.setChildrenAllowed(new_file, false);

        dataset_container.getContainerProperty(new_file, "Select").setValue(new CheckBox());
        dataset_container.getContainerProperty(new_file, "Project").setValue(project);
        dataset_container.getContainerProperty(new_file, "Sample").setValue(sample);
        // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType);
        dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName());
        dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType());
        dataset_container.getContainerProperty(new_file, "Dataset Type").setValue(d.getType());
        dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_file, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_file, "File Size")
                .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true));
        dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize());
        if (parent != null) {
            dataset_container.setParent(new_file, parent);
        }
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetViewFilterGenerator.java

License:Open Source License

@Override
public AbstractField<?> getCustomFilterComponent(Object propertyId) {
    // removed custom filter component for id
    if ("checked".equals(propertyId)) {
        CheckBox box = new CheckBox();
        return box;
    }/*from  w ww  .j  av a 2s.c  om*/
    return null;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.LevelComponent.java

License:Open Source License

public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_container, String project,
        String sample, String ts, Object parent, String secName) {
    if (d.hasChildren()) {

        Object new_ds = dataset_container.addItem();

        List<DatasetBean> subList = d.getChildren();

        dataset_container.setChildrenAllowed(new_ds, true);

        // String secName = d.getProperties().get("Q_SECONDARY_NAME");
        // TODO add User here too
        // if (secName != null) {
        dataset_container.getContainerProperty(new_ds, "Description").setValue(secName);
        // }/*from   w ww .  j av  a2 s. c o m*/

        dataset_container.getContainerProperty(new_ds, "Select").setValue(new CheckBox());

        dataset_container.getContainerProperty(new_ds, "Project").setValue(project);
        dataset_container.getContainerProperty(new_ds, "Sample").setValue(sample);
        // dataset_container.getContainerProperty(new_ds, "Sample Type").setValue(
        // d.getSample().getType());
        dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName());
        dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder");
        dataset_container.getContainerProperty(new_ds, "Dataset Type")
                .setValue(prettyNameMapper.getPrettyName(d.getType()) + " Folder");
        dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_ds, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_ds, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_ds, "file_size_bytes").setValue(d.getFileSize());
        dataset_container.getContainerProperty(new_ds, "isDirectory").setValue(true);

        if (parent != null) {
            dataset_container.setParent(new_ds, parent);
        }

        for (DatasetBean file : subList) {
            registerDatasetInTable(file, dataset_container, project, sample, ts, new_ds, secName);
        }

    } else {
        // System.out.println("Now it should be a file: " + filelist[0].getPathInDataSet());

        Object new_file = dataset_container.addItem();
        dataset_container.setChildrenAllowed(new_file, false);

        // TODO no hardcoding
        // String secName = d.getProperties().get("Q_SECONDARY_NAME");
        // TODO add User here too
        // if (secName != null) {
        dataset_container.getContainerProperty(new_file, "Description").setValue(secName);
        // }
        dataset_container.getContainerProperty(new_file, "Select").setValue(new CheckBox());
        dataset_container.getContainerProperty(new_file, "Project").setValue(project);
        dataset_container.getContainerProperty(new_file, "Sample").setValue(sample);
        // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType);
        dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName());
        dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType());
        dataset_container.getContainerProperty(new_file, "Dataset Type")
                .setValue(prettyNameMapper.getPrettyName(d.getType()));
        dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_file, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_file, "File Size")
                .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true));
        dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize());
        dataset_container.getContainerProperty(new_file, "isDirectory").setValue(false);

        if (parent != null) {
            dataset_container.setParent(new_file, parent);
        }
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjInformationComponent.java

License:Open Source License

@SuppressWarnings("unchecked")
public void registerDatasetInTable(DatasetBean d, HierarchicalContainer dataset_container, String project,
        String sample, String ts, Object parent) {
    if (d.hasChildren()) {

        Object new_ds = dataset_container.addItem();

        List<DatasetBean> subList = d.getChildren();

        dataset_container.setChildrenAllowed(new_ds, true);

        dataset_container.getContainerProperty(new_ds, "Select").setValue(new CheckBox());

        dataset_container.getContainerProperty(new_ds, "Project").setValue(project);
        dataset_container.getContainerProperty(new_ds, "Sample").setValue(sample);
        String secName = d.getProperties().get("Q_SECONDARY_NAME");
        // TODO add User here
        if (secName != null) {
            dataset_container.getContainerProperty(new_ds, "Description")
                    .setValue(d.getProperties().get("Q_SECONDARY_NAME"));
        }//from   www . j a va 2  s  .  c om
        // dataset_container.getContainerProperty(new_ds, "Sample Type").setValue(
        // d.getSample().getType());
        dataset_container.getContainerProperty(new_ds, "File Name").setValue(d.getName());
        dataset_container.getContainerProperty(new_ds, "File Type").setValue("Folder");
        dataset_container.getContainerProperty(new_ds, "Dataset Type").setValue(d.getType());
        dataset_container.getContainerProperty(new_ds, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_ds, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_ds, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_ds, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_ds, "file_size_bytes").setValue(d.getFileSize());

        if (parent != null) {
            dataset_container.setParent(new_ds, parent);
        }

        for (DatasetBean file : subList) {
            registerDatasetInTable(file, dataset_container, project, sample, ts, new_ds);
        }

    } else {
        // System.out.println("Now it should be a file: " + filelist[0].getPathInDataSet());

        Object new_file = dataset_container.addItem();
        dataset_container.setChildrenAllowed(new_file, false);

        dataset_container.getContainerProperty(new_file, "Select").setValue(new CheckBox());
        dataset_container.getContainerProperty(new_file, "Project").setValue(project);
        dataset_container.getContainerProperty(new_file, "Sample").setValue(sample);
        String secName = d.getProperties().get("Q_SECONDARY_NAME");
        // TODO add User here too
        if (secName != null) {
            dataset_container.getContainerProperty(new_file, "Description")
                    .setValue(d.getProperties().get("Q_SECONDARY_NAME"));
        }
        // dataset_container.getContainerProperty(new_file, "Sample Type").setValue(sampleType);
        dataset_container.getContainerProperty(new_file, "File Name").setValue(d.getFileName());
        dataset_container.getContainerProperty(new_file, "File Type").setValue(d.getFileType());
        dataset_container.getContainerProperty(new_file, "Dataset Type").setValue(d.getType());
        dataset_container.getContainerProperty(new_file, "Registration Date").setValue(ts);
        dataset_container.getContainerProperty(new_file, "Validated").setValue(true);
        dataset_container.getContainerProperty(new_file, "File Size")
                .setValue(DashboardUtil.humanReadableByteCount(d.getFileSize(), true));
        dataset_container.getContainerProperty(new_file, "dl_link").setValue(d.getDssPath());
        dataset_container.getContainerProperty(new_file, "CODE").setValue(d.getCode());
        dataset_container.getContainerProperty(new_file, "file_size_bytes").setValue(d.getFileSize());
        if (parent != null) {
            dataset_container.setParent(new_file, parent);
        }
    }
}