Ah and declare the value parameter of SpinEdit just as "in". Yes that makes everything a lot easier :p
Still like to know the answers to > > I got a lot of problems with an AbstractMethodError for isDisabled(). > > When I added > > public abstract boolean isDisabled(); > > public abstract void setDisabled(boolean value); > > to the SpinEdit class, these problems finally went away, but why do I need > > to add > > these? Because I didn't need them for the other parameters too. and > > how can I render my > > component template in the renderComponent method? And if a complete SpinEdit tapestry component exists somewhere for my education. Thanks... Robert On 14 Apr 2005 at 14:13, Ron Piterman wrote: > Use BaseComponent, and put your html in the .html file. > > Thats it. > > The Input will function as part of the form, there should be no prob. > > Cheers, > Ron > > ציטוט Robert: > > Hi, > > > > I am new at tapestry and I am learning from the "Tapestry in Action" book. > > Wanting to play with Tapestry I am trying to make a SpinEdit component. I > > have a > > couple of questions which I hope some of you have answers to... > > > > The SpinEdit control will be a component that will consist of a textfield > > and 2 buttons to > > increase and decrease the value in it. > > > > I started making a template SpinEdit.html > > ************************************************* > > <input type="text" jwcid="spinedit"/><button > > onclick="spinedit.value = parseInt(spinedit.value) + 1; return > > false;">+</button><button > > onclick="spinedit.value = parseInt(spinedit.value) - 1; return > > false;">-</button> > > ************************************************* > > Of course it's not how I want it to look like in the end, but I am > > interested in Tapestry > > functionality for now. > > > > Then I started making the component specification SpinEdit.jwc > > ************************************************* > > <component-specification > > class="examples.SpinEdit" > > allow-body="no" > > allow-informal-parameters="no"> > > <parameter name="value" direction="form" required="no" > > type="java.lang.String"/> > > <parameter name="min_value" direction="in" required="no" type="int"/> > > <parameter name="max_value" direction="in" required="no" type="int"/> > > <parameter name="step_size" direction="in" required="no" type="int"/> > > <component id="spinedit" type="TextField"> > > <inherited-binding name="value" parameter-name="value"/> > > </component> > > > > </component-specification> > > > > ************************************************* > > > > As you can see I wanted to use an existing TextField component for showing > > and > > saving the value. > > Then I want to use the component like this > > <input type="text" jwcid="inputAge"/> > > > > page spec: > > <component id="inputAge" type="SpinEdit"> > > <binding name="value" expression="address.age"/> > > </component> > > > > > > My first question is what class should I extend to make the SpinEdit class? > > AbstractFormComponent? Or BaseComponent and implement IFormComponent? > > > > I added a few lines such as > > <parameter name="disabled" type="boolean" direction="in"/> > > and > > <property-specification name="name" type="java.lang.String"/> > > <property-specification name="form" type="org.apache.tapestry.IForm"/> > > to the specification to make things working a little bit. > > > > I got a lot of problems with an AbstractMethodError for isDisabled(). > > When I added > > public abstract boolean isDisabled(); > > public abstract void setDisabled(boolean value); > > to the SpinEdit class, these problems finally went away, but why do I need > > to add > > these? Because I didn't need them for the other parameters too. > > > > When I extend BaseComponent and implement IFormComponent I got the problem > > that setAge() was called 2 times. The first was the correct value and the > > second it was > > reset to null, causing the next page not to the display the correct age. > > > > When I extend AbstractFormComponent I had to implement a lot of things that > > I really > > did not see the need for. Seemed a lot of work while the internal TextField > > component > > already really did all the work I needed. Which reminds me.... how can I > > render my > > component template in the renderComponent method? > > > > I hope someone can push me in the right direction. Maybe there is a > > existing SpinEdit > > component that I can learn from? Any help is appreciated. > > > > Kind regards, > > Robert. > > > > > > --------------------------------------------------------------------- > > 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] >
