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
[email protected]
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/>