On 11/1/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:
> All,
>
> Any given tool gets an init(Object) call before it gets used. For "view"
> tools, that object is a ViewContext. How can I pass configuration
> parameters from the toolbox.xml file into the tools via the ViewContext
> object?

For Veltools 1.x, in the tool:

public void configure(Map params) {
   //TODO: extract and use params here
}

and in the toolbox.xml:

<parameter name="name" value="value"/>

LinkTool already has a configure() method to set the self-absolute and
self-include-parameters properties.

In Veltools 2.x, you can still use configure(Map) or you can have
individual setters in the tool:

public void setMyProperty(Boolean property) {
   //deal with the property
}

and in the tools.xml:
<tool class="org.foo.MyClass" myProperty="true"/>

or

<tool class="org.foo.MyClass">
    <property name="myProperty" value="true"/>
    <property name="otherProp">This is "crazy"!</property>
</tool>

lots of options.  :)

> It looks like the only attribute really used is the XHTML one, but
> that's not tied to a tool -- it's tied to all tools, so it lives as an
> attribute of the ViewContext.
>
> I'd like to add a configuration parameter to the LinkTool, but I can't
> seem to figure out if there's an existing mechanism to get parameters
> from the toolbox.xml file into the actual tool during initialization.
>
> Any tips?
>
> Thanks,
> -chris
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to