Author: jacopoc
Date: Thu Mar 20 14:48:30 2008 New Revision: 639474 URL: http://svn.apache.org/viewvc?rev=639474&view=rev Log: Implemented artifact information about forms extended by forms. Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java 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=639474&r1=639473&r2=639474&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 14:48:30 2008 @@ -64,9 +64,31 @@ /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allFormInfos in ArtifactInfoFactory.getFormWidgetArtifactInfo */ public void populateAll() throws GeneralException { - // populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (TODO) (and reverse in aif.allFormInfosExtendingForm) + // populate entitiesUsedInThisForm, servicesUsedInThisForm, formThisFormExtends (and reverse in aif.allFormInfosExtendingForm) this.populateUsedEntities(); this.populateUsedServices(); + this.populateFormExtended(); + } + protected void populateFormExtended() throws GeneralException { + // populate formThisFormExtends and the reverse-associate cache in the aif + if (this.modelForm.getParentFormName() != null && this.modelForm.getParentFormLocation() != null) { + String formName = this.modelForm.getParentFormLocation() + "#" + this.modelForm.getParentFormName(); + if (formName.contains("${")) { + return; + } + + try { + ModelForm modelForm = aif.getModelForm(formName); + } catch(Exception e) { + Debug.logWarning("Form [" + formName + "] reference in form [" + this.formName + "] in resource [" + this.formLocation + "] does not exist!", module); + return; + } + + // the forward reference + this.formThisFormExtends = aif.getFormWidgetArtifactInfo(formName); + // the reverse reference + UtilMisc.addToSetInMap(this, aif.allFormInfosExtendingForm, formName); + } } protected void populateUsedEntities() throws GeneralException { // populate entitiesUsedInThisForm and for each the reverse-associate cache in the aif Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=639474&r1=639473&r2=639474&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu Mar 20 14:48:30 2008 @@ -1713,6 +1713,14 @@ return this.targetType; } + public String getParentFormName() { + return this.parentFormName; + } + + public String getParentFormLocation() { + return this.parentFormLocation; + } + /** * @return */ @@ -2700,7 +2708,7 @@ allEntityNamesUsed.add(modelFormField.getEntityName()); } if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) { - allEntityNamesUsed.add(((ModelFormField.DisplayEntityField)modelFormField).entityName); + allEntityNamesUsed.add(((ModelFormField.DisplayEntityField)modelFormField.getFieldInfo()).entityName); } if (modelFormField.getFieldInfo() instanceof ModelFormField.FieldInfoWithOptions) { for (ModelFormField.OptionSource optionSource: ((ModelFormField.FieldInfoWithOptions)modelFormField.getFieldInfo()).optionSources) { |
Free forum by Nabble | Edit this page |