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 <ni...@nereide.fr> on 2017/07/22 23:40:52 UTC

[Discussion] Xml definition file for theme

Hello,

With the common-theme and my idea to implement a specific model to 
explain a theme, I would be sharing my recent think:

This is an example of xml definition for the common-theme, I set a small 
description to explain each block

##################################

<theme name="common"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-theme.xsd">
     <visual-themes><!--List of visual theme contains to this theme components-->
         <visual-theme id="COMMON"/>
     </visual-themes>
     <widget-properties><!--Transversal properties relative to ofbiz widget component-->
         <default-view-size value="20"/>
         <autocompleter
                 default-view-size="10"
                 default-min-lenght="2"
                 default-delay="300"
                 display-return-field="true"/>
         <lookup
                 position="topleft"
                 width="640"
                 height="500"/>
         <layered-modal
                 width="800"
                 height="600"/>
     </widget-properties>

     <theme-properties> <!--specific properties dedicate to this theme -->
         <property name="jgrowl.position" value="center" type="String"/><!--possible value: top-left, top-right, bottom-left, bottom-right, center-->
         <property name="jgrowl.width" value="800" type="Integer"/>
         <property name="jgrowl.height" value="" type="Integer"/>
         <property name="jgrowl.speed" value="100" type="Integer"/>
     </theme-properties>

     <templates><!-- Freemarker template use by this theme to render widget model-->
         <template name="screen" type="html" content-type="UTF-8" encoding="none" encoder="html" compress="false">
             <template-file widget="screen" location="component://common-theme/template/macro/HtmlScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/HtmlFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/HtmlTreeMacroLibrary.ftl"/>
             <template-file widget="menu" location="component://common-theme/template/macro/HtmlMenuMacroLibrary.ftl"/>
         </template>
         <template name="screenxml" type="xml" content-type="UTF-8" encoding="none" encoder="xml">
             <template-file widget="screen" location="component://common-theme/template/macro/XmlScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/XmlFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/XmlTreeMacroLibrary.ftl"/>
         </template>
         <template name="screenxls" type="xls" content-type="application/vnd.ms-excel" encoding="none" encoder="html">
             <template-file widget="screen" location="component://common-theme/template/macro/XlsScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/XlsFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/XlsTreeMacroLibrary.ftl"/>
         </template>
         <template name="screenfop" type="xsl-fo" content-type="application/pdf" encoding="none">
             <template-file widget="screen" location="component://common-theme/template/macro/FoScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/FoFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/FoTreeMacroLibrary.ftl"/>
         </template>
         <template name="screentext" type="text" content-type="UTF-8" encoding="none">
             <template-file widget="screen" location="component://common-theme/template/macro/TextScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/TextFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/TextTreeMacroLibrary.ftl"/>
         </template>
         <template name="screencsv" type="csv" content-type="UTF-8" encoding="none" encoder="xml">
             <template-file widget="screen" location="component://common-theme/template/macro/CsvScreenMacroLibrary.ftl"/>
             <template-file widget="form" location="component://common-theme/template/macro/CsvFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/CsvTreeMacroLibrary.ftl"/>
         </template>
     </templates>

     <common-screens><!--list all common screen and decorator global to each application that each theme can be surcharge or not and use the screen present on common theme-->
         <structural-decorator default-location="component://common-theme/widget/CommonScreens.xml">
             <decorator name="GlobalDecorator"/>
             <decorator name="LookupDecorator"/>
             <decorator name="SimpleDecorator"/>
         </structural-decorator>
         <embed-decorator default-location="component://common-theme/widget/CommonEmbedScreens.xml">
             <decorator name="FindScreenDecorator"/>
             <decorator name="EditScreenDecorator"/>
             <decorator name="ListAndEditScreenDecorator"/>
         </embed-decorator>
         <general-screen default-location="component://common-theme/widget/CommonDedicateScreens.xml">
             <screen name="geoChart"/>
             <screen name="EventMessages"/>
             <screen name="countries"/>
         </general-screen>
     </common-screens>

</theme>

#######################################

Now if I want create my specific theme with only some particularity on 
html rendering et some decorator I just define this :

#######################################

<theme name="mytheme"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-theme.xsd">
     <visual-themes>
         <visual-theme id="MYTHEME"/>
     </visual-themes>
     <extend location="component://common-theme/theme.xml"/>
     <theme-properties>
         <property name="jgrowl.position" value="top-left" type="String"/>
     </theme-properties>
     <templates>
         <template name="screen" type="html" content-type="UTF-8" encoding="none" encoder="html" compress="false">
             <template-file widget="form" location="component://mytheme/template/macro/HtmlFormMacroLibrary.ftl"/>
         </template>
     </templates>
     <common-screens>
         <structural-decorator>
             <decorator name="SimpleDecorator" location="component://mytheme/widget/MyDecoratorScreens.xml"/>
         </structural-decorator>
         <general-screen >
             <screen name="EventMessages" location="component://mytheme/widget/MyTemplateScreens.xml"/>
         </general-screen>
     </common-screens>
</theme>

#######################################

With the extend elemet, mytheme resolve all information from 
common-theme and surchage only what is define on his xml definition file.

I think with this type of structure we can have :

* a base de define a screen API for homogenise the IHM
* permit to a theme to surcharge only what he want (template rendering, 
widget properties, screen present on API)
* remove all theme resource information and load it direclty on the 
decorator (this slim the decorator complexity, slim data to load and 
make more easier to follow what implement a theme)

If you have a few time to sharing your remark, It's the last big point 
to continue and maybe load the common-theme on trunk :)

Nicolas

-- 
logoNrd <https://nereide.fr/>
	Nicolas Malin
The apache way <http://theapacheway.com/> : *Openness* Technical 
decisions are made publicly
information@nereide.fr
8 rue des Déportés 37000 TOURS, 02 47 50 30 54

Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way 
<http://theapacheway.com/>|ofbiz-fr <http://www.ofbiz-fr.org/>|réseau LE 
<http://www.libre-entreprise.org/>

Re: [Discussion] Xml definition file for theme

Posted by Taher Alkhateeb <sl...@gmail.com>.
Great, maybe then you should incorporate that work in your JIRA for
the common theme so we can review the whole thing?

On Wed, Jul 26, 2017 at 11:56 AM, Nicolas Malin
<ni...@nereide.fr> wrote:
> Hi Taher,
>
> Yes I did but my idea was more oriented to create a dedicate xsd to like
> service or entity instead of grow the ofbiz-component xsd.
>
> I tried also to add a new resource definition to set the theme/xml path the
> I wasted lot of time on ComponentLoaderConfig without the result waited so I
> was folded onto FileUtil to load the config as demand
>
> Currently I set the theme.xml on the component root  but I think It can move
> on component/widget directory.
>
> Nicolas
>
>
> Le 26/07/2017 à 08:03, Taher Alkhateeb a écrit :
>>
>> Hi Nicolas,
>>
>> Have you considered reusing / enhancing the ofbiz-component.xml model
>> or do you find it insufficient?
>
>

Re: [Discussion] Xml definition file for theme

Posted by Nicolas Malin <ni...@nereide.fr>.
Hi Taher,

Yes I did but my idea was more oriented to create a dedicate xsd to like 
service or entity instead of grow the ofbiz-component xsd.

I tried also to add a new resource definition to set the theme/xml path 
the I wasted lot of time on ComponentLoaderConfig without the result 
waited so I was folded onto FileUtil to load the config as demand

Currently I set the theme.xml on the component root  but I think It can 
move on component/widget directory.

Nicolas

Le 26/07/2017 à 08:03, Taher Alkhateeb a écrit :
> Hi Nicolas,
>
> Have you considered reusing / enhancing the ofbiz-component.xml model
> or do you find it insufficient?


Re: [Discussion] Xml definition file for theme

Posted by Taher Alkhateeb <sl...@gmail.com>.
Hi Nicolas,

Have you considered reusing / enhancing the ofbiz-component.xml model
or do you find it insufficient?

On Sun, Jul 23, 2017 at 2:40 AM, Nicolas Malin <ni...@nereide.fr> wrote:
> Hello,
>
> With the common-theme and my idea to implement a specific model to explain a
> theme, I would be sharing my recent think:
>
> This is an example of xml definition for the common-theme, I set a small
> description to explain each block
>
> ##################################
>
> <theme name="common"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-theme.xsd">
>     <visual-themes><!--List of visual theme contains to this theme
> components-->
>         <visual-theme id="COMMON"/>
>     </visual-themes>
>     <widget-properties><!--Transversal properties relative to ofbiz widget
> component-->
>         <default-view-size value="20"/>
>         <autocompleter
>                 default-view-size="10"
>                 default-min-lenght="2"
>                 default-delay="300"
>                 display-return-field="true"/>
>         <lookup
>                 position="topleft"
>                 width="640"
>                 height="500"/>
>         <layered-modal
>                 width="800"
>                 height="600"/>
>     </widget-properties>
>
>     <theme-properties> <!--specific properties dedicate to this theme -->
>         <property name="jgrowl.position" value="center"
> type="String"/><!--possible value: top-left, top-right, bottom-left,
> bottom-right, center-->
>         <property name="jgrowl.width" value="800" type="Integer"/>
>         <property name="jgrowl.height" value="" type="Integer"/>
>         <property name="jgrowl.speed" value="100" type="Integer"/>
>     </theme-properties>
>
>     <templates><!-- Freemarker template use by this theme to render widget
> model-->
>         <template name="screen" type="html" content-type="UTF-8"
> encoding="none" encoder="html" compress="false">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/HtmlScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/HtmlFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/HtmlTreeMacroLibrary.ftl"/>
>             <template-file widget="menu"
> location="component://common-theme/template/macro/HtmlMenuMacroLibrary.ftl"/>
>         </template>
>         <template name="screenxml" type="xml" content-type="UTF-8"
> encoding="none" encoder="xml">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/XmlScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/XmlFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/XmlTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screenxls" type="xls"
> content-type="application/vnd.ms-excel" encoding="none" encoder="html">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/XlsScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/XlsFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/XlsTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screenfop" type="xsl-fo"
> content-type="application/pdf" encoding="none">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/FoScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/FoFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/FoTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screentext" type="text" content-type="UTF-8"
> encoding="none">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/TextScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/TextFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/TextTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screencsv" type="csv" content-type="UTF-8"
> encoding="none" encoder="xml">
>             <template-file widget="screen"
> location="component://common-theme/template/macro/CsvScreenMacroLibrary.ftl"/>
>             <template-file widget="form"
> location="component://common-theme/template/macro/CsvFormMacroLibrary.ftl"/>
>             <template-file widget="tree"
> location="component://common-theme/template/macro/CsvTreeMacroLibrary.ftl"/>
>         </template>
>     </templates>
>
>     <common-screens><!--list all common screen and decorator global to each
> application that each theme can be surcharge or not and use the screen
> present on common theme-->
>         <structural-decorator
> default-location="component://common-theme/widget/CommonScreens.xml">
>             <decorator name="GlobalDecorator"/>
>             <decorator name="LookupDecorator"/>
>             <decorator name="SimpleDecorator"/>
>         </structural-decorator>
>         <embed-decorator
> default-location="component://common-theme/widget/CommonEmbedScreens.xml">
>             <decorator name="FindScreenDecorator"/>
>             <decorator name="EditScreenDecorator"/>
>             <decorator name="ListAndEditScreenDecorator"/>
>         </embed-decorator>
>         <general-screen
> default-location="component://common-theme/widget/CommonDedicateScreens.xml">
>             <screen name="geoChart"/>
>             <screen name="EventMessages"/>
>             <screen name="countries"/>
>         </general-screen>
>     </common-screens>
>
> </theme>
>
> #######################################
>
> Now if I want create my specific theme with only some particularity on html
> rendering et some decorator I just define this :
>
> #######################################
>
> <theme name="mytheme"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-theme.xsd">
>     <visual-themes>
>         <visual-theme id="MYTHEME"/>
>     </visual-themes>
>     <extend location="component://common-theme/theme.xml"/>
>     <theme-properties>
>         <property name="jgrowl.position" value="top-left" type="String"/>
>     </theme-properties>
>     <templates>
>         <template name="screen" type="html" content-type="UTF-8"
> encoding="none" encoder="html" compress="false">
>             <template-file widget="form"
> location="component://mytheme/template/macro/HtmlFormMacroLibrary.ftl"/>
>         </template>
>     </templates>
>     <common-screens>
>         <structural-decorator>
>             <decorator name="SimpleDecorator"
> location="component://mytheme/widget/MyDecoratorScreens.xml"/>
>         </structural-decorator>
>         <general-screen >
>             <screen name="EventMessages"
> location="component://mytheme/widget/MyTemplateScreens.xml"/>
>         </general-screen>
>     </common-screens>
> </theme>
>
> #######################################
>
> With the extend elemet, mytheme resolve all information from common-theme
> and surchage only what is define on his xml definition file.
>
> I think with this type of structure we can have :
>
> * a base de define a screen API for homogenise the IHM
> * permit to a theme to surcharge only what he want (template rendering,
> widget properties, screen present on API)
> * remove all theme resource information and load it direclty on the
> decorator (this slim the decorator complexity, slim data to load and make
> more easier to follow what implement a theme)
>
> If you have a few time to sharing your remark, It's the last big point to
> continue and maybe load the common-theme on trunk :)
>
> Nicolas
>
> --
> logoNrd <https://nereide.fr/>
>         Nicolas Malin
> The apache way <http://theapacheway.com/> : *Openness* Technical decisions
> are made publicly
> information@nereide.fr
> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>
> Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
> <http://theapacheway.com/>|ofbiz-fr <http://www.ofbiz-fr.org/>|réseau LE
> <http://www.libre-entreprise.org/>

Re: [Discussion] Xml definition file for theme

Posted by Nicolas Malin <ni...@nereide.fr>.
Hello Rishi,

in line

Le 24/07/2017 à 13:35, Rishi Solanki a écrit :
> Hi Nicolas,
>
> Before putting any view on the proposal, I would like to thank you for nice
> proposal with very nice details. Also before making any view, I would like
> to confirm my understanding on the proposal with some questions.
>
> - Here we would like to replace the existing theme setup which is database
> driven. Then how we are going to change the themes on the fly as we do
> currently. Are we going to use content model. Please help me here.
I create a dedicate java object (ModelTheme) to embed all information 
relative to the theme, and put it in user session like the dispatcher 
and delegator. So when you arrive on a page not logged, the default 
ofbiz theme or webapp theme is initialize. When you are logged, your 
preference theme is set in your session.
> - Are we going to replace the theme related properties files and/or db
> entries.
Yes no properties and data are needed. You can manage your theme 
directly on source code, it's more easier to maintain and we don't win 
flexibility to use the db.
> - Also it seems to me the handlers we add in the controller xml file will
> be removed. Is it correct understanding?
I did'nt understand what do you want explain me. They are no relation 
between handler and theme. Themes are logical for all widget technology, 
so for all view rendering of type screen*
> I'm asking these question to understand how we are going to change the
> themes when server is running. I'll go thru the current rendering and get
> back on this asap.
Like service definition, you change the theme.xml file or the differents 
file used by theme and clear the cache.
Or you can create a new theme by extends, load by plugin and clear cache
> One quick comment, please see if it make sense. But I'll surely get back
> with more details on overall topic.
>
> - As mentioned the extend is child element in the structure. Can we change
> it to 'extends' just to follow the practice we have in java, form-widget
> and service definitions also uses the implements.
Sure :) as already say, I'm open to rename or reorganize the xsd because 
it's a brainstorming draft ! So I appreciate it and I will update my git 
branch.

Thanks Rishi for you interest.
>
>
>
> --
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
>
> On Sun, Jul 23, 2017 at 5:10 AM, Nicolas Malin <ni...@nereide.fr>
> wrote:
>
>> Hello,
>>
>> With the common-theme and my idea to implement a specific model to explain
>> a theme, I would be sharing my recent think:
>>
>> This is an example of xml definition for the common-theme, I set a small
>> description to explain each block
>>
>> ##################################
>>
>> <theme name="common"
>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>          xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/
>> widget-theme.xsd">
>>      <visual-themes><!--List of visual theme contains to this theme
>> components-->
>>          <visual-theme id="COMMON"/>
>>      </visual-themes>
>>      <widget-properties><!--Transversal properties relative to ofbiz
>> widget component-->
>>          <default-view-size value="20"/>
>>          <autocompleter
>>                  default-view-size="10"
>>                  default-min-lenght="2"
>>                  default-delay="300"
>>                  display-return-field="true"/>
>>          <lookup
>>                  position="topleft"
>>                  width="640"
>>                  height="500"/>
>>          <layered-modal
>>                  width="800"
>>                  height="600"/>
>>      </widget-properties>
>>
>>      <theme-properties> <!--specific properties dedicate to this theme -->
>>          <property name="jgrowl.position" value="center"
>> type="String"/><!--possible value: top-left, top-right, bottom-left,
>> bottom-right, center-->
>>          <property name="jgrowl.width" value="800" type="Integer"/>
>>          <property name="jgrowl.height" value="" type="Integer"/>
>>          <property name="jgrowl.speed" value="100" type="Integer"/>
>>      </theme-properties>
>>
>>      <templates><!-- Freemarker template use by this theme to render widget
>> model-->
>>          <template name="screen" type="html" content-type="UTF-8"
>> encoding="none" encoder="html" compress="false">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/HtmlScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/HtmlFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/HtmlTreeMacroLibrary.ftl"/>
>>              <template-file widget="menu" location="component://common-t
>> heme/template/macro/HtmlMenuMacroLibrary.ftl"/>
>>          </template>
>>          <template name="screenxml" type="xml" content-type="UTF-8"
>> encoding="none" encoder="xml">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/XmlScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/XmlFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/XmlTreeMacroLibrary.ftl"/>
>>          </template>
>>          <template name="screenxls" type="xls"
>> content-type="application/vnd.ms-excel" encoding="none" encoder="html">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/XlsScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/XlsFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/XlsTreeMacroLibrary.ftl"/>
>>          </template>
>>          <template name="screenfop" type="xsl-fo"
>> content-type="application/pdf" encoding="none">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/FoScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/FoFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/FoTreeMacroLibrary.ftl"/>
>>          </template>
>>          <template name="screentext" type="text" content-type="UTF-8"
>> encoding="none">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/TextScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/TextFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/TextTreeMacroLibrary.ftl"/>
>>          </template>
>>          <template name="screencsv" type="csv" content-type="UTF-8"
>> encoding="none" encoder="xml">
>>              <template-file widget="screen" location="component://common-t
>> heme/template/macro/CsvScreenMacroLibrary.ftl"/>
>>              <template-file widget="form" location="component://common-t
>> heme/template/macro/CsvFormMacroLibrary.ftl"/>
>>              <template-file widget="tree" location="component://common-t
>> heme/template/macro/CsvTreeMacroLibrary.ftl"/>
>>          </template>
>>      </templates>
>>
>>      <common-screens><!--list all common screen and decorator global to
>> each application that each theme can be surcharge or not and use the screen
>> present on common theme-->
>>          <structural-decorator default-location="component://
>> common-theme/widget/CommonScreens.xml">
>>              <decorator name="GlobalDecorator"/>
>>              <decorator name="LookupDecorator"/>
>>              <decorator name="SimpleDecorator"/>
>>          </structural-decorator>
>>          <embed-decorator default-location="component://
>> common-theme/widget/CommonEmbedScreens.xml">
>>              <decorator name="FindScreenDecorator"/>
>>              <decorator name="EditScreenDecorator"/>
>>              <decorator name="ListAndEditScreenDecorator"/>
>>          </embed-decorator>
>>          <general-screen default-location="component://
>> common-theme/widget/CommonDedicateScreens.xml">
>>              <screen name="geoChart"/>
>>              <screen name="EventMessages"/>
>>              <screen name="countries"/>
>>          </general-screen>
>>      </common-screens>
>>
>> </theme>
>>
>> #######################################
>>
>> Now if I want create my specific theme with only some particularity on
>> html rendering et some decorator I just define this :
>>
>> #######################################
>>
>> <theme name="mytheme"
>>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>          xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/
>> widget-theme.xsd">
>>      <visual-themes>
>>          <visual-theme id="MYTHEME"/>
>>      </visual-themes>
>>      <extend location="component://common-theme/theme.xml"/>
>>      <theme-properties>
>>          <property name="jgrowl.position" value="top-left" type="String"/>
>>      </theme-properties>
>>      <templates>
>>          <template name="screen" type="html" content-type="UTF-8"
>> encoding="none" encoder="html" compress="false">
>>              <template-file widget="form" location="component://mytheme/
>> template/macro/HtmlFormMacroLibrary.ftl"/>
>>          </template>
>>      </templates>
>>      <common-screens>
>>          <structural-decorator>
>>              <decorator name="SimpleDecorator"
>> location="component://mytheme/widget/MyDecoratorScreens.xml"/>
>>          </structural-decorator>
>>          <general-screen >
>>              <screen name="EventMessages" location="component://mytheme/
>> widget/MyTemplateScreens.xml"/>
>>          </general-screen>
>>      </common-screens>
>> </theme>
>>
>> #######################################
>>
>> With the extend elemet, mytheme resolve all information from common-theme
>> and surchage only what is define on his xml definition file.
>>
>> I think with this type of structure we can have :
>>
>> * a base de define a screen API for homogenise the IHM
>> * permit to a theme to surcharge only what he want (template rendering,
>> widget properties, screen present on API)
>> * remove all theme resource information and load it direclty on the
>> decorator (this slim the decorator complexity, slim data to load and make
>> more easier to follow what implement a theme)
>>
>> If you have a few time to sharing your remark, It's the last big point to
>> continue and maybe load the common-theme on trunk :)
>>
>> Nicolas
>>
>> --
>> logoNrd <https://nereide.fr/>
>>          Nicolas Malin
>> The apache way <http://theapacheway.com/> : *Openness* Technical
>> decisions are made publicly
>> information@nereide.fr
>> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>
>> Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way <
>> http://theapacheway.com/>|ofbiz-fr <http://www.ofbiz-fr.org/>|réseau LE <
>> http://www.libre-entreprise.org/>
>>


Re: [Discussion] Xml definition file for theme

Posted by Rishi Solanki <ri...@gmail.com>.
Hi Nicolas,

Before putting any view on the proposal, I would like to thank you for nice
proposal with very nice details. Also before making any view, I would like
to confirm my understanding on the proposal with some questions.

- Here we would like to replace the existing theme setup which is database
driven. Then how we are going to change the themes on the fly as we do
currently. Are we going to use content model. Please help me here.
- Are we going to replace the theme related properties files and/or db
entries.
- Also it seems to me the handlers we add in the controller xml file will
be removed. Is it correct understanding?

I'm asking these question to understand how we are going to change the
themes when server is running. I'll go thru the current rendering and get
back on this asap.

One quick comment, please see if it make sense. But I'll surely get back
with more details on overall topic.

- As mentioned the extend is child element in the structure. Can we change
it to 'extends' just to follow the practice we have in java, form-widget
and service definitions also uses the implements.



--
Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Sun, Jul 23, 2017 at 5:10 AM, Nicolas Malin <ni...@nereide.fr>
wrote:

> Hello,
>
> With the common-theme and my idea to implement a specific model to explain
> a theme, I would be sharing my recent think:
>
> This is an example of xml definition for the common-theme, I set a small
> description to explain each block
>
> ##################################
>
> <theme name="common"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/
> widget-theme.xsd">
>     <visual-themes><!--List of visual theme contains to this theme
> components-->
>         <visual-theme id="COMMON"/>
>     </visual-themes>
>     <widget-properties><!--Transversal properties relative to ofbiz
> widget component-->
>         <default-view-size value="20"/>
>         <autocompleter
>                 default-view-size="10"
>                 default-min-lenght="2"
>                 default-delay="300"
>                 display-return-field="true"/>
>         <lookup
>                 position="topleft"
>                 width="640"
>                 height="500"/>
>         <layered-modal
>                 width="800"
>                 height="600"/>
>     </widget-properties>
>
>     <theme-properties> <!--specific properties dedicate to this theme -->
>         <property name="jgrowl.position" value="center"
> type="String"/><!--possible value: top-left, top-right, bottom-left,
> bottom-right, center-->
>         <property name="jgrowl.width" value="800" type="Integer"/>
>         <property name="jgrowl.height" value="" type="Integer"/>
>         <property name="jgrowl.speed" value="100" type="Integer"/>
>     </theme-properties>
>
>     <templates><!-- Freemarker template use by this theme to render widget
> model-->
>         <template name="screen" type="html" content-type="UTF-8"
> encoding="none" encoder="html" compress="false">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/HtmlScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/HtmlFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/HtmlTreeMacroLibrary.ftl"/>
>             <template-file widget="menu" location="component://common-t
> heme/template/macro/HtmlMenuMacroLibrary.ftl"/>
>         </template>
>         <template name="screenxml" type="xml" content-type="UTF-8"
> encoding="none" encoder="xml">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/XmlScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/XmlFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/XmlTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screenxls" type="xls"
> content-type="application/vnd.ms-excel" encoding="none" encoder="html">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/XlsScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/XlsFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/XlsTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screenfop" type="xsl-fo"
> content-type="application/pdf" encoding="none">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/FoScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/FoFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/FoTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screentext" type="text" content-type="UTF-8"
> encoding="none">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/TextScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/TextFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/TextTreeMacroLibrary.ftl"/>
>         </template>
>         <template name="screencsv" type="csv" content-type="UTF-8"
> encoding="none" encoder="xml">
>             <template-file widget="screen" location="component://common-t
> heme/template/macro/CsvScreenMacroLibrary.ftl"/>
>             <template-file widget="form" location="component://common-t
> heme/template/macro/CsvFormMacroLibrary.ftl"/>
>             <template-file widget="tree" location="component://common-t
> heme/template/macro/CsvTreeMacroLibrary.ftl"/>
>         </template>
>     </templates>
>
>     <common-screens><!--list all common screen and decorator global to
> each application that each theme can be surcharge or not and use the screen
> present on common theme-->
>         <structural-decorator default-location="component://
> common-theme/widget/CommonScreens.xml">
>             <decorator name="GlobalDecorator"/>
>             <decorator name="LookupDecorator"/>
>             <decorator name="SimpleDecorator"/>
>         </structural-decorator>
>         <embed-decorator default-location="component://
> common-theme/widget/CommonEmbedScreens.xml">
>             <decorator name="FindScreenDecorator"/>
>             <decorator name="EditScreenDecorator"/>
>             <decorator name="ListAndEditScreenDecorator"/>
>         </embed-decorator>
>         <general-screen default-location="component://
> common-theme/widget/CommonDedicateScreens.xml">
>             <screen name="geoChart"/>
>             <screen name="EventMessages"/>
>             <screen name="countries"/>
>         </general-screen>
>     </common-screens>
>
> </theme>
>
> #######################################
>
> Now if I want create my specific theme with only some particularity on
> html rendering et some decorator I just define this :
>
> #######################################
>
> <theme name="mytheme"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/
> widget-theme.xsd">
>     <visual-themes>
>         <visual-theme id="MYTHEME"/>
>     </visual-themes>
>     <extend location="component://common-theme/theme.xml"/>
>     <theme-properties>
>         <property name="jgrowl.position" value="top-left" type="String"/>
>     </theme-properties>
>     <templates>
>         <template name="screen" type="html" content-type="UTF-8"
> encoding="none" encoder="html" compress="false">
>             <template-file widget="form" location="component://mytheme/
> template/macro/HtmlFormMacroLibrary.ftl"/>
>         </template>
>     </templates>
>     <common-screens>
>         <structural-decorator>
>             <decorator name="SimpleDecorator"
> location="component://mytheme/widget/MyDecoratorScreens.xml"/>
>         </structural-decorator>
>         <general-screen >
>             <screen name="EventMessages" location="component://mytheme/
> widget/MyTemplateScreens.xml"/>
>         </general-screen>
>     </common-screens>
> </theme>
>
> #######################################
>
> With the extend elemet, mytheme resolve all information from common-theme
> and surchage only what is define on his xml definition file.
>
> I think with this type of structure we can have :
>
> * a base de define a screen API for homogenise the IHM
> * permit to a theme to surcharge only what he want (template rendering,
> widget properties, screen present on API)
> * remove all theme resource information and load it direclty on the
> decorator (this slim the decorator complexity, slim data to load and make
> more easier to follow what implement a theme)
>
> If you have a few time to sharing your remark, It's the last big point to
> continue and maybe load the common-theme on trunk :)
>
> Nicolas
>
> --
> logoNrd <https://nereide.fr/>
>         Nicolas Malin
> The apache way <http://theapacheway.com/> : *Openness* Technical
> decisions are made publicly
> information@nereide.fr
> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>
> Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way <
> http://theapacheway.com/>|ofbiz-fr <http://www.ofbiz-fr.org/>|réseau LE <
> http://www.libre-entreprise.org/>
>