Not quite. Your view page would use this new component that you created. The extra typing only happens once when you create the component. After that, you are only _using_ the new component, and additional typing is limited to specifying the editable prameter. If your new component was called MaybeEdit, your view components would be declared as follows:
<component id="city" type="MaybeEdit"> <binding name="value" value="passedInCity" /> <binding name="editable" value="userCanEdit" /> </component> <component id="state" type="MaybeEdit"> <binding name="value" value="passedInState" /> <binding name="editable" value="userCanEdit" /> </component> <component id="zip" type="MaybeEdit"> <binding name="value" value="passedInZip" /> <binding name="editable" value="userCanEdit" /> </component> Thus the only difference is passing in the editable param. On 4/5/06, Bode, Bianca <[EMAIL PROTECTED]> wrote: > I started out like this, but that requires a lot of typing if you have a > view with lots of fields ;) > Hence my question :) > > > -----Original Message----- > From: Mike Snare [mailto:[EMAIL PROTECTED] > Sent: woensdag 5 april 2006 15:24 > To: Tapestry users > Subject: Re: Tap 3: Conditional component type in .jwc? > > I think you want to provide both in your template, and wrap them with > appropriate Conditional components: > > <component id="shouldShow" type="Conditional"> > <binding name="condition" value="not editable" /> </component> > > <component id="showCity" type="Insert"> > <binding name="value" expression="city"/> </component> > > <component id="shouldEdit" type="Conditional"> > <binding name="condition" value="editable" /> </component> > > <component id="editCity" type="Insert"> > <binding name="value" expression="city"/> </component> > > Then in your template: > > <span jwcid="shouldShow"> > <span jwcid="showCity" /> > </span> > > <span jwcid="shouldEdit"> > <span jwcid="editCity" /> > </span> > > -Mike > > On 4/5/06, Bode, Bianca <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I have created a component, that renders some plain html, with > > parameters: > > > > <parameter name="editable" required="yes"></parameter> <parameter > > name="city" required="no"></parameter> > > > > And component: > > <component id="city" type="Insert"> > > <binding name="value" expression="city"/> </component> > > > > Now, depending on the 'editable' parameter I want the type of my > 'city' > > component to be either > > 'Insert' when 'editable' is false or 'TextField' when 'editable'is > true. > > > > Can this be done, is there another way to easily switch the types of a > > > component, or do I need to make two seperate components? > > > > Kind regards, Bianca. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
