Passing parameters to embedded element

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

Passing parameters to embedded element

by Eddy Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

It's only now that I have the chance of playing with embedded
elements. Is there a way to pass values to embedded elements? And, how
does the embedded objects retrieve these values?

Thanks,

    Eddy


--~--~---------~--~----~------------~-------~--~----~
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: Passing parameters to embedded element

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Eddy,

long time no see, it's nice to have you back! :-)

There are two ways to pass data to an embedded element: a static and  
a dynamic way.

static
------

The static way basically allows you to access the data that is set  
inside the embedded element's value tag, for example:

<!--V ELEMENT:.My.Element-->some data<!--/V-->

You can get that with the getEmbedValue() method.

It's also possible to structure that data as properties, for example:

<!--V ELEMENT:.My.Element-->
key1 = value1
key2 = value2
<!--/V-->

You can get the properties with the getEmbedProperties().

dynamic
-------

For the dynamic way, you basically process the embedded elements  
manually with processEmbeddedElement(Template template, String  
elementId, Object data) instead of relying on the template to do so.  
You can then provide any data you want. This data can be obtained  
through the getEmbedData() method. You also have to insure that your  
embedded elements are process 'late' however, more info about that  
here: http://rifers.org/wiki/display/RIFE/Embedded+element+priorities

... one more thing ;-)
------------------

Since you get access to the embedding element through the  
getEmbeddingElement() method, you can actually pull in data also. You  
can for instance agree on an interface that is implemented by the  
embedding element, and use that from the embedded element to obtain  
the data you need. This is explained in the simple blog tutorial:  
http://rifers.org/rife_indepth_simple_blog/ Here, the NewsProvider  
interface is used to have a general NewsEntry element that is used in  
several places.

Hope this gets you started.

Take care,

Geert

On 14 Sep 2007, at 17:28, Eddy Young wrote:

> It's only now that I have the chance of playing with embedded
> elements. Is there a way to pass values to embedded elements? And, how
> does the embedded objects retrieve these values?

--
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: Passing parameters to embedded element

by jeyoung :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Quoting Geert Bevin <gbevin@...>:

> long time no see, it's nice to have you back! :-)

It's good to be back, too. I've been eating .NET for over a year, and  
when it was time to resume work on a pet Java project, RIFE was the  
obvious choice.

> ... one more thing ;-)
> ------------------
>
> Since you get access to the embedding element through the
> getEmbeddingElement() method, you can actually pull in data also. You
> can for instance agree on an interface that is implemented by the
> embedding element, and use that from the embedded element to obtain
> the data you need. This is explained in the simple blog tutorial:
> http://rifers.org/rife_indepth_simple_blog/ Here, the NewsProvider
> interface is used to have a general NewsEntry element that is used in
> several places.

For what I'm doing -- creating a generic drop-down list component --  
it makes more sense to push the data to the embedded element, then use  
getEmbedData() to read them.

Thanks for the quick response -- very helpful as usual.

     Eddy




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

 
 
 
Google
rifers.org web