Re: Refresh fields from model

2007-10-15 Thread Christopher Gardner
I think another way to do it is to call setModelObject() with the
appropriate parameter on each component that needs to be updated.  I
chose to use the modelChanged() approach, however, because I'm using
the presentation model pattern
(http://martinfowler.com/eaaDev/PresentationModel.html) that populates
the model properties behind the scenes.  At least in my experience, I
had to call modelChanged() to reflect the new values.

By the way, so far, the presentation model pattern seems to work
nicely with Wicket.  This includes using the LoadableDetachableModel
to call the presentation model to get data to populate a ListView and
dereference the data for memory conservation.  The result is less
verbose Wicket code and the option to use the presentation model in
other web frameworks.  Only time will tell if this approach will scale
with Wicket.

Chris

On 10/15/07, Rich Livingstone <[EMAIL PROTECTED]> wrote:
>
> Thanks, that worked great
>
>
>
> Christopher Gardner-2 wrote:
> >
> > I had to call modelChanged() to do this very thing.
> >
> > On 10/12/07, Rich Livingstone <[EMAIL PROTECTED]> wrote:
> >>
> >> I'm just not sure how to do this - for example, I have a drop down choice
> >> and
> >> when it changes, I need to populate other fields. I had presumed the way
> >> to
> >> do this was to change the values in an attached PropertyModel and any
> >> text
> >> or other UI fields which were attached to this model would be
> >> automatically
> >> updated. But this doesn't seem to be so.
> >>
> >> It seems an obvious thing but I can't find it in any of the forums - if
> >> it's
> >> possible it's got to be simple, yes ?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -
> >> 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]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13224136
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> 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]



DatePicker Problems

2007-10-15 Thread Christopher Gardner
Anyone having problems getting DatePicker to work in beta4?  I get the
icon, but when I click nothing happens.  Probably my error, but just
curious.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Configuring DatePicker

2007-10-12 Thread Christopher Gardner
Does anyone have any examples of configuring DatePicker?  I'd like to
limit the minimal date, for example.  I subclassed it and overrode
configure() to set what I thought the Yahoo documentation said to to
specify the minimal date, but to no avail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Refresh fields from model

2007-10-12 Thread Christopher Gardner
I had to call modelChanged() to do this very thing.

On 10/12/07, Rich Livingstone <[EMAIL PROTECTED]> wrote:
>
> I'm just not sure how to do this - for example, I have a drop down choice and
> when it changes, I need to populate other fields. I had presumed the way to
> do this was to change the values in an attached PropertyModel and any text
> or other UI fields which were attached to this model would be automatically
> updated. But this doesn't seem to be so.
>
> It seems an obvious thing but I can't find it in any of the forums - if it's
> possible it's got to be simple, yes ?
> --
> View this message in context: 
> http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> 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]



Use of the Presentation Model Pattern

2007-10-10 Thread Christopher Gardner
I've been experimenting with the Model-View-Presenter
(http://martinfowler.com/eaaDev/PassiveScreen.html) and the
Presentation Model
(http://martinfowler.com/eaaDev/PresentationModel.html) patterns in
Wicket.  It seems like a variation of the Presentation Model approach
could work well and /may/ reduce the need for things like
LoadableDetachableModels.

In this variation, model attributes could access service objects
dynamically.   For example:

class PlanSetup extends WebPage {
 ...
 PlanSetup(String customerId) {
   ...
   setModel(new CompoundPropertyModel(new PlanSetupPresentation(customerId))
 }
 ...
}

class PlanSetupPresentation {
 ...

 List getPlans() {
   //would a LoadableDetachableModel still be needed to call this method?
   //you could still use one if necessary.
   return planService.findPlansByCustomerId(customerId)
 }

 void setPlanId(Integer planId) {
   //this would be provided by a component in PlanSetup culled from
   //the planId of a Plan that the user selected from among
   //the plans returned by getPlans().
   this.planId = planId
 }

 Plan getPlan()
   //if necessary other things could be done in this method based on plan
   //attributes before actually returning the plan (e.g., setting an warning
   //message in another property).
   this.plan = planService.findByPlanId(planId}
   return plan
 }

 void updatePlan() {
   planService.update(plan)
 }
 ...
}

One issue would be how the presentation model accessed service objects
(e.g., planService).  Perhaps it could use a proxy or a lookup
mechanism to get around serialization requirements.

If there are no real gotchas, this approach would let you write less
Wicket code and test your presentation logic without Wicket.  Wicket
wouldn't need to know anything about service or application level
objects, for example.  And, heaven forbid, if the corporate standards
committee makes you replace Wicket with JSF (and things like that do
happen), you still might be able to use the same presentation model.

Has anyone on the list tried something like this?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Adding a Link for a Whole ListItem

2007-10-05 Thread Christopher Gardner
I'm continuing to experiment with making a click of a row do a page
refresh.  I coded up a class called LinkableListView that uses a
LinkableListItem, which implements ILinkListener.  When the
LinkableListItem's onLinkedClick() is called, LinkableListItem
delegates back to LinkableListView.onClick().

Here is the what my LinkableListView generates for the 2 's.


...
 
...



To use this component, I created a very simple page with two tables.

One table contains a list of objects fetched from memory.  These
objects are fetched only once (at WebPage construction time).  Now
when I click on a row, I want the data from the LinkableListItem in
the selected row to be popped over to the second table which is
designed to hold only a single row.

In this simple page, EVERY time I click on a row in table 1, I get the
page expired message.  I'm new to Wicket, so please forgive and blot
out my ignorance.


On 10/4/07, swaroop belur <[EMAIL PROTECTED]> wrote:
>
>
> Look up how requesttargets work in wicket. In particular
> look up ListenerInterfaceRequestTarget for this use case.
> It just knows how to call ur component(link for example)
> in ur page object. Call will land in onLinkClicked.
>
> -swaroop
>
>
>
>
>
>
> Christopher Gardner-2 wrote:
> >
> > Thank you.  I got this to work.  Now I'm wondering how the
> > ILinkListener gets registered to pick up the event.  Does anything
> > that happens to implement that interface automatically get registered?
> >
> > On 10/3/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> >> Yes, but odds are you already had to do that, to override populateItem().
> >>
> >> Martijn
> >>
> >> On 10/3/07, Christopher Gardner <[EMAIL PROTECTED]> wrote:
> >> > Do you also have to subclass ListView (overriding newItem()) to create
> >> > an object of the ListItem subclass?
> >> >
> >> > On 10/3/07, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> >> > > Yes you can, The trick is to extend ListItem and have it implement
> >> > > ILinkListener you can then add the onclick behavior through an
> >> > > attributemodifier or override oncomponenttag. To prevent having to
> >> > > make a subclass per page you should make the onLinkClicked method in
> >> > > your listitem redirect to a method in your listview.
> >> > >
> >> > > I could show you our code but it is cluttered with non relevant code,
> >> > > and the above really says it all.
> >> > >
> >> > > Maurice
> >> > >
> >> > > On 10/3/07, Christopher Gardner <[EMAIL PROTECTED]> wrote:
> >> > > > With a ListView is there a way to actually create a Link component
> >> > > > that encompasses the whole ListItem, such that when you click
> >> anywhere
> >> > > > on a row the onClick event is fired?  I know you can do this with
> >> Ajax
> >> > > > support, but I'm curious if you can do this using the traditional
> >> way,
> >> > > > i.e., with a full page refresh.  I don't want to add a "click here"
> >> > > > button to my row.
> >> > > >
> >> > > >
> >> -
> >> > > > 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]
> >> >
> >> >
> >>
> >>
> >> --
> >> Buy Wicket in Action: http://manning.com/dashorst
> >> Apache Wicket 1.3.0-beta3 is released
> >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> >>
> >> -
> >> 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]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Adding-a-Link-for-a-Whole-ListItem-tf4561727.html#a13032210
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> 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]



Re: Adding a Link for a Whole ListItem

2007-10-03 Thread Christopher Gardner
Thank you.  I got this to work.  Now I'm wondering how the
ILinkListener gets registered to pick up the event.  Does anything
that happens to implement that interface automatically get registered?

On 10/3/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> Yes, but odds are you already had to do that, to override populateItem().
>
> Martijn
>
> On 10/3/07, Christopher Gardner <[EMAIL PROTECTED]> wrote:
> > Do you also have to subclass ListView (overriding newItem()) to create
> > an object of the ListItem subclass?
> >
> > On 10/3/07, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> > > Yes you can, The trick is to extend ListItem and have it implement
> > > ILinkListener you can then add the onclick behavior through an
> > > attributemodifier or override oncomponenttag. To prevent having to
> > > make a subclass per page you should make the onLinkClicked method in
> > > your listitem redirect to a method in your listview.
> > >
> > > I could show you our code but it is cluttered with non relevant code,
> > > and the above really says it all.
> > >
> > > Maurice
> > >
> > > On 10/3/07, Christopher Gardner <[EMAIL PROTECTED]> wrote:
> > > > With a ListView is there a way to actually create a Link component
> > > > that encompasses the whole ListItem, such that when you click anywhere
> > > > on a row the onClick event is fired?  I know you can do this with Ajax
> > > > support, but I'm curious if you can do this using the traditional way,
> > > > i.e., with a full page refresh.  I don't want to add a "click here"
> > > > button to my row.
> > > >
> > > > -
> > > > 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]
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>
> -
> 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]



Re: Adding a Link for a Whole ListItem

2007-10-03 Thread Christopher Gardner
Do you also have to subclass ListView (overriding newItem()) to create
an object of the ListItem subclass?

On 10/3/07, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> Yes you can, The trick is to extend ListItem and have it implement
> ILinkListener you can then add the onclick behavior through an
> attributemodifier or override oncomponenttag. To prevent having to
> make a subclass per page you should make the onLinkClicked method in
> your listitem redirect to a method in your listview.
>
> I could show you our code but it is cluttered with non relevant code,
> and the above really says it all.
>
> Maurice
>
> On 10/3/07, Christopher Gardner <[EMAIL PROTECTED]> wrote:
> > With a ListView is there a way to actually create a Link component
> > that encompasses the whole ListItem, such that when you click anywhere
> > on a row the onClick event is fired?  I know you can do this with Ajax
> > support, but I'm curious if you can do this using the traditional way,
> > i.e., with a full page refresh.  I don't want to add a "click here"
> > button to my row.
> >
> > -
> > 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]



Adding a Link for a Whole ListItem

2007-10-03 Thread Christopher Gardner
With a ListView is there a way to actually create a Link component
that encompasses the whole ListItem, such that when you click anywhere
on a row the onClick event is fired?  I know you can do this with Ajax
support, but I'm curious if you can do this using the traditional way,
i.e., with a full page refresh.  I don't want to add a "click here"
button to my row.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]