Author |
Message |
06/11/2008 08:49:33
|
wocher
Power User
Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline
|
Greet,
have you a example for a macro that use the reference field?
The Macro Feature where easy to use with drag & drop from the Bean Browser to the reference field.
Thanks,
Wocher
|
„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz
Rainer Wocher Quentia Development GmbH (Sotware Developer) |
|
|
06/11/2008 09:14:56
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
...oops, I am astonished that this is not in the documentation, but you are right... Sorry!
Example:
Code:
<macro>
<applysto>
<tag name="t:field"/>
<tag name="t:formattedfield"/>
<tag name="t:calendarfield"/>
<tag name="t:textarea"/>
<tag name="t:combobox"/>
<tag name="t:radiobutton"/>
</applysto>
<parameters>
</parameters>
<attributes>
<attribute name="bgpaint" value="#{d.${ref.b}.selBgpaints.${ref.p}}"/>
<attribute name="text" value="#{d.${ref.b}.sel.${ref.p}}"/>
<attribute name="value" value="#{d.${ref.b}.sel.${ref.p}}"/>
<attribute name="width" value="100%"/>
</attributes>
</macro>
You see: no parameters, the reference inforamtion is taken from the REFERENCE attribute. In the reference attribute there is a semicolon separated list of name:value pairs. For the macro above it would be:
reference="b:order;p:deliveryDate" ("b" for bean, "p" for property). In the maco the values are referenced by ${ref.<name>}.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
06/11/2008 09:18:49
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
...and there is one additional feature: a replace function that can be used in the macro:
Code:
<attribute name="bgpaint" value="$replace(},.addon.bgpaint},${ref.expression})"/>
In this example the string "}" is replaced by ".addon.bgpaint}" in the reference passed by "${ref.expression}".
Btw: when you drag & drop from the bean browser into the reference field then the corresponding expression is passed as "expression:<expresseion>" string.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
06/11/2008 09:30:06
|
wocher
Power User
Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline
|
Thx for the information, this is the information that i need
|
„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz
Rainer Wocher Quentia Development GmbH (Sotware Developer) |
|
|
06/11/2008 10:02:05
|
wocher
Power User
Joined: 14/04/2008 13:10:19
Messages: 49
Location: Ravensburg
Offline
|
One more question.
I use this:
<attribute name="value" value="#{d.${screen}.${bean}.${property}}"/>
<attribute name="enabled" value="#{d.${screen}.${bean}.e_${property}}"/>
<attribute name="bgpaint" value="#{d.${screen}.${bean}.b_${property}}"/>
the problem is the replace must be on the last point in the expression, not on the }.
Then where is no way to make this i must rewrite the Wrapper, to work with the suffix not with a prefix ( b_ / _b
|
„Ein Haus ohne Bücher ist arm, auch wenn schöne Teppiche seinen Boden und kostbare Tapeten und Bilder die Wände bedecken.“
Hermann Hesse, Dichter, Schriftsteller und Maler * 02. 07. 1877 - Calw † 09. 08. 1962 - Montagnola, Schweiz
Rainer Wocher Quentia Development GmbH (Sotware Developer) |
|
|
06/11/2008 10:08:34
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5521
Offline
|
...yes, that's right!
I would suggest to check if to use the programmed Macro, then there is full flexibility.
Please contact us in case you cannot wait for next Monday...!
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
|