Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-29 Thread Johan Compagner
i will look at it, but the property model shouldn't do a thingthe call:getParent().modelChanging();should do itBUTlook at the ModelChange class and then its constructor. (where you will end up)
final IModel model = component.getModel();        // If the component has a model, it's about to change!        if (model != null)        {            // Should we clone the model?            boolean cloneModel = true;
            // If the component is a form component            if (model instanceof CompoundPropertyModel)            {                if (component instanceof FormComponent)                {                    // and it's using the same model as the form
                    if (((FormComponent)component).getForm().getModel() == model)                    {                        // we don't need to clone the model, because it will                        // be re-initialized using initModel()
                        cloneModel = false;                    }                }                else                {                    // If the component is using the same model as the page
                    if (component.getPage().getModel() == model)                    {                        // we don't need to clone the model, because it will                        // be re-initialized using initModel()
                        cloneModel = false;                    }                }            }            // Clone model?            if (cloneModel)            {                model.detach
();                originalModel = (IModel)Objects.cloneModel(model);            }            else            {                originalModel = model;            }i don't know exactly where it falls in, but i guess the model will not be cloned.
But what you do in the end:TestPage.this.addStateChange(new Change() {                            public void undo()                            {                                ((StatePojo)
getPage().getModelObject()).setA(oldA);                            }                        });is a much much much better solution anyway!You dont clone everything. It is much lighter variant, only the old object is kept alive..
johanOn 8/29/06, landtuna <[EMAIL PROTECTED]> wrote:
Eelco Hillenius wrote:>> Would you mind creating an issue for this, so we can track it/ won't> forget to address it? Thanks,>Entered as issue 1548207.--View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6029382Sent from the Wicket - User forum at 
Nabble.com.-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread landtuna


Eelco Hillenius wrote:
> 
> Would you mind creating an issue for this, so we can track it/ won't
> forget to address it? Thanks,
> 

Entered as issue 1548207.
-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6029382
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread Eelco Hillenius
Would you mind creating an issue for this, so we can track it/ won't
forget to address it? Thanks,

Eelco


On 8/28/06, landtuna <[EMAIL PROTECTED]> wrote:
>
> Removing the if block below the comment "If the component is using the same
> model as the page" in ModelChange.java fixes the problem.  I suspect this
> change breaks something else, though, so someone else should look into what
> the correct fix is.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread landtuna

Removing the if block below the comment "If the component is using the same
model as the page" in ModelChange.java fixes the problem.  I suspect this
change breaks something else, though, so someone else should look into what
the correct fix is.
-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6028907
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread landtuna


igor.vaynberg wrote:
> 
> i believe property model should be doing that for you. johan are you
> reading
> with us?
> 

I think I can see why PropertyModel isn't doing it -

There's a block inside ModelChange that skips cloning the model if the model
of the component that's changing is the same as the model of the page.  In
this case, though, the page _is_ the component that's changing, so the
page's model can't be cloned.

(Calling modelChanging and modelChanged on the Link rather than the Page
doesn't seem to have any effect, even if I do a setVersioned(true) on the
Link.)
-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6028785
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread Igor Vaynberg
i believe property model should be doing that for you. johan are you reading with us?-IgorOn 8/28/06, landtuna <
[EMAIL PROTECTED]> wrote:I got past my original problem by changing my onClick methods to look like
this.  Is this the right approach?public void onClick() {final int oldA = ((StatePojo)getPage().getModelObject()).getA();TestPage.this.addStateChange
(new Change() {public void undo(){((StatePojo)getPage().getModelObject()).setA(oldA);}
});((StatePojo) getParent().getModelObject()).setA(100);}--View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6028222Sent from the Wicket - User forum at Nabble.com.-
Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread landtuna

I got past my original problem by changing my onClick methods to look like
this.  Is this the right approach?

public void onClick() {
final int oldA = ((StatePojo)
getPage().getModelObject()).getA();
TestPage.this.addStateChange(new Change() { 
public void undo()
{
((StatePojo)
getPage().getModelObject()).setA(oldA);
}
});
((StatePojo) getParent().getModelObject()).setA(100);
}

-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6028222
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread landtuna


Eelco Hillenius wrote:
> 
> Could you please provide us with a little bit of code to look at your
> case?
> 

Here is the most trivial case I could come up with.  Click the number 1. 
Click your browser's back button.  Click the number 2.  I would expect the
page to say "1 200", but it says, "100 200".

http://www.w3.org/TR/html4/strict.dtd";>





Test Page






# text here 



# text also here 





import wicket.markup.html.WebPage;
import wicket.markup.html.link.Link;
import wicket.markup.html.basic.Label;
import wicket.model.CompoundPropertyModel;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

class StatePojo implements java.io.Serializable {
private int a;
private int b;

public StatePojo() { a = 1; b = 2; }

public int getA() { return a; }
public void setA(int a) { this.a = a; }

public int getB() { return b; }
public void setB(int b) { this.b = b; }
}

public class TestPage extends WebPage {
private static Log log = LogFactory.getLog(PpiPage.class);

public TestPage() {
super(new CompoundPropertyModel(new StatePojo()));

Link aLink = new Link("aLink") {
public void onClick() {
getParent().modelChanging();
((StatePojo) getParent().getModelObject()).setA(100);
getParent().modelChanged();
}
};
 
aLink.add(new Label("a"));

add(aLink);
 
Link bLink = new Link("bLink") {
public void onClick() {
getParent().modelChanging();
((StatePojo) getParent().getModelObject()).setB(200);
getParent().modelChanged();
}
};

bLink.add(new Label("b"));

add(bLink);
}
}

-- 
View this message in context: 
http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a6026125
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Versioning a PropertyModel backed by another Model

2006-08-28 Thread Eelco Hillenius
Could you please provide us with a little bit of code to look at your case?

Thanks,

Eelco


On 8/25/06, landtuna <[EMAIL PROTECTED]> wrote:
>
> I have a POJO that is the object for my WebPage's Model (let's call it
> SystemState).  Some components need to interact with this object in a
> non-trivial way in their onClick handlers.  Other components use
> PropertyModel models to get at a specific part of the SystemState.
>
> My whole application was working fine this way, until I started messing with
> the back button.  Then it was clear that the versioning system was
> serializing, saving, and restoring versions of SystemState, but that the
> nestedObject fields of the PropertyModel objects that were using SystemState
> were not being updated with the new SystemState in the version rollback
> process.
>
> I could just make all of those components be versioned, but then each one
> would have its own serialized copy of SystemState.  So my solution was to
> reset the Model objects of all of my components in the main page's
> onModelChanged method.  This seems to work fine, but it seems goofy.  Is
> there a better way to do this?  (Or is it a bug that the nestedObject fields
> don't get updated automatically during a rollback?)
>
> Thanks - and I love Wicket so far!
>
> --- Jim
> --
> View this message in context: 
> http://www.nabble.com/Versioning-a-PropertyModel-backed-by-another-Model-tf2166294.html#a5988817
> Sent from the Wicket - User forum at Nabble.com.
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user