You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "WeizhanGuo (JIRA)" <ji...@apache.org> on 2009/03/06 04:35:56 UTC

[jira] Updated: (OFBIZ-1235) Create the theme for the form widget

     [ https://issues.apache.org/jira/browse/OFBIZ-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

WeizhanGuo updated OFBIZ-1235:
------------------------------

    Description: 
We are creating the "theme" for the ofbiz widget form, why we create this? We found it's very difficultty to extend the current form widget, all the widget generation code is hard code in HtmlFormRenderer or others, we need to change those file if we want to add some function to the form, like ajax.
 
And yes, we have some ajax function in ofbiz now, but the code of HtmlFormRenderer with ajax is much harder for understanding. like the code: "if(ajaxEnabled)". In fact , we want to implement the dojo function in ofbiz without mess.
 
So we decide to extract the hard code is responsible for the html form generation  to the ftl files, like the struts2 does. If you know well about struts2, then you will also know the form theme we are creating. 
 
Those ftl files is responsible for the html code generation, like text.ftl:
<input type="text"<#rt/>
 name="${rp.name?default("")?html}"<#rt/>
<#include "class.ftl" />
<#if rp.value?exists>
<#escape x as x?html> value="${rp.value}" </#escape> <#rt/>
</#if>
<#if rp.textSize?exists>
 size="${rp.textSize?html}"<#rt/>
</#if>
<#if rp.maxlength?exists>
 maxlength="${rp.maxlength?html}"<#rt/>
</#if>
<#if rp.textId?exists>
 id="${rp.textId?html}"<#rt/>
</#if>
<#if rp.event?exists && rp.action?exists>
 ${rp.event?html}="${rp.action?html}"<#rt/>
</#if>
<#if rp.clientAutocomplete?exists && !rp.clientAutocomplete>
  autocomplete="off"<#rt/>
</#if>
/>
Then, in the renderTextField method, we use the ftl file to generate the html text instand of the hard code. 
 
Finally,we can have different themes like simple/text.ftl  ajax/text.ftl  and dojo/text.ftl. By setting the theme with code "theme=simple/ajax/dojo " , the corresponding theme file like text.ftl will be loaded. The attachment is the dojo theme capture.

  was:
This is the AJAX featur for the widget egine, I'd like the widget engine can deal with the dojo like the struts2 integrate with dojo, when you want to use the AJAX function just add " theme='ajax' "  in the form elements. and then the form have the AJAX function like submit it without refresh all page, auto validation the input, make the table pages AJAXed and so on. 


        Summary: Create the theme for the form widget  (was: Widget Engine integrate with dojo)

> Create the theme for the form widget
> ------------------------------------
>
>                 Key: OFBIZ-1235
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1235
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: all the platform
>            Reporter: WeizhanGuo
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>
> We are creating the "theme" for the ofbiz widget form, why we create this? We found it's very difficultty to extend the current form widget, all the widget generation code is hard code in HtmlFormRenderer or others, we need to change those file if we want to add some function to the form, like ajax.
>  
> And yes, we have some ajax function in ofbiz now, but the code of HtmlFormRenderer with ajax is much harder for understanding. like the code: "if(ajaxEnabled)". In fact , we want to implement the dojo function in ofbiz without mess.
>  
> So we decide to extract the hard code is responsible for the html form generation  to the ftl files, like the struts2 does. If you know well about struts2, then you will also know the form theme we are creating. 
>  
> Those ftl files is responsible for the html code generation, like text.ftl:
> <input type="text"<#rt/>
>  name="${rp.name?default("")?html}"<#rt/>
> <#include "class.ftl" />
> <#if rp.value?exists>
> <#escape x as x?html> value="${rp.value}" </#escape> <#rt/>
> </#if>
> <#if rp.textSize?exists>
>  size="${rp.textSize?html}"<#rt/>
> </#if>
> <#if rp.maxlength?exists>
>  maxlength="${rp.maxlength?html}"<#rt/>
> </#if>
> <#if rp.textId?exists>
>  id="${rp.textId?html}"<#rt/>
> </#if>
> <#if rp.event?exists && rp.action?exists>
>  ${rp.event?html}="${rp.action?html}"<#rt/>
> </#if>
> <#if rp.clientAutocomplete?exists && !rp.clientAutocomplete>
>   autocomplete="off"<#rt/>
> </#if>
> />
> Then, in the renderTextField method, we use the ftl file to generate the html text instand of the hard code. 
>  
> Finally,we can have different themes like simple/text.ftl  ajax/text.ftl  and dojo/text.ftl. By setting the theme with code "theme=simple/ajax/dojo " , the corresponding theme file like text.ftl will be loaded. The attachment is the dojo theme capture.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.