Re: Can Panel replace itself ?

2007-08-24 Thread Artur W.


igor.vaynberg wrote:
 
 does it do that in all browsers?
 
 also call view.setreuseitems(true);
 

I've checked it with ff2 and ie7. Also with Wicket1.3beta2 and beta3. I've
set view.setreuseitems(true);

The problem is that the wicket generate span tags for panels after body tag
and before the table tag.
So replacing is proper, but the tags location is incorrect:

lt;bodygt;

lt;span id=panel5gt;
lt;/spangt;lt;span id=panel7gt;
lt;/spangt;lt;span id=panel9gt;
lt;/spangt;lt;span id=panel11gt;
lt;/spangt;lt;tablegt;
lt;tbodygt;lt;trgt;
lt;tdgt;lt;a id=link6 onclick=var
wcall=wicketAjaxGet('?wicket:interface=:4:list:0:panel:link::IBehaviorListener:0:',
function() { }.bind(this), function() { }.bind(this));return !wcall;
href=#gt;lt;spangt;clicklt;/spangt;lt;/agt;lt;/tdgt;

lt;tdgt;lt;spangt;ONElt;/spangt;lt;/tdgt;
lt;tdgt;lt;spangt;onelt;/spangt;lt;/tdgt;

lt;/trgt;...



Full generated html file:
http://sunet.pl/testpage.html

Full generated html file after one click:
http://sunet.pl/testpage-after-one-click.html

Is it a but or am I doing something wrong?

Artur

-- 
View this message in context: 
http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12307236
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can Panel replace itself ?

2007-08-24 Thread Igor Vaynberg
its happening because you are creating invalid html

you cannot have a span between a tr and td, so you just need to adjust how
you are outputting the markup. change testpage.html to use the following and
it will work:

body
table style=border-collapse: collapse; empty-cells: show;
wicket:container wicket:id=list
tr style=border: 1px solid #000; wicket:id=panel
/tr
/wicket:container
/table
/body

-igor


On 8/24/07, Artur W. [EMAIL PROTECTED] wrote:



 igor.vaynberg wrote:
 
  i dont get it, where do you expect it to go? it looks like you are
  replacing
  an item inside panel7, not inside the panel that is inside the table?
 
  maybe you should build a quickstart so we have something to play with.
 
 

 Thanks for you replay Igor.

 The panel is put inside the table. But when I replace it with ajax it
 appear
 outside the table.
 Here is the working example with full source code:
 http://sunet.pl/files/test.war

 Artur


 --
 View this message in context:
 http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12307905
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can Panel replace itself ?

2007-08-23 Thread Artur W.



Eelco Hillenius wrote:
 
 do:
 
TestPanel newOne = new TestPanel(TestPanel.this.getId(), another
 param);
TestPanel.this.replaceWith(newOne);
target.addComponent(newOne);
 
 

I didn't know about replaceWith method. It works great! Thanks a lot!!! 
Artur

-- 
View this message in context: 
http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12297058
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can Panel replace itself ?

2007-08-23 Thread Igor Vaynberg
c.replacewith(a) is the same as c.getparent().replace(a)

-igor


On 8/23/07, Artur W. [EMAIL PROTECTED] wrote:




 Eelco Hillenius wrote:
 
  do:
 
 TestPanel newOne = new TestPanel(TestPanel.this.getId(), another
  param);
 TestPanel.this.replaceWith(newOne);
 target.addComponent(newOne);
 
 

 I didn't know about replaceWith method. It works great! Thanks a lot!!!
 Artur

 --
 View this message in context:
 http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12297058
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can Panel replace itself ?

2007-08-23 Thread Igor Vaynberg
does it do that in all browsers?

also call view.setreuseitems(true);

-igor



On 8/23/07, Artur W. [EMAIL PROTECTED] wrote:



 igor.vaynberg wrote:
 
  c.replacewith(a) is the same as c.getparent().replace(a)
 

 I want to extend this example and replace the panel but inside the
 ListView.
 But I've found another problem.

 I did like you wrote but the panel isn't replaced. The new panel is being
 added at the top of the table.
 Why?

 The Page:
 public class TestPage extends MyPage {

 private static final Listlt;Stringgt; params = Arrays.asList(
 new
 String[] { one, two, three, four} );

 public TestPage(PageParameters parameters) {
 super(parameters);

 ListView view = new ListView(list, params) {
 protected void populateItem(ListItem item) {
 String s = (String) item.getModelObject();
 item.add(new TestPanel(panel, s));
 }
 };
 add(view);
 }
 }

 lt;wicket:extendgt;
 lt;tablegt;
 lt;tr wicket:id=listgt;
 lt;span wicket:id=panelgt;[panel]lt;/spangt;
 lt;/trgt;
 lt;/tablegt;
 lt;/wicket:extendgt;

 The Panel:
 public TestPanel(String id, String param) {
 super(id);
 setOutputMarkupId(true);
 AjaxLink link = new AjaxLink(link) {
 public void onClick(AjaxRequestTarget target) {
 TestPanel newOne = new TestPanel(
 TestPanel.this.getId(), another
 param);
 TestPanel.this.replaceWith(newOne);
 target.addComponent(newOne);
 }
 };
 link.add(new Label(label0, click));
 add(link);
 add(new Label(label1, param.toUpperCase()));
 add(new Label(label2, param.toLowerCase()));
 }

 lt;wicket:panelgt;
 lt;tdgt;lt;a href=# wicket:id=linkgt;lt;span
 wicket:id=label0gt;[label0]lt;/spangt;lt;/agt;lt;/tdgt;
 lt;tdgt;lt;span
 wicket:id=label1gt;[label1]lt;/spangt;lt;/tdgt;
 lt;tdgt;lt;span
 wicket:id=label2gt;[label2]lt;/spangt;lt;/tdgt;
 lt;/wicket:panelgt;


 Artur
 --
 View this message in context:
 http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12300076
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]