コード例 #1
0
 public static Graphnode_c createProxy(
     ModelRoot modelRoot,
     float p_m_width,
     float p_m_height,
     java.util.UUID p_m_elementid,
     String p_contentPath,
     IPath p_localPath) {
   ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath);
   // if a model root was not resolved it is most likely
   // due to a missing file of the proxy, defualt back to
   // the original model root
   if (resolvedModelRoot != null) modelRoot = resolvedModelRoot;
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   Graphnode_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_elementid};
     new_inst = (Graphnode_c) instances.get(key);
   }
   String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath));
   if (modelRoot.isNewCompareRoot()) {
     // for comparisons we do not want to change
     // the content path
     contentPath = p_contentPath;
   }
   if (new_inst != null && !modelRoot.isCompareRoot()) {
     PersistableModelComponent pmc = new_inst.getPersistableComponent();
     if (pmc == null) {
       // dangling reference, redo this instance
       new_inst.batchUnrelate();
       new_inst.m_width = p_m_width;
       new_inst.m_height = p_m_height;
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
     }
   }
   if (new_inst == null) {
     // there is no instance matching the id, create a proxy
     // if the resource doesn't exist then this will be a dangling reference
     new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
コード例 #2
0
  public static Graphnode_c resolveInstance(
      ModelRoot modelRoot, float p_m_width, float p_m_height, java.util.UUID p_m_elementid) {
    InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
    Graphnode_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid};
      source = (Graphnode_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        source.m_width = p_m_width;
        source.m_height = p_m_height;
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);

        return source;
      }
    }
    // there is no instance matching the id
    Graphnode_c new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid);
    return new_inst;
  }