Author: adrianc
Date: Sat Dec 10 12:33:38 2011
New Revision: 1212781

URL: http://svn.apache.org/viewvc?rev=1212781&view=rev
Log:
Screen Widget Redesign - added FormWidgetVisitor interface, MenuWidgetVisitor 
interface, and also added accept methods to the relevant Model classes.

Added:
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
   (with props)
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
   (with props)
Modified:
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
    
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java

Added: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java?rev=1212781&view=auto
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
 (added)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
 Sat Dec 10 12:33:38 2011
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ 
*******************************************************************************/
+package org.ofbiz.widget.form;
+
+import java.io.IOException;
+
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.widget.form.ModelFormField.CheckField;
+import org.ofbiz.widget.form.ModelFormField.ContainerField;
+import org.ofbiz.widget.form.ModelFormField.DateTimeField;
+import org.ofbiz.widget.form.ModelFormField.DisplayField;
+import org.ofbiz.widget.form.ModelFormField.DropDownField;
+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.RadioField;
+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.TextareaField;
+
+/**
+ * Form widget visitor.
+ */
+public interface FormWidgetVisitor {
+
+    void visit(CheckField checkField) throws IOException, GeneralException;
+
+    void visit(ContainerField containerField) throws IOException, 
GeneralException;
+
+    void visit(DateTimeField dateTimeField) throws IOException, 
GeneralException;
+
+    void visit(DisplayField displayField) throws IOException, GeneralException;
+
+    void visit(DropDownField dropDownField) throws IOException, 
GeneralException;
+
+    void visit(HiddenField hiddenField) throws IOException, GeneralException;
+
+    void visit(HyperlinkField hyperlinkField) throws IOException, 
GeneralException;
+
+    void visit(IgnoredField ignoredField) throws IOException, GeneralException;
+
+    void visit(ImageField imageField) throws IOException, GeneralException;
+
+    void visit(ModelForm modelForm) throws IOException, GeneralException;
+
+    void visit(ModelFormField modelFormField) throws IOException, 
GeneralException;
+
+    void visit(RadioField radioField) throws IOException, GeneralException;
+
+    void visit(ResetField resetField) throws IOException, GeneralException;
+
+    void visit(SubmitField submitField) throws IOException, GeneralException;
+
+    void visit(TextareaField textareaField) throws IOException, 
GeneralException;
+
+    void visit(TextField textField) throws IOException, GeneralException;
+
+}

Propchange: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/FormWidgetVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Modified: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1212781&r1=1212780&r2=1212781&view=diff
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
 (original)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
 Sat Dec 10 12:33:38 2011
@@ -222,6 +222,10 @@ public class ModelForm extends ModelWidg
         initForm(formElement);
     }
 
+    public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+        visitor.visit(this);
+    }
+
     public void initForm(Element formElement) {
 
         
setDefaultViewSize(UtilProperties.getPropertyValue("widget.properties", 
"widget.form.defaultViewSize"));

Modified: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1212781&r1=1212780&r2=1212781&view=diff
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
 (original)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
 Sat Dec 10 12:33:38 2011
@@ -208,6 +208,10 @@ public class ModelFormField {
         }
     }
 
+    public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+        visitor.visit(this);
+    }
+
     public void addOnEventUpdateArea(UpdateArea updateArea) {
         // Event types are sorted as a convenience for the rendering classes
         Debug.logInfo(this.modelForm.getName() + ":" + this.name + " adding 
UpdateArea type " + updateArea.getEventType(), module);
@@ -1333,6 +1337,8 @@ public class ModelFormField {
             this.modelFormField = modelFormField;
         }
 
+        public abstract void accept(FormWidgetVisitor visitor) throws 
IOException, GeneralException;
+
         public ModelFormField getModelFormField() {
             return modelFormField;
         }
@@ -1936,6 +1942,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDisplayField(writer, context, this);
         }
@@ -2246,6 +2257,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderHyperlinkField(writer, context, this);
         }
@@ -2721,6 +2737,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderTextField(writer, context, this);
         }
@@ -2846,6 +2867,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderTextareaField(writer, context, this);
         }
@@ -2953,6 +2979,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDateTimeField(writer, context, this);
         }
@@ -3087,6 +3118,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderDropDownField(writer, context, this);
         }
@@ -3188,6 +3224,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderRadioField(writer, context, this);
         }
@@ -3215,6 +3256,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderCheckField(writer, context, this);
         }
@@ -3255,6 +3301,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderSubmitField(writer, context, this);
         }
@@ -3332,6 +3383,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderResetField(writer, context, this);
         }
@@ -3358,6 +3414,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderHiddenField(writer, context, this);
         }
@@ -3398,6 +3459,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderIgnoredField(writer, context, this);
         }
@@ -3720,6 +3786,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderImageField(writer, context, this);
         }
@@ -3804,6 +3875,11 @@ public class ModelFormField {
         }
 
         @Override
+        public void accept(FormWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
+        @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
             formStringRenderer.renderContainerFindField(writer, context, this);
         }

Added: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java?rev=1212781&view=auto
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
 (added)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
 Sat Dec 10 12:33:38 2011
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ 
*******************************************************************************/
+package org.ofbiz.widget.menu;
+
+import java.io.IOException;
+
+import org.ofbiz.base.util.GeneralException;
+
+/**
+ * Menu widget visitor.
+ */
+public interface MenuWidgetVisitor {
+
+    void visit(ModelMenu modelMenu) throws IOException, GeneralException;
+
+    void visit(ModelMenuItem modelMenuItem) throws IOException, 
GeneralException;
+
+    void visit(ModelMenuItem.Image image) throws IOException, GeneralException;
+
+    void visit(ModelMenuItem.Link link) throws IOException, GeneralException;
+}

Propchange: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/MenuWidgetVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Modified: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1212781&r1=1212780&r2=1212781&view=diff
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
 (original)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
 Sat Dec 10 12:33:38 2011
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import org.ofbiz.base.util.BshUtil;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
@@ -250,6 +251,11 @@ public class ModelMenu extends ModelWidg
     public ModelMenu(Element menuElement, Delegator delegator, LocalDispatcher 
dispatcher) {
         this(menuElement);
     }
+
+    public void accept(MenuWidgetVisitor visitor) throws IOException, 
GeneralException {
+        visitor.visit(this);
+    }
+
     /**
      * add/override modelMenuItem using the menuItemList and menuItemMap
      *

Modified: 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1212781&r1=1212780&r2=1212781&view=diff
==============================================================================
--- 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
 (original)
+++ 
ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
 Sat Dec 10 12:33:38 2011
@@ -31,6 +31,7 @@ import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilProperties;
@@ -106,6 +107,10 @@ public class ModelMenuItem {
         loadMenuItem(fieldElement, modelMenu);
     }
 
+    public void accept(MenuWidgetVisitor visitor) throws IOException, 
GeneralException {
+        visitor.visit(this);
+    }
+
     public void loadMenuItem(Element fieldElement, ModelMenu modelMenu) {
         this.modelMenu = modelMenu;
         this.name = fieldElement.getAttribute("name");
@@ -627,6 +632,10 @@ public class ModelMenuItem {
             setConfirmationMsg("");
         }
 
+        public void accept(MenuWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
         public void renderLinkString(Appendable writer, Map<String, Object> 
context, MenuStringRenderer menuStringRenderer) throws IOException {
             menuStringRenderer.renderLink(writer, context, this);
         }
@@ -839,6 +848,10 @@ public class ModelMenuItem {
 
         }
 
+        public void accept(MenuWidgetVisitor visitor) throws IOException, 
GeneralException {
+            visitor.visit(this);
+        }
+
         public void renderImageString(Appendable writer, Map<String, Object> 
context, MenuStringRenderer menuStringRenderer) throws IOException {
             menuStringRenderer.renderImage(writer, context, this);
         }


Reply via email to