Hi Martin

I have used this pastie http://pastie.org/7922079 as you requested.

The problem that I really stuck in retrieve the value of the textField
description, inside a listView
and the selected value of DDC neither. And without these values I can't set
the properties name
and description for the model Meeting to save it in the database.

An off topic question.

The most of the time you are working an put effort to help people and
answer questions from noobies
like me? :-D

If I know some prize for people that help other specifically for IT
subjects I'll nominate you to win :-P

Thanks very much!




Bruno Moura


2013/5/17 Martin Grigorov <mgrigo...@apache.org>

> Hi Bruno,
>
> Use any pastebin service to paste your code with Scala/Java highlighting so
> we can see what is wrong.
>
>
> On Fri, May 17, 2013 at 6:04 AM, Bruno Moura <brunormo...@gmail.com>
> wrote:
>
> > Thanks Martin again
> >
> > I coded as you told me but unfortunately the code doesn't work
> > because the description property of the model/object descriptionModel
> > didn't receive the value inserted in the text field.
> >
> > after inspected the descriptionModel in debug time I saw that description
> > hasn't any value assigned.
> >
> >
> >
> > Bruno Moura
> >
> >
> > 2013/5/15 Martin Grigorov <mgrigo...@apache.org>
> >
> > > Hi,
> > >
> > >
> > > On Wed, May 15, 2013 at 6:18 AM, Bruno Moura <brunormo...@gmail.com>
> > > wrote:
> > >
> > > > Hi Paul, thanks very much for your help!
> > > >
> > > > I followed your suggestion but this peace of code doesn't compile
> > > > unfortunately:
> > > >
> > > > IModel descriptionModel = new PropertyModel[Meeting](meeting,
> > > > "description"));
> > > >
> > > > I have tried
> > > >
> > > > val descriptionModel[IModel] = new PropertyModel[Meeting](meeting,
> > > > "description")); //wrong systax for scala
> > > >
> > > >
> > > the easiest is: val descriptionModel = new
> > PropertyModel[Meeting](meeting,
> > > "description")
> > >
> > > the more explicit ones are:
> > >
> > > val descriptionModel : IModel[Meeting] = new
> > > PropertyModel[Meeting](meeting, "description")
> > > val descriptionModel : PropertyModel[Meeting] = new
> > > PropertyModel[Meeting](meeting, "description")
> > >
> > >
> > > > and
> > > >
> > > > val descriptionModel = new IModel[Meeting](meeting, "description"));
> //
> > > > IModel can't be instanced
> > > >
> > > > But I'm doing this thing wrong.
> > > >
> > > > I made a great progress with my app but now I'm struggling with this
> > > issue
> > > > and I spent a lot
> > > > of time to archive this simple task. If I'm  doing this stuff with
> java
> > > my
> > > > life could
> > > > be much easier :-D.
> > > >
> > > > I'll appreciate your hep again
> > > >
> > > >
> > > > Thanks very much
> > > >
> > > >
> > > >
> > > >
> > > > Bera
> > > >
> > > >
> > > > 2013/5/10 Paul Bors <p...@bors.ws>
> > > >
> > > > > Why the Ajax round-trips for each "keyup" to extract the model's
> > > object?
> > > > > Have you tried to implement just the Save link/button and then
> > look-up
> > > > the
> > > > > model object from inside the onClick() method?
> > > > >
> > > > > In your case it would come from the PropertyModel you use already:
> > > > >
> > > > > TextField description = new TextField("description",new
> > > > > PropertyModel[Meeting](meeting, "description"))
> > > > >
> > > > > change to:
> > > > >
> > > > > IModel descriptionModel = new
> > > > > PropertyModel[Meeting](meeting, "description"));
> > > > > TextField descriptionTextField = new TextField("description",
> > > > > descriptionModel );
> > > > >
> > > > > and your link becomes:
> > > > >
> > > > > private class LinkSave(id: String, meeting: Meeting) extends
> > > > > AjaxLink[String](id) {
> > > > >
> > > > > @SpringBean
> > > > > var meetingMediator: TMeetingMediator = _
> > > > >   def onClick(target: AjaxRequestTarget) {
> > > > >     meetingDAO.saveMeeting(descriptionModel.getObject())
> > > > >   }
> > > > > }
> > > > >
> > > > > Unless you want to also update some other element on the screen
> with
> > > each
> > > > > user key press I really don't think you need the "keyup" listener.
> > > > >
> > > > > ~ Thank you,
> > > > >    Paul Bors
> > > > >
> > > > >
> > > > > On Thu, May 9, 2013 at 11:03 PM, Bruno Moura <
> brunormo...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > I'm trying to implement a ListView and in on column of it I
> added a
> > > > > > listView, for each line,
> > > > > > I want to save the data inserted on it and update the model:
> > > > > >
> > > > > > I'm implemented the code bellow:
> > > > > >
> > > > > > val description = new TextField("description",new
> > > > > > PropertyModel[Meeting](meeting, "description"))
> > > > > > description.add(new AjaxFormComponentUpdatingBehavior("keyup") {
> > > > > >   protected def onUpdate(target: AjaxRequestTarget) {
> > > > > >     description.getDefaultModelObjectAsString
> > > > > >   }
> > > > > > })
> > > > > >
> > > > > > item.add(description)
> > > > > >
> > > > > > And I added a link for each line of my ListView for save the
> > > > information
> > > > > in
> > > > > > database,
> > > > > > each line is a instance of a model meeting as is showed bellow:
> > > > > >
> > > > > > item.add(new LinkSave("save", meeting))
> > > > > >
> > > > > > private class LinkSave(id: String, meeting: Meeting) extends
> > > > > > AjaxLink[String](id) {
> > > > > >
> > > > > >     @SpringBean
> > > > > >     var meetingMediator: TMeetingMediator = _
> > > > > >
> > > > > >     setVisible(clickavel.asInstanceOf[Boolean])
> > > > > >     add(new Label("label", new Model[String]() {
> > > > > >       override def getObject: String = "Save"
> > > > > >     }))
> > > > > >
> > > > > >     def onClick(target: AjaxRequestTarget) {
> > > > > >       meetingDAO.saveMeeting(meeting)
> > > > > >
> > > > > >     }
> > > > > >   }
> > > > > >
> > > > > >
> > > > > > But unfortunately the code above doesn't work. It's fail to
> > retrieve
> > > > the
> > > > > > value of the text
> > > > > > field and also to set the attribute description of the Object
> > meeting
> > > > > with
> > > > > > the value of the text field, so in the database the column
> > > description
> > > > is
> > > > > > never filled
> > > > > >
> > > > > > Someone know where I am doing wrong stuff?
> > > > > >
> > > > > > Thanks a lot!
> > > > > >
> > > > > >
> > > > > > Bera
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > Wicket Training & Consulting
> > > http://jWeekend.com <http://jweekend.com/>
> > >
> >
>
>
>
> --
> Martin Grigorov
> Wicket Training & Consulting
> http://jWeekend.com <http://jweekend.com/>
>

Reply via email to