Bugs item #1548207, was opened at 2006-08-28 18:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1548207&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jim Hunziker (landtuna)
Assigned to: Nobody/Anonymous (nobody)
Summary: CompoundPropertyModels attached to Pages don't get cloned

Initial Comment:
Because of the if block below the comment "If the 
component is using the same model as the page" in 
ModelChange.java, CompoundPropertyModels that are 
attached to Pages never get cloned.

The effect of this is that the following code does not 
behave as expected.  The expected behavior is that 
clicking the 1, clicking the browser's back button, 
and clicking the 2 results in a page that says, "100 
200" rather than "1 200".

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//
EN" "http://www.w3.org/TR/html4/strict.dtd";>
<html lang="en">
<head>

<meta http-equiv="content-type" content="text/html; 
charset=utf-8">

<title>Test Page</title>

</head>

<body>

<p>
<a href="#" wicket:id="aLink"><span wicket:id="a">text 
here</span></a>
</p>

<p>
<a href="#" wicket:id="bLink"><span wicket:id="b">text 
also here</span></a>
</p>
</body>

</html>

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

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 { 

    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); 
    } 
}    

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1548207&group_id=119783

-------------------------------------------------------------------------
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-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to