You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Markus Wiederkehr <ma...@gmail.com> on 2004/10/29 17:33:07 UTC

Dynamic components?

I have a Document interface and classes that implement that interface:
HtmlDocument, AsciiTextDocument, PdfDocument, etc. Now I want to
create a page that can display a Document. Depending on the runtime
class of the Document a different component should be used to display
the document, that is HtmlViewer, AsciiTextViewer or PdfViewer,
respectively.

The page could make use of several Conditional components to select
the right viewer, but this does not scale well. Adding another
document type would also require to change the page template.

I would prefer to pass the viewer component to the page as a
parameter. Is this possible somehow? Can a page property be a
component, and if yes, how can the component be instantiated in the
first place?

I have the feeling that I am missing something basic here, any help
would be very much appreciated.

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Dynamic components?

Posted by Nick Stuart <ba...@gmail.com>.
The page it self could act as a border component could it not? With
this each of your view components would simply use the border
component, instead of the other way around like you have it now.

So each view type would have their own page/component and would have
something like:
<span jwcid="$contet$">
<span jwcid="border">
[fill in the details]
</span<
</span>

Hope this helps, and just yell if you've already thought of this :)

-Nick



On Fri, 29 Oct 2004 17:33:07 +0200, Markus Wiederkehr
<ma...@gmail.com> wrote:
> I have a Document interface and classes that implement that interface:
> HtmlDocument, AsciiTextDocument, PdfDocument, etc. Now I want to
> create a page that can display a Document. Depending on the runtime
> class of the Document a different component should be used to display
> the document, that is HtmlViewer, AsciiTextViewer or PdfViewer,
> respectively.
> 
> The page could make use of several Conditional components to select
> the right viewer, but this does not scale well. Adding another
> document type would also require to change the page template.
> 
> I would prefer to pass the viewer component to the page as a
> parameter. Is this possible somehow? Can a page property be a
> component, and if yes, how can the component be instantiated in the
> first place?
> 
> I have the feeling that I am missing something basic here, any help
> would be very much appreciated.
> 
> Markus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org