Dynamic value tags in Templates

View: New views
5 Messages — Rating Filter:   Alert me  

Dynamic value tags in Templates

by Klaus-26 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


It seems not possible with standard means to add value tags (r:v) to
templates at runtime. Basically I want to do the following in
processElement():
--
template = getTemplate();
...
template.setValue("dynamicValueTag","<r:v name=\"MARK:myField\"\>");
...
print(template);
---
Instead of the above given r:v tag text, any other one could be
imaginable (e.g. RIFE built-in or custom control text).

I don't want to use embedded elements in this case as this seems to be
an overkill to me.

As I found out, the r:v tags in the template are determined somewhen
and no public methods are available with Element subclasses to add new
r:v tags later on.

Could you help me out with a solution? Am I wrong with my assumptions?

Best

Klaus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Dynamic value tags in Templates

by Mork :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello Klaus,

you want to mix template code and element code, i could not imagine that
this is supported by rife. The concept separation of concerns means that
you neven should mix template code and java code.

Klaus schrieb:

> It seems not possible with standard means to add value tags (r:v) to
> templates at runtime. Basically I want to do the following in
> processElement():
> --
> template = getTemplate();
> ...
> template.setValue("dynamicValueTag","<r:v name=\"MARK:myField\"\>");
> ...
> print(template);
> ---
> Instead of the above given r:v tag text, any other one could be
> imaginable (e.g. RIFE built-in or custom control text).
>
> I don't want to use embedded elements in this case as this seems to be
> an overkill to me.
>
> As I found out, the r:v tags in the template are determined somewhen
> and no public methods are available with Element subclasses to add new
> r:v tags later on.
>
> Could you help me out with a solution? Am I wrong with my assumptions?
>
> Best
>
> Klaus
>
>
> >
>
>  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Dynamic value tags in Templates

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Klaus,

Indeed, the template are not executed and have no runtime model, this  
is by design.

Similar to HTML, which has no runtime model without Javascript. The  
text is simply parsed and you can manipulate the value and block tags  
in Java.

If you 'really' want to do this (and you should be sure you want to  
do this), you could write a template transformer that creates tags  
from the original template content. However, this will again only be  
ran once, when the source code of your template is loaded and before  
it is parsed.

Best regards,

Geert

On 27 Aug 2007, at 09:04, Klaus wrote:

>
> It seems not possible with standard means to add value tags (r:v) to
> templates at runtime. Basically I want to do the following in
> processElement():
> --
> template = getTemplate();
> ...
> template.setValue("dynamicValueTag","<r:v name=\"MARK:myField\"\>");
> ...
> print(template);
> ---
> Instead of the above given r:v tag text, any other one could be
> imaginable (e.g. RIFE built-in or custom control text).
>
> I don't want to use embedded elements in this case as this seems to be
> an overkill to me.
>
> As I found out, the r:v tags in the template are determined somewhen
> and no public methods are available with Element subclasses to add new
> r:v tags later on.
>
> Could you help me out with a solution? Am I wrong with my assumptions?
>
> Best
>
> Klaus


--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Dynamic value tags in Templates

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sorry, forgot to ask, what is your use-case Klaus? Maybe that will  
help us figure out what the best approach is for you.

On 27 Aug 2007, at 09:08, Mork0075 wrote:

>
> Hello Klaus,
>
> you want to mix template code and element code, i could not imagine  
> that
> this is supported by rife. The concept separation of concerns means  
> that
> you neven should mix template code and java code.
>
> Klaus schrieb:
>> It seems not possible with standard means to add value tags (r:v) to
>> templates at runtime. Basically I want to do the following in
>> processElement():
>> --
>> template = getTemplate();
>> ...
>> template.setValue("dynamicValueTag","<r:v name=\"MARK:myField\"\>");
>> ...
>> print(template);
>> ---
>> Instead of the above given r:v tag text, any other one could be
>> imaginable (e.g. RIFE built-in or custom control text).
>>
>> I don't want to use embedded elements in this case as this seems  
>> to be
>> an overkill to me.
>>
>> As I found out, the r:v tags in the template are determined somewhen
>> and no public methods are available with Element subclasses to add  
>> new
>> r:v tags later on.
>>
>> Could you help me out with a solution? Am I wrong with my  
>> assumptions?
>>
>> Best
>>
>> Klaus
>>
>>
>>>
>>
>>
>
> >

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Dynamic value tags in Templates

by Klaus-26 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Geert, thanx a lot for your very quick answers!

My use case is the following:
I want to dynamically build dialogues (e.g. for maintenance,
comparable to CRUD). So instead of writing
<input type="text" name="..." value=".."/>
or
<r.v name="FORM:INPUT:...">
I have to dynamically add the content. Of course I could just add all
text into one single r:v tag, but I want to define the structure of
the output within the template, such as:
<html>
<bod<>
Here is my dialogue.
<r:v name="inputfields"/>
<r:b name="inputfield">
  <r:v name="fieldname"/>:
  <r.v name="inputcomponent"/>
</r:b>
</html>

So I want to replace the inputcomponent tag with the component to be
inserted, like this:
<r:v name="FORM:INPUT..."/>
or maybe
<input type="text" name="<r:v name=\"fieldname\"/>">
I think that I could use a embedded element, but this seems quite
complicated and would not so something different than what I would
like to do by replacing the tag.
The reason I want to use dynamic tags is that I want to "reuse" the
fieldname-tag.

How would you do this?

Best

Klaus

On 27 Aug., 09:14, Geert Bevin <gbe...@...> wrote:

> Sorry, forgot to ask, what is your use-case Klaus? Maybe that will  
> help us figure out what the best approach is for you.
>
> On 27 Aug 2007, at 09:08, Mork0075 wrote:
>
>
>
>
>
>
>
> > Hello Klaus,
>
> > you want to mix template code and element code, i could not imagine  
> > that
> > this is supported by rife. The concept separation of concerns means  
> > that
> > you neven should mix template code and java code.
>
> > Klaus schrieb:
> >> It seems not possible with standard means to add value tags (r:v) to
> >> templates at runtime. Basically I want to do the following in
> >> processElement():
> >> --
> >> template = getTemplate();
> >> ...
> >> template.setValue("dynamicValueTag","<r:v name=\"MARK:myField\"\>");
> >> ...
> >> print(template);
> >> ---
> >> Instead of the above given r:v tag text, any other one could be
> >> imaginable (e.g. RIFE built-in or custom control text).
>
> >> I don't want to use embedded elements in this case as this seems  
> >> to be
> >> an overkill to me.
>
> >> As I found out, the r:v tags in the template are determined somewhen
> >> and no public methods are available with Element subclasses to add  
> >> new
> >> r:v tags later on.
>
> >> Could you help me out with a solution? Am I wrong with my  
> >> assumptions?
>
> >> Best
>
> >> Klaus
>
> --
> Geert Bevin
> Terracotta -http://www.terracotta.org
> Uwyn "Use what you need" -http://uwyn.com
> RIFE Java application framework -http://rifers.org
> Music and words -http://gbevin.com- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price!
 
 
 
Google
rifers.org web