private void renderDBfillers() {

    descriptionEditor.clear();

    richTextEditor = new RichTextEditor();
    richTextEditor.setHeight(200);
    richTextEditor.setWidth("600px");
    richTextEditor.setBorder("1px solid green");

    richTextEditor.setZIndex(0);

    // richTextEditor.setOverflow(Overflow.HIDDEN);
    richTextEditor.setCanDragResize(true);
    //  richTextEditor.setZIndex(-99900);
    // richTextEditor.setShowEdges(true);

    // Standard control group options include
    // "fontControls", "formatControls", "styleControls" and "colorControls"
    // richTextEditor.setControlGroups(new String[]{"fontControls", "styleControls"});
    richTextEditor.setValue(dto.getDesctiption());

    descriptionEditor.add(richTextEditor);
    // layout.addMember();

    elasticDBfields.clear();
    _db_.setDesc("Метаданные исследования");
    mv = new MultiValuedField(_db_, null, dto.getFilling(), "");
    elasticDBfields.add(mv);
  }
 public MultiValuedEntityMultiselected(
     MetaUnitMultivaluedEntityDTO dto,
     JSON_Representation represent,
     HashMap<String, String> filling,
     String base_name) {
   initWidget((Widget) uiBinder.createAndBindUi(this));
   this.dto = dto;
   this.entity_name.setText(dto.getDesc());
   this.filling = filling;
   if (this.filling == null) this.filling = new HashMap<String, String>();
   editBtn.setStyleName("metaoptsBtn");
   this.base_name =
       base_name.equals("") ? dto.getUnique_name() : base_name + "_" + dto.getUnique_name();
   if (this.filling.containsKey(this.base_name)) {
     String val = (String) filling.get(this.base_name);
     if (val != null) {
       this.items_list.setText(val);
       if (val.contains(";")) {
         String[] tokens = val.split(";");
         for (String token : tokens) {
           int index = dto.getItem_names().indexOf(token);
           long idd = ((Long) dto.getItem_ids().get(index)).longValue();
           this.initial_selected_ids.add(Long.valueOf(idd));
           this.selected_ids.add(Long.valueOf(idd));
         }
       } else {
         int index = dto.getItem_names().indexOf(val);
         if (index != -1) {
           long idd = ((Long) dto.getItem_ids().get(index)).longValue();
           this.initial_selected_ids.add(Long.valueOf(idd));
           this.selected_ids.add(Long.valueOf(idd));
         }
       }
     }
   }
 }
 @Override
 public void updateItems(ArrayList<String> items_names, ArrayList<Long> item_ids) {
   dto.setItem_ids(item_ids);
   dto.setItem_names(items_names);
 }
  private MetaUnitMultivaluedEntityDTO toMultivaluedEntityDTO(
      MetaUnitMultivaluedEntity m, boolean flattened_items) {
    MetaUnitMultivaluedEntityDTO dto = new MetaUnitMultivaluedEntityDTO();
    try {
      dto.setId(m.getId());
      dto.setDesc(m.getDescription());
      dto.setUnique_name(m.getUnique_name());
      dto.setIsCatalogizable(m.getIsCatalogizable() != 0);
      dto.setIsSplittingEnabled(m.getIsSplittingEnabled() != 0);
      dto.setIsMultiselected(m.getIsMultiSelected() != 0);
      Collection<MetaUnitEntityItem> items = m.getItems();
      ArrayList<String> names = new ArrayList<String>();
      ArrayList<Long> ids = new ArrayList<Long>();
      for (MetaUnitEntityItem item : items) {
        names.add(item.getValue());
        ids.add(item.getId());
        if (flattened_items) getRecursiveItemsFlattened(names, ids, item, ". ");
        //                {
        //                    for(MetaUnitEntityItem it:item.getSubitems())
        //                    {
        //                        names.add(".  "+it.getValue());
        //                        ids.add(it.getId());
        //                    }
        //                }
      }
      dto.setItem_ids(ids);
      dto.setItem_names(names);
      ArrayList<Long> tagged_ent = new ArrayList<Long>();
      if (m.getTagged_entities() != null)
        for (Long ent : m.getTagged_entities()) {
          tagged_ent.add(ent);
        }
      dto.setTagged_entities(tagged_ent);
      ArrayList<MetaUnitDTO> sub_meta_units_dtos = new ArrayList<MetaUnitDTO>();
      if (m.getSub_meta_units() != null)
        for (MetaUnit unit : m.getSub_meta_units()) {
          if (unit != null) {
            if (unit instanceof MetaUnitMultivaluedEntity) {
              MetaUnitDTO dt;
              // DONE FOR SPLIITING DOWNLOAD OF DEEP TREE
              if (((MetaUnitMultivalued) unit).getIsSplittingEnabled() != 0) {
                dt =
                    new MetaUnitMultivaluedEntityDTO(
                        unit.getId(), unit.getUnique_name(), unit.getDescription());
                ((MetaUnitMultivaluedDTO) dt)
                    .setIsCatalogizable(((MetaUnitMultivalued) unit).getIsCatalogizable() != 0);
                ((MetaUnitMultivaluedDTO) dt)
                    .setIsSplittingEnabled(
                        ((MetaUnitMultivalued) unit).getIsSplittingEnabled() != 0);
                ((MetaUnitMultivaluedEntityDTO) dt)
                    .setIsMultiselected(
                        ((MetaUnitMultivaluedEntity) unit).getIsMultiSelected() != 0);
                Collection<MetaUnitEntityItem> items2 =
                    ((MetaUnitMultivaluedEntity) unit).getItems();
                ArrayList<String> names2 = new ArrayList<String>();
                ArrayList<Long> ids2 = new ArrayList<Long>();
                for (MetaUnitEntityItem item : items2) {
                  names2.add(item.getValue());
                  ids2.add(item.getId());
                }
                ((MetaUnitMultivaluedEntityDTO) dt).setItem_ids(ids2);
                ((MetaUnitMultivaluedEntityDTO) dt).setItem_names(names2);

              } else {
                dt = toMultivaluedEntityDTO((MetaUnitMultivaluedEntity) unit, flattened_items);
              }
              if (dt != null) sub_meta_units_dtos.add(dt);
            } else if (unit instanceof MetaUnitMultivaluedStructure) {
              MetaUnitDTO dt;
              // DONE FOR SPLIITING DOWNLOAD OF DEEP TREE
              if (((MetaUnitMultivalued) unit).getIsSplittingEnabled() != 0) {
                dt =
                    new MetaUnitMultivaluedStructureDTO(
                        unit.getId(), unit.getUnique_name(), unit.getDescription());
                ((MetaUnitMultivaluedDTO) dt)
                    .setIsCatalogizable(((MetaUnitMultivalued) unit).getIsCatalogizable() != 0);
                ((MetaUnitMultivaluedDTO) dt)
                    .setIsSplittingEnabled(
                        ((MetaUnitMultivalued) unit).getIsSplittingEnabled() != 0);
              } else {
                dt = toMultivaluedStructureDTO((MetaUnitMultivaluedStructure) unit);
              }
              if (dt != null) sub_meta_units_dtos.add(dt);
            } else {
              sub_meta_units_dtos.add(unit.toDTO());
            }
          }
        }
      dto.setSub_meta_units(sub_meta_units_dtos);

      return dto;
    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
      return dto;
    }
  }