Ejemplo n.º 1
0
 void updateIconList(TreeNode parentNode, Device device) {
   IconList iconList = device.getIconList();
   int nIcons = iconList.size();
   for (int n = 0; n < nIcons; n++) {
     Icon icon = iconList.getIcon(n);
     String url = icon.getURL();
     TreeNode iconNode = new TreeNode(url);
     iconNode.setUserData(icon);
     parentNode.add(iconNode);
   }
 }
Ejemplo n.º 2
0
 void updateStateVariableList(TreeNode parentNode, Service service) {
   ServiceStateTable stateList = service.getServiceStateTable();
   int nStateVariables = stateList.size();
   for (int n = 0; n < nStateVariables; n++) {
     StateVariable state = stateList.getStateVariable(n);
     String stateName = state.getName();
     TreeNode stateNode = new TreeNode(stateName);
     stateNode.setUserData(state);
     parentNode.add(stateNode);
   }
 }
Ejemplo n.º 3
0
 void updateArgumentList(TreeNode parentNode, Action action) {
   ArgumentList argList = action.getArgumentList();
   int nArguments = argList.size();
   for (int n = 0; n < nArguments; n++) {
     Argument arg = argList.getArgument(n);
     String argName = arg.getName() + "(" + arg.getDirection() + ")";
     TreeNode argNode = new TreeNode(argName);
     argNode.setUserData(arg);
     parentNode.add(argNode);
   }
 }
Ejemplo n.º 4
0
  public void BuildTree() {
    TreeNode home = new TreeNode(fsv.getHomeDirectory());
    currentnode = home;
    Vector rootnode = treeview.GetRootNode();
    for (int i = 0; i < rootnode.size(); i++) {
      TreeNode root = new TreeNode((File) rootnode.get(i));
      root.add(new TreeNode(""));
      home.add(root);
    }
    treemodel = new DefaultTreeModel(home);
    tree = new JTree(treemodel);
    tree.setRowHeight(20); // 设置数单元格高度
    tree.getSelectionModel().setSelectionMode(1); // 1代表SINGLE_TREE_SELECTION,一次只能选择一个路径

    tree.setCellRenderer(new DefaultTreeCellRenderer());
    tree.putClientProperty("JTree.lineStyle", "None");
    tree.addTreeSelectionListener(this);
    tree.addTreeWillExpandListener(this);
    tree.addMouseListener(this);
  }
Ejemplo n.º 5
0
 void updateActionList(TreeNode parentNode, Service service) {
   ActionList actionList = service.getActionList();
   int nActions = actionList.size();
   for (int n = 0; n < nActions; n++) {
     Action action = actionList.getAction(n);
     String actionName = action.getName();
     TreeNode actionNode = new TreeNode(actionName);
     actionNode.setUserData(action);
     parentNode.add(actionNode);
     updateArgumentList(actionNode, action);
   }
 }
Ejemplo n.º 6
0
 void updateServiceList(TreeNode parentNode, Device device) {
   ServiceList serviceList = device.getServiceList();
   int nServices = serviceList.size();
   for (int n = 0; n < nServices; n++) {
     Service service = serviceList.getService(n);
     String serviceType = service.getServiceType();
     TreeNode serviceNode = new TreeNode(serviceType);
     serviceNode.setUserData(service);
     parentNode.add(serviceNode);
     updateActionList(serviceNode, service);
     updateStateVariableList(serviceNode, service);
   }
 }
Ejemplo n.º 7
0
 void updateDeviceList(TreeNode parentNode, DeviceList devList) {
   int nDevs = devList.size();
   for (int n = 0; n < nDevs; n++) {
     Device dev = devList.getDevice(n);
     String friendlyName = dev.getFriendlyName();
     TreeNode devNode = new TreeNode(friendlyName);
     devNode.setUserData(dev);
     parentNode.add(devNode);
     updateServiceList(devNode, dev);
     updateIconList(devNode, dev);
     updateDeviceList(devNode, dev.getDeviceList());
   }
 }