Ejemplo n.º 1
0
  public NodeGUI get(String path) {

    if (path == null) {
      return root;
    }

    return (NodeGUI) root.get(path); // root.getNode(path);
  }
Ejemplo n.º 2
0
  public NodeGUI put(String parentPath, Node node) {
    log.info("here");
    // FIXME FIXME FIXME ???? - use JTree's index or NodeGUI's ?
    NodeGUI parent = (NodeGUI) root.get(parentPath);
    if (parent == null) {
      log.error("could not add gui node {} to path {}", node.getName(), parentPath);
      return null;
    }

    NodeGUI child = (NodeGUI) parent.get(node.getName());
    if (child == null) {
      child = new NodeGUI(node);
      // you must insertNodeInto only if child does not previously
      // exist - as
      model.insertNodeInto(child, parent, parent.getChildCount());
      parent.put(child);
    } else {
      child.refresh(node);
    }

    // FIXXED - NO LONGER CREATE BOGUS NODE GUIService'S --- YAY ! - JUST SIMPLY DISPLAY A NODE
    // IMPORANT TO BE TRANSPARENT - MEMORY IS !

    // FIXME - for a pre-existing NodeGUI - regen ?? all children ??? or refresh ???
    // FIXME - only NodeGUI's are in the (or should be in) the HashMap - this should be strongly
    // typed !
    // ----- add non-recursive nodes - begin ------------------
    /*
    for (Map.Entry<String,?> nodeData : node.getNodes().entrySet())
    {
    	String key = nodeData.getKey();
    	Object object = nodeData.getValue();
    	log.info("{}{}", key, object);

    	// display based on type for all non-recursive memory
    	Class<?> clazz = object.getClass();
    	if (clazz != Node.class)
    	{
    		if (clazz == OpenCVData.class)
    		{
    			OpenCVData data = (OpenCVData)object;
    			//log.info("{}",data);
    			// adding a "gui" node - to have a place where a user can highlight
    			// to "see" the opencv image data in the video widget
    			// addLeaf(newChild, o.getKey(), o.getValue().toString());
    			// TODO - compartmentalize the following to methods
    			// TODO - type info should be different field - your now converting typ info through name..

    			// this adds complexity - in that viewing its preferrable to be able to
    			// select on different types, while "real" memory is much more compact
    			// String imageKey = String.format("%s.%s", childKey, "image");

    			NodeGUI images = (NodeGUI)child.get("images");
    			log.info("{}",images);
    			if (images == null){
    				images = new NodeGUI(child, "images");
    				model.insertNodeInto(images, child, child.getChildCount());
    				// FIXME - nodeMap - probably not necessary if you learn to use
    				// the JTree system
    				child.put(images);
    			}


    			for (Map.Entry<String,?> img : data.getImages().entrySet())
    			{
    				NodeGUI imgDisplay = (NodeGUI)images.get(img.getKey());

    				if (imgDisplay == null) {
    					imgDisplay = new NodeGUI(images, img.getKey());
    					model.insertNodeInto(imgDisplay, images, imgDisplay.getChildCount());
    					images.put(imgDisplay);

    					if (memoryDisplay != null && img != null)
    					{
    						memoryDisplay.displayFrame((SerializableImage)img.getValue());
    					}
    				}

    			}
    		}

    	}

    }*/

    return (NodeGUI) child;
  }
Ejemplo n.º 3
0
 public NodeGUI put(NodeGUI newChild) {
   return nodeMap.put(newChild.getName(), newChild);
 }