Leszek Gawron wrote:
Ok, only the InstructionFactory is a component, that is better. Is there any point in leting the InstructionFactory be a component? As said I would prefer template configuration in a separate file. Also I don't like the repetition of the target name space, we could declare that in a enclosing tag e.g. "instructions".Daniel Fagerstrom wrote:
I would prefer to have the template configuration in a separate file, not in cocoon.xconf. AFAICS there is no point in making the instructions Avalon components. It would be enough to have a configuration file that connnects the instruction name with the implementation class. Then the configuration file could be explicitly refered to in the JXTG code. We could also make the template configuration file path configurable in the JXTG configuration. But as many people where upset about allowing configurable template languages, I think we should avoid making it to easy to configure for non committers for the moment. I think we have more important things to do than to discuss why tag libraries sucks ;)
Instructions are not components:
<component role="org.apache.cocoon.template.jxtg.script.InstructionFactory"
class="org.apache.cocoon.template.jxtg.script.DefaultInstructionFactory">
<instruction name="template" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartTemplate"/>
<instruction name="forEach" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartForEach"/>
<instruction name="if" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartIf"/>
<instruction name="choose" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartChoose"/>
<instruction name="when" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartWhen"/>
<instruction name="otherwise" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartOtherwise"/>
<instruction name="out" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartOut"/>
<instruction name="import" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartImport"/>
<instruction name="set" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartSet"/>
<instruction name="macro" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartDefine"/>
<instruction name="evalBody" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartEvalBody"/>
<instruction name="eval" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartEval"/>
<instruction name="parameter" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartParameter"/>
<instruction name="formatNumber" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartFormatNumber"/>
<instruction name="formatDate" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartFormatDate"/>
<instruction name="comment" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartComment"/>
<instruction name="call" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartCall"/>
<instruction name="withParam" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartParameterInstance"/>
<instruction name="attribute" targetNamespace="http://apache.org/cocoon/templates/jx/1.0" class="org.apache.cocoon.template.jxtg.instruction.StartAttribute"/>
</component>
Those evil tag libraries. Still Sylvain kicked forms presentation rocket high (respect!) using jxtg and jx-macros.xml and IMO we should replace macro file with java instructions - it's core functionality and looks like cforms - jxtg mariage is tightening.
This does not look good:
<jx:macro name="widget" targetNamespace="http://apache.org/cocoon/forms/1.0#template">
<jx:parameter name="id"/>
<jx:set var="widget" value="${cformsHelper.getWidget(widget, id)}"/>
<jx:if test="${cformsHelper.isVisible(widget)}">
<jx:set var="cformsDummy" value="${cformsHelper.generateWidget(widget, locale)}"/>
<jx:evalBody/>
<jx:set var="cformsDummy" value="${cformsHelper.flushRoot(widget)}"/>
</jx:if>
</jx:macro>
cformsDummy all around the place. I may rewrite the functionality myself if noone objects. As we are approaching a stable JXTG 2.0 fast I think of switching to CForms a little bit. It will be a good start.
Might be, but I just don't feel like participating in any more taglib discussions.
OT: I'd like to rename o.a.c.template.jxtg.script.event.StartInstruction into o.a.c.template.jxtg.script.instruction.Instruction. The name was good internally. If ever any other block implemented a new Instruction it is kind of weird to implement "StartInstruction"..
Sure, just go ahead. I would even prefer o.a.c.template.script.instruction.Instruction as it shoulddn't have anything to do with JXTG.
/Daniel
