svn commit: r1766080 - in /ofbiz/trunk/framework/widget: dtd/ src/main/java/org/apache/ofbiz/widget/model/ src/main/java/org/apache/ofbiz/widget/renderer/ src/main/java/org/apache/ofbiz/widget/renderer/fo/ src/main/java/org/apache/ofbiz/widget/renderer...

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

svn commit: r1766080 - in /ofbiz/trunk/framework/widget: dtd/ src/main/java/org/apache/ofbiz/widget/model/ src/main/java/org/apache/ofbiz/widget/renderer/ src/main/java/org/apache/ofbiz/widget/renderer/fo/ src/main/java/org/apache/ofbiz/widget/renderer...

jleroux@apache.org
Author: jleroux
Date: Fri Oct 21 17:31:37 2016
New Revision: 1766080

URL: http://svn.apache.org/viewvc?rev=1766080&view=rev
Log:
Reverted: Can't find Company and admin in Party find feature
(OFBIZ-8505)

Reverts r1765058 + r1765080 following discussion on dev ML

This was introduced for this improvement: In form widgets of list type empty
header row should not render if list to render in file is empty for OFBIZ-7598

Modified:
    ofbiz/trunk/framework/widget/dtd/widget-form.xsd
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormStringRenderer.java
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java
    ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
    ofbiz/trunk/framework/widget/templates/HtmlFormMacroLibrary.ftl

Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Fri Oct 21 17:31:37 2016
@@ -86,7 +86,6 @@ under the License.
             <xs:attribute name="style" type="xs:string" />
             <xs:attribute name="focus-field-name" type="xs:string" />
             <xs:attribute name="title" type="xs:string" />
-            <xs:attribute name="empty-form-data-message" type="xs:string" />
             <xs:attribute name="tooltip" type="xs:string" />
             <xs:attribute name="list-name" type="xs:string">
                 <xs:annotation>
@@ -328,7 +327,6 @@ under the License.
             <xs:attribute name="style" type="xs:string" />
             <xs:attribute name="focus-field-name" type="xs:string" />
             <xs:attribute name="title" type="xs:string" />
-            <xs:attribute name="empty-form-data-message" type="xs:string" />
             <xs:attribute name="tooltip" type="xs:string" />
             <xs:attribute name="list-name" type="xs:string">
                 <xs:annotation>

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java Fri Oct 21 17:31:37 2016
@@ -147,7 +147,7 @@ public abstract class ModelForm extends
     private final String formWidgetAreaStyle;
     private final boolean groupColumns;
     private final String headerRowStyle;
-    private boolean hideHeader;
+    private final boolean hideHeader;
     private final String itemIndexSeparator;
     private final List<String> lastOrderFields;
     private final String listEntryName;
@@ -184,7 +184,6 @@ public abstract class ModelForm extends
     private final String targetType;
     private final FlexibleStringExpander targetWindowExdr;
     private final String title;
-    private final String emptyFormDataMessage;
     private final String tooltip;
     private final String type;
     private final boolean useRowSubmit;
@@ -242,13 +241,6 @@ public abstract class ModelForm extends
             title = parentModel.title;
         }
         this.title = title;
-        String emptyFormDataMessage = formElement.getAttribute("empty-form-data-message");
-        if (emptyFormDataMessage.isEmpty() && parentModel != null) {
-            emptyFormDataMessage = parentModel.emptyFormDataMessage;
-        } else if (emptyFormDataMessage.isEmpty()) {
-            emptyFormDataMessage = "No records found";
-        }
-        this.emptyFormDataMessage = emptyFormDataMessage;
         String tooltip = formElement.getAttribute("tooltip");
         if (tooltip.isEmpty() && parentModel != null) {
             tooltip = parentModel.tooltip;
@@ -1023,10 +1015,6 @@ public abstract class ModelForm extends
     public boolean getHideHeader() {
         return this.hideHeader;
     }
-    public boolean setHideHeader(Boolean hideHeader) {
-        this.hideHeader = hideHeader;
-        return hideHeader;
-    }
 
     public String getItemIndexSeparator() {
         if (UtilValidate.isNotEmpty(this.itemIndexSeparator)) {
@@ -1396,10 +1384,6 @@ public abstract class ModelForm extends
         return this.title;
     }
 
-    public String getEmptyFormDataMessage() {
-        return this.emptyFormDataMessage;
-    }
-
     public String getTooltip() {
         return this.tooltip;
     }

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java Fri Oct 21 17:31:37 2016
@@ -48,7 +48,6 @@ import org.apache.ofbiz.widget.model.*;
 import org.apache.ofbiz.widget.model.ModelForm.FieldGroup;
 import org.apache.ofbiz.widget.model.ModelForm.FieldGroupBase;
 import org.apache.ofbiz.widget.model.ModelFormField;
-import org.apache.ofbiz.widget.model.ModelFormField.DisplayField;
 
 /**
  * A form rendering engine.
@@ -926,12 +925,9 @@ public class FormRenderer {
         formStringRenderer.renderFormatListWrapperOpen(writer, context, modelForm);
 
         int numOfColumns = 0;
-        this.checkFormDataAndSetHeader(context);
         // ===== render header row =====
         if (!modelForm.getHideHeader()) {
             numOfColumns = this.renderHeaderRow(writer, context);
-        } else {
-            formStringRenderer.renderEmptyFormDataMessage(writer, context, modelForm);
         }
 
         // ===== render the item rows =====
@@ -955,12 +951,9 @@ public class FormRenderer {
         formStringRenderer.renderFormatListWrapperOpen(writer, context, modelForm);
 
         int numOfColumns = 0;
-        this.checkFormDataAndSetHeader(context);
         // ===== render header row =====
         if (!modelForm.getHideHeader()) {
             numOfColumns = this.renderHeaderRow(writer, context);
-        } else {
-            formStringRenderer.renderEmptyFormDataMessage(writer, context, modelForm);
         }
 
         // ===== render the item rows =====
@@ -974,32 +967,6 @@ public class FormRenderer {
 
     }
 
-    private void checkFormDataAndSetHeader(Map<String, Object> context) {
-        String lookupName = modelForm.getListName();
-        Object obj = context.get(lookupName);
-        if (obj == null) {
-            if (Debug.verboseOn())
-                Debug.logVerbose("No object for list or iterator name [" + lookupName + "] found, so not rendering rows.", module);
-            return;
-        }
-        // if list is empty, do not render rows
-        Iterator<?> iter = null;
-        if (obj instanceof Iterator<?>) {
-            iter = (Iterator<?>) obj;
-        } else if (obj instanceof List<?>) {
-            iter = ((List<?>) obj).listIterator();
-        }
-        int itemIndex = -1;
-        Object item = null;
-        while ((item = safeNext(iter)) != null) {
-            itemIndex++;
-            break;
-        }
-        if (itemIndex < 0) {
-            modelForm.setHideHeader(true);
-        }
-    }
-
     private void renderSingleFormString(Appendable writer, Map<String, Object> context,
             int positions) throws IOException {
         List<ModelFormField> tempFieldList = new LinkedList<ModelFormField>();

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormStringRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormStringRenderer.java?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormStringRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormStringRenderer.java Fri Oct 21 17:31:37 2016
@@ -99,5 +99,4 @@ public interface FormStringRenderer {
     public void renderContainerFindField(Appendable writer, Map<String, Object> context, ModelFormField.ContainerField containerField) throws IOException;
     public void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException;
     public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException;
-    public void renderEmptyFormDataMessage(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
 }

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java Fri Oct 21 17:31:37 2016
@@ -438,7 +438,4 @@ public class FoFormRenderer extends Html
 
     public void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField) throws IOException {
     }
-
-    public void renderEmptyFormDataMessage(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
-    }
 }

Modified: ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Fri Oct 21 17:31:37 2016
@@ -1538,16 +1538,7 @@ public final class MacroFormRenderer imp
             renderEndingBoundaryComment(writer, "Grid Widget - Grid Element", modelForm);
         }
     }
-
-    public void renderEmptyFormDataMessage(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderEmptyFormDataMessage");
-        sr.append(" message=\"");
-        sr.append(modelForm.getEmptyFormDataMessage());
-        sr.append("\" />");
-        executeMacro(writer, sr.toString());
-    }
-
+    
     public void renderFormatHeaderOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         StringWriter sr = new StringWriter();
         sr.append("<@renderFormatHeaderOpen ");

Modified: ofbiz/trunk/framework/widget/templates/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/HtmlFormMacroLibrary.ftl?rev=1766080&r1=1766079&r2=1766080&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/HtmlFormMacroLibrary.ftl Fri Oct 21 17:31:37 2016
@@ -326,10 +326,6 @@ under the License.
   </label><#t/>
 </#macro>
 
-<#macro renderEmptyFormDataMessage message>
-  <h3><#if message?has_content>${message}</#if></h3>
-</#macro>
-
 <#macro renderSingleFormFieldTitle></#macro>
 
 <#macro renderFormOpen linkUrl formType targetWindow containerId containerStyle autocomplete name viewIndexField viewSizeField viewIndex viewSize useRowSubmit>