Example #1
0
  // Constructor
  public UserViewTreeGui() {

    // Init user, class, team, and group sequences
    RCT.UserSeqHolder userSeq = new RCT.UserSeqHolder();
    RCT.ClassSeqHolder classSeq = new RCT.ClassSeqHolder();
    RCT.TeamSeqHolder teamSeq = new RCT.TeamSeqHolder();
    RCT.GroupSeqHolder groupSeq = new RCT.GroupSeqHolder();

    // Getting the class relevant users
    UserModule.getUsersRelatedByClasses(UserModule.getId(), userSeq);

    // Populate the user tree view
    // Creating and adding the user nodes
    for (int i = 0; i < userSeq.value.length; i++) {

      DefaultMutableTreeNode userNode =
          new DefaultMutableTreeNode(
              new UserNode(
                  userSeq.value[i].alias,
                  conv_status(userSeq.value[i].online_status),
                  userSeq.value[i].first_name,
                  userSeq.value[i].last_name,
                  userSeq.value[i].permission));
      rootNode_.add(userNode);

      // Getting all the user relevant classes
      ClassModule.getClassesFromUserIds(UserModule.getId(), userSeq.value[i].user_id, classSeq);

      // Creating and adding classe nodes
      for (int j = 0; j < classSeq.value.length; j++) {

        DefaultMutableTreeNode classNode =
            new DefaultMutableTreeNode(
                new ClassNode(
                    classSeq.value[j].name, conv_status(classSeq.value[j].active_status)));
        userNode.add(classNode);

        // Getting all the class relevant teams and groups
        TeamModule.getTeamsFromUserAndClass(
            UserModule.getId(), userSeq.value[i].user_id, classSeq.value[j].class_id, teamSeq);
        GroupModule.getGroupsFromUserAndClass(
            userSeq.value[i].user_id, classSeq.value[j].class_id, groupSeq);

        // Creating and adding Team nodes
        for (int t = 0; t < teamSeq.value.length; t++) {

          classNode.add(
              new DefaultMutableTreeNode(
                  new TeamNode(
                      teamSeq.value[t].name, conv_status(teamSeq.value[t].active_status))));
        }

        // Creating and adding group nodes
        for (int g = 0; g < groupSeq.value.length; g++) {

          classNode.add(new DefaultMutableTreeNode(new GroupNode(groupSeq.value[g].name)));
        }
      } // End class seq. for loop
    } // End user seq. for loop

    // Set the user view modle
    this.setModel(new DefaultTreeModel(rootNode_));

    // Set the tree node style
    this.putClientProperty(LINE_STYLE, ANGLED);

    // Hide the root node
    this.setRootVisible(false);
  }
Example #2
0
  // Methdo:
  public void refresh() {

    rootNode_.removeAllChildren();

    // Init user, class, team, and group sequences
    RCT.UserSeqHolder userSeq = new RCT.UserSeqHolder();
    RCT.ClassSeqHolder classSeq = new RCT.ClassSeqHolder();
    RCT.TeamSeqHolder teamSeq = new RCT.TeamSeqHolder();
    RCT.GroupSeqHolder groupSeq = new RCT.GroupSeqHolder();

    // Getting the class relevant users
    UserModule.getUsersRelatedByClasses(UserModule.getId(), userSeq);

    // Populate the user tree view
    // Creating and adding the user nodes
    for (int i = 0; i < userSeq.value.length; i++) {

      DefaultMutableTreeNode userNode =
          new DefaultMutableTreeNode(
              new UserNode(
                  userSeq.value[i].alias,
                  conv_status(userSeq.value[i].online_status),
                  userSeq.value[i].first_name,
                  userSeq.value[i].last_name,
                  userSeq.value[i].permission));
      rootNode_.add(userNode);

      // Getting all the user relevant classes
      ClassModule.getClassesFromUserIds(UserModule.getId(), userSeq.value[i].user_id, classSeq);

      // Creating and adding classe nodes
      for (int j = 0; j < classSeq.value.length; j++) {

        DefaultMutableTreeNode classNode =
            new DefaultMutableTreeNode(
                new ClassNode(
                    classSeq.value[j].name, conv_status(classSeq.value[j].active_status)));
        userNode.add(classNode);

        // Getting all the class relevant teams and groups
        TeamModule.getTeamsFromUserAndClass(
            UserModule.getId(), userSeq.value[i].user_id, classSeq.value[j].class_id, teamSeq);
        GroupModule.getGroupsFromUserAndClass(
            userSeq.value[i].user_id, classSeq.value[j].class_id, groupSeq);

        // Creating and adding Team nodes
        for (int t = 0; t < teamSeq.value.length; t++) {

          classNode.add(
              new DefaultMutableTreeNode(
                  new TeamNode(
                      teamSeq.value[t].name, conv_status(teamSeq.value[t].active_status))));
        }

        // Creating and adding group nodes
        for (int g = 0; g < groupSeq.value.length; g++) {

          classNode.add(new DefaultMutableTreeNode(new GroupNode(groupSeq.value[g].name)));
        }
      } // End class seq. for loop
    } // End user seq. for loop
  }