public static void addArrayElements(
      TreeNode parent, SpreadSheetTable table, List<Integer> rows, LogSupport log) {
    int valCol = table.numCols() - 1;
    Map<String, String> values = new HashMap<>();
    for (int i = 0; i < rows.size(); ++i) {
      String name;
      if (table.numCols() > 1) {
        name = table.get(rows.get(i), 0);
        int index = name.lastIndexOf('.');
        if (index != -1) {
          name = name.substring(index + 1);
        }
      } else {
        name = S.fmt("%s", i);
      }
      values.put(name, table.get(rows.get(i), valCol));
    }

    for (Map.Entry<String, String> e : values.entrySet()) {
      String name = e.getKey();
      String value = e.getValue();

      Option<TreeNodeLike> optVN = parent.findChild(name);
      TreeNode vn;
      if (!optVN.isDefined()) {
        vn = ElementHelper.addElement(parent, name);
      } else {
        vn = (TreeNode) optVN.get();
      }

      EntryEditorEditingSupport.writeValue(vn, value, log);
    }

    ElementHelper.removeChildren(parent, values.keySet());
  }
  public static void addMapElements(
      TreeNode parent, SpreadSheetTable table, List<Integer> rows, LogSupport log) {
    Map<String, String> values = new HashMap<>();
    for (int i = 0; i < rows.size(); ++i) {
      String name = table.get(rows.get(i), 0);
      int index = name.lastIndexOf('.');
      if (index != -1) {
        name = name.substring(index + 1);
      }
      name = ElementHelper.mkName(parent, name);
      values.put(name, table.get(rows.get(i), 1));
    }

    for (Map.Entry<String, String> e : values.entrySet()) {
      String name = e.getKey();
      String value = e.getValue();
      TreeNode vn = ElementHelper.addElement(parent, name);
      EntryEditorEditingSupport.writeValue(vn, value, log);
    }

    ElementHelper.removeChildren(parent, values.keySet());
  }
 private TreeNode pasteSimple(EntryEditor editor, TreeNode sel, String data) {
   EntryEditorEditingSupport.writeValue(sel, data, log);
   return sel;
 }