コード例 #1
0
  private DefaultMutableTreeNode getTreeNode(FieldMapNode node) {
    if (node == null) {
      return new TristateCheckBoxNode();
    }
    TristateCheckBoxNode treeNode = new TristateCheckBoxNode(node);
    if (node.isLeaf()) {
      return treeNode;
    }

    for (int i = 0; i < node.getChildCount(); i++) {
      treeNode.add(getTreeNode(node.getChildAt(i)));
    }
    return treeNode;
  }
コード例 #2
0
 private void getNodeValue(TristateCheckBoxNode node, List v, String fName, boolean isSel) {
   if (node == null) {
     return;
   }
   boolean isV =
       isSel ? State.SELECTED.equals(node.getState()) : State.NOT_SELECTED.equals(node.getState());
   if (isV) {
     FieldMapNode fmn = (FieldMapNode) node.getUserObject();
     v.add(fmn.getFieldValue(fName));
   }
   for (TristateCheckBoxNode tmp : node.getChildren()) {
     getNodeValue(tmp, v, fName, isSel);
   }
 }
コード例 #3
0
 private void setNodeValue(TristateCheckBoxNode node, List vList, String fName, boolean isSel) {
   if (node == null) {
     return;
   }
   FieldMapNode fmn = (FieldMapNode) node.getUserObject();
   boolean isS =
       isSel
           ? vList.contains(fmn.getFieldValue(fName))
           : !vList.contains(fmn.getFieldValue(fName));
   if (isS && node.isLeaf()) {
     node.setState(State.SELECTED);
   }
   for (TristateCheckBoxNode tmp : node.getChildren()) {
     setNodeValue(tmp, vList, fName, isSel);
   }
 }