You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2014/11/02 02:21:39 UTC

svn commit: r1636077 - in /ofbiz/trunk/framework: webtools/src/org/ofbiz/webtools/artifactinfo/ widget/src/org/ofbiz/widget/ widget/src/org/ofbiz/widget/artifact/ widget/src/org/ofbiz/widget/form/

Author: adrianc
Date: Sun Nov  2 01:21:39 2014
New Revision: 1636077

URL: http://svn.apache.org/r1636077
Log:
Move form widget artifact info code to a separate class. This eliminates a lot of duplicate code and it should speed up artifact info gathering. Also converted form widget to reuse some of the screen widget action models.

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelActionVisitor.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoContext.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.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=1636077&r1=1636076&r2=1636077&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 Sun Nov  2 01:21:39 2014
@@ -31,6 +31,8 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilURL;
+import org.ofbiz.widget.artifact.ArtifactInfoContext;
+import org.ofbiz.widget.artifact.ArtifactInfoGatherer;
 import org.ofbiz.widget.form.ModelForm;
 import org.xml.sax.SAXException;
 
@@ -68,12 +70,14 @@ public class FormWidgetArtifactInfo exte
 
     /** 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 (and reverse in aif.allFormInfosExtendingForm)
-        this.populateUsedEntities();
-        this.populateUsedServices();
+        ArtifactInfoContext infoContext = new ArtifactInfoContext();
+        ArtifactInfoGatherer infoGatherer = new ArtifactInfoGatherer(infoContext);
+        infoGatherer.visit(this.modelForm);
+        populateEntitiesFromNameSet(infoContext.getEntityNames());
+        populateServicesFromNameSet(infoContext.getServiceNames());
         this.populateFormExtended();
-        this.populateLinkedRequests();
-        this.populateTargetedRequests();
+        this.populateLinkedRequests(infoContext.getRequestLocations());
+        this.populateTargetedRequests(infoContext.getTargetLocations());
     }
 
     protected void populateFormExtended() throws GeneralException {
@@ -97,11 +101,7 @@ public class FormWidgetArtifactInfo exte
             UtilMisc.addToSortedSetInMap(this, aif.allFormInfosExtendingForm, formName);
         }
     }
-    protected void populateUsedEntities() throws GeneralException {
-        // populate entitiesUsedInThisForm and for each the reverse-associate cache in the aif
-        Set<String> allEntityNameSet = this.modelForm.getAllEntityNamesUsed();
-        populateEntitiesFromNameSet(allEntityNameSet);
-    }
+
     protected void populateEntitiesFromNameSet(Set<String> allEntityNameSet) throws GeneralException {
         for (String entityName: allEntityNameSet) {
             if (entityName.contains("${")) {
@@ -118,11 +118,6 @@ public class FormWidgetArtifactInfo exte
             UtilMisc.addToSortedSetInMap(this, aif.allFormInfosReferringToEntityName, entityName);
         }
     }
-    protected void populateUsedServices() throws GeneralException {
-        // populate servicesUsedInThisForm and for each the reverse-associate cache in the aif
-        Set<String> allServiceNameSet = this.modelForm.getAllServiceNamesUsed();
-        populateServicesFromNameSet(allServiceNameSet);
-    }
     protected void populateServicesFromNameSet(Set<String> allServiceNameSet) throws GeneralException {
         for (String serviceName: allServiceNameSet) {
             if (serviceName.contains("${")) {
@@ -142,8 +137,7 @@ public class FormWidgetArtifactInfo exte
         }
     }
 
-    protected void populateLinkedRequests() throws GeneralException{
-        Set<String> allRequestUniqueId = this.modelForm.getLinkedRequestsLocationAndUri();
+    protected void populateLinkedRequests(Set<String> allRequestUniqueId) throws GeneralException{
 
         for (String requestUniqueId: allRequestUniqueId) {
             if (requestUniqueId.contains("${")) {
@@ -160,8 +154,7 @@ public class FormWidgetArtifactInfo exte
             }
         }
     }
-    protected void populateTargetedRequests() throws GeneralException{
-        Set<String> allRequestUniqueId = this.modelForm.getTargetedRequestsLocationAndUri();
+    protected void populateTargetedRequests(Set<String> allRequestUniqueId) throws GeneralException{
 
         for (String requestUniqueId: allRequestUniqueId) {
             if (requestUniqueId.contains("${")) {

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelActionVisitor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelActionVisitor.java?rev=1636077&r1=1636076&r2=1636077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelActionVisitor.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelActionVisitor.java Sun Nov  2 01:21:39 2014
@@ -18,12 +18,15 @@
  *******************************************************************************/
 package org.ofbiz.widget;
 
+import org.ofbiz.widget.form.ModelFormAction;
 
 /**
  *  A <code>ModelWidgetAction</code> visitor.
  */
 public interface ModelActionVisitor {
 
+    void visit(ModelFormAction.CallParentActions callParentActions);
+
     void visit(ModelWidgetAction.EntityAnd entityAnd);
 
     void visit(ModelWidgetAction.EntityCondition entityCondition);
@@ -43,4 +46,10 @@ public interface ModelActionVisitor {
     void visit(ModelWidgetAction.Service service);
 
     void visit(ModelWidgetAction.SetField setField);
+
+    void visit(ModelFormAction.Service service);
+
+    void visit(ModelFormAction.EntityAnd entityAnd);
+
+    void visit(ModelFormAction.EntityCondition entityCondition);
 }

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoContext.java?rev=1636077&r1=1636076&r2=1636077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoContext.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoContext.java Sun Nov  2 01:21:39 2014
@@ -31,6 +31,7 @@ public final class ArtifactInfoContext {
     private final Set<String> screenLocationSet = new HashSet<String>();
     private final Set<String> formLocationSet = new HashSet<String>();
     private final Set<String> requestLocationSet = new HashSet<String>();
+    private final Set<String> targetLocationSet = new HashSet<String>();
 
     /**
      * Adds an entity name to this context.
@@ -83,6 +84,16 @@ public final class ArtifactInfoContext {
     }
 
     /**
+     * Adds a target location to this context.
+     * @param name The target location to add to this context
+     */
+    public void addTargetLocation(String name) {
+        if (name != null) {
+            this.targetLocationSet.add(name);
+        }
+    }
+
+    /**
      * Returns the entity names in this context.
      * @return The entity names in this context
      */
@@ -121,4 +132,12 @@ public final class ArtifactInfoContext {
     public Set<String> getServiceNames() {
         return this.serviceNameSet;
     }
+
+    /**
+     * Returns the target locations in this context.
+     * @return The target locations in this context
+     */
+    public Set<String> getTargetLocations() {
+        return this.targetLocationSet;
+    }
 }

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java?rev=1636077&r1=1636076&r2=1636077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java Sun Nov  2 01:21:39 2014
@@ -21,8 +21,10 @@ package org.ofbiz.widget.artifact;
 import java.util.Set;
 
 import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 import org.ofbiz.widget.ModelActionVisitor;
+import org.ofbiz.widget.ModelFieldVisitor;
 import org.ofbiz.widget.ModelWidgetAction;
 import org.ofbiz.widget.ModelWidgetAction.EntityAnd;
 import org.ofbiz.widget.ModelWidgetAction.EntityCondition;
@@ -36,6 +38,34 @@ import org.ofbiz.widget.ModelWidgetActio
 import org.ofbiz.widget.ModelWidgetAction.SetField;
 import org.ofbiz.widget.ModelWidgetVisitor;
 import org.ofbiz.widget.form.ModelForm;
+import org.ofbiz.widget.form.ModelForm.AltTarget;
+import org.ofbiz.widget.form.ModelForm.AutoFieldsEntity;
+import org.ofbiz.widget.form.ModelForm.AutoFieldsService;
+import org.ofbiz.widget.form.ModelFormAction;
+import org.ofbiz.widget.form.ModelFormAction.CallParentActions;
+import org.ofbiz.widget.form.ModelFormField;
+import org.ofbiz.widget.form.ModelFormField.CheckField;
+import org.ofbiz.widget.form.ModelFormField.ContainerField;
+import org.ofbiz.widget.form.ModelFormField.DateFindField;
+import org.ofbiz.widget.form.ModelFormField.DateTimeField;
+import org.ofbiz.widget.form.ModelFormField.DisplayEntityField;
+import org.ofbiz.widget.form.ModelFormField.DisplayField;
+import org.ofbiz.widget.form.ModelFormField.DropDownField;
+import org.ofbiz.widget.form.ModelFormField.FieldInfo;
+import org.ofbiz.widget.form.ModelFormField.FileField;
+import org.ofbiz.widget.form.ModelFormField.HiddenField;
+import org.ofbiz.widget.form.ModelFormField.HyperlinkField;
+import org.ofbiz.widget.form.ModelFormField.IgnoredField;
+import org.ofbiz.widget.form.ModelFormField.ImageField;
+import org.ofbiz.widget.form.ModelFormField.LookupField;
+import org.ofbiz.widget.form.ModelFormField.PasswordField;
+import org.ofbiz.widget.form.ModelFormField.RadioField;
+import org.ofbiz.widget.form.ModelFormField.RangeFindField;
+import org.ofbiz.widget.form.ModelFormField.ResetField;
+import org.ofbiz.widget.form.ModelFormField.SubmitField;
+import org.ofbiz.widget.form.ModelFormField.TextField;
+import org.ofbiz.widget.form.ModelFormField.TextFindField;
+import org.ofbiz.widget.form.ModelFormField.TextareaField;
 import org.ofbiz.widget.menu.ModelMenu;
 import org.ofbiz.widget.screen.HtmlWidget;
 import org.ofbiz.widget.screen.HtmlWidget.HtmlTemplate;
@@ -77,6 +107,10 @@ public final class ArtifactInfoGatherer 
     }
 
     @Override
+    public void visit(CallParentActions callParentActions) {
+    }
+
+    @Override
     public void visit(EntityAnd entityAnd) {
         infoContext.addEntityName(entityAnd.getFinder().getEntityName());
     }
@@ -116,6 +150,7 @@ public final class ArtifactInfoGatherer 
     @Override
     public void visit(Service service) {
         infoContext.addServiceName(service.getServiceNameExdr().getOriginal());
+        // TODO: Look for entityName in performFind service call
     }
 
     @Override
@@ -147,6 +182,96 @@ public final class ArtifactInfoGatherer 
 
     @Override
     public void visit(ModelForm modelForm) {
+        if (modelForm.getActions() != null) {
+            for (ModelWidgetAction action : modelForm.getActions()) {
+                action.accept(this);
+            }
+        }
+        if (modelForm.getRowActions() != null) {
+            for (ModelWidgetAction action : modelForm.getRowActions()) {
+                action.accept(this);
+            }
+        }
+        for (AutoFieldsEntity autoFieldsEntity : modelForm.getAutoFieldsEntities()) {
+            infoContext.addEntityName(autoFieldsEntity.entityName);
+        }
+        for (AutoFieldsService autoFieldsService : modelForm.getAutoFieldsServices()) {
+            infoContext.addServiceName(autoFieldsService.serviceName);
+        }
+        if (modelForm.getAltTargets() != null) {
+            for (AltTarget altTarget : modelForm.getAltTargets()) {
+                String target = altTarget.targetExdr.getOriginal();
+                String urlMode = "intra-app";
+                try {
+                    Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target,
+                            urlMode);
+                    if (controllerLocAndRequestSet != null) {
+                        for (String requestLocation : controllerLocAndRequestSet) {
+                            infoContext.addTargetLocation(requestLocation);
+                        }
+                    }
+                } catch (GeneralException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        if (!modelForm.getTarget().isEmpty()) {
+            String target = modelForm.getTarget();
+            String urlMode = UtilValidate.isNotEmpty(modelForm.getTargetType()) ? modelForm.getTargetType() : "intra-app";
+            if (target.indexOf("${") < 0) {
+                try {
+                    Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target,
+                            urlMode);
+                    if (controllerLocAndRequestSet != null) {
+                        for (String requestLocation : controllerLocAndRequestSet) {
+                            infoContext.addTargetLocation(requestLocation);
+                        }
+                    }
+                } catch (GeneralException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        FieldInfoGatherer fieldInfoGatherer = new FieldInfoGatherer();
+        for (ModelFormField modelFormField : modelForm.getFieldList()) {
+            if (UtilValidate.isNotEmpty(modelFormField.getEntityName())) {
+                infoContext.addEntityName(modelFormField.getEntityName());
+            }
+            if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) {
+                infoContext.addEntityName(((ModelFormField.DisplayEntityField) modelFormField.getFieldInfo()).getEntityName());
+            }
+            if (modelFormField.getFieldInfo() instanceof ModelFormField.FieldInfoWithOptions) {
+                for (ModelFormField.OptionSource optionSource : ((ModelFormField.FieldInfoWithOptions) modelFormField
+                        .getFieldInfo()).getOptionSources()) {
+                    if (optionSource instanceof ModelFormField.EntityOptions) {
+                        infoContext.addEntityName(((ModelFormField.EntityOptions) optionSource).getEntityName());
+                    }
+                }
+            }
+            if (UtilValidate.isNotEmpty(modelFormField.getServiceName())) {
+                infoContext.addServiceName(modelFormField.getServiceName());
+            }
+            FieldInfo fieldInfo = modelFormField.getFieldInfo();
+            if (fieldInfo != null) {
+                fieldInfo.accept(fieldInfoGatherer);
+            }
+        }
+    }
+
+    @Override
+    public void visit(ModelFormAction.EntityAnd entityAnd) {
+        infoContext.addEntityName(entityAnd.getFinder().getEntityName());
+    }
+
+    @Override
+    public void visit(ModelFormAction.EntityCondition entityCondition) {
+        infoContext.addEntityName(entityCondition.getFinder().getEntityName());
+    }
+
+    @Override
+    public void visit(ModelFormAction.Service service) {
+        infoContext.addServiceName(service.getServiceName());
+        // TODO: Look for entityName in performFind service call
     }
 
     @Override
@@ -157,7 +282,8 @@ public final class ArtifactInfoGatherer 
     public void visit(ModelScreen modelScreen) {
         String screenLocation = modelScreen.getSourceLocation().concat("#").concat(modelScreen.getName());
         infoContext.addScreenLocation(screenLocation);
-        modelScreen.getSection().accept(this);;
+        modelScreen.getSection().accept(this);
+        ;
     }
 
     @Override
@@ -279,4 +405,128 @@ public final class ArtifactInfoGatherer 
     @Override
     public void visit(ModelTree modelTree) {
     }
+
+    private class FieldInfoGatherer implements ModelFieldVisitor {
+
+        private void addRequestLocations(String target, String urlMode) {
+            try {
+                Set<String> controllerLocAndRequestSet = ConfigXMLReader
+                        .findControllerRequestUniqueForTargetType(target, urlMode);
+                if (controllerLocAndRequestSet != null) {
+                    for (String requestLocation : controllerLocAndRequestSet) {
+                        infoContext.addRequestLocation(requestLocation);
+                    }
+                }
+            } catch (GeneralException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        @Override
+        public void visit(CheckField checkField) {
+        }
+
+        @Override
+        public void visit(ContainerField containerField) {
+        }
+
+        @Override
+        public void visit(DateFindField dateTimeField) {
+        }
+
+        @Override
+        public void visit(DateTimeField dateTimeField) {
+        }
+
+        @Override
+        public void visit(DisplayEntityField displayField) {
+            if (displayField.getSubHyperlink() != null) {
+                String target = displayField.getSubHyperlink().getTarget(null);
+                String urlMode = displayField.getSubHyperlink().getTargetType();
+                addRequestLocations(target, urlMode);
+            }
+        }
+
+        @Override
+        public void visit(DisplayField displayField) {
+        }
+
+        @Override
+        public void visit(DropDownField dropDownField) {
+            if (dropDownField.getSubHyperlink() != null) {
+                String target = dropDownField.getSubHyperlink().getTarget(null);
+                String urlMode = dropDownField.getSubHyperlink().getTargetType();
+                addRequestLocations(target, urlMode);
+            }
+        }
+
+        @Override
+        public void visit(FileField textField) {
+            if (textField.getSubHyperlink() != null) {
+                String target = textField.getSubHyperlink().getTarget(null);
+                String urlMode = textField.getSubHyperlink().getTargetType();
+                addRequestLocations(target, urlMode);
+            }
+        }
+
+        @Override
+        public void visit(HiddenField hiddenField) {
+        }
+
+        @Override
+        public void visit(HyperlinkField hyperlinkField) {
+            String target = hyperlinkField.getTarget(null);
+            String urlMode = hyperlinkField.getTargetType();
+            addRequestLocations(target, urlMode);
+        }
+
+        @Override
+        public void visit(IgnoredField ignoredField) {
+        }
+
+        @Override
+        public void visit(ImageField imageField) {
+            if (imageField.getSubHyperlink() != null) {
+                String target = imageField.getSubHyperlink().getTarget(null);
+                String urlMode = imageField.getSubHyperlink().getTargetType();
+                addRequestLocations(target, urlMode);
+            }
+        }
+
+        @Override
+        public void visit(LookupField textField) {
+        }
+
+        @Override
+        public void visit(PasswordField textField) {
+        }
+
+        @Override
+        public void visit(RadioField radioField) {
+        }
+
+        @Override
+        public void visit(RangeFindField textField) {
+        }
+
+        @Override
+        public void visit(ResetField resetField) {
+        }
+
+        @Override
+        public void visit(SubmitField submitField) {
+        }
+
+        @Override
+        public void visit(TextareaField textareaField) {
+        }
+
+        @Override
+        public void visit(TextField textField) {
+        }
+
+        @Override
+        public void visit(TextFindField textField) {
+        }
+    }
 }

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=1636077&r1=1636076&r2=1636077&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 Sun Nov  2 01:21:39 2014
@@ -35,7 +35,6 @@ import java.util.TreeSet;
 
 import org.ofbiz.base.util.BshUtil;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
@@ -55,8 +54,8 @@ import org.ofbiz.service.DispatchContext
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelParam;
 import org.ofbiz.service.ModelService;
-import org.ofbiz.webapp.control.ConfigXMLReader;
 import org.ofbiz.widget.ModelWidget;
+import org.ofbiz.widget.ModelWidgetAction;
 import org.ofbiz.widget.ModelWidgetVisitor;
 import org.ofbiz.widget.WidgetWorker;
 import org.w3c.dom.Element;
@@ -189,8 +188,8 @@ public class ModelForm extends ModelWidg
     public static String DEFAULT_SORT_FIELD_ASC_STYLE = "sort-order-asc";
     public static String DEFAULT_SORT_FIELD_DESC_STYLE = "sort-order-desc";
 
-    protected List<ModelFormAction> actions;
-    protected List<ModelFormAction> rowActions;
+    protected List<ModelWidgetAction> actions;
+    protected List<ModelWidgetAction> rowActions;
     protected FlexibleStringExpander rowCountExdr;
     protected List<ModelFormField> multiSubmitFields = new ArrayList<ModelFormField>();
     protected int rowCount = 0;
@@ -223,6 +222,30 @@ public class ModelForm extends ModelWidg
         initForm(formElement);
     }
 
+    public String getTarget() {
+        return target.getOriginal();
+    }
+
+    public List<AltTarget> getAltTargets() {
+        return altTargets;
+    }
+
+    public List<ModelWidgetAction> getActions() {
+        return actions;
+    }
+
+    public List<ModelWidgetAction> getRowActions() {
+        return rowActions;
+    }
+
+    public List<AutoFieldsEntity> getAutoFieldsEntities() {
+        return autoFieldsEntities;
+    }
+
+    public List<AutoFieldsService> getAutoFieldsServices() {
+        return autoFieldsServices;
+    }
+
     public void initForm(Element formElement) {
 
         setDefaultViewSize(UtilProperties.getPropertyValue("widget.properties", "widget.form.defaultViewSize"));
@@ -3160,166 +3183,6 @@ public class ModelForm extends ModelWidg
         }
     }
 
-    public Set<String> getAllEntityNamesUsed() {
-        Set<String> allEntityNamesUsed = new HashSet<String>();
-        for (AutoFieldsEntity autoFieldsEntity: this.autoFieldsEntities) {
-            allEntityNamesUsed.add(autoFieldsEntity.entityName);
-        }
-        if (this.actions != null) {
-            for (ModelFormAction modelFormAction: this.actions) {
-                if (modelFormAction instanceof ModelFormAction.EntityOne) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityOne)modelFormAction).finder.getEntityName());
-                } else if (modelFormAction instanceof ModelFormAction.EntityAnd) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityAnd)modelFormAction).finder.getEntityName());
-                } else if (modelFormAction instanceof ModelFormAction.EntityCondition) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityCondition)modelFormAction).finder.getEntityName());
-                }
-
-            }
-        }
-        if (this.rowActions != null) {
-            for (ModelFormAction modelFormAction: this.rowActions) {
-                if (modelFormAction instanceof ModelFormAction.EntityOne) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityOne)modelFormAction).finder.getEntityName());
-                } else if (modelFormAction instanceof ModelFormAction.EntityAnd) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityAnd)modelFormAction).finder.getEntityName());
-                } else if (modelFormAction instanceof ModelFormAction.EntityCondition) {
-                    allEntityNamesUsed.add(((ModelFormAction.EntityCondition)modelFormAction).finder.getEntityName());
-                }
-            }
-        }
-        for (ModelFormField modelFormField: this.fieldList) {
-            if (UtilValidate.isNotEmpty(modelFormField.getEntityName())) {
-                allEntityNamesUsed.add(modelFormField.getEntityName());
-            }
-            if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) {
-                allEntityNamesUsed.add(((ModelFormField.DisplayEntityField)modelFormField.getFieldInfo()).entityName);
-            }
-            if (modelFormField.getFieldInfo() instanceof ModelFormField.FieldInfoWithOptions) {
-                for (ModelFormField.OptionSource optionSource: ((ModelFormField.FieldInfoWithOptions)modelFormField.getFieldInfo()).optionSources) {
-                    if (optionSource instanceof ModelFormField.EntityOptions) {
-                        allEntityNamesUsed.add(((ModelFormField.EntityOptions)optionSource).entityName);
-                    }
-                }
-            }
-        }
-        return allEntityNamesUsed;
-    }
-
-    public Set<String> getAllServiceNamesUsed() {
-        Set<String> allServiceNamesUsed = new HashSet<String>();
-        for (AutoFieldsService autoFieldsService: this.autoFieldsServices) {
-            allServiceNamesUsed.add(autoFieldsService.serviceName);
-        }
-        if (this.actions != null) {
-            for (ModelFormAction modelFormAction: this.actions) {
-                try {
-                    ModelFormAction.Service service = (ModelFormAction.Service) modelFormAction;
-                    if (!service.serviceNameExdr.isEmpty()) {
-                        allServiceNamesUsed.add(service.serviceNameExdr.toString());
-                    }
-                } catch (ClassCastException e) {}
-            }
-        }
-        if (this.rowActions != null) {
-            for (ModelFormAction modelFormAction: this.rowActions) {
-                try {
-                    ModelFormAction.Service service = (ModelFormAction.Service) modelFormAction;
-                    if (!service.serviceNameExdr.isEmpty()) {
-                        allServiceNamesUsed.add(service.serviceNameExdr.toString());
-                    }
-                } catch (ClassCastException e) {}
-            }
-        }
-        for (ModelFormField modelFormField: this.fieldList) {
-            if (UtilValidate.isNotEmpty(modelFormField.getServiceName())) {
-                allServiceNamesUsed.add(modelFormField.getServiceName());
-            }
-        }
-        return allServiceNamesUsed;
-    }
-
-    public Set<String> getLinkedRequestsLocationAndUri() throws GeneralException {
-        Set<String> allRequestsUsed = new HashSet<String>();
-
-        if (this.fieldList != null) {
-            for (ModelFormField modelFormField: this.fieldList) {
-                if (modelFormField.getFieldInfo() instanceof ModelFormField.HyperlinkField) {
-                    ModelFormField.HyperlinkField link = (ModelFormField.HyperlinkField) modelFormField.getFieldInfo();
-                    String target = link.getTarget(null);
-                    String urlMode = link.getTargetType();
-
-                    Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
-                    if (controllerLocAndRequestSet != null) {
-                        allRequestsUsed.addAll(controllerLocAndRequestSet);
-                    }
-                } else if (modelFormField.getFieldInfo() instanceof ModelFormField.DisplayEntityField) {
-                    ModelFormField.DisplayEntityField parentField = (ModelFormField.DisplayEntityField) modelFormField.getFieldInfo();
-                    if (parentField.subHyperlink != null) {
-                        Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(parentField.subHyperlink.getTarget(null), parentField.subHyperlink.getTargetType());
-                        if (controllerLocAndRequestSet != null) {
-                            allRequestsUsed.addAll(controllerLocAndRequestSet);
-                        }
-                    }
-                } else if (modelFormField.getFieldInfo() instanceof ModelFormField.TextField) {
-                    ModelFormField.TextField parentField = (ModelFormField.TextField) modelFormField.getFieldInfo();
-                    if (parentField.subHyperlink != null) {
-                        Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(parentField.subHyperlink.getTarget(null), parentField.subHyperlink.getTargetType());
-                        if (controllerLocAndRequestSet != null) {
-                            allRequestsUsed.addAll(controllerLocAndRequestSet);
-                        }
-                    }
-                } else if (modelFormField.getFieldInfo() instanceof ModelFormField.DropDownField) {
-                    ModelFormField.DropDownField parentField = (ModelFormField.DropDownField) modelFormField.getFieldInfo();
-                    if (parentField.subHyperlink != null) {
-                        Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(parentField.subHyperlink.getTarget(null), parentField.subHyperlink.getTargetType());
-                        if (controllerLocAndRequestSet != null) {
-                            allRequestsUsed.addAll(controllerLocAndRequestSet);
-                        }
-                    }
-                } else if (modelFormField.getFieldInfo() instanceof ModelFormField.ImageField) {
-                    ModelFormField.ImageField parentField = (ModelFormField.ImageField) modelFormField.getFieldInfo();
-                    if (parentField.subHyperlink != null) {
-                        Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(parentField.subHyperlink.getTarget(null), parentField.subHyperlink.getTargetType());
-                        if (controllerLocAndRequestSet != null) {
-                            allRequestsUsed.addAll(controllerLocAndRequestSet);
-                        }
-                    }
-                }
-            }
-        }
-        return allRequestsUsed;
-    }
-
-    public Set<String> getTargetedRequestsLocationAndUri() throws GeneralException {
-        Set<String> allRequestsUsed = new HashSet<String>();
-
-        if (this.altTargets != null) {
-            for (AltTarget altTarget: this.altTargets) {
-                String target = altTarget.targetExdr.getOriginal();
-                String urlMode = "intra-app";
-
-                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
-                if (controllerLocAndRequestSet != null) {
-                    allRequestsUsed.addAll(controllerLocAndRequestSet);
-                }
-            }
-        }
-
-        if (!this.target.isEmpty()) {
-            String target = this.target.getOriginal();
-            String urlMode = UtilValidate.isNotEmpty(this.targetType) ? this.targetType : "intra-app";
-            if (target.indexOf("${") < 0) {
-                Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
-                if (controllerLocAndRequestSet != null) {
-                    allRequestsUsed.addAll(controllerLocAndRequestSet);
-                }
-            }
-        }
-
-        return allRequestsUsed;
-    }
-
     @Override
     public void accept(ModelWidgetVisitor visitor) {
         visitor.visit(this);

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=1636077&r1=1636076&r2=1636077&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Sun Nov  2 01:21:39 2014
@@ -18,22 +18,16 @@
  *******************************************************************************/
 package org.ofbiz.widget.form;
 
-import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Locale;
 import java.util.Map;
-import java.util.TimeZone;
 import java.util.regex.PatternSyntaxException;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.ObjectType;
-import org.ofbiz.base.util.ScriptUtil;
 import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
@@ -41,35 +35,28 @@ import org.ofbiz.base.util.string.Flexib
 import org.ofbiz.entity.finder.ByAndFinder;
 import org.ofbiz.entity.finder.ByConditionFinder;
 import org.ofbiz.entity.finder.EntityFinderUtil;
-import org.ofbiz.entity.finder.PrimaryKeyFinder;
-import org.ofbiz.entity.util.EntityUtilProperties;
-import org.ofbiz.minilang.MiniLangException;
-import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.MethodContext;
-import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelService;
+import org.ofbiz.widget.ModelActionVisitor;
+import org.ofbiz.widget.ModelWidgetAction;
+import org.ofbiz.widget.ModelWidgetAction.EntityOne;
+import org.ofbiz.widget.ModelWidgetAction.PropertyMap;
+import org.ofbiz.widget.ModelWidgetAction.PropertyToField;
+import org.ofbiz.widget.ModelWidgetAction.Script;
+import org.ofbiz.widget.ModelWidgetAction.SetField;
 import org.ofbiz.widget.WidgetWorker;
 import org.w3c.dom.Element;
 
-
 /**
  * Widget Library - Screen model class
  */
 public abstract class ModelFormAction {
     public static final String module = ModelFormAction.class.getName();
 
-    protected ModelForm modelForm;
-
-    public ModelFormAction(ModelForm modelForm, Element actionElement) {
-        this.modelForm = modelForm;
-        if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
-    }
-
     public abstract void runAction(Map<String, Object> context);
 
-    public static List<ModelFormAction> readSubActions(ModelForm modelForm, Element parentElement) {
-        List<ModelFormAction> actions = new LinkedList<ModelFormAction>();
+    public static List<ModelWidgetAction> readSubActions(ModelForm modelForm, Element parentElement) {
+        List<ModelWidgetAction> actions = new LinkedList<ModelWidgetAction>();
 
         for (Element actionElement: UtilXml.childElementList(parentElement)) {
             if ("set".equals(actionElement.getNodeName())) {
@@ -98,209 +85,21 @@ public abstract class ModelFormAction {
         return actions;
     }
 
-    public static void runSubActions(List<ModelFormAction> actions, Map<String, Object> context) {
+    public static void runSubActions(List<ModelWidgetAction> actions, Map<String, Object> context) {
         if (actions == null) return;
 
-        for (ModelFormAction action: actions) {
+        for (ModelWidgetAction action: actions) {
             if (Debug.verboseOn()) Debug.logVerbose("Running screen action " + action.getClass().getName(), module);
-            action.runAction(context);
-        }
-    }
-
-    public static class SetField extends ModelFormAction {
-        protected FlexibleMapAccessor<Object> field;
-        protected FlexibleMapAccessor<String> fromField;
-        protected FlexibleStringExpander valueExdr;
-        protected FlexibleStringExpander defaultExdr;
-        protected FlexibleStringExpander globalExdr;
-        protected String type;
-
-        public SetField(ModelForm modelForm, Element setElement) {
-            super (modelForm, setElement);
-            this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field"));
-            this.fromField = FlexibleMapAccessor.getInstance(setElement.getAttribute("from-field"));
-            this.valueExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("value"));
-            this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default-value"));
-            this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
-            this.type = setElement.getAttribute("type");
-            if (!this.fromField.isEmpty() && !this.valueExdr.isEmpty()) {
-                throw new IllegalArgumentException("Cannot specify a from-field [" + setElement.getAttribute("from-field") + "] and a value [" + setElement.getAttribute("value") + "] on the set action in a screen widget");
-            }
-        }
-
-        @SuppressWarnings("rawtypes")
-        @Override
-        public void runAction(Map<String, Object> context) {
-            String globalStr = this.globalExdr.expandString(context);
-            // default to false
-            boolean global = "true".equals(globalStr);
-
-            Object newValue = null;
-            if (!this.fromField.isEmpty()) {
-                newValue = this.fromField.get(context);
-                if (Debug.verboseOn()) Debug.logVerbose("In screen getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module);
-            } else if (!this.valueExdr.isEmpty()) {
-                newValue = this.valueExdr.expand(context);
-            }
-
-            // If newValue is still empty, use the default value
-            if (ObjectType.isEmpty(newValue) && !this.defaultExdr.isEmpty()) {
-                newValue = this.defaultExdr.expand(context);
-            }
-
-            if (UtilValidate.isNotEmpty(this.type)) {
-                if ("NewMap".equals(this.type)) {
-                    newValue = new HashMap();
-                } else if ("NewList".equals(this.type)) {
-                    newValue = new LinkedList();
-                } else {
-                    try {
-                        newValue = ObjectType.simpleTypeConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
-                    } catch (GeneralException e) {
-                        String errMsg = "Could not convert field value for the field: [" + this.field.getOriginalName() + "] to the [" + this.type + "] type for the value [" + newValue + "]: " + e.toString();
-                        Debug.logError(e, errMsg, module);
-                        throw new IllegalArgumentException(errMsg);
-                    }
-                }
-            }
-            if (Debug.verboseOn()) Debug.logVerbose("In screen setting field [" + this.field.getOriginalName() + "] to value: " + newValue, module);
-            this.field.put(context, newValue);
-
-            if (global) {
-                Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
-                if (globalCtx != null) {
-                    this.field.put(globalCtx, newValue);
-                }
-            }
-
-            // this is a hack for backward compatibility with the JPublish page object
-            Map<String, Object> page = UtilGenerics.checkMap(context.get("page"));
-            if (page != null) {
-                this.field.put(page, newValue);
-            }
-        }
-    }
-
-    public static class PropertyMap extends ModelFormAction {
-        protected FlexibleStringExpander resourceExdr;
-        protected FlexibleMapAccessor<Map<String, Object>> mapNameAcsr;
-        protected FlexibleStringExpander globalExdr;
-
-        public PropertyMap(ModelForm modelForm, Element setElement) {
-            super (modelForm, setElement);
-            this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource"));
-            this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name"));
-            this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            String globalStr = this.globalExdr.expandString(context);
-            // default to false
-            boolean global = "true".equals(globalStr);
-
-            Locale locale = (Locale) context.get("locale");
-            String resource = this.resourceExdr.expandString(context, locale);
-            Map<String, Object> propertyMap = UtilProperties.getResourceBundleMap(resource, locale);
-            this.mapNameAcsr.put(context, propertyMap);
-
-            if (global) {
-                Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
-                if (globalCtx != null) {
-                    this.mapNameAcsr.put(globalCtx, propertyMap);
-                }
-            }
-        }
-    }
-
-    public static class PropertyToField extends ModelFormAction {
-
-        protected FlexibleStringExpander resourceExdr;
-        protected FlexibleStringExpander propertyExdr;
-        protected FlexibleMapAccessor<String> fieldAcsr;
-        protected FlexibleStringExpander defaultExdr;
-        protected boolean noLocale;
-        protected FlexibleMapAccessor<List<Object>> argListAcsr;
-        protected FlexibleStringExpander globalExdr;
-
-        public PropertyToField(ModelForm modelForm, Element setElement) {
-            super (modelForm, setElement);
-            this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource"));
-            this.propertyExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("property"));
-            this.fieldAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("field"));
-            this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default"));
-            noLocale = "true".equals(setElement.getAttribute("no-locale"));
-            this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name"));
-            this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            //String globalStr = this.globalExdr.expandString(context);
-            // default to false
-            //boolean global = "true".equals(globalStr);
-
-            Locale locale = (Locale) context.get("locale");
-            String resource = this.resourceExdr.expandString(context, locale);
-            String property = this.propertyExdr.expandString(context, locale);
-
-            String value = null;
-            if (noLocale) {
-                value = EntityUtilProperties.getPropertyValue(resource, property, WidgetWorker.getDelegator(context));
-            } else {
-                value = EntityUtilProperties.getMessage(resource, property, locale, WidgetWorker.getDelegator(context));
-            }
-            if (UtilValidate.isEmpty(value)) {
-                value = this.defaultExdr.expandString(context);
-            }
-
-            // note that expanding the value string here will handle defaultValue and the string from
-            //  the properties file; if we decide later that we don't want the string from the properties
-            //  file to be expanded we should just expand the defaultValue at the beginning of this method.
-            value = FlexibleStringExpander.expandString(value, context);
-
-            if (!argListAcsr.isEmpty()) {
-                List<Object> argList = argListAcsr.get(context);
-                if (UtilValidate.isNotEmpty(argList)) {
-                    value = MessageFormat.format(value, argList.toArray());
-                }
-            }
-
-            fieldAcsr.put(context, value);
-        }
-    }
-
-    public static class Script extends ModelFormAction {
-        protected String location;
-        protected String method;
-
-        public Script(ModelForm modelForm, Element scriptElement) {
-            super (modelForm, scriptElement);
-            String scriptLocation = scriptElement.getAttribute("location");
-            this.location = WidgetWorker.getScriptLocation(scriptLocation);
-            this.method = WidgetWorker.getScriptMethodName(scriptLocation);
-        }
-
-        @Override
-        public void runAction(Map<String, Object> context) {
-            if (location.endsWith(".xml")) {
-                Map<String, Object> localContext = new HashMap<String, Object>();
-                localContext.putAll(context);
-                DispatchContext ctx = this.modelForm.dispatchContext;
-                MethodContext methodContext = new MethodContext(ctx, localContext, null);
-                try {
-                    SimpleMethod.runSimpleMethod(location, method, methodContext);
-                    context.putAll(methodContext.getResults());
-                } catch (MiniLangException e) {
-                    throw new IllegalArgumentException("Error running simple method at location [" + location + "]", e);
-                }
-            } else {
-                ScriptUtil.executeScript(this.location, this.method, context);
+            try {
+                action.runAction(context);
+            } catch (GeneralException e) {
+                throw new RuntimeException(e);
             }
         }
     }
 
-    public static class Service extends ModelFormAction {
+    @SuppressWarnings("serial")
+    public static class Service extends ModelWidgetAction {
         protected FlexibleStringExpander serviceNameExdr;
         protected FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr;
         protected FlexibleStringExpander autoFieldMapExdr;
@@ -389,44 +188,33 @@ public abstract class ModelFormAction {
                 Object listObj = result.get(listName);
                 if (listObj != null) {
                     if (!(listObj instanceof List<?>) && !(listObj instanceof ListIterator<?>)) {
-                        throw new IllegalArgumentException("Error in form [" + this.modelForm.getName() + "] calling service with name [" + serviceNameExpanded + "]: the result that is supposed to be a List or ListIterator and is not.");
+                        throw new IllegalArgumentException("Error in form [" + this.modelWidget.getName() + "] calling service with name [" + serviceNameExpanded + "]: the result that is supposed to be a List or ListIterator and is not.");
                     }
                     context.put("listName", listName);
                     context.put(listName, listObj);
                 }
             } catch (GenericServiceException e) {
-                String errMsg = "Error in form [" + this.modelForm.getName() + "] calling service with name [" + serviceNameExpanded + "]: " + e.toString();
+                String errMsg = "Error in form [" + this.modelWidget.getName() + "] calling service with name [" + serviceNameExpanded + "]: " + e.toString();
                 Debug.logError(e, errMsg, module);
                 if (!this.ignoreError) {
                     throw new IllegalArgumentException(errMsg);
                 }
             }
         }
-    }
-
-    public static class EntityOne extends ModelFormAction {
-        protected PrimaryKeyFinder finder;
 
-        public EntityOne(ModelForm modelForm, Element entityOneElement) {
-            super (modelForm, entityOneElement);
-            finder = new PrimaryKeyFinder(entityOneElement);
+        @Override
+        public void accept(ModelActionVisitor visitor) {
+            visitor.visit(this);
         }
 
-        @Override
-        public void runAction(Map<String, Object> context) {
-            try {
-                finder.runFind(context, WidgetWorker.getDelegator(context));
-            } catch (GeneralException e) {
-                String errMsg = "Error doing entity query by condition: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
-            }
+        public String getServiceName() {
+            return serviceNameExdr.getOriginal();
         }
     }
 
-    public static class EntityAnd extends ModelFormAction {
+    @SuppressWarnings("serial")
+    public static class EntityAnd extends ModelWidgetAction {
         protected ByAndFinder finder;
-        String actualListName;
 
         public EntityAnd(ModelForm modelForm, Element entityAndElement) {
             super (modelForm, entityAndElement);
@@ -444,8 +232,6 @@ public abstract class ModelFormAction {
                 }
                 entityAndElement.setAttribute("list", lstNm);
             }
-            this.actualListName = entityAndElement.getAttribute("list");
-            if (UtilValidate.isEmpty(this.actualListName)) this.actualListName = entityAndElement.getAttribute("list-name");
             finder = new ByAndFinder(entityAndElement);
         }
 
@@ -472,9 +258,18 @@ public abstract class ModelFormAction {
             }
         }
 
+        @Override
+        public void accept(ModelActionVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        public ByAndFinder getFinder() {
+            return finder;
+        }
     }
 
-    public static class EntityCondition extends ModelFormAction {
+    @SuppressWarnings("serial")
+    public static class EntityCondition extends ModelWidgetAction {
         ByConditionFinder finder;
         String actualListName;
 
@@ -521,15 +316,26 @@ public abstract class ModelFormAction {
                 throw new IllegalArgumentException(errMsg);
             }
         }
+
+        @Override
+        public void accept(ModelActionVisitor visitor) {
+            visitor.visit(this);
+        }
+
+        public ByConditionFinder getFinder() {
+            return finder;
+        }
     }
 
-    public static class CallParentActions extends ModelFormAction {
+    @SuppressWarnings("serial")
+    public static class CallParentActions extends ModelWidgetAction {
         protected static enum ActionsKind {
             ACTIONS,
             ROW_ACTIONS
         };
 
         protected ActionsKind kind;
+        private final ModelForm modelForm;
 
         public CallParentActions(ModelForm modelForm, Element callParentActionsElement) {
             super(modelForm, callParentActionsElement);
@@ -546,6 +352,7 @@ public abstract class ModelFormAction {
             if (parentModel == null) {
                 throw new IllegalArgumentException("call-parent-actions can only be used with form extending another form");
             }
+            this.modelForm = modelForm;
         }
 
         @Override
@@ -560,5 +367,10 @@ public abstract class ModelFormAction {
                     break;
             }
         }
+
+        @Override
+        public void accept(ModelActionVisitor visitor) {
+            visitor.visit(this);
+        }
     }
 }