tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Nelson <cnelson4...@yahoo.com>
Subject Re: How to instantiate components in code
Date Sun, 12 Dec 2004 23:35:54 GMT
Kind of.  What I am really trying to do is have the
form rendered with proper components based on the type
and descriptor of the object currently being edited. 
Each property may need a different component based on
it's type.  I understand that pages are shared.  So if
I was instantiating components in code I would have to
instantiate a page also.  I'm guessing that is no mean
feat from some of the other threads on this list.

I really would prefer to do something like this
though. I suppose an approach with blocks may work,
but it seems kinda clunky.  

Any chance this will be easier in 3.1 or is what I'm
trying to do just not part of the Tapestry vision?

Ooo, and one more thing (hope you read this far).  How
is the component documentation produced?  Is there
some stylesheet that generates it from jwc files or
something?

Thanks.

--- Howard Lewis Ship <hlship@gmail.com> wrote:

> So, you want the type of editor to be conditional
> based on a parameter
> of your component?
> 
> Remember that Tapestry pages are shared, they must
> be equally useful
> to all potential users. It would be silly for user
> A's submission of a
> text field to fail because user B just was editting
> a field that
> required a drop down list.
> 
> Page pooling, and the lack of flexibility you get,
> is a consequence of
> the need for Efficiency (along with Simplicity,
> Consistency,  and
> Feedback) as a driving principal of Tapestry.
> 
> Conditionals are a valid approach.  Alternately,
> surround each element
> with a Block and choose the correct block
> dynamically.  Or, put all
> the components in an anonymous Block and simply
> select one of those
> components to render dynamically.
> 
> 
> On Sun, 12 Dec 2004 08:45:26 -0800 (PST), Chris
> Nelson
> <cnelson4eii@yahoo.com> wrote:
> > Apologize if I should be asking this on the users
> list
> > first, but it didn't seem like this had been
> answered
> > there.
> > 
> > I am making good progress with Trails, but ran
> into
> > something I just can't figure out how to do easily
> in
> > Tapestry.  I have a component called
> ProperttyEditor
> > that renders a form input component for a bean
> > property based on the property's type (and other
> > information contained in it's PropertyDescriptor).
> > Right now, it uses a big nasty set of Conditionals
> > like so:
> > 
> >     <td jwcid="isIdentifier" element="td">
> >         <span jwcid="identifier" />
> >     </td>
> >     <td jwcid="isDate" element="td">
> >         <input jwcid="dateField" />
> >     </td>
> >     <td jwcid="isNumeric" element="td">
> >         <input jwcid="numberField" />
> >     </td>
> >     <td jwcid="isString" element="td">
> >         <input jwcid="stringField"  />
> >     </td>
> >     <td jwcid="isObject" element="td">
> >         <span jwcid="selectObject"  />
> >     </td>
> >     <td jwcid="isCollection" element="td">
> >         <span jwcid="collectionEditor"  />
> >     </td>
> > 
> > Yuck, right?  Well, what I'd rather do is have
> some
> > sort of factory that spits out the correct
> component.
> > As well as cleaning up this code, it would let me
> do
> > cool things like being able to have the
> PropertyEditor
> > class from the PropertyDescriptor be a Tapestry
> > component and just instatiate it.
> > 
> > However, instantiating components in code does not
> > seem very easy.  Am I missing something?  Can
> someone
> > point me at a way to do this?  A code example
> perhaps?
> > Is this something that will be way easier in 3.1,
> and
> > if so, is 3.1 in a state where I should be
> thinking
> > about moving to it?
> > 
> > Thanks in advance,
> > 
> > Chris Nelson
> > 
> > __________________________________
> > Do you Yahoo!?
> > Take Yahoo! Mail with you! Get it on your mobile
> phone.
> > http://mobile.yahoo.com/maildemo
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-dev-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> http://howardlewisship.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-dev-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

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


Mime
View raw message