Example #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);
   }
 }
Example #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);
   }
 }
Example #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);
   }
 }
Example #4
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);
   }
 }
Example #5
0
  void update(ControlPoint ctrlp) {
    TreeNode rootNode = getRootNode();
    if (rootNode == null) return;

    rootNode.removeAllChildren();

    DeviceList rootDevList = ctrlp.getDeviceList();
    updateDeviceList(rootNode, rootDevList);

    ((DefaultTreeModel) getModel()).reload();
    repaint();
  }
Example #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);
   }
 }
Example #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());
   }
 }