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:
<subsite id="Components">
<element id="Label" implementation="web.components.Label">
</element>
</subsite>
In templates/test.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>View profile</title>
</head>
<body>
<!--V 'content' /-->
<!--BV 'content'-->
<p>This is your profile.</p>
<p>Username: <!--V 'ELEMENT:^Components.Label'-->
id = username
value = uname
<!--/V-->
<!--/BV-->
</body>
</html>
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("<label id=" + id + ">" + getInput(value) + "</
label>");
}
}
The interesting thing here is that the ELEMENT:<name> 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
[email protected]
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
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users