Пример #1
0
  private void selectCodeInTree(Tree tree, Treeitem treeItem, String code) {
    // tree.setSelectedItem(null);
    // Collection<Treeitem> items = null;

    if (treeItem != null) {
      // items = treeItem.getChildren();
      /*TODO for (Component comp : treeItem.getChildren())
      {
        logger.debug("Component, comp: " + comp.getClass().getCanonicalName());

      }*/
    } else {
      if (tree != null) {
        logger.debug("selectCodeInTree, code: " + code);
        // items = tree.getItems();
        for (Treeitem ti : tree.getItems()) {
          logger.debug("Treeitem, value: " + ti.getValue().getClass().getCanonicalName());
          CodeSystemEntityVersion csev = ti.getValue();
          if (csev.getCodeSystemConcepts().get(0).getCode().equals(code)) {
            // item found
            tree.setSelectedItem(ti);

            return;
          }

          selectCodeInTree(tree, ti, code);
        }
      }
    }
  }
Пример #2
0
  public void render(Treeitem item, Object data) throws Exception {
    item.setValue(data);
    TaskDTO dto = (TaskDTO) data;
    Treerow row;

    row = item.getTreerow();
    if (row == null) {
      row = new Treerow();
      item.appendChild(row);
    }
    row.appendChild(new Treecell(dto.toString()));
    if (draggable) row.setDraggable("true");
    if (droppable) {
      row.setDroppable("true");
      if (dropEvent != null)
        row.addEventListener(
            Events.ON_DROP,
            new EventListener() {
              @Override
              public void onEvent(Event event) throws Exception {
                dropEvent.onDrop((DropEvent) event);
              }
            });
    }
  }
Пример #3
0
 public INode getSelectedNode() {
   Treeitem item = getSelectTree().getSelectedItem();
   if (item == null) return null;
   EccTreeItem itemNode = (EccTreeItem) item.getValue();
   INode node = itemNode.getValue();
   if (!node.getType().equals(INode.MONITOR)) return null;
   return node;
 }
Пример #4
0
 /** 刷新节点的选择 -- 子节点们 */
 private void allLookupChildren(Treeitem treeitem) {
   if (treeitem.getTreechildren() == null) return;
   for (Object item : treeitem.getTreechildren().getItems()) {
     if (item instanceof Treeitem) {
       EccTreeItem node = (EccTreeItem) ((BaseTreeitem) item).getValue();
       ((BaseTreeitem) item).setChecked(existNode(node));
       this.allLookupChildren((Treeitem) item);
     }
   }
 }
Пример #5
0
 /**
  *
  * <li>功能描述:将树节点展开。
  *
  * @param chi void
  * @author DaLei
  */
 @SuppressWarnings("unchecked")
 private void openTree(Treechildren chi) {
   if (chi == null) return;
   List<Treeitem> tlist = chi.getChildren();
   for (int i = 0; i < tlist.size(); i++) {
     Treeitem item = (Treeitem) tlist.get(i);
     item.setOpen(true);
     openTree(item.getTreechildren());
   }
 }
Пример #6
0
 private void addDept(Treeitem item, List dlist) {
   if (item.getTreechildren() == null) {
     dlist.add(item.getValue());
     return;
   }
   List clist = item.getTreechildren().getChildren();
   for (int i = 0; i < clist.size(); i++) {
     Treeitem it = (Treeitem) clist.get(i);
     addDept(it, dlist);
   }
 }
Пример #7
0
  public MyItemTree getDataItemSelected(Treeitem itemSelected) {
    log.info("Ejecutando método [ getDataItemSelected ]...");
    MyItemTree myItemTree = new MyItemTree();
    myItemTree.setId(itemSelected.getFirstChild().getAttribute("llave").toString());
    myItemTree.setValor(itemSelected.getFirstChild().getAttribute("valor").toString());
    myItemTree.setEtiqueta(
        ((Treecell) ((Treerow) itemSelected.getFirstChild()).getChildren().get(0)).getLabel());
    myItemTree.setNivel(
        Integer.valueOf(itemSelected.getFirstChild().getAttribute("nivel").toString()));

    return myItemTree;
  }
Пример #8
0
 protected void compareTreeChildren(Treeitem item) throws EmulationException {
   List<Treeitem> children = new ArrayList<Treeitem>();
   if (!item.isOpen()) {
     new org.tsc.emulation.components.Treeitem(item).open();
   }
   if (item.getTreechildren() != null && item.getTreechildren().getChildren() != null) {
     children = item.getTreechildren().getChildren();
   }
   assertEquals(
       "Wrong children count at row " + _row + ". File " + _reader.getFileName(),
       _children.size(),
       children.size());
   for (int i = 0; i < _children.size(); i++) {
     _children.get(i).compareTreeItem(children.get(i));
   }
 }
Пример #9
0
 protected void compareTreeItem(Treeitem item) throws EmulationException {
   Treerow row = null;
   for (Object obj : item.getChildren()) {
     if (obj instanceof Treerow) {
       row = (Treerow) obj;
       break;
     }
   }
   int counter = 0;
   for (Object obj : row.getChildren()) {
     if (obj instanceof Treecell) {
       if (counter >= _values.length) {
         fail(
             "Tree contains more items than specified in file. File: "
                 + _reader.getFileName()
                 + " Row: "
                 + _row);
       }
       assertEquals(
           "Tree item doesn't match. File: " + _reader.getFileName() + " Row: " + _row,
           _values[counter++],
           TreeUtil.getColumnText((Treecell) obj));
     }
   }
   if (counter < _values.length) {
     fail(
         "Tree contains less items than specified in file. File: "
             + _reader.getFileName()
             + " Row: "
             + _row);
   }
   compareTreeChildren(item);
 }
Пример #10
0
  private void open(int level) {
    Treechildren treechildren = this.getTreechildren();

    for (int mylevel = 0; mylevel < level; mylevel++) {
      for (Object object : treechildren.getItems()) {
        if (object instanceof Treeitem) {
          Treeitem item = (Treeitem) object;
          item.setOpen(true);
          Events.sendEvent(item, new Event(Events.ON_OPEN, item));
          treechildren = item.getTreechildren();
          if (treechildren == null || treechildren.getChildren().size() == 0) {
            continue;
          }
          break;
        }
      }
    }
  }
Пример #11
0
 /**
  *
  * <li>功能描述:将树节点展开并默认打开某个部门用户。
  *
  * @param chi
  * @param dept void
  * @author DaLei
  */
 @SuppressWarnings("unchecked")
 private void openTree(Treechildren chi, WkTDept dept) {
   if (chi == null) return;
   List<Treeitem> tlist = chi.getChildren();
   for (int i = 0; i < tlist.size(); i++) {
     Treeitem item = (Treeitem) tlist.get(i);
     WkTDept d = (WkTDept) item.getValue();
     if (d.getKdId().intValue() == dept.getKdId().intValue()) {
       tree.setSelectedItem(item);
       if (uWindow == null) {
         openListWindow(d);
       } else {
         uWindow.initWindow(d);
       }
     }
     if (d.getKdLevel() == WkTDept.GRADE_SCH.intValue()) item.setOpen(true);
     else item.setOpen(false);
     openTree(item.getTreechildren(), dept);
   }
 }
Пример #12
0
 /**
  *
  * <li>功能描述:打开编辑角色窗口。
  *
  * @param it void
  * @author DaLei
  */
 private void openEditWindow(Treeitem it) {
   WkTRole r = (WkTRole) it.getValue();
   Executions.getCurrent().setAttribute("deptList", userDeptList);
   if (r.getKrPid().intValue() > 0) {
     Component c = creatTab("roleEdit", "角色管理", "/admin/system/role/role.zul", rolePanel);
     if (c != null) {
       rWindow = (RoleEditWindow) c;
     }
     rWindow.initWindow(r);
   } else {
     Component c = creatTab("roleEdit", "角色管理", "/admin/system/role/roleGroup.zul", rolePanel);
     if (c != null) {
       rgWindow = (RoleGroupEditWindow) c;
     }
     rgWindow.initWindow(r);
   }
 }
Пример #13
0
  /** ************************************************************************************* */
  public void buildTreePorDemanda(
      Treechildren tree,
      List<MyItemTree> listaDatos,
      String etiqueta,
      String consulta,
      String ids,
      boolean treeItemRenderMovimiento)
      throws Exception {
    log.info(
        "Ejecutando metodo [ buildTree("
            + tree.getId()
            + ", No. Reg: "
            + listaDatos.size()
            + ") ]... ");

    Treechildren raiz = new Treechildren();
    tree.getChildren().clear();

    Treeitem ti = new Treeitem();
    Treerow tr = new Treerow();
    Treecell tcValor = new Treecell("");
    Treecell tcPadre = new Treecell("");
    Treecell tcNivel = new Treecell("0");
    Treecell tcLlave = new Treecell("0");
    Treecell tcEtiqueta = new Treecell(etiqueta);
    Treecell tcMovimiento = new Treecell("");
    Treecell tcIncluyeExcluye = new Treecell("");
    tcIncluyeExcluye.setVisible(false);
    tcMovimiento.setVisible(false);

    tr.setAttribute("valor", "");
    tr.setAttribute("padre", "");
    tr.setAttribute("nivel", 0);
    tr.setAttribute("llave", 0);
    tr.setAttribute("movimiento", "");
    tr.setAttribute("parametros", "");

    tr.appendChild(tcEtiqueta);
    tr.appendChild(tcValor);
    tr.appendChild(tcPadre);
    tr.appendChild(tcNivel);
    tr.appendChild(tcLlave);
    tr.appendChild(tcMovimiento);
    tr.appendChild(tcIncluyeExcluye);

    ti.appendChild(tr);
    ti.appendChild(raiz);
    tree.appendChild(ti);

    log.info("EDITAR : " + treeItemRenderMovimiento);

    for (final MyItemTree itemTree : listaDatos) {
      log.info("PARAMETROS : " + itemTree.getParametros());

      tcEtiqueta = new Treecell(itemTree.getEtiqueta());
      tcEtiqueta.setTooltiptext(itemTree.getEtiqueta());

      if (itemTree.getOtherValue() != null && itemTree.getOtherValue().toString().equals("N")) {
        tcEtiqueta.setStyle("color:#BDBDBD;font-weight: bold");
      }

      tcValor = new Treecell(itemTree.getValor() != null ? itemTree.getValor().trim() : null);
      tcPadre = new Treecell(itemTree.getPadre() != null ? itemTree.getPadre().trim() : null);
      tcNivel = new Treecell(itemTree.getNivel().toString());
      tcLlave = new Treecell(itemTree.getId() != null ? itemTree.getId().trim() : null);
      tcMovimiento =
          new Treecell(
              itemTree.getOtherValue() != null ? itemTree.getOtherValue().toString() : null);
      tcMovimiento.setVisible(false);
      tcIncluyeExcluye =
          new Treecell(itemTree.getParametros() != null ? itemTree.getParametros() : null);
      tcIncluyeExcluye.setVisible(false);

      tr = new Treerow();
      tr.setAttribute("valor", itemTree.getValor());
      tr.setAttribute("padre", itemTree.getPadre());
      tr.setAttribute("nivel", itemTree.getNivel());
      tr.setAttribute("llave", itemTree.getId());
      tr.setAttribute("movimiento", itemTree.getOtherValue());
      tr.setAttribute("parametros", itemTree.getParametros());

      if (itemTree.getParametros() != null) {
        if (itemTree.getParametros().equals("I")) {
          tr.setStyle("background-color:#E3F6CE");

        } else if (itemTree.getParametros().equals("E")) {
          tr.setStyle("background-color:#F6CECE");
        }
      }

      if (!treeItemRenderMovimiento) { // valida si se debe habilitar o no el componente
                                       // dragdroptree
        tr.setDroppable("true");
        tr.setDraggable("true");
      }

      tr.appendChild(tcEtiqueta);
      tr.appendChild(tcValor);
      tr.appendChild(tcPadre);
      tr.appendChild(tcNivel);
      tr.appendChild(tcLlave);
      tr.appendChild(tcMovimiento);
      tr.appendChild(tcIncluyeExcluye);

      ti = new Treeitem();
      ti.setAttribute("Consulta", consulta);
      ti.setAttribute("grupo", tree.getAttribute("grupo"));
      ti.setId(ids + itemTree.getId());
      ti.appendChild(tr);
      raiz.appendChild(ti);

      if (itemTree.getNumeroDescendientes() > 0) {
        cargarHijosTreePorDemanda(ti, itemTree.getId(), ids, treeItemRenderMovimiento);
      }
    }
  }
Пример #14
0
  public Treeitem cargarHijosTreePorDemanda(
      Treechildren padre, String[] sec, String ids, boolean treeItemRenderMovimiento)
      throws Exception {
    log.info("Ejecutando el metodo [Treeitem cargarHijosTreePorDemanda...]");

    Component itemSelected = null;
    List<Component> listItem = padre.getChildren();
    Map<String, Object> parameter = new HashMap<String, Object>();
    parameter.put("GRUPO", padre.getAttribute("grupo").toString());
    if (sec != null) {
      List<Component> arbol =
          ((Treechildren) ((Treeitem) listItem.get(0)).getChildren().get(1)).getChildren();
      for (int i = (sec.length - 1); i > 0; i--) {
        for (Component itemTree : arbol) {
          if (itemTree.getId().trim().equals(ids + sec[i])) {
            if (i == 1) {
              ((Treeitem) itemTree).setSelected(true);
              itemSelected = itemTree;
              break;
            } else {
              parameter.put("PADRE", sec[i]);
              List<MyItemTree> listaHijos =
                  (List<MyItemTree>)
                      ParametrizacionFac.getFacade()
                          .obtenerListado(itemTree.getAttribute("Consulta").toString(), parameter);
              Treechildren tchil = (Treechildren) itemTree.getChildren().get(1);
              tchil.getChildren().clear();
              for (MyItemTree myItemTree : listaHijos) {
                Treeitem tiHijo = new Treeitem();
                Treerow trow = new Treerow();
                Treecell tcEti = new Treecell(myItemTree.getEtiqueta());

                if (!treeItemRenderMovimiento) { // valida si se debe habilitar o no el componente
                                                 // dragdroptree
                  trow.setDroppable("true");
                  trow.setDraggable("true");
                }
                if (myItemTree.getParametros() != null) {
                  if (myItemTree.getParametros().equals("I")) {
                    trow.setStyle("background-color:#E3F6CE");

                  } else if (myItemTree.getParametros().equals("E")) {
                    trow.setStyle("background-color:#F6CECE");
                  }
                }
                if (myItemTree.getOtherValue() != null
                    && myItemTree.getOtherValue().toString().equals("N")) {
                  tcEti.setStyle("color:#BDBDBD;font-weight: bold");
                }

                tcEti.setTooltiptext(myItemTree.getEtiqueta());
                trow.appendChild(tcEti);
                trow.appendChild(
                    new Treecell(
                        myItemTree.getValor() != null ? myItemTree.getValor().trim() : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getPadre() != null ? myItemTree.getPadre().trim() : null));
                trow.appendChild(new Treecell(myItemTree.getNivel().toString()));
                trow.appendChild(
                    new Treecell(myItemTree.getId() != null ? myItemTree.getId().trim() : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getOtherValue() != null
                            ? myItemTree.getOtherValue().toString().trim()
                            : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getParametros() != null
                            ? myItemTree.getParametros().trim()
                            : null));

                trow.setAttribute("valor", myItemTree.getValor());
                trow.setAttribute("padre", myItemTree.getPadre());
                trow.setAttribute("nivel", myItemTree.getNivel());
                trow.setAttribute("llave", myItemTree.getId());
                trow.setAttribute("movimiento", myItemTree.getOtherValue());
                trow.setAttribute("parametros", myItemTree.getParametros());

                tiHijo.appendChild(trow);
                tiHijo.setId(ids + myItemTree.getId());
                tiHijo.setAttribute("Consulta", itemTree.getAttribute("Consulta"));
                tiHijo.setAttribute("grupo", itemTree.getAttribute("grupo"));
                if (padre.hasFellow(ids + myItemTree.getId()))
                  padre.getFellow(ids + myItemTree.getId());
                tchil.appendChild(tiHijo);
                if (myItemTree.getNumeroDescendientes() > 0) {
                  cargarHijosTreePorDemanda(
                      tiHijo, myItemTree.getId(), ids, treeItemRenderMovimiento);
                }
              }
              ((Treeitem) itemTree).setOpen(true);
              arbol = ((Treechildren) itemTree.getChildren().get(1)).getChildren();
              break;
            }
          }
        }
      }
    } else {
      itemSelected = (Treeitem) listItem.get(0);
      ((Treeitem) listItem.get(0)).setSelected(true);
    }
    return ((Treeitem) itemSelected);
  }
Пример #15
0
  public void cargarHijosTreePorDemanda(
      Treeitem ti, final String sec, final String ids, final boolean treeItemRenderMovimiento) {
    log.info("Ejecutando el metodo [void cargarHijosTreePorDemanda...]");

    final String consulta = ti.getAttribute("Consulta").toString();
    final Treechildren hijo = new Treechildren();
    final String grupo = ti.getAttribute("grupo").toString();
    final Map<String, Object> parameter = new HashMap<String, Object>();
    parameter.put("GRUPO", grupo);
    parameter.put("PADRE", sec);
    ti.appendChild(hijo);
    ti.setOpen(false);
    ti.addEventListener(
        "onOpen",
        new EventListener<Event>() {
          public void onEvent(Event arg0) throws Exception {
            OpenEvent oe = (OpenEvent) arg0;
            if (oe.isOpen()) {
              List<MyItemTree> listaHijos =
                  (List<MyItemTree>)
                      ParametrizacionFac.getFacade().obtenerListado(consulta, parameter);
              hijo.getChildren().clear();
              for (MyItemTree myItemTree : listaHijos) {
                Treeitem tiHijo = new Treeitem();
                Treerow trow = new Treerow();
                Treecell tcEti = new Treecell(myItemTree.getEtiqueta());

                if (!treeItemRenderMovimiento) { // valida si se debe habilitar o no el componente
                                                 // dragdroptree
                  trow.setDroppable("true");
                  trow.setDraggable("true");
                }

                if (myItemTree.getParametros() != null) {
                  if (myItemTree.getParametros().equals("I")) {
                    trow.setStyle("background-color:#E3F6CE");

                  } else if (myItemTree.getParametros().equals("E")) {
                    trow.setStyle("background-color:#F6CECE");
                  }
                }
                if (myItemTree.getOtherValue() != null
                    && myItemTree.getOtherValue().toString().equals("N")) {
                  tcEti.setStyle("color:#BDBDBD;font-weight: bold");
                }

                tcEti.setTooltiptext(myItemTree.getEtiqueta());

                trow.appendChild(tcEti);
                trow.appendChild(
                    new Treecell(
                        myItemTree.getValor() != null ? myItemTree.getValor().trim() : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getPadre() != null ? myItemTree.getPadre().trim() : null));
                trow.appendChild(new Treecell(myItemTree.getNivel().toString()));
                trow.appendChild(
                    new Treecell(myItemTree.getId() != null ? myItemTree.getId().trim() : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getOtherValue() != null
                            ? myItemTree.getOtherValue().toString().trim()
                            : null));
                trow.appendChild(
                    new Treecell(
                        myItemTree.getParametros() != null
                            ? myItemTree.getParametros().trim()
                            : null));

                trow.setAttribute("valor", myItemTree.getValor());
                trow.setAttribute("padre", myItemTree.getPadre());
                trow.setAttribute("nivel", myItemTree.getNivel());
                trow.setAttribute("llave", myItemTree.getId());
                trow.setAttribute("movimiento", myItemTree.getOtherValue());
                trow.setAttribute("parametros", myItemTree.getParametros());

                tiHijo.appendChild(trow);
                tiHijo.setId(ids + myItemTree.getId());
                tiHijo.setAttribute("Consulta", consulta);
                tiHijo.setAttribute("grupo", grupo);
                hijo.appendChild(tiHijo);
                if (myItemTree.getNumeroDescendientes() > 0) {
                  cargarHijosTreePorDemanda(
                      tiHijo, myItemTree.getId(), ids, treeItemRenderMovimiento);
                }
              }
            }
          }
        });
  }