svn commit: r639386 - in /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo: ArtifactInfoFactory.java FormWidgetArtifactInfo.java ScreenWidgetArtifactInfo.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r639386 - in /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo: ArtifactInfoFactory.java FormWidgetArtifactInfo.java ScreenWidgetArtifactInfo.java

jonesde
Author: jonesde
Date: Thu Mar 20 10:47:42 2008
New Revision: 639386

URL: http://svn.apache.org/viewvc?rev=639386&view=rev
Log:
Added basic methods (skeleton) for FormWidgetArtifact info

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=639386&r1=639385&r2=639386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Thu Mar 20 10:47:42 2008
@@ -103,6 +103,9 @@
     public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
 
     public Map<ServiceEcaRule, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceEcaRule = FastMap.newInstance();
+
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosExtendingForm = FastMap.newInstance();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToForm = FastMap.newInstance();
     
     public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToScreen = FastMap.newInstance();
     public Map<String, Set<ControllerViewArtifactInfo>> allViewInfosReferringToScreen = FastMap.newInstance();
@@ -301,6 +304,7 @@
         if (curInfo == null) {
             curInfo = new FormWidgetArtifactInfo(formName, formLocation, this);
             this.allFormInfos.put(curInfo.getUniqueId(), curInfo);
+            curInfo.populateAll();
         }
         return curInfo;
     }
@@ -310,12 +314,12 @@
         if (curInfo == null) {
             try {
                 curInfo = new ScreenWidgetArtifactInfo(screenName, screenLocation, this);
+                this.allScreenInfos.put(curInfo.getUniqueId(), curInfo);
                 curInfo.populateAll();
             } catch(GeneralException e) {
                 Debug.logWarning("Error loading screen [" + screenName + "] from resource [" + screenLocation + "]: " + e.toString(), module);
                 return null;
             }
-            this.allScreenInfos.put(curInfo.getUniqueId(), curInfo);
         }
         return curInfo;
     }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java?rev=639386&r1=639385&r2=639386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java Thu Mar 20 10:47:42 2008
@@ -19,9 +19,12 @@
 package org.ofbiz.webtools.artifactinfo;
 
 import java.io.IOException;
+import java.util.Set;
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import javolution.util.FastSet;
+
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.widget.form.ModelForm;
 import org.xml.sax.SAXException;
@@ -36,6 +39,10 @@
     protected String formName;
     protected String formLocation;
     
+    protected Set<EntityArtifactInfo> entitiesUsedInThisForm = FastSet.newInstance();
+    protected Set<ServiceArtifactInfo> servicesUsedInThisForm = FastSet.newInstance();
+    protected FormWidgetArtifactInfo formThisFormExtends = null;
+    
     public FormWidgetArtifactInfo(String formName, String formLocation, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
         this.formName = formName;
@@ -51,6 +58,11 @@
         }
     }
     
+    /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allFormInfos in ArtifactInfoFactory.getFormWidgetArtifactInfo */
+    public void populateAll() {
+        // TODO: populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (and reverse in aif.allFormInfosExtendingForm)
+    }
+    
     public String getDisplayName() {
         return this.getUniqueId();
     }
@@ -74,5 +86,25 @@
         } else {
             return false;
         }
+    }
+
+    public Set<EntityArtifactInfo> getEntitiesUsedInForm() {
+        return this.entitiesUsedInThisForm;
+    }
+    
+    public Set<ServiceArtifactInfo> getServicesUsedInForm() {
+        return this.servicesUsedInThisForm;
+    }
+    
+    public FormWidgetArtifactInfo getFormThisFormExtends() {
+        return this.formThisFormExtends;
+    }
+    
+    public Set<FormWidgetArtifactInfo> getFormsExtendingThisForm() {
+        return this.aif.allFormInfosExtendingForm.get(this.getUniqueId());
+    }
+    
+    public Set<ScreenWidgetArtifactInfo> getScreensIncludingThisForm() {
+        return this.aif.allScreenInfosReferringToForm.get(this.getUniqueId());
     }
 }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java?rev=639386&r1=639385&r2=639386&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java Thu Mar 20 10:47:42 2008
@@ -44,9 +44,9 @@
     protected String screenName;
     protected String screenLocation;
     
-    Set<EntityArtifactInfo> entitiesUsedInThisScreen = FastSet.newInstance();
-    Set<ServiceArtifactInfo> servicesUsedInThisScreen = FastSet.newInstance();
-    Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = FastSet.newInstance();
+    protected Set<EntityArtifactInfo> entitiesUsedInThisScreen = FastSet.newInstance();
+    protected Set<ServiceArtifactInfo> servicesUsedInThisScreen = FastSet.newInstance();
+    protected Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = FastSet.newInstance();
     
     public ScreenWidgetArtifactInfo(String screenName, String screenLocation, ArtifactInfoFactory aif) throws GeneralException {
         super(aif);
@@ -136,7 +136,7 @@
             // the forward reference
             this.formsIncludedInThisScreen.add(aif.getFormWidgetArtifactInfo(formName));
             // the reverse reference
-            UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToEntityName, formName);
+            UtilMisc.addToSetInMap(this, aif.allScreenInfosReferringToForm, formName);
         }
     }