It's a dangerous ambigutity that should probably not be allowed!
On 5/4/07, Kristian Marinkovic <[EMAIL PROTECTED]> wrote:
hi howard,
i switched to "normal" inheritance having Stylesheet
extend RelationshipLink.
Now i experience some troubles with @Parameter
overrides (redefining a property with another @Parameter).
Can you tell me how this works? What rules are applied to
it?
following override works correct and outputs "stylesheet":
public Stylesheet extends RelationshipLink {
@Parameter(value="stylesheet",defaultPrefix="literal")
private String rel;
public RelationshipLink {
@Parameter
private String rel;
but this does not; instead returns a toString of my Stylesheet
instance:
public Stylesheet extends RelationshipLink {
@Parameter(value="literal:stylesheet")
private String rel;
public RelationshipLink {
@Parameter
private String rel;
neither works
public Stylesheet extends RelationshipLink {
@Parameter(value="stylesheet")
private String rel;
public RelationshipLink {
@Parameter(defaultPrefix="literal")
private String rel;
thanks in advance
g,
kris
"Howard Lewis Ship" <[EMAIL PROTECTED]>
03.05.2007 17:59
Bitte antworten an
"Tapestry users" <[email protected]>
An
"Tapestry users" <[email protected]>
Kopie
Thema
Re: [T5]: rendering component with nested component with @Component
annotation
Sub-components have no meaning unless there's a template. It is the
elements in the template that drive the creation of sub-components. This
should be more explicit in the documentation, and perhaps there should be
a
check for components in classes without a template.
On 5/3/07, Kristian Marinkovic <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> does anyone know how to render a Tapestry 5 component that itself
> contains a component with the @Component annotation?
>
> What i did so far is to define a template for the first component that
> contains the second component as a embedded component (code below).
>
> I'm trying to write a Stylesheet component that depends on a
> RelationshipLink (... actually the <link> tag :)) (please comment
> on whether you consider this component to be useful/reasonable
> or not).
>
> anyway, is this the right approach for writing (nested) components?
> should i use component inheritance instead? then i do not need the
> template.
>
> g,
> kris
>
> example code:
>
> public class Stylesheet {
> @Parameter(required=true) private Asset href;
> @Parameter private String media;
> @Parameter private String rel;
> @Parameter(value="text/css",defaultPrefix="literal") private String
> type;
>
>
>
>
@Component(id="relationshipLink",parameters={"href=href","media=media","rel=rel","type=type"})
> private RelationshipLink relationshipLink;
>
> public RelationshipLink getRelationshipLink() {
> return relationshipLink;
> }
>
> Stylesheet.html
> <link t:id="relationshipLink" xmlns:t="http://tapestry.." />
>
> //see http://www.w3.org/TR/html4/struct/links.html for more details on
> link
> public class RelationshipLink {
> /*
> * As the only valid location for <link> is within <head>
> it will
> * not check the location
> */
> ...
> void beginRender(MarkupWriter writer) {
> writer.element("link",
> "href",href, "charSet",charSet, "hrefLang",
> hrefLang,"media",media,"rel",rel,"rev",rev,
> "target",target,"type",type);
> writer.end();
> }
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com