You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martijn Lindhout <ml...@jointeffort.nl> on 2008/02/09 19:45:17 UTC

TabbedPanel and model load...

Hi,

I have a page, with those two constructors, the first for editing a new
employee, the second for editing an existing.

    public EditEmployee() {
        setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
            protected Object load() {
                return new Employee();
            }
        }));
        init();
    }

    public EditEmployee(final Long id) {
        setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
            protected Object load() {
                return empRepository.getEmployee(id);
            }
        }));
        init();
    }

Because the Employee info is relatively much, I separate it in two panels in
a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several Panels
The problem is, that when I enter the formfields on the panels, they got
valided, but then a new Employee instance is created, and the FormComponent
values are not copied to the newly instantiated Employee. They're null.

I did some tests and it appears that on each panel switch, the Model.load is
called, and a new Employee is returned.

What's going wrong here....
-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Igor Vaynberg <ig...@gmail.com>.
that sadness is an artifact of how hibernate works. it is
easier/cheaper to create a bean than keep a disconnected session in
your http session, which can be quiet memory intensive. of course
which way you go is up to you.

in a lot of these cases i have noticed that the mapping isnt always
1:1 between what is in the domain model and what is in the ui anyways,
so a bean also makes your ui code a lot leaner.

just my two cents.

-igor


On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> I agree that it is *easier*, but I got bored by duplicating my domain model
> in a DTO like structure. And that's cumbersome.
> I saw this hapening in several projects, and in the end we had two almost
> equals object structures, one with rich behavior, and one with just data and
> structure.
>
> that's sad.... or not?
>
>
> 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> >
> > well, you will have to disconnect the hibernate session, and store it
> > in the http session - or some other place. then your model would have
> > to reconnect the session and pull the entity out of it. its much
> > easier to create a bean imho.
> >
> > -igor
> >
> >
> > On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > because I use the domain objects directly,. without any DTO's, I have to
> > use
> > > the long conversation pattern. That means I have to store the domain
> > object
> > > somewhere in the session and let the loadabledetachable model retrieve
> > it
> > > from there?
> > >
> > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > >
> > > > then you have to use a bean, and on confirm apply changes from the
> > > > bean to the persistent entity. the only other alternative i know of is
> > > > to use the long conversation pattern which i am not really a fan of.
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > ok, that makes sense.
> > > > >
> > > > > But what if I have a Hibernate persisted entity that I want to edit
> > in
> > > > > multiple actions? Say I have an order with orderlines, and I want to
> > add
> > > > and
> > > > > remove them at will, and in the end save or rollback all the
> > changes? I
> > > > > don't want the intermediate add and removes propagate directly to
> > the
> > > > > database, only at 'confirm'.
> > > > >
> > > > >
> > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > >
> > > > > > the other constructor i presume is getting a persistent entity? so
> > > > > > hibernate/jpa will flush state back to db at the end of request,
> > thats
> > > > > > why that works.
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > ok, thanx, that seems to work.
> > > > > > >
> > > > > > > And what about the other constructor, when editing an existing
> > > > entity?
> > > > > > >
> > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > >
> > > > > > > >
> > > > > > > > setModel(new CompoundPropertyModel(new
> > LoadableDetachableModel(){
> > > > > > > >
> > > > > > > > ^ that is bad because ldm is cleared between requests, thats
> > why
> > > > its
> > > > > > > > called loadable
> > > > > > > >
> > > > > > > > just do this
> > > > > > > >
> > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > mlindhout@jointeffort.nl>
> > > > > > > > wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > I have a page, with those two constructors, the first for
> > > > editing a
> > > > > > new
> > > > > > > > > employee, the second for editing an existing.
> > > > > > > > >
> > > > > > > > >     public EditEmployee() {
> > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > LoadableDetachableModel(){
> > > > > > > > >             protected Object load() {
> > > > > > > > >                 return new Employee();
> > > > > > > > >             }
> > > > > > > > >         }));
> > > > > > > > >         init();
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > LoadableDetachableModel(){
> > > > > > > > >             protected Object load() {
> > > > > > > > >                 return empRepository.getEmployee(id);
> > > > > > > > >             }
> > > > > > > > >         }));
> > > > > > > > >         init();
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > Because the Employee info is relatively much, I separate it
> > in
> > > > two
> > > > > > > > panels in
> > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> > > > several
> > > > > > > > Panels
> > > > > > > > > The problem is, that when I enter the formfields on the
> > panels,
> > > > they
> > > > > > got
> > > > > > > > > valided, but then a new Employee instance is created, and
> > the
> > > > > > > > FormComponent
> > > > > > > > > values are not copied to the newly instantiated Employee.
> > > > They're
> > > > > > null.
> > > > > > > > >
> > > > > > > > > I did some tests and it appears that on each panel switch,
> > the
> > > > > > > > Model.load is
> > > > > > > > > called, and a new Employee is returned.
> > > > > > > > >
> > > > > > > > > What's going wrong here....
> > > > > > > > > --
> > > > > > > > > Martijn Lindhout
> > > > > > > > > JointEffort IT Services
> > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
ok, so the memento's are not incremental? Then only one memento should be
enough to restore the order back to the state the user created. That sound
good. I'll try that.

thanx

2008/2/11, Scott Swank <sc...@gmail.com>:
>
> The order has methods createMemento():Memento and applyMemento(Memento
> m).  These are used to get objects that contain state.  They can in
> turn be applied to the order to set it back to that state at a later
> point.  So yes, you fetch the Order, detach it, call applyMemento() if
> you have unsaved work, make additional changes to the order, call
> createMemento(), and then put that in the session.
>
>
> On Feb 11, 2008 11:44 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > ok. never used memento, so I picked the book and read about it. I'm not
> sure
> > how to implement this. When do I retrieve a memento from the order? And
> in
> > the meantime, while adding and removing lines, is the Order updated and
> > saved in the DB? If someone reads the database, will he see the
> intermediate
> > changes?
> >
> > Or do I for each add/remove/change the user makes:
> > - load the original order,
> > - apply any memento's present in a temp space (session)
> > - apply new changes
> > - create a memento
> > - discard changes to DB
> >
> >
> > 2008/2/11, Scott Swank <sc...@gmail.com>:
> > >
> > > The order has one or more order mementos (pre/post editing) and each
> > > order memento has a collection of orderline mementos.  The mementos
> > > are completely opaque, and only the Order & OrderLine are able to
> > > inspect them and extract their content -- perhaps by implementing them
> > > a static inner classes with private mutators.
> > >
> > > On Feb 11, 2008 10:36 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > sounds interesting. Can you explain a bit more? How does this work
> for
> > > > example in an Order-OrderLine situation where you edit an existing
> order
> > > by
> > > > adding and removing orderlines and finally do a commit or rollback?
> > > >
> > > > 2008/2/11, Scott Swank <sc...@gmail.com>:
> > > >
> > > > >
> > > > > I suggest using the GoF memento pattern here.  You keep your
> changes
> > > > > in one or more mementos, which can be kept in the session.  Then
> you
> > > > > push the changes back to the domain model when you are happy with
> > > > > them.  We use this approach for modifying hotel reservations --
> > > > > particularly because we need to see the price before the change as
> > > > > well as with the change to generate e-mails, faxes, etc.
> > > > >
> > > > >
> > > > > On Feb 11, 2008 10:06 AM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > I agree that it is *easier*, but I got bored by duplicating my
> > > domain
> > > > > model
> > > > > > in a DTO like structure. And that's cumbersome.
> > > > > > I saw this hapening in several projects, and in the end we had
> two
> > > > > almost
> > > > > > equals object structures, one with rich behavior, and one with
> just
> > > data
> > > > > and
> > > > > > structure.
> > > > > >
> > > > > > that's sad.... or not?
> > > > > >
> > > > > >
> > > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > > > >
> > > > > > > well, you will have to disconnect the hibernate session, and
> store
> > > it
> > > > > > > in the http session - or some other place. then your model
> would
> > > have
> > > > > > > to reconnect the session and pull the entity out of it. its
> much
> > > > > > > easier to create a bean imho.
> > > > > > >
> > > > > > > -igor
> > > > > > >
> > > > > > >
> > > > > > > On Feb 11, 2008 12:13 AM, Martijn Lindhout <
> > > mlindhout@jointeffort.nl>
> > > > > > > wrote:
> > > > > > > > because I use the domain objects directly,. without any
> DTO's, I
> > > > > have to
> > > > > > > use
> > > > > > > > the long conversation pattern. That means I have to store
> the
> > > domain
> > > > > > > object
> > > > > > > > somewhere in the session and let the loadabledetachable
> model
> > > > > retrieve
> > > > > > > it
> > > > > > > > from there?
> > > > > > > >
> > > > > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > >
> > > > > > > > >
> > > > > > > > > then you have to use a bean, and on confirm apply changes
> from
> > > the
> > > > > > > > > bean to the persistent entity. the only other alternative
> i
> > > know
> > > > > of is
> > > > > > > > > to use the long conversation pattern which i am not really
> a
> > > fan
> > > > > of.
> > > > > > > > >
> > > > > > > > > -igor
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <
> > > > > mlindhout@jointeffort.nl>
> > > > > > > > > wrote:
> > > > > > > > > > ok, that makes sense.
> > > > > > > > > >
> > > > > > > > > > But what if I have a Hibernate persisted entity that I
> want
> > > to
> > > > > edit
> > > > > > > in
> > > > > > > > > > multiple actions? Say I have an order with orderlines,
> and I
> > > > > want to
> > > > > > > add
> > > > > > > > > and
> > > > > > > > > > remove them at will, and in the end save or rollback all
> the
> > > > > > > changes? I
> > > > > > > > > > don't want the intermediate add and removes propagate
> > > directly
> > > > > to
> > > > > > > the
> > > > > > > > > > database, only at 'confirm'.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > > > >
> > > > > > > > > > > the other constructor i presume is getting a
> persistent
> > > > > entity? so
> > > > > > > > > > > hibernate/jpa will flush state back to db at the end
> of
> > > > > request,
> > > > > > > thats
> > > > > > > > > > > why that works.
> > > > > > > > > > >
> > > > > > > > > > > -igor
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > ok, thanx, that seems to work.
> > > > > > > > > > > >
> > > > > > > > > > > > And what about the other constructor, when editing
> an
> > > > > existing
> > > > > > > > > entity?
> > > > > > > > > > > >
> > > > > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > setModel(new CompoundPropertyModel(new
> > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > > >
> > > > > > > > > > > > > ^ that is bad because ldm is cleared between
> requests,
> > > > > thats
> > > > > > > why
> > > > > > > > > its
> > > > > > > > > > > > > called loadable
> > > > > > > > > > > > >
> > > > > > > > > > > > > just do this
> > > > > > > > > > > > >
> > > > > > > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > > > > > > >
> > > > > > > > > > > > > -igor
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > Hi,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I have a page, with those two constructors, the
> > > first
> > > > > for
> > > > > > > > > editing a
> > > > > > > > > > > new
> > > > > > > > > > > > > > employee, the second for editing an existing.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >     public EditEmployee() {
> > > > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > > > >                 return new Employee();
> > > > > > > > > > > > > >             }
> > > > > > > > > > > > > >         }));
> > > > > > > > > > > > > >         init();
> > > > > > > > > > > > > >     }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > > > >                 return empRepository.getEmployee
> > > (id);
> > > > > > > > > > > > > >             }
> > > > > > > > > > > > > >         }));
> > > > > > > > > > > > > >         init();
> > > > > > > > > > > > > >     }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Because the Employee info is relatively much, I
> > > separate
> > > > > it
> > > > > > > in
> > > > > > > > > two
> > > > > > > > > > > > > panels in
> > > > > > > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <-
> > > > > TabbedPanel <-
> > > > > > > > > several
> > > > > > > > > > > > > Panels
> > > > > > > > > > > > > > The problem is, that when I enter the formfields
> on
> > > the
> > > > > > > panels,
> > > > > > > > > they
> > > > > > > > > > > got
> > > > > > > > > > > > > > valided, but then a new Employee instance is
> > > created,
> > > > > and
> > > > > > > the
> > > > > > > > > > > > > FormComponent
> > > > > > > > > > > > > > values are not copied to the newly instantiated
> > > > > Employee.
> > > > > > > > > They're
> > > > > > > > > > > null.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I did some tests and it appears that on each
> panel
> > > > > switch,
> > > > > > > the
> > > > > > > > > > > > > Model.load is
> > > > > > > > > > > > > > called, and a new Employee is returned.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > What's going wrong here....
> > > > > > > > > > > > > > --
> > > > > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > > > > > > To unsubscribe, e-mail:
> > > > > users-unsubscribe@wicket.apache.org
> > > > > > > > > > > > > For additional commands, e-mail:
> > > > > users-help@wicket.apache.org
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > > > > > To unsubscribe, e-mail:
> > > users-unsubscribe@wicket.apache.org
> > > > > > > > > > > For additional commands, e-mail:
> > > users-help@wicket.apache.org
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Martijn Lindhout
> > > > > > > > > > JointEffort IT Services
> > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> users-unsubscribe@wicket.apache.org
> > > > > > > > > For additional commands, e-mail:
> users-help@wicket.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Martijn Lindhout
> > > > > > > > JointEffort IT Services
> > > > > > > > http://www.jointeffort.nl
> > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Scott Swank
> > > > > reformed mathematician
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > >
> > >
> > > --
> > > Scott Swank
> > > reformed mathematician
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
>
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Scott Swank <sc...@gmail.com>.
The order has methods createMemento():Memento and applyMemento(Memento
m).  These are used to get objects that contain state.  They can in
turn be applied to the order to set it back to that state at a later
point.  So yes, you fetch the Order, detach it, call applyMemento() if
you have unsaved work, make additional changes to the order, call
createMemento(), and then put that in the session.


On Feb 11, 2008 11:44 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> ok. never used memento, so I picked the book and read about it. I'm not sure
> how to implement this. When do I retrieve a memento from the order? And in
> the meantime, while adding and removing lines, is the Order updated and
> saved in the DB? If someone reads the database, will he see the intermediate
> changes?
>
> Or do I for each add/remove/change the user makes:
> - load the original order,
> - apply any memento's present in a temp space (session)
> - apply new changes
> - create a memento
> - discard changes to DB
>
>
> 2008/2/11, Scott Swank <sc...@gmail.com>:
> >
> > The order has one or more order mementos (pre/post editing) and each
> > order memento has a collection of orderline mementos.  The mementos
> > are completely opaque, and only the Order & OrderLine are able to
> > inspect them and extract their content -- perhaps by implementing them
> > a static inner classes with private mutators.
> >
> > On Feb 11, 2008 10:36 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > sounds interesting. Can you explain a bit more? How does this work for
> > > example in an Order-OrderLine situation where you edit an existing order
> > by
> > > adding and removing orderlines and finally do a commit or rollback?
> > >
> > > 2008/2/11, Scott Swank <sc...@gmail.com>:
> > >
> > > >
> > > > I suggest using the GoF memento pattern here.  You keep your changes
> > > > in one or more mementos, which can be kept in the session.  Then you
> > > > push the changes back to the domain model when you are happy with
> > > > them.  We use this approach for modifying hotel reservations --
> > > > particularly because we need to see the price before the change as
> > > > well as with the change to generate e-mails, faxes, etc.
> > > >
> > > >
> > > > On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > I agree that it is *easier*, but I got bored by duplicating my
> > domain
> > > > model
> > > > > in a DTO like structure. And that's cumbersome.
> > > > > I saw this hapening in several projects, and in the end we had two
> > > > almost
> > > > > equals object structures, one with rich behavior, and one with just
> > data
> > > > and
> > > > > structure.
> > > > >
> > > > > that's sad.... or not?
> > > > >
> > > > >
> > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > > >
> > > > > > well, you will have to disconnect the hibernate session, and store
> > it
> > > > > > in the http session - or some other place. then your model would
> > have
> > > > > > to reconnect the session and pull the entity out of it. its much
> > > > > > easier to create a bean imho.
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 11, 2008 12:13 AM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > because I use the domain objects directly,. without any DTO's, I
> > > > have to
> > > > > > use
> > > > > > > the long conversation pattern. That means I have to store the
> > domain
> > > > > > object
> > > > > > > somewhere in the session and let the loadabledetachable model
> > > > retrieve
> > > > > > it
> > > > > > > from there?
> > > > > > >
> > > > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > > > >
> > > > > > > >
> > > > > > > > then you have to use a bean, and on confirm apply changes from
> > the
> > > > > > > > bean to the persistent entity. the only other alternative i
> > know
> > > > of is
> > > > > > > > to use the long conversation pattern which i am not really a
> > fan
> > > > of.
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <
> > > > mlindhout@jointeffort.nl>
> > > > > > > > wrote:
> > > > > > > > > ok, that makes sense.
> > > > > > > > >
> > > > > > > > > But what if I have a Hibernate persisted entity that I want
> > to
> > > > edit
> > > > > > in
> > > > > > > > > multiple actions? Say I have an order with orderlines, and I
> > > > want to
> > > > > > add
> > > > > > > > and
> > > > > > > > > remove them at will, and in the end save or rollback all the
> > > > > > changes? I
> > > > > > > > > don't want the intermediate add and removes propagate
> > directly
> > > > to
> > > > > > the
> > > > > > > > > database, only at 'confirm'.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > > >
> > > > > > > > > > the other constructor i presume is getting a persistent
> > > > entity? so
> > > > > > > > > > hibernate/jpa will flush state back to db at the end of
> > > > request,
> > > > > > thats
> > > > > > > > > > why that works.
> > > > > > > > > >
> > > > > > > > > > -igor
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > wrote:
> > > > > > > > > > > ok, thanx, that seems to work.
> > > > > > > > > > >
> > > > > > > > > > > And what about the other constructor, when editing an
> > > > existing
> > > > > > > > entity?
> > > > > > > > > > >
> > > > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > setModel(new CompoundPropertyModel(new
> > > > > > LoadableDetachableModel(){
> > > > > > > > > > > >
> > > > > > > > > > > > ^ that is bad because ldm is cleared between requests,
> > > > thats
> > > > > > why
> > > > > > > > its
> > > > > > > > > > > > called loadable
> > > > > > > > > > > >
> > > > > > > > > > > > just do this
> > > > > > > > > > > >
> > > > > > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > > > > > >
> > > > > > > > > > > > -igor
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > >
> > > > > > > > > > > > > I have a page, with those two constructors, the
> > first
> > > > for
> > > > > > > > editing a
> > > > > > > > > > new
> > > > > > > > > > > > > employee, the second for editing an existing.
> > > > > > > > > > > > >
> > > > > > > > > > > > >     public EditEmployee() {
> > > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > > >                 return new Employee();
> > > > > > > > > > > > >             }
> > > > > > > > > > > > >         }));
> > > > > > > > > > > > >         init();
> > > > > > > > > > > > >     }
> > > > > > > > > > > > >
> > > > > > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > > >                 return empRepository.getEmployee
> > (id);
> > > > > > > > > > > > >             }
> > > > > > > > > > > > >         }));
> > > > > > > > > > > > >         init();
> > > > > > > > > > > > >     }
> > > > > > > > > > > > >
> > > > > > > > > > > > > Because the Employee info is relatively much, I
> > separate
> > > > it
> > > > > > in
> > > > > > > > two
> > > > > > > > > > > > panels in
> > > > > > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <-
> > > > TabbedPanel <-
> > > > > > > > several
> > > > > > > > > > > > Panels
> > > > > > > > > > > > > The problem is, that when I enter the formfields on
> > the
> > > > > > panels,
> > > > > > > > they
> > > > > > > > > > got
> > > > > > > > > > > > > valided, but then a new Employee instance is
> > created,
> > > > and
> > > > > > the
> > > > > > > > > > > > FormComponent
> > > > > > > > > > > > > values are not copied to the newly instantiated
> > > > Employee.
> > > > > > > > They're
> > > > > > > > > > null.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I did some tests and it appears that on each panel
> > > > switch,
> > > > > > the
> > > > > > > > > > > > Model.load is
> > > > > > > > > > > > > called, and a new Employee is returned.
> > > > > > > > > > > > >
> > > > > > > > > > > > > What's going wrong here....
> > > > > > > > > > > > > --
> > > > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > > > > > To unsubscribe, e-mail:
> > > > users-unsubscribe@wicket.apache.org
> > > > > > > > > > > > For additional commands, e-mail:
> > > > users-help@wicket.apache.org
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > users-unsubscribe@wicket.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > users-help@wicket.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Martijn Lindhout
> > > > > > > > > JointEffort IT Services
> > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Scott Swank
> > > > reformed mathematician
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> >
> >
> > --
> > Scott Swank
> > reformed mathematician
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>



-- 
Scott Swank
reformed mathematician

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


RE: StringResourceModel - how to pass method call instead of bean

Posted by Michael Mehrle <mi...@ask.com>.
Wow, that is cool - excellent, excellent input - that's exactly what I
need. Roland - you're the man :-)

Thanks!

Michael

-----Original Message-----
From: Roland Huss [mailto:nabble@tichny.org] 
Sent: Tuesday, February 12, 2008 12:19 PM
To: users@wicket.apache.org
Subject: RE: StringResourceModel - how to pass method call instead of
bean



Michael Mehrle wrote:
> 
> One more question - what do you refer to with 'late binding' - I
assume
> the value would be computed 'late' in the process? Please elaborate or
> send me a pointer.
> ...
> 
>> Alternatively, I you need late binding put 
>> 
>> new AbstractReadOnlyModel() {
>>    public Object getObject() { return getTotalAlbums(); }
>> }
> 
> 

You got it. ('late binding' is probably the wrong synonym here, but it's
a
good metaphor anyway. 
At least for me ;-) Instead of showing only the number of total albums
which
existed 
at creation time of your component, by using this extra indirection step
you
get
your method evaluated each time the component is rendered (which can
happen
quite later 
when your album collection changes, e.g. when you use this label on a
page
where you
manage your stuff).

...roland
-- 
View this message in context:
http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15441970.
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


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


RE: StringResourceModel - how to pass method call instead of bean

Posted by Roland Huss <na...@tichny.org>.

Michael Mehrle wrote:
> 
> One more question - what do you refer to with 'late binding' - I assume
> the value would be computed 'late' in the process? Please elaborate or
> send me a pointer.
> ...
> 
>> Alternatively, I you need late binding put 
>> 
>> new AbstractReadOnlyModel() {
>>    public Object getObject() { return getTotalAlbums(); }
>> }
> 
> 

You got it. ('late binding' is probably the wrong synonym here, but it's a
good metaphor anyway. 
At least for me ;-) Instead of showing only the number of total albums which
existed 
at creation time of your component, by using this extra indirection step you
get
your method evaluated each time the component is rendered (which can happen
quite later 
when your album collection changes, e.g. when you use this label on a page
where you
manage your stuff).

...roland
-- 
View this message in context: http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15441970.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


RE: StringResourceModel - how to pass method call instead of bean

Posted by Michael Mehrle <mi...@ask.com>.
Well, the reason why was I didn't know that call existed ;-) Of course I
looked at the JavaDoc, but the examples there didn't show this scenario.
Thanks a LOT for your reply - this addresses exactly what I'm looking
for :-)

One more question - what do you refer to with 'late binding' - I assume
the value would be computed 'late' in the process? Please elaborate or
send me a pointer.

Michael


********** 

Why dont you simple use MessageFormat's parameter substitution as
desribed
in the JavaDoc, i.e.

 .. new StringResourceModel("label.getTotalAlbums",this,null,new
Object[] {
getTotalAlbums() });

with 

label.getTotalAlbums=All Albums: ${0}

Alternatively, I you need late binding put 

new AbstractReadOnlyModel() {
    public Object getObject() { return getTotalAlbums(); }
}

in the object array (instead of getTotalAlbums() directly)

bye ...

...roland
-- 
View this message in context:
http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15440668.
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


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


RE: StringResourceModel - how to pass method call instead of bean

Posted by Roland Huss <na...@tichny.org>.

Michael Mehrle wrote:
> 
> Now, if I want to call a method that returns a String instead, like
> so...
> 
> add(new Label("greetings", new StringResourceModel("label.allAlbums",
> this, new Model(getTotalAlbums())));
>         ^^^^^^^^^^^
> 
> ...with my properties file having this entry:
> 
> label.getTotalAlbums = All Albums: ${someReference}
> 
> Obviously, this doesn't work, since the new Model(xxx) call expects a
> bean to be passed in. How can I do this with a simple method call? And
> what would my someReference var be?
> 

Why dont you simple use MessageFormat's parameter substitution as desribed
in the JavaDoc, i.e.

 .. new StringResourceModel("label.getTotalAlbums",this,null,new Object[] {
getTotalAlbums() });

with 

label.getTotalAlbums=All Albums: ${0}

Alternatively, I you need late binding put 

new AbstractReadOnlyModel() {
    public Object getObject() { return getTotalAlbums(); }
}

in the object array (instead of getTotalAlbums() directly)

bye ...

...roland
-- 
View this message in context: http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15440668.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


RE: StringResourceModel - how to pass method call instead of bean

Posted by Michael Mehrle <mi...@ask.com>.
Didn't see a response - does anyone know how to do this?

-----Original Message-----
From: Michael Mehrle [mailto:michael.mehrle@ask.com] 
Sent: Monday, February 11, 2008 5:53 PM
To: users@wicket.apache.org
Subject: StringResourceModel - how to pass method call instead of bean

I actually have a follow up question regarding StringResourceModel - the
tutorial shows this example, which makes sense:

add(new Label("greetings", new StringResourceModel("label.greetings",
this, new Model(user))));

Now, if I want to call a method that returns a String instead, like
so...

add(new Label("greetings", new StringResourceModel("label.allAlbums",
this, new Model(getTotalAlbums())));
        ^^^^^^^^^^^

...with my properties file having this entry:

label.getTotalAlbums = All Albums: ${someReference}

Obviously, this doesn't work, since the new Model(xxx) call expects a
bean to be passed in. How can I do this with a simple method call? And
what would my someReference var be?

Hope this makes sense - I just want to avoid passing in/creating a bean.

Michael


-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com]
On Behalf Of James Carman
Sent: Monday, February 11, 2008 12:04 PM
To: users@wicket.apache.org
Subject: Re: TabbedPanel tab names

Oops.  That's what I meant. I had to use StringResourceModel in my
case because I had to supply parameters.

On 2/11/08, Igor Vaynberg <ig...@gmail.com> wrote:
> or just ResourceModel
>
> -igor
>
>
> On Feb 11, 2008 11:59 AM, James Carman <ja...@carmanconsulting.com>
wrote:
> > Have you tried StringResourceModel?
> >
> >
> > On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> > > Assuming the typical tabbed panel example below - is there a good
way to
> > > grab the tab name from the page's properties file? What I need to
do is
> > > to internationalize the tab name. I guess I could do my own call
to grab
> > > it from the classpath + the property file name. Was hoping
> > >
> > > List tabs = new ArrayList();
> > >         tabs.add(new AbstractTab(new Model("first tab"))
> > >                 {                                 ^^^^^^
> > >             public Panel getPanel(String panelId)
> > >             {
> > >                 return new TabPanel1(panelId);
> > >             }
> > > });
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


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


StringResourceModel - how to pass method call instead of bean

Posted by Michael Mehrle <mi...@ask.com>.
I actually have a follow up question regarding StringResourceModel - the
tutorial shows this example, which makes sense:

add(new Label("greetings", new StringResourceModel("label.greetings",
this, new Model(user))));

Now, if I want to call a method that returns a String instead, like
so...

add(new Label("greetings", new StringResourceModel("label.allAlbums",
this, new Model(getTotalAlbums())));
        ^^^^^^^^^^^

...with my properties file having this entry:

label.getTotalAlbums = All Albums: ${someReference}

Obviously, this doesn't work, since the new Model(xxx) call expects a
bean to be passed in. How can I do this with a simple method call? And
what would my someReference var be?

Hope this makes sense - I just want to avoid passing in/creating a bean.

Michael


-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com]
On Behalf Of James Carman
Sent: Monday, February 11, 2008 12:04 PM
To: users@wicket.apache.org
Subject: Re: TabbedPanel tab names

Oops.  That's what I meant. I had to use StringResourceModel in my
case because I had to supply parameters.

On 2/11/08, Igor Vaynberg <ig...@gmail.com> wrote:
> or just ResourceModel
>
> -igor
>
>
> On Feb 11, 2008 11:59 AM, James Carman <ja...@carmanconsulting.com>
wrote:
> > Have you tried StringResourceModel?
> >
> >
> > On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> > > Assuming the typical tabbed panel example below - is there a good
way to
> > > grab the tab name from the page's properties file? What I need to
do is
> > > to internationalize the tab name. I guess I could do my own call
to grab
> > > it from the classpath + the property file name. Was hoping
> > >
> > > List tabs = new ArrayList();
> > >         tabs.add(new AbstractTab(new Model("first tab"))
> > >                 {                                 ^^^^^^
> > >             public Panel getPanel(String panelId)
> > >             {
> > >                 return new TabPanel1(panelId);
> > >             }
> > > });
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


RE: TabbedPanel tab names

Posted by Michael Mehrle <mi...@ask.com>.
That seems to work - thanks guys! Much cleaner than manually accessing a
resource bundle.

Thanks,

Michael

-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com]
On Behalf Of James Carman
Sent: Monday, February 11, 2008 12:04 PM
To: users@wicket.apache.org
Subject: Re: TabbedPanel tab names

Oops.  That's what I meant. I had to use StringResourceModel in my
case because I had to supply parameters.

On 2/11/08, Igor Vaynberg <ig...@gmail.com> wrote:
> or just ResourceModel
>
> -igor
>
>
> On Feb 11, 2008 11:59 AM, James Carman <ja...@carmanconsulting.com>
wrote:
> > Have you tried StringResourceModel?
> >
> >
> > On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> > > Assuming the typical tabbed panel example below - is there a good
way to
> > > grab the tab name from the page's properties file? What I need to
do is
> > > to internationalize the tab name. I guess I could do my own call
to grab
> > > it from the classpath + the property file name. Was hoping
> > >
> > > List tabs = new ArrayList();
> > >         tabs.add(new AbstractTab(new Model("first tab"))
> > >                 {                                 ^^^^^^
> > >             public Panel getPanel(String panelId)
> > >             {
> > >                 return new TabPanel1(panelId);
> > >             }
> > > });
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


Re: TabbedPanel tab names

Posted by James Carman <ja...@carmanconsulting.com>.
Oops.  That's what I meant. I had to use StringResourceModel in my
case because I had to supply parameters.

On 2/11/08, Igor Vaynberg <ig...@gmail.com> wrote:
> or just ResourceModel
>
> -igor
>
>
> On Feb 11, 2008 11:59 AM, James Carman <ja...@carmanconsulting.com> wrote:
> > Have you tried StringResourceModel?
> >
> >
> > On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> > > Assuming the typical tabbed panel example below - is there a good way to
> > > grab the tab name from the page's properties file? What I need to do is
> > > to internationalize the tab name. I guess I could do my own call to grab
> > > it from the classpath + the property file name. Was hoping
> > >
> > > List tabs = new ArrayList();
> > >         tabs.add(new AbstractTab(new Model("first tab"))
> > >                 {                                 ^^^^^^
> > >             public Panel getPanel(String panelId)
> > >             {
> > >                 return new TabPanel1(panelId);
> > >             }
> > > });
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: TabbedPanel tab names

Posted by Igor Vaynberg <ig...@gmail.com>.
or just ResourceModel

-igor


On Feb 11, 2008 11:59 AM, James Carman <ja...@carmanconsulting.com> wrote:
> Have you tried StringResourceModel?
>
>
> On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> > Assuming the typical tabbed panel example below - is there a good way to
> > grab the tab name from the page's properties file? What I need to do is
> > to internationalize the tab name. I guess I could do my own call to grab
> > it from the classpath + the property file name. Was hoping
> >
> > List tabs = new ArrayList();
> >         tabs.add(new AbstractTab(new Model("first tab"))
> >                 {                                 ^^^^^^
> >             public Panel getPanel(String panelId)
> >             {
> >                 return new TabPanel1(panelId);
> >             }
> > });
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: TabbedPanel tab names

Posted by James Carman <ja...@carmanconsulting.com>.
Have you tried StringResourceModel?

On 2/11/08, Michael Mehrle <mi...@ask.com> wrote:
> Assuming the typical tabbed panel example below - is there a good way to
> grab the tab name from the page's properties file? What I need to do is
> to internationalize the tab name. I guess I could do my own call to grab
> it from the classpath + the property file name. Was hoping
>
> List tabs = new ArrayList();
>         tabs.add(new AbstractTab(new Model("first tab"))
>                 {                                 ^^^^^^
>             public Panel getPanel(String panelId)
>             {
>                 return new TabPanel1(panelId);
>             }
> });
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


TabbedPanel tab names

Posted by Michael Mehrle <mi...@ask.com>.
Assuming the typical tabbed panel example below - is there a good way to
grab the tab name from the page's properties file? What I need to do is
to internationalize the tab name. I guess I could do my own call to grab
it from the classpath + the property file name. Was hoping 

List tabs = new ArrayList();
        tabs.add(new AbstractTab(new Model("first tab")) 
		{                                 ^^^^^^
            public Panel getPanel(String panelId)
            {
                return new TabPanel1(panelId);
            }
});

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
ok. never used memento, so I picked the book and read about it. I'm not sure
how to implement this. When do I retrieve a memento from the order? And in
the meantime, while adding and removing lines, is the Order updated and
saved in the DB? If someone reads the database, will he see the intermediate
changes?

Or do I for each add/remove/change the user makes:
- load the original order,
- apply any memento's present in a temp space (session)
- apply new changes
- create a memento
- discard changes to DB

2008/2/11, Scott Swank <sc...@gmail.com>:
>
> The order has one or more order mementos (pre/post editing) and each
> order memento has a collection of orderline mementos.  The mementos
> are completely opaque, and only the Order & OrderLine are able to
> inspect them and extract their content -- perhaps by implementing them
> a static inner classes with private mutators.
>
> On Feb 11, 2008 10:36 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > sounds interesting. Can you explain a bit more? How does this work for
> > example in an Order-OrderLine situation where you edit an existing order
> by
> > adding and removing orderlines and finally do a commit or rollback?
> >
> > 2008/2/11, Scott Swank <sc...@gmail.com>:
> >
> > >
> > > I suggest using the GoF memento pattern here.  You keep your changes
> > > in one or more mementos, which can be kept in the session.  Then you
> > > push the changes back to the domain model when you are happy with
> > > them.  We use this approach for modifying hotel reservations --
> > > particularly because we need to see the price before the change as
> > > well as with the change to generate e-mails, faxes, etc.
> > >
> > >
> > > On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > I agree that it is *easier*, but I got bored by duplicating my
> domain
> > > model
> > > > in a DTO like structure. And that's cumbersome.
> > > > I saw this hapening in several projects, and in the end we had two
> > > almost
> > > > equals object structures, one with rich behavior, and one with just
> data
> > > and
> > > > structure.
> > > >
> > > > that's sad.... or not?
> > > >
> > > >
> > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > >
> > > > > well, you will have to disconnect the hibernate session, and store
> it
> > > > > in the http session - or some other place. then your model would
> have
> > > > > to reconnect the session and pull the entity out of it. its much
> > > > > easier to create a bean imho.
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 11, 2008 12:13 AM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > because I use the domain objects directly,. without any DTO's, I
> > > have to
> > > > > use
> > > > > > the long conversation pattern. That means I have to store the
> domain
> > > > > object
> > > > > > somewhere in the session and let the loadabledetachable model
> > > retrieve
> > > > > it
> > > > > > from there?
> > > > > >
> > > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > > >
> > > > > > >
> > > > > > > then you have to use a bean, and on confirm apply changes from
> the
> > > > > > > bean to the persistent entity. the only other alternative i
> know
> > > of is
> > > > > > > to use the long conversation pattern which i am not really a
> fan
> > > of.
> > > > > > >
> > > > > > > -igor
> > > > > > >
> > > > > > >
> > > > > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <
> > > mlindhout@jointeffort.nl>
> > > > > > > wrote:
> > > > > > > > ok, that makes sense.
> > > > > > > >
> > > > > > > > But what if I have a Hibernate persisted entity that I want
> to
> > > edit
> > > > > in
> > > > > > > > multiple actions? Say I have an order with orderlines, and I
> > > want to
> > > > > add
> > > > > > > and
> > > > > > > > remove them at will, and in the end save or rollback all the
> > > > > changes? I
> > > > > > > > don't want the intermediate add and removes propagate
> directly
> > > to
> > > > > the
> > > > > > > > database, only at 'confirm'.
> > > > > > > >
> > > > > > > >
> > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > >
> > > > > > > > > the other constructor i presume is getting a persistent
> > > entity? so
> > > > > > > > > hibernate/jpa will flush state back to db at the end of
> > > request,
> > > > > thats
> > > > > > > > > why that works.
> > > > > > > > >
> > > > > > > > > -igor
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > > > > mlindhout@jointeffort.nl>
> > > > > > > > > wrote:
> > > > > > > > > > ok, thanx, that seems to work.
> > > > > > > > > >
> > > > > > > > > > And what about the other constructor, when editing an
> > > existing
> > > > > > > entity?
> > > > > > > > > >
> > > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > setModel(new CompoundPropertyModel(new
> > > > > LoadableDetachableModel(){
> > > > > > > > > > >
> > > > > > > > > > > ^ that is bad because ldm is cleared between requests,
> > > thats
> > > > > why
> > > > > > > its
> > > > > > > > > > > called loadable
> > > > > > > > > > >
> > > > > > > > > > > just do this
> > > > > > > > > > >
> > > > > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > > > > >
> > > > > > > > > > > -igor
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > Hi,
> > > > > > > > > > > >
> > > > > > > > > > > > I have a page, with those two constructors, the
> first
> > > for
> > > > > > > editing a
> > > > > > > > > new
> > > > > > > > > > > > employee, the second for editing an existing.
> > > > > > > > > > > >
> > > > > > > > > > > >     public EditEmployee() {
> > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > >                 return new Employee();
> > > > > > > > > > > >             }
> > > > > > > > > > > >         }));
> > > > > > > > > > > >         init();
> > > > > > > > > > > >     }
> > > > > > > > > > > >
> > > > > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > > >             protected Object load() {
> > > > > > > > > > > >                 return empRepository.getEmployee
> (id);
> > > > > > > > > > > >             }
> > > > > > > > > > > >         }));
> > > > > > > > > > > >         init();
> > > > > > > > > > > >     }
> > > > > > > > > > > >
> > > > > > > > > > > > Because the Employee info is relatively much, I
> separate
> > > it
> > > > > in
> > > > > > > two
> > > > > > > > > > > panels in
> > > > > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <-
> > > TabbedPanel <-
> > > > > > > several
> > > > > > > > > > > Panels
> > > > > > > > > > > > The problem is, that when I enter the formfields on
> the
> > > > > panels,
> > > > > > > they
> > > > > > > > > got
> > > > > > > > > > > > valided, but then a new Employee instance is
> created,
> > > and
> > > > > the
> > > > > > > > > > > FormComponent
> > > > > > > > > > > > values are not copied to the newly instantiated
> > > Employee.
> > > > > > > They're
> > > > > > > > > null.
> > > > > > > > > > > >
> > > > > > > > > > > > I did some tests and it appears that on each panel
> > > switch,
> > > > > the
> > > > > > > > > > > Model.load is
> > > > > > > > > > > > called, and a new Employee is returned.
> > > > > > > > > > > >
> > > > > > > > > > > > What's going wrong here....
> > > > > > > > > > > > --
> > > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > > > > > To unsubscribe, e-mail:
> > > users-unsubscribe@wicket.apache.org
> > > > > > > > > > > For additional commands, e-mail:
> > > users-help@wicket.apache.org
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > Martijn Lindhout
> > > > > > > > > > JointEffort IT Services
> > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> users-unsubscribe@wicket.apache.org
> > > > > > > > > For additional commands, e-mail:
> users-help@wicket.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Martijn Lindhout
> > > > > > > > JointEffort IT Services
> > > > > > > > http://www.jointeffort.nl
> > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > >
> > >
> > > --
> > > Scott Swank
> > > reformed mathematician
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
>
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Scott Swank <sc...@gmail.com>.
The order has one or more order mementos (pre/post editing) and each
order memento has a collection of orderline mementos.  The mementos
are completely opaque, and only the Order & OrderLine are able to
inspect them and extract their content -- perhaps by implementing them
a static inner classes with private mutators.

On Feb 11, 2008 10:36 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> sounds interesting. Can you explain a bit more? How does this work for
> example in an Order-OrderLine situation where you edit an existing order by
> adding and removing orderlines and finally do a commit or rollback?
>
> 2008/2/11, Scott Swank <sc...@gmail.com>:
>
> >
> > I suggest using the GoF memento pattern here.  You keep your changes
> > in one or more mementos, which can be kept in the session.  Then you
> > push the changes back to the domain model when you are happy with
> > them.  We use this approach for modifying hotel reservations --
> > particularly because we need to see the price before the change as
> > well as with the change to generate e-mails, faxes, etc.
> >
> >
> > On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > I agree that it is *easier*, but I got bored by duplicating my domain
> > model
> > > in a DTO like structure. And that's cumbersome.
> > > I saw this hapening in several projects, and in the end we had two
> > almost
> > > equals object structures, one with rich behavior, and one with just data
> > and
> > > structure.
> > >
> > > that's sad.... or not?
> > >
> > >
> > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > well, you will have to disconnect the hibernate session, and store it
> > > > in the http session - or some other place. then your model would have
> > > > to reconnect the session and pull the entity out of it. its much
> > > > easier to create a bean imho.
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > because I use the domain objects directly,. without any DTO's, I
> > have to
> > > > use
> > > > > the long conversation pattern. That means I have to store the domain
> > > > object
> > > > > somewhere in the session and let the loadabledetachable model
> > retrieve
> > > > it
> > > > > from there?
> > > > >
> > > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > > >
> > > > > >
> > > > > > then you have to use a bean, and on confirm apply changes from the
> > > > > > bean to the persistent entity. the only other alternative i know
> > of is
> > > > > > to use the long conversation pattern which i am not really a fan
> > of.
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > ok, that makes sense.
> > > > > > >
> > > > > > > But what if I have a Hibernate persisted entity that I want to
> > edit
> > > > in
> > > > > > > multiple actions? Say I have an order with orderlines, and I
> > want to
> > > > add
> > > > > > and
> > > > > > > remove them at will, and in the end save or rollback all the
> > > > changes? I
> > > > > > > don't want the intermediate add and removes propagate directly
> > to
> > > > the
> > > > > > > database, only at 'confirm'.
> > > > > > >
> > > > > > >
> > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > >
> > > > > > > > the other constructor i presume is getting a persistent
> > entity? so
> > > > > > > > hibernate/jpa will flush state back to db at the end of
> > request,
> > > > thats
> > > > > > > > why that works.
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > > > mlindhout@jointeffort.nl>
> > > > > > > > wrote:
> > > > > > > > > ok, thanx, that seems to work.
> > > > > > > > >
> > > > > > > > > And what about the other constructor, when editing an
> > existing
> > > > > > entity?
> > > > > > > > >
> > > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > setModel(new CompoundPropertyModel(new
> > > > LoadableDetachableModel(){
> > > > > > > > > >
> > > > > > > > > > ^ that is bad because ldm is cleared between requests,
> > thats
> > > > why
> > > > > > its
> > > > > > > > > > called loadable
> > > > > > > > > >
> > > > > > > > > > just do this
> > > > > > > > > >
> > > > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > > > >
> > > > > > > > > > -igor
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > > > mlindhout@jointeffort.nl>
> > > > > > > > > > wrote:
> > > > > > > > > > > Hi,
> > > > > > > > > > >
> > > > > > > > > > > I have a page, with those two constructors, the first
> > for
> > > > > > editing a
> > > > > > > > new
> > > > > > > > > > > employee, the second for editing an existing.
> > > > > > > > > > >
> > > > > > > > > > >     public EditEmployee() {
> > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > >             protected Object load() {
> > > > > > > > > > >                 return new Employee();
> > > > > > > > > > >             }
> > > > > > > > > > >         }));
> > > > > > > > > > >         init();
> > > > > > > > > > >     }
> > > > > > > > > > >
> > > > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > > >             protected Object load() {
> > > > > > > > > > >                 return empRepository.getEmployee(id);
> > > > > > > > > > >             }
> > > > > > > > > > >         }));
> > > > > > > > > > >         init();
> > > > > > > > > > >     }
> > > > > > > > > > >
> > > > > > > > > > > Because the Employee info is relatively much, I separate
> > it
> > > > in
> > > > > > two
> > > > > > > > > > panels in
> > > > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <-
> > TabbedPanel <-
> > > > > > several
> > > > > > > > > > Panels
> > > > > > > > > > > The problem is, that when I enter the formfields on the
> > > > panels,
> > > > > > they
> > > > > > > > got
> > > > > > > > > > > valided, but then a new Employee instance is created,
> > and
> > > > the
> > > > > > > > > > FormComponent
> > > > > > > > > > > values are not copied to the newly instantiated
> > Employee.
> > > > > > They're
> > > > > > > > null.
> > > > > > > > > > >
> > > > > > > > > > > I did some tests and it appears that on each panel
> > switch,
> > > > the
> > > > > > > > > > Model.load is
> > > > > > > > > > > called, and a new Employee is returned.
> > > > > > > > > > >
> > > > > > > > > > > What's going wrong here....
> > > > > > > > > > > --
> > > > > > > > > > > Martijn Lindhout
> > > > > > > > > > > JointEffort IT Services
> > > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > users-unsubscribe@wicket.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > users-help@wicket.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > Martijn Lindhout
> > > > > > > > > JointEffort IT Services
> > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> >
> >
> > --
> > Scott Swank
> > reformed mathematician
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>



-- 
Scott Swank
reformed mathematician

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
sounds interesting. Can you explain a bit more? How does this work for
example in an Order-OrderLine situation where you edit an existing order by
adding and removing orderlines and finally do a commit or rollback?

2008/2/11, Scott Swank <sc...@gmail.com>:
>
> I suggest using the GoF memento pattern here.  You keep your changes
> in one or more mementos, which can be kept in the session.  Then you
> push the changes back to the domain model when you are happy with
> them.  We use this approach for modifying hotel reservations --
> particularly because we need to see the price before the change as
> well as with the change to generate e-mails, faxes, etc.
>
>
> On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > I agree that it is *easier*, but I got bored by duplicating my domain
> model
> > in a DTO like structure. And that's cumbersome.
> > I saw this hapening in several projects, and in the end we had two
> almost
> > equals object structures, one with rich behavior, and one with just data
> and
> > structure.
> >
> > that's sad.... or not?
> >
> >
> > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > well, you will have to disconnect the hibernate session, and store it
> > > in the http session - or some other place. then your model would have
> > > to reconnect the session and pull the entity out of it. its much
> > > easier to create a bean imho.
> > >
> > > -igor
> > >
> > >
> > > On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > because I use the domain objects directly,. without any DTO's, I
> have to
> > > use
> > > > the long conversation pattern. That means I have to store the domain
> > > object
> > > > somewhere in the session and let the loadabledetachable model
> retrieve
> > > it
> > > > from there?
> > > >
> > > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > >
> > > > > then you have to use a bean, and on confirm apply changes from the
> > > > > bean to the persistent entity. the only other alternative i know
> of is
> > > > > to use the long conversation pattern which i am not really a fan
> of.
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > ok, that makes sense.
> > > > > >
> > > > > > But what if I have a Hibernate persisted entity that I want to
> edit
> > > in
> > > > > > multiple actions? Say I have an order with orderlines, and I
> want to
> > > add
> > > > > and
> > > > > > remove them at will, and in the end save or rollback all the
> > > changes? I
> > > > > > don't want the intermediate add and removes propagate directly
> to
> > > the
> > > > > > database, only at 'confirm'.
> > > > > >
> > > > > >
> > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > >
> > > > > > > the other constructor i presume is getting a persistent
> entity? so
> > > > > > > hibernate/jpa will flush state back to db at the end of
> request,
> > > thats
> > > > > > > why that works.
> > > > > > >
> > > > > > > -igor
> > > > > > >
> > > > > > >
> > > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > > mlindhout@jointeffort.nl>
> > > > > > > wrote:
> > > > > > > > ok, thanx, that seems to work.
> > > > > > > >
> > > > > > > > And what about the other constructor, when editing an
> existing
> > > > > entity?
> > > > > > > >
> > > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > > >
> > > > > > > > >
> > > > > > > > > setModel(new CompoundPropertyModel(new
> > > LoadableDetachableModel(){
> > > > > > > > >
> > > > > > > > > ^ that is bad because ldm is cleared between requests,
> thats
> > > why
> > > > > its
> > > > > > > > > called loadable
> > > > > > > > >
> > > > > > > > > just do this
> > > > > > > > >
> > > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > > >
> > > > > > > > > -igor
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > > mlindhout@jointeffort.nl>
> > > > > > > > > wrote:
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > I have a page, with those two constructors, the first
> for
> > > > > editing a
> > > > > > > new
> > > > > > > > > > employee, the second for editing an existing.
> > > > > > > > > >
> > > > > > > > > >     public EditEmployee() {
> > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > >             protected Object load() {
> > > > > > > > > >                 return new Employee();
> > > > > > > > > >             }
> > > > > > > > > >         }));
> > > > > > > > > >         init();
> > > > > > > > > >     }
> > > > > > > > > >
> > > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > > LoadableDetachableModel(){
> > > > > > > > > >             protected Object load() {
> > > > > > > > > >                 return empRepository.getEmployee(id);
> > > > > > > > > >             }
> > > > > > > > > >         }));
> > > > > > > > > >         init();
> > > > > > > > > >     }
> > > > > > > > > >
> > > > > > > > > > Because the Employee info is relatively much, I separate
> it
> > > in
> > > > > two
> > > > > > > > > panels in
> > > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <-
> TabbedPanel <-
> > > > > several
> > > > > > > > > Panels
> > > > > > > > > > The problem is, that when I enter the formfields on the
> > > panels,
> > > > > they
> > > > > > > got
> > > > > > > > > > valided, but then a new Employee instance is created,
> and
> > > the
> > > > > > > > > FormComponent
> > > > > > > > > > values are not copied to the newly instantiated
> Employee.
> > > > > They're
> > > > > > > null.
> > > > > > > > > >
> > > > > > > > > > I did some tests and it appears that on each panel
> switch,
> > > the
> > > > > > > > > Model.load is
> > > > > > > > > > called, and a new Employee is returned.
> > > > > > > > > >
> > > > > > > > > > What's going wrong here....
> > > > > > > > > > --
> > > > > > > > > > Martijn Lindhout
> > > > > > > > > > JointEffort IT Services
> > > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> users-unsubscribe@wicket.apache.org
> > > > > > > > > For additional commands, e-mail:
> users-help@wicket.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > Martijn Lindhout
> > > > > > > > JointEffort IT Services
> > > > > > > > http://www.jointeffort.nl
> > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> >
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
>
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Scott Swank <sc...@gmail.com>.
I suggest using the GoF memento pattern here.  You keep your changes
in one or more mementos, which can be kept in the session.  Then you
push the changes back to the domain model when you are happy with
them.  We use this approach for modifying hotel reservations --
particularly because we need to see the price before the change as
well as with the change to generate e-mails, faxes, etc.


On Feb 11, 2008 10:06 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> I agree that it is *easier*, but I got bored by duplicating my domain model
> in a DTO like structure. And that's cumbersome.
> I saw this hapening in several projects, and in the end we had two almost
> equals object structures, one with rich behavior, and one with just data and
> structure.
>
> that's sad.... or not?
>
>
> 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> >
> > well, you will have to disconnect the hibernate session, and store it
> > in the http session - or some other place. then your model would have
> > to reconnect the session and pull the entity out of it. its much
> > easier to create a bean imho.
> >
> > -igor
> >
> >
> > On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > because I use the domain objects directly,. without any DTO's, I have to
> > use
> > > the long conversation pattern. That means I have to store the domain
> > object
> > > somewhere in the session and let the loadabledetachable model retrieve
> > it
> > > from there?
> > >
> > > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > >
> > > > then you have to use a bean, and on confirm apply changes from the
> > > > bean to the persistent entity. the only other alternative i know of is
> > > > to use the long conversation pattern which i am not really a fan of.
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > ok, that makes sense.
> > > > >
> > > > > But what if I have a Hibernate persisted entity that I want to edit
> > in
> > > > > multiple actions? Say I have an order with orderlines, and I want to
> > add
> > > > and
> > > > > remove them at will, and in the end save or rollback all the
> > changes? I
> > > > > don't want the intermediate add and removes propagate directly to
> > the
> > > > > database, only at 'confirm'.
> > > > >
> > > > >
> > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > >
> > > > > > the other constructor i presume is getting a persistent entity? so
> > > > > > hibernate/jpa will flush state back to db at the end of request,
> > thats
> > > > > > why that works.
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > ok, thanx, that seems to work.
> > > > > > >
> > > > > > > And what about the other constructor, when editing an existing
> > > > entity?
> > > > > > >
> > > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > > >
> > > > > > > >
> > > > > > > > setModel(new CompoundPropertyModel(new
> > LoadableDetachableModel(){
> > > > > > > >
> > > > > > > > ^ that is bad because ldm is cleared between requests, thats
> > why
> > > > its
> > > > > > > > called loadable
> > > > > > > >
> > > > > > > > just do this
> > > > > > > >
> > > > > > > > setModel(new CPM(new Employee()));
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > > mlindhout@jointeffort.nl>
> > > > > > > > wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > I have a page, with those two constructors, the first for
> > > > editing a
> > > > > > new
> > > > > > > > > employee, the second for editing an existing.
> > > > > > > > >
> > > > > > > > >     public EditEmployee() {
> > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > LoadableDetachableModel(){
> > > > > > > > >             protected Object load() {
> > > > > > > > >                 return new Employee();
> > > > > > > > >             }
> > > > > > > > >         }));
> > > > > > > > >         init();
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > > LoadableDetachableModel(){
> > > > > > > > >             protected Object load() {
> > > > > > > > >                 return empRepository.getEmployee(id);
> > > > > > > > >             }
> > > > > > > > >         }));
> > > > > > > > >         init();
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > Because the Employee info is relatively much, I separate it
> > in
> > > > two
> > > > > > > > panels in
> > > > > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> > > > several
> > > > > > > > Panels
> > > > > > > > > The problem is, that when I enter the formfields on the
> > panels,
> > > > they
> > > > > > got
> > > > > > > > > valided, but then a new Employee instance is created, and
> > the
> > > > > > > > FormComponent
> > > > > > > > > values are not copied to the newly instantiated Employee.
> > > > They're
> > > > > > null.
> > > > > > > > >
> > > > > > > > > I did some tests and it appears that on each panel switch,
> > the
> > > > > > > > Model.load is
> > > > > > > > > called, and a new Employee is returned.
> > > > > > > > >
> > > > > > > > > What's going wrong here....
> > > > > > > > > --
> > > > > > > > > Martijn Lindhout
> > > > > > > > > JointEffort IT Services
> > > > > > > > > http://www.jointeffort.nl
> > > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
>
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>



-- 
Scott Swank
reformed mathematician

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
I agree that it is *easier*, but I got bored by duplicating my domain model
in a DTO like structure. And that's cumbersome.
I saw this hapening in several projects, and in the end we had two almost
equals object structures, one with rich behavior, and one with just data and
structure.

that's sad.... or not?

2008/2/11, Igor Vaynberg <ig...@gmail.com>:
>
> well, you will have to disconnect the hibernate session, and store it
> in the http session - or some other place. then your model would have
> to reconnect the session and pull the entity out of it. its much
> easier to create a bean imho.
>
> -igor
>
>
> On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > because I use the domain objects directly,. without any DTO's, I have to
> use
> > the long conversation pattern. That means I have to store the domain
> object
> > somewhere in the session and let the loadabledetachable model retrieve
> it
> > from there?
> >
> > 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
> >
> > >
> > > then you have to use a bean, and on confirm apply changes from the
> > > bean to the persistent entity. the only other alternative i know of is
> > > to use the long conversation pattern which i am not really a fan of.
> > >
> > > -igor
> > >
> > >
> > > On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > ok, that makes sense.
> > > >
> > > > But what if I have a Hibernate persisted entity that I want to edit
> in
> > > > multiple actions? Say I have an order with orderlines, and I want to
> add
> > > and
> > > > remove them at will, and in the end save or rollback all the
> changes? I
> > > > don't want the intermediate add and removes propagate directly to
> the
> > > > database, only at 'confirm'.
> > > >
> > > >
> > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > >
> > > > > the other constructor i presume is getting a persistent entity? so
> > > > > hibernate/jpa will flush state back to db at the end of request,
> thats
> > > > > why that works.
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > ok, thanx, that seems to work.
> > > > > >
> > > > > > And what about the other constructor, when editing an existing
> > > entity?
> > > > > >
> > > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > > >
> > > > > > >
> > > > > > > setModel(new CompoundPropertyModel(new
> LoadableDetachableModel(){
> > > > > > >
> > > > > > > ^ that is bad because ldm is cleared between requests, thats
> why
> > > its
> > > > > > > called loadable
> > > > > > >
> > > > > > > just do this
> > > > > > >
> > > > > > > setModel(new CPM(new Employee()));
> > > > > > >
> > > > > > > -igor
> > > > > > >
> > > > > > >
> > > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > > mlindhout@jointeffort.nl>
> > > > > > > wrote:
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > I have a page, with those two constructors, the first for
> > > editing a
> > > > > new
> > > > > > > > employee, the second for editing an existing.
> > > > > > > >
> > > > > > > >     public EditEmployee() {
> > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > LoadableDetachableModel(){
> > > > > > > >             protected Object load() {
> > > > > > > >                 return new Employee();
> > > > > > > >             }
> > > > > > > >         }));
> > > > > > > >         init();
> > > > > > > >     }
> > > > > > > >
> > > > > > > >     public EditEmployee(final Long id) {
> > > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > > LoadableDetachableModel(){
> > > > > > > >             protected Object load() {
> > > > > > > >                 return empRepository.getEmployee(id);
> > > > > > > >             }
> > > > > > > >         }));
> > > > > > > >         init();
> > > > > > > >     }
> > > > > > > >
> > > > > > > > Because the Employee info is relatively much, I separate it
> in
> > > two
> > > > > > > panels in
> > > > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> > > several
> > > > > > > Panels
> > > > > > > > The problem is, that when I enter the formfields on the
> panels,
> > > they
> > > > > got
> > > > > > > > valided, but then a new Employee instance is created, and
> the
> > > > > > > FormComponent
> > > > > > > > values are not copied to the newly instantiated Employee.
> > > They're
> > > > > null.
> > > > > > > >
> > > > > > > > I did some tests and it appears that on each panel switch,
> the
> > > > > > > Model.load is
> > > > > > > > called, and a new Employee is returned.
> > > > > > > >
> > > > > > > > What's going wrong here....
> > > > > > > > --
> > > > > > > > Martijn Lindhout
> > > > > > > > JointEffort IT Services
> > > > > > > > http://www.jointeffort.nl
> > > > > > > > mlindhout@jointeffort.nl
> > > > > > > > +31 (0)6 18 47 25 29
> > > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Igor Vaynberg <ig...@gmail.com>.
well, you will have to disconnect the hibernate session, and store it
in the http session - or some other place. then your model would have
to reconnect the session and pull the entity out of it. its much
easier to create a bean imho.

-igor


On Feb 11, 2008 12:13 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> because I use the domain objects directly,. without any DTO's, I have to use
> the long conversation pattern. That means I have to store the domain object
> somewhere in the session and let the loadabledetachable model retrieve it
> from there?
>
> 2008/2/11, Igor Vaynberg <ig...@gmail.com>:
>
> >
> > then you have to use a bean, and on confirm apply changes from the
> > bean to the persistent entity. the only other alternative i know of is
> > to use the long conversation pattern which i am not really a fan of.
> >
> > -igor
> >
> >
> > On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > ok, that makes sense.
> > >
> > > But what if I have a Hibernate persisted entity that I want to edit in
> > > multiple actions? Say I have an order with orderlines, and I want to add
> > and
> > > remove them at will, and in the end save or rollback all the changes? I
> > > don't want the intermediate add and removes propagate directly to the
> > > database, only at 'confirm'.
> > >
> > >
> > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > the other constructor i presume is getting a persistent entity? so
> > > > hibernate/jpa will flush state back to db at the end of request, thats
> > > > why that works.
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > ok, thanx, that seems to work.
> > > > >
> > > > > And what about the other constructor, when editing an existing
> > entity?
> > > > >
> > > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > > >
> > > > > >
> > > > > > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> > > > > >
> > > > > > ^ that is bad because ldm is cleared between requests, thats why
> > its
> > > > > > called loadable
> > > > > >
> > > > > > just do this
> > > > > >
> > > > > > setModel(new CPM(new Employee()));
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > I have a page, with those two constructors, the first for
> > editing a
> > > > new
> > > > > > > employee, the second for editing an existing.
> > > > > > >
> > > > > > >     public EditEmployee() {
> > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > LoadableDetachableModel(){
> > > > > > >             protected Object load() {
> > > > > > >                 return new Employee();
> > > > > > >             }
> > > > > > >         }));
> > > > > > >         init();
> > > > > > >     }
> > > > > > >
> > > > > > >     public EditEmployee(final Long id) {
> > > > > > >         setModel(new CompoundPropertyModel(new
> > > > > > LoadableDetachableModel(){
> > > > > > >             protected Object load() {
> > > > > > >                 return empRepository.getEmployee(id);
> > > > > > >             }
> > > > > > >         }));
> > > > > > >         init();
> > > > > > >     }
> > > > > > >
> > > > > > > Because the Employee info is relatively much, I separate it in
> > two
> > > > > > panels in
> > > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> > several
> > > > > > Panels
> > > > > > > The problem is, that when I enter the formfields on the panels,
> > they
> > > > got
> > > > > > > valided, but then a new Employee instance is created, and the
> > > > > > FormComponent
> > > > > > > values are not copied to the newly instantiated Employee.
> > They're
> > > > null.
> > > > > > >
> > > > > > > I did some tests and it appears that on each panel switch, the
> > > > > > Model.load is
> > > > > > > called, and a new Employee is returned.
> > > > > > >
> > > > > > > What's going wrong here....
> > > > > > > --
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: TabbedPanel and model load...

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 11 Feb 2008, Martijn Lindhout wrote:
> because I use the domain objects directly,. without any DTO's, I have to use
> the long conversation pattern. That means I have to store the domain object
> somewhere in the session and let the loadabledetachable model retrieve it
> from there?

Depends on which "session" you're talkin about :)

For me the normal way is to store the domain object in a
normal Model during the editing, and then when saving the
changes update it to the database (either by copying the
values or with Hibernate merge, which may or may not work
for you).

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
because I use the domain objects directly,. without any DTO's, I have to use
the long conversation pattern. That means I have to store the domain object
somewhere in the session and let the loadabledetachable model retrieve it
from there?

2008/2/11, Igor Vaynberg <ig...@gmail.com>:
>
> then you have to use a bean, and on confirm apply changes from the
> bean to the persistent entity. the only other alternative i know of is
> to use the long conversation pattern which i am not really a fan of.
>
> -igor
>
>
> On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > ok, that makes sense.
> >
> > But what if I have a Hibernate persisted entity that I want to edit in
> > multiple actions? Say I have an order with orderlines, and I want to add
> and
> > remove them at will, and in the end save or rollback all the changes? I
> > don't want the intermediate add and removes propagate directly to the
> > database, only at 'confirm'.
> >
> >
> > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > the other constructor i presume is getting a persistent entity? so
> > > hibernate/jpa will flush state back to db at the end of request, thats
> > > why that works.
> > >
> > > -igor
> > >
> > >
> > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > ok, thanx, that seems to work.
> > > >
> > > > And what about the other constructor, when editing an existing
> entity?
> > > >
> > > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > >
> > > > > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> > > > >
> > > > > ^ that is bad because ldm is cleared between requests, thats why
> its
> > > > > called loadable
> > > > >
> > > > > just do this
> > > > >
> > > > > setModel(new CPM(new Employee()));
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I have a page, with those two constructors, the first for
> editing a
> > > new
> > > > > > employee, the second for editing an existing.
> > > > > >
> > > > > >     public EditEmployee() {
> > > > > >         setModel(new CompoundPropertyModel(new
> > > > > LoadableDetachableModel(){
> > > > > >             protected Object load() {
> > > > > >                 return new Employee();
> > > > > >             }
> > > > > >         }));
> > > > > >         init();
> > > > > >     }
> > > > > >
> > > > > >     public EditEmployee(final Long id) {
> > > > > >         setModel(new CompoundPropertyModel(new
> > > > > LoadableDetachableModel(){
> > > > > >             protected Object load() {
> > > > > >                 return empRepository.getEmployee(id);
> > > > > >             }
> > > > > >         }));
> > > > > >         init();
> > > > > >     }
> > > > > >
> > > > > > Because the Employee info is relatively much, I separate it in
> two
> > > > > panels in
> > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> several
> > > > > Panels
> > > > > > The problem is, that when I enter the formfields on the panels,
> they
> > > got
> > > > > > valided, but then a new Employee instance is created, and the
> > > > > FormComponent
> > > > > > values are not copied to the newly instantiated Employee.
> They're
> > > null.
> > > > > >
> > > > > > I did some tests and it appears that on each panel switch, the
> > > > > Model.load is
> > > > > > called, and a new Employee is returned.
> > > > > >
> > > > > > What's going wrong here....
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Igor Vaynberg <ig...@gmail.com>.
then you have to use a bean, and on confirm apply changes from the
bean to the persistent entity. the only other alternative i know of is
to use the long conversation pattern which i am not really a fan of.

-igor


On Feb 10, 2008 11:25 PM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> ok, that makes sense.
>
> But what if I have a Hibernate persisted entity that I want to edit in
> multiple actions? Say I have an order with orderlines, and I want to add and
> remove them at will, and in the end save or rollback all the changes? I
> don't want the intermediate add and removes propagate directly to the
> database, only at 'confirm'.
>
>
> 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> >
> > the other constructor i presume is getting a persistent entity? so
> > hibernate/jpa will flush state back to db at the end of request, thats
> > why that works.
> >
> > -igor
> >
> >
> > On Feb 9, 2008 11:08 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > ok, thanx, that seems to work.
> > >
> > > And what about the other constructor, when editing an existing entity?
> > >
> > > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > >
> > > > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> > > >
> > > > ^ that is bad because ldm is cleared between requests, thats why its
> > > > called loadable
> > > >
> > > > just do this
> > > >
> > > > setModel(new CPM(new Employee()));
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > Hi,
> > > > >
> > > > > I have a page, with those two constructors, the first for editing a
> > new
> > > > > employee, the second for editing an existing.
> > > > >
> > > > >     public EditEmployee() {
> > > > >         setModel(new CompoundPropertyModel(new
> > > > LoadableDetachableModel(){
> > > > >             protected Object load() {
> > > > >                 return new Employee();
> > > > >             }
> > > > >         }));
> > > > >         init();
> > > > >     }
> > > > >
> > > > >     public EditEmployee(final Long id) {
> > > > >         setModel(new CompoundPropertyModel(new
> > > > LoadableDetachableModel(){
> > > > >             protected Object load() {
> > > > >                 return empRepository.getEmployee(id);
> > > > >             }
> > > > >         }));
> > > > >         init();
> > > > >     }
> > > > >
> > > > > Because the Employee info is relatively much, I separate it in two
> > > > panels in
> > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several
> > > > Panels
> > > > > The problem is, that when I enter the formfields on the panels, they
> > got
> > > > > valided, but then a new Employee instance is created, and the
> > > > FormComponent
> > > > > values are not copied to the newly instantiated Employee. They're
> > null.
> > > > >
> > > > > I did some tests and it appears that on each panel switch, the
> > > > Model.load is
> > > > > called, and a new Employee is returned.
> > > > >
> > > > > What's going wrong here....
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
ok, that makes sense.

But what if I have a Hibernate persisted entity that I want to edit in
multiple actions? Say I have an order with orderlines, and I want to add and
remove them at will, and in the end save or rollback all the changes? I
don't want the intermediate add and removes propagate directly to the
database, only at 'confirm'.

2008/2/9, Igor Vaynberg <ig...@gmail.com>:
>
> the other constructor i presume is getting a persistent entity? so
> hibernate/jpa will flush state back to db at the end of request, thats
> why that works.
>
> -igor
>
>
> On Feb 9, 2008 11:08 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > ok, thanx, that seems to work.
> >
> > And what about the other constructor, when editing an existing entity?
> >
> > 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
> >
> > >
> > > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> > >
> > > ^ that is bad because ldm is cleared between requests, thats why its
> > > called loadable
> > >
> > > just do this
> > >
> > > setModel(new CPM(new Employee()));
> > >
> > > -igor
> > >
> > >
> > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > Hi,
> > > >
> > > > I have a page, with those two constructors, the first for editing a
> new
> > > > employee, the second for editing an existing.
> > > >
> > > >     public EditEmployee() {
> > > >         setModel(new CompoundPropertyModel(new
> > > LoadableDetachableModel(){
> > > >             protected Object load() {
> > > >                 return new Employee();
> > > >             }
> > > >         }));
> > > >         init();
> > > >     }
> > > >
> > > >     public EditEmployee(final Long id) {
> > > >         setModel(new CompoundPropertyModel(new
> > > LoadableDetachableModel(){
> > > >             protected Object load() {
> > > >                 return empRepository.getEmployee(id);
> > > >             }
> > > >         }));
> > > >         init();
> > > >     }
> > > >
> > > > Because the Employee info is relatively much, I separate it in two
> > > panels in
> > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several
> > > Panels
> > > > The problem is, that when I enter the formfields on the panels, they
> got
> > > > valided, but then a new Employee instance is created, and the
> > > FormComponent
> > > > values are not copied to the newly instantiated Employee. They're
> null.
> > > >
> > > > I did some tests and it appears that on each panel switch, the
> > > Model.load is
> > > > called, and a new Employee is returned.
> > > >
> > > > What's going wrong here....
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> >
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Igor Vaynberg <ig...@gmail.com>.
the other constructor i presume is getting a persistent entity? so
hibernate/jpa will flush state back to db at the end of request, thats
why that works.

-igor


On Feb 9, 2008 11:08 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> ok, thanx, that seems to work.
>
> And what about the other constructor, when editing an existing entity?
>
> 2008/2/9, Igor Vaynberg <ig...@gmail.com>:
>
> >
> > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> >
> > ^ that is bad because ldm is cleared between requests, thats why its
> > called loadable
> >
> > just do this
> >
> > setModel(new CPM(new Employee()));
> >
> > -igor
> >
> >
> > On Feb 9, 2008 10:45 AM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > Hi,
> > >
> > > I have a page, with those two constructors, the first for editing a new
> > > employee, the second for editing an existing.
> > >
> > >     public EditEmployee() {
> > >         setModel(new CompoundPropertyModel(new
> > LoadableDetachableModel(){
> > >             protected Object load() {
> > >                 return new Employee();
> > >             }
> > >         }));
> > >         init();
> > >     }
> > >
> > >     public EditEmployee(final Long id) {
> > >         setModel(new CompoundPropertyModel(new
> > LoadableDetachableModel(){
> > >             protected Object load() {
> > >                 return empRepository.getEmployee(id);
> > >             }
> > >         }));
> > >         init();
> > >     }
> > >
> > > Because the Employee info is relatively much, I separate it in two
> > panels in
> > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several
> > Panels
> > > The problem is, that when I enter the formfields on the panels, they got
> > > valided, but then a new Employee instance is created, and the
> > FormComponent
> > > values are not copied to the newly instantiated Employee. They're null.
> > >
> > > I did some tests and it appears that on each panel switch, the
> > Model.load is
> > > called, and a new Employee is returned.
> > >
> > > What's going wrong here....
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
>
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: TabbedPanel and model load...

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
ok, thanx, that seems to work.

And what about the other constructor, when editing an existing entity?

2008/2/9, Igor Vaynberg <ig...@gmail.com>:
>
> setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
>
> ^ that is bad because ldm is cleared between requests, thats why its
> called loadable
>
> just do this
>
> setModel(new CPM(new Employee()));
>
> -igor
>
>
> On Feb 9, 2008 10:45 AM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > Hi,
> >
> > I have a page, with those two constructors, the first for editing a new
> > employee, the second for editing an existing.
> >
> >     public EditEmployee() {
> >         setModel(new CompoundPropertyModel(new
> LoadableDetachableModel(){
> >             protected Object load() {
> >                 return new Employee();
> >             }
> >         }));
> >         init();
> >     }
> >
> >     public EditEmployee(final Long id) {
> >         setModel(new CompoundPropertyModel(new
> LoadableDetachableModel(){
> >             protected Object load() {
> >                 return empRepository.getEmployee(id);
> >             }
> >         }));
> >         init();
> >     }
> >
> > Because the Employee info is relatively much, I separate it in two
> panels in
> > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several
> Panels
> > The problem is, that when I enter the formfields on the panels, they got
> > valided, but then a new Employee instance is created, and the
> FormComponent
> > values are not copied to the newly instantiated Employee. They're null.
> >
> > I did some tests and it appears that on each panel switch, the
> Model.load is
> > called, and a new Employee is returned.
> >
> > What's going wrong here....
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: TabbedPanel and model load...

Posted by Igor Vaynberg <ig...@gmail.com>.
setModel(new CompoundPropertyModel(new LoadableDetachableModel(){

^ that is bad because ldm is cleared between requests, thats why its
called loadable

just do this

setModel(new CPM(new Employee()));

-igor


On Feb 9, 2008 10:45 AM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> Hi,
>
> I have a page, with those two constructors, the first for editing a new
> employee, the second for editing an existing.
>
>     public EditEmployee() {
>         setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
>             protected Object load() {
>                 return new Employee();
>             }
>         }));
>         init();
>     }
>
>     public EditEmployee(final Long id) {
>         setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
>             protected Object load() {
>                 return empRepository.getEmployee(id);
>             }
>         }));
>         init();
>     }
>
> Because the Employee info is relatively much, I separate it in two panels in
> a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <- several Panels
> The problem is, that when I enter the formfields on the panels, they got
> valided, but then a new Employee instance is created, and the FormComponent
> values are not copied to the newly instantiated Employee. They're null.
>
> I did some tests and it appears that on each panel switch, the Model.load is
> called, and a new Employee is returned.
>
> What's going wrong here....
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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