look what you are doing here:

final Panel3 p3 = new Panel3("Panel3", url1);
p3.setOutputMarkupId(true);
add(p3);

add(new Panel2("Panel2", url2){
public void updatePanel3(AjaxRequestTarget target){
Panel3 newPanel3 = new Panel3("Panel3", url2);
newPanel3.setOutputMarkupId(true);
p3.replaceWith(newPanel3);

on first click p3.replacewith(newpanel3) works because p3 points to a
component in a page, but on subsequent clicks it doesnt because p3 is no
longer in the page - you replaced it - and you do not update the reference
to it

what you should do

replace final Panel3 p3 local var with a field, then after
p3.replaceWith(newPanel3)
add p3=newPanel3; so that p3 always points to the right component

-igor



On 7/7/07, Ed _ <[EMAIL PROTECTED]> wrote:

 no couldn't find any missing ids.

So wrote a smaller sample program and I see the same issue - here is the
source - maybe you can point out something blatanly obvious that I am
missing.

---TestWebPage.java ---
public class TestWebPage extends WebPage {
    public TestWebPage(PageParameters params){
        super();
        add(new Panel1("Panel1"));
    }
}

---TestWebPage.html ---
html xmlns="http://www.w3.org/1999/xhtml";>
<body>
  <span wicket:id="Panel1"> </span>
</body>
</html>


--- Panel1.java ----
public class Panel1 extends Panel {
    public Panel1(String id){
        super(id);
        final String url1 = "http://www.cnn.com";;
        final String url2 = "http://www.abc.com";;
        final Panel3 p3 = new Panel3("Panel3", url1);
        p3.setOutputMarkupId(true);
        add(p3);
        add(new Panel2("Panel2", url2){
            public void updatePanel3(AjaxRequestTarget target){
                Panel3 newPanel3 = new Panel3("Panel3", url2);
                newPanel3.setOutputMarkupId(true);
                p3.replaceWith(newPanel3);
                if(target != null){
                    target.addComponent(p3);
                }
            }
        });
    }
}

--- Panel1.html ---
<html>
<wicket:panel>

    This is a test for AjaxLink.
    <div id="Panel2List">
        <span wicket:id="Panel2"></span>
    </div>
    <span wicket:id="Panel3"></span>
</wicket:panel>
</html>


----- Panel2.java ---
abstract public class Panel2 extends Panel {
    public Panel2(String id, String url){
        super(id);
        add(new WebMarkupContainer("iframe").add(new
SimpleAttributeModifier("src", url)));

        add(new AjaxLink("AJAXLINK"){
            public void onClick(AjaxRequestTarget target)  {
                Panel2.this.updatePanel3(target);
            }
        });
    }
    protected abstract void updatePanel3(AjaxRequestTarget target);
}

--- panel2.html ---
<html xmlns:wicket>
<wicket:panel>
<div>
    <div> <iframe src="#" wicket:id="iframe" scrolling="no"></iframe>
</div>
    <div> <a href="#" wicket:id="AJAXLINK">Update</a> </div>
</div>
</wicket:panel>
</html>

---Panel3.java ---
public class Panel3 extends Panel {
    public Panel3(String id, String url)
    {
        super(id);
        add(new WebMarkupContainer("iframe").add(new
SimpleAttributeModifier("src",url)));
    }
}

----Panel3.html ----
<html xmlns:wicket>
<wicket:panel>
<div align="right"> <iframe src="#" wicket:id="iframe"
scrolling="no"></iframe>
</div>
</wicket:panel>
</html>


------------------------------
Local listings, incredible imagery, and driving directions - all in one
place! Find it! <http://maps.live.com/?wip=69&FORM=MGAC01>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to