Re: [Rife-users] A first component using embedded elements
ahh nice one, eddy; something new to mention when i talk again about rife on the 17th at the oracle city office :) cheers, emmanuel On 3/6/06, Eddy Young <[EMAIL PROTECTED]> wrote: > Hi all, > > I recently started experimenting with using embedded elements to create > components. Today, after just 5 minutes messing about, I produced my > first component, a simple label. > > Here is how I did it. > > In sites/main.xml: > > > > > > > In templates/test.html: > > "http://www.w3.org/TR/html4/loose.dtd";> > > > > View profile > > > > >This is your profile. >Username: > id = username > value = uname > > > > > > > In web.components.Label: > > /* > * Label.java > * > * $Id$ > */ > > package web.components; > > import com.uwyn.rife.engine.Element; > import java.util.Properties; > > /** > * > * @author Eddy.Young > * @version $Revision$ > */ > public class Label extends Element { > private String id; > private String value; > > public void processElement() { > Properties properties = getEmbedProperties(); > id = properties.getProperty("id"); > value = properties.getProperty("value"); > print("" + getInput(value) + ""); > } > } > > The interesting thing here is that the ELEMENT: tag can embed more > than one value. This can be used to specify parameters. For example, for > a "list" component, the parameter could be the name of a bean that > contains the entries. Another parameter could be the name of a template. > > The possibilities are virtually limitless. It would be great if those > who have used embedded elements to create components could share their > experience here. > > -- > http://coding.mu > http://priscimon.com/blog > ___ > Rife-users mailing list > Rife-users@uwyn.com > http://lists.uwyn.com/mailman/listinfo/rife-users > -- Mohandas Gandhi - "You must be the change you wish to see in the world." ___ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users
Re: [Rife-users] A first component using embedded elements
Hi Eddy, nice initiative. I think that a component collection like this for RIFE would interest a lot of people. If you want, I can setup a subversion repository for you so that you can make them easily available. Also, don't hesitate to create a dedicated section on the Wiki to mention, document and plan component- related work there. I've been looking at widget component support too this weekend and I think that I found a suitable way to pass on the data that components need. Since the element that uses the template typically has the data, it can simply be set as an expression var. Any embedded element has access to the template it which it is embedded, and can obtain this expression var. This should make it easy to add components for lists and such. Also, I one of the next new features that I'm going to add is support for nested value tags. This means that you could just include any template content inside an embedded element value tag. This content fragment could then be obtained by the embedded element as a full- blown template. Having this feature available would make it very easy to create component trees that still include HTML design. I definitely think that this would be a nice direction to take RIFE into. Best regards, Geert On 6-mrt-06, at 11:43, Eddy Young wrote: Hi all, I recently started experimenting with using embedded elements to create components. Today, after just 5 minutes messing about, I produced my first component, a simple label. Here is how I did it. In sites/main.xml: In templates/test.html: http://www.w3.org/TR/html4/loose.dtd";> View profile This is your profile. Username: id = username value = uname In web.components.Label: /* * Label.java * * $Id$ */ package web.components; import com.uwyn.rife.engine.Element; import java.util.Properties; /** * * @author Eddy.Young * @version $Revision$ */ public class Label extends Element { private String id; private String value; public void processElement() { Properties properties = getEmbedProperties(); id = properties.getProperty("id"); value = properties.getProperty("value"); print("" + getInput(value) + "label>"); } } The interesting thing here is that the ELEMENT: tag can embed more than one value. This can be used to specify parameters. For example, for a "list" component, the parameter could be the name of a bean that contains the entries. Another parameter could be the name of a template. The possibilities are virtually limitless. It would be great if those who have used embedded elements to create components could share their experience here. -- http://coding.mu http://priscimon.com/blog ___ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users -- Geert Bevin Uwyn bvba GTalk: [EMAIL PROTECTED] "Use what you need" Avenue de Scailmont 34 Skype: gbevin http://www.uwyn.com 7170 Manage, Belgium AIM: geertbevin gbevin at uwyn dot com Tel: +32 64 84 80 03 Mobile: +32 477 302 599 PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9 Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net ___ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users
[Rife-users] A first component using embedded elements
Hi all, I recently started experimenting with using embedded elements to create components. Today, after just 5 minutes messing about, I produced my first component, a simple label. Here is how I did it. In sites/main.xml: In templates/test.html: http://www.w3.org/TR/html4/loose.dtd";> View profile This is your profile. Username: id = username value = uname In web.components.Label: /* * Label.java * * $Id$ */ package web.components; import com.uwyn.rife.engine.Element; import java.util.Properties; /** * * @author Eddy.Young * @version $Revision$ */ public class Label extends Element { private String id; private String value; public void processElement() { Properties properties = getEmbedProperties(); id = properties.getProperty("id"); value = properties.getProperty("value"); print("" + getInput(value) + ""); } } The interesting thing here is that the ELEMENT: tag can embed more than one value. This can be used to specify parameters. For example, for a "list" component, the parameter could be the name of a bean that contains the entries. Another parameter could be the name of a template. The possibilities are virtually limitless. It would be great if those who have used embedded elements to create components could share their experience here. -- http://coding.mu http://priscimon.com/blog ___ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users