You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Nicolas Malin <ma...@librenberry.net> on 2010/02/02 10:58:08 UTC

Re: svn commit: r899815 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Hi David,
I have a problem with this commit. In neogia accounting component I use 
many list form with conditionnal fields  :

  <field name="debit" entry-name="amount" use-when="'${isDebit}' == 
'Y'"  widget-area-style="align-text"><display type="currency" 
currency="${currency}"/></field>
  <field name="debit" use-when="'${isDebit}' == 'N'"><display 
description=""/></field>
  <field name="credit" entry-name="amount" use-when="'${isDebit}' == 
'N'" widget-area-style="align-text"><display type="currency" 
currency="${currency}"/></field>
  <field name="credit" use-when="'${isDebit}' == 'Y'"><display 
description=""/></field>

Before the commit I had :
Debit | Credit
-----------------------
100    |
          |  100

Now I have :
Debit | Credit |
-------------------------------------------------
100    |             |             |
          |             |             | 100

I think they missing an information on field as "force-display" with 
defaut value has "false".
What did you tried to achieve with your commit ?

Nicolas

jonesde@apache.org a écrit :
> Author: jonesde
> Date: Fri Jan 15 21:19:21 2010
> New Revision: 899815
>
> URL: http://svn.apache.org/viewvc?rev=899815&view=rev
> Log:
> Fixed bug with form widget and the use-when attribute on fields which caused the header cell to be rendered but no cells would be rendered on certain rows causing the columns to not be aligned; now the cell is rendered, but nothing in it
>
> Modified:
>     ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>
> 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=899815&r1=899814&r2=899815&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 Fri Jan 15 21:19:21 2010
> @@ -1511,7 +1511,9 @@
>                              break;
>                          }
>  
> -                        if (!modelFormField.shouldUse(localContext)) {
> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
> +                                !modelFormField.shouldUse(localContext)) {
>                              continue;
>                          }
>                          innerDisplayHyperlinkFieldsBegin.add(modelFormField);
> @@ -1532,7 +1534,9 @@
>                              continue;
>                          }
>  
> -                        if (!modelFormField.shouldUse(localContext)) {
> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
> +                                !modelFormField.shouldUse(localContext)) {
>                              continue;
>                          }
>                          innerFormFields.add(modelFormField);
> @@ -1552,7 +1556,9 @@
>                              continue;
>                          }
>  
> -                        if (!modelFormField.shouldUse(localContext)) {
> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
> +                                !modelFormField.shouldUse(localContext)) {
>                              continue;
>                          }
>                          innerDisplayHyperlinkFieldsEnd.add(modelFormField);
> @@ -1613,7 +1619,9 @@
>              } else {
>                  formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>              }
> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +            }
>              formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>          }
>  
> @@ -1636,7 +1644,10 @@
>                      formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
>                  }
>                  // render field widget
> -                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +                if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
> +                    modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +                }
> +                
>                  if (separateColumns || modelFormField.getSeparateColumn()) {
>                      formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>                  }
> @@ -1659,7 +1670,9 @@
>              } else {
>                  formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>              }
> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
> +            }
>              formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>          }
>  
>
>
>   


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: svn commit: r899815 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by Nicolas Malin <ma...@librenberry.net>.
David E Jones a écrit :
> Sorry about this Nicholas. I'll make a change so that when considering whether or not to create a column header it also looks at the field name to make sure there is only one column per field name.
>   
No problem David, I just surprise ;)
> One caveat will be that if there are two fields with the same name and use-when conditions that can both be true at the same time then there will be a problem with column alignment for that row...
>   
Exactly, but the developer must be careful in what he wrote.
thanks for this return

Nicolas
> -David
>
>
> On Feb 2, 2010, at 3:58 AM, Nicolas Malin wrote:
>
>   
>> Hi David,
>> I have a problem with this commit. In neogia accounting component I use many list form with conditionnal fields  :
>>
>> <field name="debit" entry-name="amount" use-when="'${isDebit}' == 'Y'"  widget-area-style="align-text"><display type="currency" currency="${currency}"/></field>
>> <field name="debit" use-when="'${isDebit}' == 'N'"><display description=""/></field>
>> <field name="credit" entry-name="amount" use-when="'${isDebit}' == 'N'" widget-area-style="align-text"><display type="currency" currency="${currency}"/></field>
>> <field name="credit" use-when="'${isDebit}' == 'Y'"><display description=""/></field>
>>
>> Before the commit I had :
>> Debit | Credit
>> -----------------------
>> 100    |
>>         |  100
>>
>> Now I have :
>> Debit | Credit |
>> -------------------------------------------------
>> 100    |             |             |
>>         |             |             | 100
>>
>> I think they missing an information on field as "force-display" with defaut value has "false".
>> What did you tried to achieve with your commit ?
>>
>> Nicolas
>>
>> jonesde@apache.org a écrit :
>>     
>>> Author: jonesde
>>> Date: Fri Jan 15 21:19:21 2010
>>> New Revision: 899815
>>>
>>> URL: http://svn.apache.org/viewvc?rev=899815&view=rev
>>> Log:
>>> Fixed bug with form widget and the use-when attribute on fields which caused the header cell to be rendered but no cells would be rendered on certain rows causing the columns to not be aligned; now the cell is rendered, but nothing in it
>>>
>>> Modified:
>>>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>>>
>>> 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=899815&r1=899814&r2=899815&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 Fri Jan 15 21:19:21 2010
>>> @@ -1511,7 +1511,9 @@
>>>                             break;
>>>                         }
>>> -                        if (!modelFormField.shouldUse(localContext)) {
>>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>>> +                                !modelFormField.shouldUse(localContext)) {
>>>                             continue;
>>>                         }
>>>                         innerDisplayHyperlinkFieldsBegin.add(modelFormField);
>>> @@ -1532,7 +1534,9 @@
>>>                             continue;
>>>                         }
>>> -                        if (!modelFormField.shouldUse(localContext)) {
>>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>>> +                                !modelFormField.shouldUse(localContext)) {
>>>                             continue;
>>>                         }
>>>                         innerFormFields.add(modelFormField);
>>> @@ -1552,7 +1556,9 @@
>>>                             continue;
>>>                         }
>>> -                        if (!modelFormField.shouldUse(localContext)) {
>>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>>> +                                !modelFormField.shouldUse(localContext)) {
>>>                             continue;
>>>                         }
>>>                         innerDisplayHyperlinkFieldsEnd.add(modelFormField);
>>> @@ -1613,7 +1619,9 @@
>>>             } else {
>>>                 formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>>>             }
>>> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>>> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +            }
>>>             formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>>         }
>>> @@ -1636,7 +1644,10 @@
>>>                     formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
>>>                 }
>>>                 // render field widget
>>> -                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +                if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>>> +                    modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +                }
>>> +                                 if (separateColumns || modelFormField.getSeparateColumn()) {
>>>                     formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>>                 }
>>> @@ -1659,7 +1670,9 @@
>>>             } else {
>>>                 formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>>>             }
>>> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>>> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>>> +            }
>>>             formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>>         }
>>>
>>>
>>>  
>>>       
>> -- 
>> Nicolas MALIN
>> Consultant
>> Tél : 06.17.66.40.06
>> Site projet : http://www.neogia.org/
>> -------
>> Société LibrenBerry
>> Tél : 02.48.02.56.12
>> Site : http://www.librenberry.net/
>>
>>     
>
>   


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: svn commit: r899815 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java

Posted by David E Jones <de...@me.com>.
Sorry about this Nicholas. I'll make a change so that when considering whether or not to create a column header it also looks at the field name to make sure there is only one column per field name.

One caveat will be that if there are two fields with the same name and use-when conditions that can both be true at the same time then there will be a problem with column alignment for that row...

-David


On Feb 2, 2010, at 3:58 AM, Nicolas Malin wrote:

> Hi David,
> I have a problem with this commit. In neogia accounting component I use many list form with conditionnal fields  :
> 
> <field name="debit" entry-name="amount" use-when="'${isDebit}' == 'Y'"  widget-area-style="align-text"><display type="currency" currency="${currency}"/></field>
> <field name="debit" use-when="'${isDebit}' == 'N'"><display description=""/></field>
> <field name="credit" entry-name="amount" use-when="'${isDebit}' == 'N'" widget-area-style="align-text"><display type="currency" currency="${currency}"/></field>
> <field name="credit" use-when="'${isDebit}' == 'Y'"><display description=""/></field>
> 
> Before the commit I had :
> Debit | Credit
> -----------------------
> 100    |
>         |  100
> 
> Now I have :
> Debit | Credit |
> -------------------------------------------------
> 100    |             |             |
>         |             |             | 100
> 
> I think they missing an information on field as "force-display" with defaut value has "false".
> What did you tried to achieve with your commit ?
> 
> Nicolas
> 
> jonesde@apache.org a écrit :
>> Author: jonesde
>> Date: Fri Jan 15 21:19:21 2010
>> New Revision: 899815
>> 
>> URL: http://svn.apache.org/viewvc?rev=899815&view=rev
>> Log:
>> Fixed bug with form widget and the use-when attribute on fields which caused the header cell to be rendered but no cells would be rendered on certain rows causing the columns to not be aligned; now the cell is rendered, but nothing in it
>> 
>> Modified:
>>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>> 
>> 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=899815&r1=899814&r2=899815&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 Fri Jan 15 21:19:21 2010
>> @@ -1511,7 +1511,9 @@
>>                             break;
>>                         }
>> -                        if (!modelFormField.shouldUse(localContext)) {
>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>> +                                !modelFormField.shouldUse(localContext)) {
>>                             continue;
>>                         }
>>                         innerDisplayHyperlinkFieldsBegin.add(modelFormField);
>> @@ -1532,7 +1534,9 @@
>>                             continue;
>>                         }
>> -                        if (!modelFormField.shouldUse(localContext)) {
>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>> +                                !modelFormField.shouldUse(localContext)) {
>>                             continue;
>>                         }
>>                         innerFormFields.add(modelFormField);
>> @@ -1552,7 +1556,9 @@
>>                             continue;
>>                         }
>> -                        if (!modelFormField.shouldUse(localContext)) {
>> +                        // if this is a list or multi form don't skip here because we don't want to skip the table cell, will skip the actual field later
>> +                        if (!"list".equals(this.getType()) && !"multi".equals(this.getType()) &&
>> +                                !modelFormField.shouldUse(localContext)) {
>>                             continue;
>>                         }
>>                         innerDisplayHyperlinkFieldsEnd.add(modelFormField);
>> @@ -1613,7 +1619,9 @@
>>             } else {
>>                 formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>>             }
>> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +            }
>>             formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>         }
>> @@ -1636,7 +1644,10 @@
>>                     formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, 1);
>>                 }
>>                 // render field widget
>> -                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +                if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>> +                    modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +                }
>> +                                 if (separateColumns || modelFormField.getSeparateColumn()) {
>>                     formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>                 }
>> @@ -1659,7 +1670,9 @@
>>             } else {
>>                 formStringRenderer.renderFormatItemRowCellOpen(writer, localContext, this, modelFormField, numOfColumnsToSpan);
>>             }
>> -            modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +            if ((!"list".equals(this.getType()) && !"multi".equals(this.getType())) || modelFormField.shouldUse(localContext)) {
>> +                modelFormField.renderFieldString(writer, localContext, formStringRenderer);
>> +            }
>>             formStringRenderer.renderFormatItemRowCellClose(writer, localContext, this, modelFormField);
>>         }
>> 
>> 
>>  
> 
> 
> -- 
> Nicolas MALIN
> Consultant
> Tél : 06.17.66.40.06
> Site projet : http://www.neogia.org/
> -------
> Société LibrenBerry
> Tél : 02.48.02.56.12
> Site : http://www.librenberry.net/
>