Author: jonesde
Date: Sun Jan 10 09:20:18 2010
New Revision: 897606

URL: http://svn.apache.org/viewvc?rev=897606&view=rev
Log:
Small improvement to allow ignoring of errors in form widget action services, 
mostly for those used to get info to display and if they fail it's not a big 
deal

Modified:
    ofbiz/trunk/framework/widget/dtd/widget-form.xsd
    
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.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=897606&r1=897605&r2=897606&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Sun Jan 10 09:20:18 2010
@@ -1527,6 +1527,14 @@
         </xs:attribute>
         <!-- this is deprecated and should not be used; use 
result-map-list-name instead: <xs:attribute type="xs:string" 
name="result-map-list-iterator-name"/> -->
         <xs:attribute type="xs:string" name="result-map-list"/>
+        <xs:attribute name="ignore-error" default="false">
+            <xs:simpleType>
+                <xs:restriction base="xs:token">
+                    <xs:enumeration value="true"/>
+                    <xs:enumeration value="false"/>
+                </xs:restriction>
+            </xs:simpleType>
+        </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="set" substitutionGroup="AllActions">
         <xs:complexType>

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=897606&r1=897605&r2=897606&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java 
(original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java 
Sun Jan 10 09:20:18 2010
@@ -2020,7 +2020,7 @@
         int viewIndex = modelForm.getViewIndex(context);
         int viewSize = modelForm.getViewSize(context);
         int listSize = modelForm.getListSize(context);
-
+        
         int lowIndex = modelForm.getLowIndex(context);
         int highIndex = modelForm.getHighIndex(context);
         int actualPageSize = modelForm.getActualPageSize(context);

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=897606&r1=897605&r2=897606&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 Jan 10 09:20:18 2010
@@ -304,6 +304,7 @@
         protected FlexibleStringExpander autoFieldMapExdr;
         protected FlexibleStringExpander resultMapListNameExdr;
         protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
+        protected boolean ignoreError = false;
 
         public Service(ModelForm modelForm, Element serviceElement) {
             super (modelForm, serviceElement);
@@ -329,6 +330,7 @@
             }
 
             this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
+            this.ignoreError = 
"true".equals(serviceElement.getAttribute("ignore-error"));
         }
 
         @Override
@@ -383,7 +385,9 @@
             } catch (GenericServiceException e) {
                 String errMsg = "Error in form [" + this.modelForm.getName() + 
"] calling service with name [" + serviceNameExpanded + "]: " + e.toString();
                 Debug.logError(e, errMsg, module);
-                throw new IllegalArgumentException(errMsg);
+                if (!this.ignoreError) {
+                    throw new IllegalArgumentException(errMsg);
+                }
             }
         }
     }

Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=897606&r1=897605&r2=897606&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Sun Jan 10 
09:20:18 2010
@@ -245,7 +245,7 @@
     </td>
 </#macro>
 <#macro renderFormatHeaderRowFormCellTitleSeparator style isLast>
-<#if style?has_content><sapn class="${style}"></#if> - <#if 
style?has_content></span></#if>
+<#if style?has_content><span class="${style}"></#if> - <#if 
style?has_content></span></#if>
 </#macro>
 
 <#macro renderFormatItemRowOpen formName itemIndex altRowStyles evenRowStyle 
oddRowStyle>
@@ -429,6 +429,7 @@
     <script language="JavaScript" 
type="text/javascript">ajaxAutoCompleter('${ajaxUrl}');</script><#t/>
 </#if>
 </#macro>
+
 <#macro renderNextPrev paginateStyle paginateFirstStyle viewIndex highIndex 
listSize viewSize ajaxEnabled javaScriptEnabled ajaxFirstUrl firstUrl 
paginateFirstLabel paginatePreviousStyle ajaxPreviousUrl previousUrl 
paginatePreviousLabel pageLabel ajaxSelectUrl selectUrl ajaxSelectSizeUrl 
selectSizeUrl commonDisplaying paginateNextStyle ajaxNextUrl nextUrl 
paginateNextLabel paginateLastStyle ajaxLastUrl lastUrl paginateLastLabel 
paginateViewSizeLabel>
 <#if listSize gt viewSize>
 <div class="${paginateStyle}">&nbsp; <ul>
@@ -453,9 +454,11 @@
 </ul></div><br/>
 </#if>
 </#macro>
+
 <#macro renderFileField className alert name value size maxlength 
autocomplete><input type="file" <@renderClass className alert /><#if 
name?has_content> name="${name}"</#if><#if value?has_content> 
value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if 
maxlength?has_content> maxlength="${maxlength}"</#if><#if 
autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#macro>
 <#macro renderPasswordField className alert name value size maxlength id 
autocomplete><input type="password" <@renderClass className alert /><#if 
name?has_content> name="${name}"</#if><#if value?has_content> 
value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if 
maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> 
id="${id}"</#if><#if autocomplete?has_content> 
autocomplete="off"</#if>/></#macro>
 <#macro renderImageField value border width height event action><img<#if 
value?has_content> src="${value}"</#if><#if border?has_content> 
border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if 
height?has_content> height="${height}"</#if><#if event?has_content> 
${rp.event?html}="${action}" </#if>/></#macro>
+
 <#macro renderBanner style leftStyle rightStyle leftText text rightText>
 <table width="100%">  <tr><#rt/>
 <#if leftText?has_content><td align="left"><#if leftStyle?has_content><div 
class="${leftStyle}"></#if>${leftText}<#if 
leftStyle?has_content></div></#if></td><#rt/></#if>
@@ -463,6 +466,7 @@
 <#if rightText?has_content><td align="right"><#if rightStyle?has_content><div 
class="${rightStyle}"></#if>${rightText}<#if 
rightStyle?has_content></div></#if></td><#rt/></#if>
 </tr> </table>
 </#macro>
+
 <#macro renderContainerField id><div id="${id?if_exists}"/></#macro>
 
 <#macro renderFieldGroupOpen style id title collapsed collapsibleAreaId 
collapsible expandToolTip collapseToolTip>
@@ -476,6 +480,7 @@
 <div id="${collapsibleAreaId}" class="fieldgroup-body" <#if collapsed && 
collapsible> style="display: none;"</#if>>
 </#if>
 </#macro>
+
 <#macro renderFieldGroupClose style id title><#if style?has_content || 
id?has_content || title?has_content></div></div></#if></#macro>
 
 <#macro renderHyperlinkTitle name title showSelectAll="N"><#if 
title?has_content>${title}<br/></#if><#if showSelectAll="Y"><input 
type="checkbox" name="selectAll" value="Y" onclick="javascript:toggleAll(this, 
'${name}');"/></#if></#macro>
@@ -483,12 +488,15 @@
 <#macro formatBoundaryComment boundaryType widgetType widgetName><!-- 
${boundaryType}  ${widgetType}  ${widgetName} --></#macro>
 
 <#macro renderTooltip tooltip tooltipStyle><#if tooltip?has_content><span 
class="<#if 
tooltipStyle?has_content>${tooltipStyle}<#else>tooltip</#if>">${tooltip}</span><#rt/></#if></#macro>
+
 <#macro renderClass className="" alert="">
 <#if className?has_content || (alert?has_content && alert=="true")> 
class="${className}<#if alert?has_content && alert=="true"> alert</#if>" </#if>
 </#macro>
+
 <#macro renderAsterisks requiredField requiredStyle>
 <#if requiredField=="true"><#if !requiredStyle?has_content>*</#if></#if>
 </#macro>
+
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow><form 
method="post" action="${actionUrl}" <#if 
targetWindow?has_content>target="${targetWindow}"</#if> 
onsubmit="javascript:submitFormDisableSubmits(this)" name="${name}"><#list 
parameters as parameter><input name="${parameter.name}" 
value="${parameter.value}" type="hidden"/></#list></form></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc 
description confirmation><a <#if 
linkStyle?has_content>class="${linkStyle}"</#if> 
href="javascript:document.${hiddenFormName}.submit()"<#if action?has_content && 
event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> 
onclick="return confirm('${confirmation}')"</#if>><#if imgSrc?has_content><img 
src="${imgSrc}"/></#if>${description}</a></#macro>
 <#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc 
linkUrl targetWindow description confirmation><a <#if 
linkStyle?has_content>class="${linkStyle}"</#if> href="${linkUrl}"<#if 
targetWindow?has_content> target="${targetWindow}"</#if><#if action?has_content 
&& event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> 
onclick="return confirm('${confirmation}')"</#if>><#if imgSrc?has_content><img 
src="${imgSrc}"/></#if>${description}</a></#macro>


Reply via email to