You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2010/04/19 18:12:42 UTC

Re: What is the best way to use LoadableDetachableModel with a WebPage and DataView?

why all the complexity of ldm inside idataprovider, why not just:

class mydataprovider implements idataprovider {
  private long applicantid;
  private transient applicant applicant;
  private applicant getapplicant() { if (applicant==null) {
applicant=dao.get(applicantid); }}
  private iterator(..) {
         return getapplicant().getapplications();
  }
  private size() { return getapplicant().getapplications().size(); }
  private void detach() { applicant=null; }
}

-igor

On Mon, Apr 19, 2010 at 7:42 AM, Steve Hiller <sh...@bellsouth.net> wrote:
> Hi All,
>
> I need help with a Wicket architecture design issue that I am having.
>
> In previous Wicket applications, I have used the LoadableDetachableModel in 2 separate ways:
>
> 1) In the constructor of a WebPage, an LDM is instantiated and then used as the model
> for a component such as a ListView. This is staight out of "Wicket In Action" Chapter 4
> on LDMs.
>
> 2) As the model for a SortableDataProvider to be used with a DataView component.
> I have more or less used the WicketStuff SortingPage example as a guide. That is,
> the SortableDataProvider uses an LDM to supply its own backing data.
>
> For a new Wicket application, I have a WebPage that will have the following aspects:
>
> 1) A sortable grid based on the DataView component.
> 2) The data behind the grid is a collection of "Job Application" objects that is owned by an "Applicant" object.
> 3) A link somewhere else on the page will cause a new Job Application object to be added to the Applicant's list.
> 4) Adding the Job Application object will cause a new record to be written to the underlying database.
>
> Hibernate will be used as the persistence framework.
>
> So here is my issue:
> For this new application, is the correct approach to:
>
> 1) create an LDM in the WebPage's constructor that loads the Applicant object,
> 2) pass the Applicant object's collection of Job Applications objects to the SortableDataProvider
>   that is used with the DataView component?
>
> Or should the SortableDataProvider use its own LDM that is separate from the one used on the WebPage?
>
> Thanks in advance,
> Steve
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What is the best way to use LoadableDetachableModel with a WebPage and DataView?

Posted by shetc <sh...@bellsouth.net>.
So the Sorting DataView Example at wicket-library.com is overkill? It uses an
LDM, and that's what I based
my own implementations on before.

-- 
View this message in context: http://n4.nabble.com/What-is-the-best-way-to-use-LoadableDetachableModel-with-a-WebPage-and-DataView-tp2016027p2016272.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org