Updated widget visitor for new grid widget.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1654673 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java b/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
index 46f0f93..d601bfb 100644
--- a/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
+++ b/framework/webtools/src/org/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
@@ -33,7 +33,7 @@
import org.ofbiz.base.util.UtilURL;
import org.ofbiz.widget.artifact.ArtifactInfoContext;
import org.ofbiz.widget.artifact.ArtifactInfoGatherer;
-import org.ofbiz.widget.model.ModelForm;
+import org.ofbiz.widget.model.*;
import org.xml.sax.SAXException;
/**
@@ -73,7 +73,11 @@
ArtifactInfoContext infoContext = new ArtifactInfoContext();
ArtifactInfoGatherer infoGatherer = new ArtifactInfoGatherer(infoContext);
try {
- infoGatherer.visit(this.modelForm);
+ if (this.modelForm instanceof ModelSingleForm) {
+ infoGatherer.visit((ModelSingleForm) this.modelForm);
+ } else {
+ infoGatherer.visit((ModelGrid) this.modelForm);
+ }
} catch (Exception e) {
throw new GeneralException(e);
}
diff --git a/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java b/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java
index 6c33396..82c6faa 100644
--- a/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java
+++ b/framework/widget/src/org/ofbiz/widget/artifact/ArtifactInfoGatherer.java
@@ -33,22 +33,14 @@
import org.ofbiz.widget.model.AbstractModelAction.Script;
import org.ofbiz.widget.model.AbstractModelAction.Service;
import org.ofbiz.widget.model.AbstractModelAction.SetField;
-import org.ofbiz.widget.model.FieldInfo;
-import org.ofbiz.widget.model.HtmlWidget;
+import org.ofbiz.widget.model.*;
import org.ofbiz.widget.model.HtmlWidget.HtmlTemplate;
import org.ofbiz.widget.model.HtmlWidget.HtmlTemplateDecorator;
import org.ofbiz.widget.model.HtmlWidget.HtmlTemplateDecoratorSection;
-import org.ofbiz.widget.model.IterateSectionWidget;
-import org.ofbiz.widget.model.ModelAction;
-import org.ofbiz.widget.model.ModelActionVisitor;
-import org.ofbiz.widget.model.ModelFieldVisitor;
-import org.ofbiz.widget.model.ModelForm;
import org.ofbiz.widget.model.ModelForm.AltTarget;
import org.ofbiz.widget.model.ModelForm.AutoFieldsEntity;
import org.ofbiz.widget.model.ModelForm.AutoFieldsService;
-import org.ofbiz.widget.model.ModelFormAction;
import org.ofbiz.widget.model.ModelFormAction.CallParentActions;
-import org.ofbiz.widget.model.ModelFormField;
import org.ofbiz.widget.model.ModelFormField.CheckField;
import org.ofbiz.widget.model.ModelFormField.ContainerField;
import org.ofbiz.widget.model.ModelFormField.DateFindField;
@@ -71,11 +63,6 @@
import org.ofbiz.widget.model.ModelFormField.TextField;
import org.ofbiz.widget.model.ModelFormField.TextFindField;
import org.ofbiz.widget.model.ModelFormField.TextareaField;
-import org.ofbiz.widget.model.ModelMenu;
-import org.ofbiz.widget.model.ModelMenuAction;
-import org.ofbiz.widget.model.ModelMenuItem;
-import org.ofbiz.widget.model.ModelScreen;
-import org.ofbiz.widget.model.ModelScreenWidget;
import org.ofbiz.widget.model.ModelScreenWidget.Column;
import org.ofbiz.widget.model.ModelScreenWidget.ColumnContainer;
import org.ofbiz.widget.model.ModelScreenWidget.Container;
@@ -96,11 +83,8 @@
import org.ofbiz.widget.model.ModelScreenWidget.Screenlet;
import org.ofbiz.widget.model.ModelScreenWidget.Section;
import org.ofbiz.widget.model.ModelScreenWidget.Tree;
-import org.ofbiz.widget.model.ModelTree;
import org.ofbiz.widget.model.ModelTree.ModelNode;
import org.ofbiz.widget.model.ModelTree.ModelNode.ModelSubNode;
-import org.ofbiz.widget.model.ModelTreeAction;
-import org.ofbiz.widget.model.ModelWidgetVisitor;
/**
* An object that gathers artifact information from screen widgets.
@@ -240,7 +224,7 @@
}
@Override
- public void visit(ModelForm modelForm) throws Exception {
+ public void visit(ModelSingleForm modelForm) throws Exception {
if (modelForm.getActions() != null) {
for (ModelAction action : modelForm.getActions()) {
action.accept(this);
@@ -318,6 +302,12 @@
}
@Override
+ public void visit(ModelGrid modelGrid) throws Exception {
+ // TODO: Finish implementation
+
+ }
+
+ @Override
public void visit(ModelFormAction.Service service) throws Exception {
infoContext.addServiceName(service.getServiceName());
// TODO: Look for entityName in performFind service call
diff --git a/framework/widget/src/org/ofbiz/widget/model/ModelForm.java b/framework/widget/src/org/ofbiz/widget/model/ModelForm.java
index 191c78b..b2e0d20 100644
--- a/framework/widget/src/org/ofbiz/widget/model/ModelForm.java
+++ b/framework/widget/src/org/ofbiz/widget/model/ModelForm.java
@@ -734,11 +734,6 @@
this.focusFieldName = focusFieldName;
}
- @Override
- public void accept(ModelWidgetVisitor visitor) throws Exception {
- visitor.visit(this);
- }
-
private void addAutoFieldsFromEntity(AutoFieldsEntity autoFieldsEntity, ModelReader entityModelReader,
Set<String> useWhenFields, List<ModelFormFieldBuilder> fieldBuilderList, Map<String, ModelFormFieldBuilder> fieldBuilderMap) {
// read entity def and auto-create fields
diff --git a/framework/widget/src/org/ofbiz/widget/model/ModelWidgetVisitor.java b/framework/widget/src/org/ofbiz/widget/model/ModelWidgetVisitor.java
index 9ad6785..9728c3f 100644
--- a/framework/widget/src/org/ofbiz/widget/model/ModelWidgetVisitor.java
+++ b/framework/widget/src/org/ofbiz/widget/model/ModelWidgetVisitor.java
@@ -18,7 +18,6 @@
*******************************************************************************/
package org.ofbiz.widget.model;
-import org.ofbiz.widget.model.HtmlWidget;
/**
* A <code>ModelWidget</code> visitor.
@@ -35,7 +34,9 @@
void visit(IterateSectionWidget iterateSectionWidget) throws Exception;
- void visit(ModelForm modelForm) throws Exception;
+ void visit(ModelSingleForm modelForm) throws Exception;
+
+ void visit(ModelGrid modelGrid) throws Exception;
void visit(ModelMenu modelMenu) throws Exception;
diff --git a/framework/widget/src/org/ofbiz/widget/model/XmlWidgetVisitor.java b/framework/widget/src/org/ofbiz/widget/model/XmlWidgetVisitor.java
index a40e3c2..049d996 100644
--- a/framework/widget/src/org/ofbiz/widget/model/XmlWidgetVisitor.java
+++ b/framework/widget/src/org/ofbiz/widget/model/XmlWidgetVisitor.java
@@ -237,7 +237,7 @@
}
@Override
- public void visit(ModelForm modelForm) throws Exception {
+ public void visit(ModelSingleForm modelForm) throws Exception {
writer.append("<form");
visitModelWidget(modelForm);
if (modelForm.getParentModelForm() != null) {
@@ -345,12 +345,21 @@
}
@Override
- public void visit(Grid grid) throws Exception {
- // TODO Auto-generated method stub
+ public void visit(ModelGrid modelGrid) throws Exception {
+ // TODO: Finish implementation
}
@Override
+ public void visit(Grid grid) throws Exception {
+ writer.append("<include-grid");
+ visitModelWidget(grid);
+ visitAttribute("location", grid.getLocationExdr());
+ visitAttribute("share-scope", grid.getShareScopeExdr());
+ writer.append("/>");
+ }
+
+ @Override
public void visit(ModelMenu modelMenu) throws Exception {
writer.append("<menu");
visitModelWidget(modelMenu);