Re: Page load after an action

2010-01-27 Thread Pedro Santos
It is natural:

1 - model load some data from some source
2 - that source was updated, changed, and the data loaded on the model no
more reflect the data on that source
3 - detach the old loaded data on model
4 - next time any object require the data on model, it will no longer have
the old data (that is no more the same on his source) that was detached. So
it is forced to reload from the updated source, the new data, that now has
an deleted item.

On Tue, Jan 26, 2010 at 2:59 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:


 Thanks Pedro, it's ok now ;-)

 I use LoadableDetachableModel to avoid the call to detach() method. It does
 not seem that is the right way. Somebody can explain me why ?

 Stéphane


 Pedro Santos a écrit :

  by calling getDefaultModel inside onClick, you get an reference to the
 link
 component model. You need to detach the model on your list view. You has
 an
 reference to it on your variable news. So:
 news.getDefaultModel().detach()
 If you need, you can change that variable modifiers or turn it an instance
 variable for have acess to it inside your onClick implementation.

 On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 The behaviour is the same with the following code :(


  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
  getDefaultModel().detach();
}


 Pedro Santos a écrit :

  missing line: call detach method just after delete your item.


 On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
 wrote:





 Call news.getDefaultModel().detach(), and look for more info about
 detachable models.

 http://cwiki.apache.org/WICKET/detachable-models.html

 On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,




 I'll let someone smarter than me address the wicket issue of removing
 the
 item from the ListView and seeing if that helps -- but is there a
 chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd
 level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:







 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
PageableListViewNews news =
new PageableListViewNews(list, new NewsModel(), 15){

@Override
protected void populateItem(final ListItemNews item) {
ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

News news = item.getModelObject();
  item.add(new Label(date, new
 Model(news.getDate(;
  LinkNews l = new LinkNews(edit){

@Override
public void onClick() {
setResponsePage(new
 NewsPage(item.getModelObject()));
  }
 };

item.add(l);
l.add(new Label(title, news.getTitle()));

item.add(new LinkNews(delete, new Model()){

@Override
public void onClick() {
// TODO : check the refresh issue
getNewsDao().delete(item.getModelObject());
ourLogger.debug(News deleted);
  }
  });
  }

  };

add(news);
add(new OrPagingNavigator(navigator, news));
  add(new BookmarkablePageLinkVoid(add, NewsPage.class));

  }

  /**
  * Model for the news List to load the news from the db each time
  *
  */
  public class NewsModel extends LoadableDetachableModelListNews
 {

@Override
protected ListNews load() {
ourLogger.debug(Loading all news);
return new NewsDao().load();
}


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your
 list






 view.  You could post some code, but make sure that you're
 reloading
 the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:









 Hello,

 My page displays a list of items, 

Page load after an action

2010-01-26 Thread Stéphane Jeanjean

Hello,

My page displays a list of items, for each of them, an icon is available 
to delete it. The action is managed in a Link.onClick() method.
When I click on the link, the page is refreshed but the item is always 
in my list, I have to do refresh again manually the page to have a list 
wihtout this item.


In the logs, it seems that the deletion in the onClick() method is 
called after the load of the page :(


Somebody has an idea to avoid this manual refresh ?

Thanks,

Stéphane

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



Re: Page load after an action

2010-01-26 Thread Jeremy Thomerson
You're probably not using models correctly - specifically for your list
view.  You could post some code, but make sure that you're reloading the
data for the list view after the onClick is called and the item is deleted.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:

 Hello,

 My page displays a list of items, for each of them, an icon is available to
 delete it. The action is managed in a Link.onClick() method.
 When I click on the link, the page is refreshed but the item is always in
 my list, I have to do refresh again manually the page to have a list wihtout
 this item.

 In the logs, it seems that the deletion in the onClick() method is called
 after the load of the page :(

 Somebody has an idea to avoid this manual refresh ?

 Thanks,

 Stéphane

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




Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean


Please find my code just below :


public class NewsListPage  {

   protected static transient NewsDao myNewsDao;

   public NewsListPage() {
   PageableListViewNews news =
   new PageableListViewNews(list, new NewsModel(), 15){

   @Override
   protected void populateItem(final ListItemNews item) {
   ourLogger.debug(Getting item value 
+item.getModelObject().getTitle());


   News news = item.getModelObject();
  
   item.add(new Label(date, new Model(news.getDate(;
  
   LinkNews l = new LinkNews(edit){


   @Override
   public void onClick() {
   setResponsePage(new 
NewsPage(item.getModelObject()));
  
   }   
   };


   item.add(l);
   l.add(new Label(title, news.getTitle()));

   item.add(new LinkNews(delete, new Model()){

   @Override
   public void onClick() {
   // TODO : check the refresh issue
   getNewsDao().delete(item.getModelObject());
   ourLogger.debug(News deleted);
  
   }
  
   });
  
   }


  
   };


   add(news);
   add(new OrPagingNavigator(navigator, news));
  
   add(new BookmarkablePageLinkVoid(add, NewsPage.class));


  
   }


   /**
* Model for the news List to load the news from the db each time
*
*/
   public class NewsModel extends LoadableDetachableModelListNews {

   @Override
   protected ListNews load() {
   ourLogger.debug(Loading all news);
   return new NewsDao().load();
   }


   }
 
}




Jeremy Thomerson a écrit :

You're probably not using models correctly - specifically for your list
view.  You could post some code, but make sure that you're reloading the
data for the list view after the onClick is called and the item is deleted.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:

  

Hello,

My page displays a list of items, for each of them, an icon is available to
delete it. The action is managed in a Link.onClick() method.
When I click on the link, the page is refreshed but the item is always in
my list, I have to do refresh again manually the page to have a list wihtout
this item.

In the logs, it seems that the deletion in the onClick() method is called
after the load of the page :(

Somebody has an idea to avoid this manual refresh ?

Thanks,

Stéphane

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







  



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



Re: Page load after an action

2010-01-26 Thread Riyad Kalla
Stephane,

I'll let someone smarter than me address the wicket issue of removing the
item from the ListView and seeing if that helps -- but is there a chance you
are using Hibernate and the Level 2 ehcache plugin or any 2nd-level caching
with your persistence code? I ask because I've seen code like this I don't
see my changes until the 2nd refresh! a lot with folks using 2nd level
caches and not seeing immediate persistence of those changes.

On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:


 Please find my code just below :


 public class NewsListPage  {

   protected static transient NewsDao myNewsDao;

   public NewsListPage() {
   PageableListViewNews news =
   new PageableListViewNews(list, new NewsModel(), 15){

   @Override
   protected void populateItem(final ListItemNews item) {
   ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

   News news = item.getModelObject();
 item.add(new Label(date, new
 Model(news.getDate(;
 LinkNews l = new LinkNews(edit){

   @Override
   public void onClick() {
   setResponsePage(new NewsPage(item.getModelObject()));
 }
 };

   item.add(l);
   l.add(new Label(title, news.getTitle()));

   item.add(new LinkNews(delete, new Model()){

   @Override
   public void onClick() {
   // TODO : check the refresh issue
   getNewsDao().delete(item.getModelObject());
   ourLogger.debug(News deleted);
 }
 });
 }

 };

   add(news);
   add(new OrPagingNavigator(navigator, news));
 add(new BookmarkablePageLinkVoid(add, NewsPage.class));

 }

   /**
* Model for the news List to load the news from the db each time
*
*/
   public class NewsModel extends LoadableDetachableModelListNews {

   @Override
   protected ListNews load() {
   ourLogger.debug(Loading all news);
   return new NewsDao().load();
   }


   }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your list
 view.  You could post some code, but make sure that you're reloading the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 Hello,

 My page displays a list of items, for each of them, an icon is available
 to
 delete it. The action is managed in a Link.onClick() method.
 When I click on the link, the page is refreshed but the item is always in
 my list, I have to do refresh again manually the page to have a list
 wihtout
 this item.

 In the logs, it seems that the deletion in the onClick() method is called
 after the load of the page :(

 Somebody has an idea to avoid this manual refresh ?

 Thanks,

 Stéphane

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











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




Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean

Hi,

I don't use Hibernate. My persistence layer uses JDBC.

What is strange when I click the delete link, it's the logs order :

Loading all news
News deleted

So it seems that the deletion is done after the data reload :(

Stéphane


Riyad Kalla a écrit :

Stephane,

I'll let someone smarter than me address the wicket issue of removing the
item from the ListView and seeing if that helps -- but is there a chance you
are using Hibernate and the Level 2 ehcache plugin or any 2nd-level caching
with your persistence code? I ask because I've seen code like this I don't
see my changes until the 2nd refresh! a lot with folks using 2nd level
caches and not seeing immediate persistence of those changes.

On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:

  

Please find my code just below :


public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
  PageableListViewNews news =
  new PageableListViewNews(list, new NewsModel(), 15){

  @Override
  protected void populateItem(final ListItemNews item) {
  ourLogger.debug(Getting item value
+item.getModelObject().getTitle());

  News news = item.getModelObject();
item.add(new Label(date, new
Model(news.getDate(;
LinkNews l = new LinkNews(edit){

  @Override
  public void onClick() {
  setResponsePage(new NewsPage(item.getModelObject()));
}
};

  item.add(l);
  l.add(new Label(title, news.getTitle()));

  item.add(new LinkNews(delete, new Model()){

  @Override
  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
}
});
}

};

  add(news);
  add(new OrPagingNavigator(navigator, news));
add(new BookmarkablePageLinkVoid(add, NewsPage.class));

}

  /**
   * Model for the news List to load the news from the db each time
   *
   */
  public class NewsModel extends LoadableDetachableModelListNews {

  @Override
  protected ListNews load() {
  ourLogger.debug(Loading all news);
  return new NewsDao().load();
  }


  }
 }



Jeremy Thomerson a écrit :

 You're probably not using models correctly - specifically for your list


view.  You could post some code, but make sure that you're reloading the
data for the list view after the onClick is called and the item is
deleted.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:



  

Hello,

My page displays a list of items, for each of them, an icon is available
to
delete it. The action is managed in a Link.onClick() method.
When I click on the link, the page is refreshed but the item is always in
my list, I have to do refresh again manually the page to have a list
wihtout
this item.

In the logs, it seems that the deletion in the onClick() method is called
after the load of the page :(

Somebody has an idea to avoid this manual refresh ?

Thanks,

Stéphane

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









  

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







  



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



Re: Page load after an action

2010-01-26 Thread Pedro Santos
Call news.getDefaultModel().detach(), and look for more info about
detachable models.

http://cwiki.apache.org/WICKET/detachable-models.html

On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:

 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,

 I'll let someone smarter than me address the wicket issue of removing the
 item from the ListView and seeing if that helps -- but is there a chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
  PageableListViewNews news =
  new PageableListViewNews(list, new NewsModel(), 15){

  @Override
  protected void populateItem(final ListItemNews item) {
  ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

  News news = item.getModelObject();
item.add(new Label(date, new
 Model(news.getDate(;
LinkNews l = new LinkNews(edit){

  @Override
  public void onClick() {
  setResponsePage(new
 NewsPage(item.getModelObject()));
}
 };

  item.add(l);
  l.add(new Label(title, news.getTitle()));

  item.add(new LinkNews(delete, new Model()){

  @Override
  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
}
});
}

};

  add(news);
  add(new OrPagingNavigator(navigator, news));
add(new BookmarkablePageLinkVoid(add, NewsPage.class));

}

  /**
   * Model for the news List to load the news from the db each time
   *
   */
  public class NewsModel extends LoadableDetachableModelListNews {

  @Override
  protected ListNews load() {
  ourLogger.debug(Loading all news);
  return new NewsDao().load();
  }


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your list


 view.  You could post some code, but make sure that you're reloading the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Hello,

 My page displays a list of items, for each of them, an icon is
 available
 to
 delete it. The action is managed in a Link.onClick() method.
 When I click on the link, the page is refreshed but the item is always
 in
 my list, I have to do refresh again manually the page to have a list
 wihtout
 this item.

 In the logs, it seems that the deletion in the onClick() method is
 called
 after the load of the page :(

 Somebody has an idea to avoid this manual refresh ?

 Thanks,

 Stéphane

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











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











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




-- 
Pedro Henrique Oliveira dos Santos


Re: Page load after an action

2010-01-26 Thread Pedro Santos
missing line: call detach method just after delete your item.

On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com wrote:

 Call news.getDefaultModel().detach(), and look for more info about
 detachable models.

 http://cwiki.apache.org/WICKET/detachable-models.html

 On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:

 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,

 I'll let someone smarter than me address the wicket issue of removing the
 item from the ListView and seeing if that helps -- but is there a chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
  PageableListViewNews news =
  new PageableListViewNews(list, new NewsModel(), 15){

  @Override
  protected void populateItem(final ListItemNews item) {
  ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

  News news = item.getModelObject();
item.add(new Label(date, new
 Model(news.getDate(;
LinkNews l = new LinkNews(edit){

  @Override
  public void onClick() {
  setResponsePage(new
 NewsPage(item.getModelObject()));
}
 };

  item.add(l);
  l.add(new Label(title, news.getTitle()));

  item.add(new LinkNews(delete, new Model()){

  @Override
  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
}
});
}

};

  add(news);
  add(new OrPagingNavigator(navigator, news));
add(new BookmarkablePageLinkVoid(add, NewsPage.class));

}

  /**
   * Model for the news List to load the news from the db each time
   *
   */
  public class NewsModel extends LoadableDetachableModelListNews {

  @Override
  protected ListNews load() {
  ourLogger.debug(Loading all news);
  return new NewsDao().load();
  }


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your list


 view.  You could post some code, but make sure that you're reloading
 the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Hello,

 My page displays a list of items, for each of them, an icon is
 available
 to
 delete it. The action is managed in a Link.onClick() method.
 When I click on the link, the page is refreshed but the item is always
 in
 my list, I have to do refresh again manually the page to have a list
 wihtout
 this item.

 In the logs, it seems that the deletion in the onClick() method is
 called
 after the load of the page :(

 Somebody has an idea to avoid this manual refresh ?

 Thanks,

 Stéphane

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











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











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




 --
 Pedro Henrique Oliveira dos Santos




-- 
Pedro Henrique Oliveira dos Santos


Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean


The behaviour is the same with the following code :(

   public void onClick() {
   // TODO : check the refresh issue
   getNewsDao().delete(item.getModelObject());
   ourLogger.debug(News deleted);
   getDefaultModel().detach();
  
   }



Pedro Santos a écrit :

missing line: call detach method just after delete your item.

On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com wrote:

  

Call news.getDefaultModel().detach(), and look for more info about
detachable models.

http://cwiki.apache.org/WICKET/detachable-models.html

On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:



Hi,

I don't use Hibernate. My persistence layer uses JDBC.

What is strange when I click the delete link, it's the logs order :

Loading all news
News deleted

So it seems that the deletion is done after the data reload :(

Stéphane


Riyad Kalla a écrit :

 Stephane,
  

I'll let someone smarter than me address the wicket issue of removing the
item from the ListView and seeing if that helps -- but is there a chance
you
are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
caching
with your persistence code? I ask because I've seen code like this I
don't
see my changes until the 2nd refresh! a lot with folks using 2nd level
caches and not seeing immediate persistence of those changes.

On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:





Please find my code just below :


public class NewsListPage  {

 protected static transient NewsDao myNewsDao;

 public NewsListPage() {
 PageableListViewNews news =
 new PageableListViewNews(list, new NewsModel(), 15){

 @Override
 protected void populateItem(final ListItemNews item) {
 ourLogger.debug(Getting item value
+item.getModelObject().getTitle());

 News news = item.getModelObject();
   item.add(new Label(date, new
Model(news.getDate(;
   LinkNews l = new LinkNews(edit){

 @Override
 public void onClick() {
 setResponsePage(new
NewsPage(item.getModelObject()));
   }
};

 item.add(l);
 l.add(new Label(title, news.getTitle()));

 item.add(new LinkNews(delete, new Model()){

 @Override
 public void onClick() {
 // TODO : check the refresh issue
 getNewsDao().delete(item.getModelObject());
 ourLogger.debug(News deleted);
   }
   });
   }

   };

 add(news);
 add(new OrPagingNavigator(navigator, news));
   add(new BookmarkablePageLinkVoid(add, NewsPage.class));

   }

 /**
  * Model for the news List to load the news from the db each time
  *
  */
 public class NewsModel extends LoadableDetachableModelListNews {

 @Override
 protected ListNews load() {
 ourLogger.debug(Loading all news);
 return new NewsDao().load();
 }


 }
 }



Jeremy Thomerson a écrit :

 You're probably not using models correctly - specifically for your list


  

view.  You could post some code, but make sure that you're reloading
the
data for the list view after the onClick is called and the item is
deleted.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:







Hello,

My page displays a list of items, for each of them, an icon is
available
to
delete it. The action is managed in a Link.onClick() method.
When I click on the link, the page is refreshed but the item is always
in
my list, I have to do refresh again manually the page to have a list
wihtout
this item.

In the logs, it seems that the deletion in the onClick() method is
called
after the load of the page :(

Somebody has an idea to avoid this manual refresh ?

Thanks,

Stéphane

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






  






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




  






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


  

--
Pedro Henrique Oliveira dos Santos






  




Re: Page load after an action

2010-01-26 Thread Pedro Santos
by calling getDefaultModel inside onClick, you get an reference to the link
component model. You need to detach the model on your list view. You has an
reference to it on your variable news. So: news.getDefaultModel().detach()
If you need, you can change that variable modifiers or turn it an instance
variable for have acess to it inside your onClick implementation.

On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:


 The behaviour is the same with the following code :(


   public void onClick() {
   // TODO : check the refresh issue
   getNewsDao().delete(item.getModelObject());
   ourLogger.debug(News deleted);
   getDefaultModel().detach();
 }


 Pedro Santos a écrit :

  missing line: call detach method just after delete your item.

 On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
 wrote:



 Call news.getDefaultModel().detach(), and look for more info about
 detachable models.

 http://cwiki.apache.org/WICKET/detachable-models.html

 On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,


 I'll let someone smarter than me address the wicket issue of removing
 the
 item from the ListView and seeing if that helps -- but is there a
 chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
 PageableListViewNews news =
 new PageableListViewNews(list, new NewsModel(), 15){

 @Override
 protected void populateItem(final ListItemNews item) {
 ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

 News news = item.getModelObject();
   item.add(new Label(date, new
 Model(news.getDate(;
   LinkNews l = new LinkNews(edit){

 @Override
 public void onClick() {
 setResponsePage(new
 NewsPage(item.getModelObject()));
   }
 };

 item.add(l);
 l.add(new Label(title, news.getTitle()));

 item.add(new LinkNews(delete, new Model()){

 @Override
 public void onClick() {
 // TODO : check the refresh issue
 getNewsDao().delete(item.getModelObject());
 ourLogger.debug(News deleted);
   }
   });
   }

   };

 add(news);
 add(new OrPagingNavigator(navigator, news));
   add(new BookmarkablePageLinkVoid(add, NewsPage.class));

   }

  /**
  * Model for the news List to load the news from the db each time
  *
  */
  public class NewsModel extends LoadableDetachableModelListNews {

 @Override
 protected ListNews load() {
 ourLogger.debug(Loading all news);
 return new NewsDao().load();
 }


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your
 list




 view.  You could post some code, but make sure that you're reloading
 the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:







 Hello,

 My page displays a list of items, for each of them, an icon is
 available
 to
 delete it. The action is managed in a Link.onClick() method.
 When I click on the link, the page is refreshed but the item is
 always
 in
 my list, I have to do refresh again manually the page to have a list
 wihtout
 this item.

 In the logs, it seems that the deletion in the onClick() method is
 called
 after the load of the page :(

 Somebody has an idea to avoid this manual refresh ?

 Thanks,

 Stéphane


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













 -
 To 

Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean


Thanks Pedro, it's ok now ;-)

I use LoadableDetachableModel to avoid the call to detach() method. It 
does not seem that is the right way. Somebody can explain me why ?


Stéphane


Pedro Santos a écrit :

by calling getDefaultModel inside onClick, you get an reference to the link
component model. You need to detach the model on your list view. You has an
reference to it on your variable news. So: news.getDefaultModel().detach()
If you need, you can change that variable modifiers or turn it an instance
variable for have acess to it inside your onClick implementation.

On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:

  

The behaviour is the same with the following code :(


  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
  getDefaultModel().detach();
}


Pedro Santos a écrit :

 missing line: call detach method just after delete your item.


On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
wrote:



  

Call news.getDefaultModel().detach(), and look for more info about
detachable models.

http://cwiki.apache.org/WICKET/detachable-models.html

On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:





Hi,

I don't use Hibernate. My persistence layer uses JDBC.

What is strange when I click the delete link, it's the logs order :

Loading all news
News deleted

So it seems that the deletion is done after the data reload :(

Stéphane


Riyad Kalla a écrit :

 Stephane,


  

I'll let someone smarter than me address the wicket issue of removing
the
item from the ListView and seeing if that helps -- but is there a
chance
you
are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
caching
with your persistence code? I ask because I've seen code like this I
don't
see my changes until the 2nd refresh! a lot with folks using 2nd level
caches and not seeing immediate persistence of those changes.

On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:







Please find my code just below :


public class NewsListPage  {

 protected static transient NewsDao myNewsDao;

 public NewsListPage() {
PageableListViewNews news =
new PageableListViewNews(list, new NewsModel(), 15){

@Override
protected void populateItem(final ListItemNews item) {
ourLogger.debug(Getting item value
+item.getModelObject().getTitle());

News news = item.getModelObject();
  item.add(new Label(date, new
Model(news.getDate(;
  LinkNews l = new LinkNews(edit){

@Override
public void onClick() {
setResponsePage(new
NewsPage(item.getModelObject()));
  }
};

item.add(l);
l.add(new Label(title, news.getTitle()));

item.add(new LinkNews(delete, new Model()){

@Override
public void onClick() {
// TODO : check the refresh issue
getNewsDao().delete(item.getModelObject());
ourLogger.debug(News deleted);
  }
  });
  }

  };

add(news);
add(new OrPagingNavigator(navigator, news));
  add(new BookmarkablePageLinkVoid(add, NewsPage.class));

  }

 /**
 * Model for the news List to load the news from the db each time
 *
 */
 public class NewsModel extends LoadableDetachableModelListNews {

@Override
protected ListNews load() {
ourLogger.debug(Loading all news);
return new NewsDao().load();
}


 }
 }



Jeremy Thomerson a écrit :

 You're probably not using models correctly - specifically for your
list




  

view.  You could post some code, but make sure that you're reloading
the
data for the list view after the onClick is called and the item is
deleted.

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 8:37 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:









Hello,

My page displays a list of items, for each of them, an icon is
available
to
delete it. The action is managed in a Link.onClick() method.
When I click on the link, the page is refreshed but the item is
always
in
my list, I have to do refresh again manually the page to have a list
wihtout
this item.

In the logs, it seems that the deletion in the onClick() method is
called
after the load of the page :(

Somebody has an idea to avoid this manual refresh ?

Thanks,

Stéphane


-
To unsubscribe, e-mail: 

Re: Page load after an action

2010-01-26 Thread Riyad Kalla
Seems weird to me as well that 'detach' has to be explicitly called. Also
still curious why Stephane was seeing the log ordering he did when the link
was clicked:


Loading all news
News deleted


I'd expect to see news deleted first, from his onClick handler then the
loading all news caused by the call to load() before the response was
sent -- in which case it seems he wouldn't have run into this issue in the
first place.

It's entirely possible I'm missing the wicket processing sequence here being
something else which would explain this.

On Tue, Jan 26, 2010 at 9:59 AM, Stéphane Jeanjean 
stephane.jeanj...@softeam.com wrote:


 Thanks Pedro, it's ok now ;-)

 I use LoadableDetachableModel to avoid the call to detach() method. It does
 not seem that is the right way. Somebody can explain me why ?

 Stéphane


 Pedro Santos a écrit :

  by calling getDefaultModel inside onClick, you get an reference to the
 link
 component model. You need to detach the model on your list view. You has
 an
 reference to it on your variable news. So:
 news.getDefaultModel().detach()
 If you need, you can change that variable modifiers or turn it an instance
 variable for have acess to it inside your onClick implementation.

 On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 The behaviour is the same with the following code :(


  public void onClick() {
  // TODO : check the refresh issue
  getNewsDao().delete(item.getModelObject());
  ourLogger.debug(News deleted);
  getDefaultModel().detach();
}


 Pedro Santos a écrit :

  missing line: call detach method just after delete your item.


 On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
 wrote:





 Call news.getDefaultModel().detach(), and look for more info about
 detachable models.

 http://cwiki.apache.org/WICKET/detachable-models.html

 On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,




 I'll let someone smarter than me address the wicket issue of removing
 the
 item from the ListView and seeing if that helps -- but is there a
 chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd
 level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:







 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
PageableListViewNews news =
new PageableListViewNews(list, new NewsModel(), 15){

@Override
protected void populateItem(final ListItemNews item) {
ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

News news = item.getModelObject();
  item.add(new Label(date, new
 Model(news.getDate(;
  LinkNews l = new LinkNews(edit){

@Override
public void onClick() {
setResponsePage(new
 NewsPage(item.getModelObject()));
  }
 };

item.add(l);
l.add(new Label(title, news.getTitle()));

item.add(new LinkNews(delete, new Model()){

@Override
public void onClick() {
// TODO : check the refresh issue
getNewsDao().delete(item.getModelObject());
ourLogger.debug(News deleted);
  }
  });
  }

  };

add(news);
add(new OrPagingNavigator(navigator, news));
  add(new BookmarkablePageLinkVoid(add, NewsPage.class));

  }

  /**
  * Model for the news List to load the news from the db each time
  *
  */
  public class NewsModel extends LoadableDetachableModelListNews
 {

@Override
protected ListNews load() {
ourLogger.debug(Loading all news);
return new NewsDao().load();
}


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your
 list






 view.  You could post some code, but make sure that you're
 reloading
 the
 data for the list view after the onClick is called and the item is
 deleted.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 

Re: Page load after an action

2010-01-26 Thread James Carman
Doesn't it have to load the model so that it knows what item it's talking to?

On Tue, Jan 26, 2010 at 2:12 PM, Riyad Kalla rka...@gmail.com wrote:
 Seems weird to me as well that 'detach' has to be explicitly called. Also
 still curious why Stephane was seeing the log ordering he did when the link
 was clicked:

 
 Loading all news
 News deleted
 

 I'd expect to see news deleted first, from his onClick handler then the
 loading all news caused by the call to load() before the response was
 sent -- in which case it seems he wouldn't have run into this issue in the
 first place.

 It's entirely possible I'm missing the wicket processing sequence here being
 something else which would explain this.

 On Tue, Jan 26, 2010 at 9:59 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:


 Thanks Pedro, it's ok now ;-)

 I use LoadableDetachableModel to avoid the call to detach() method. It does
 not seem that is the right way. Somebody can explain me why ?

 Stéphane


 Pedro Santos a écrit :

  by calling getDefaultModel inside onClick, you get an reference to the
 link
 component model. You need to detach the model on your list view. You has
 an
 reference to it on your variable news. So:
 news.getDefaultModel().detach()
 If you need, you can change that variable modifiers or turn it an instance
 variable for have acess to it inside your onClick implementation.

 On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:



 The behaviour is the same with the following code :(


                  public void onClick() {
                      // TODO : check the refresh issue
                      getNewsDao().delete(item.getModelObject());
                      ourLogger.debug(News deleted);
                      getDefaultModel().detach();
                                        }


 Pedro Santos a écrit :

  missing line: call detach method just after delete your item.


 On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
 wrote:





 Call news.getDefaultModel().detach(), and look for more info about
 detachable models.

 http://cwiki.apache.org/WICKET/detachable-models.html

 On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:





 Hi,

 I don't use Hibernate. My persistence layer uses JDBC.

 What is strange when I click the delete link, it's the logs order :

 Loading all news
 News deleted

 So it seems that the deletion is done after the data reload :(

 Stéphane


 Riyad Kalla a écrit :

  Stephane,




 I'll let someone smarter than me address the wicket issue of removing
 the
 item from the ListView and seeing if that helps -- but is there a
 chance
 you
 are using Hibernate and the Level 2 ehcache plugin or any 2nd-level
 caching
 with your persistence code? I ask because I've seen code like this I
 don't
 see my changes until the 2nd refresh! a lot with folks using 2nd
 level
 caches and not seeing immediate persistence of those changes.

 On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
 stephane.jeanj...@softeam.com wrote:







 Please find my code just below :


 public class NewsListPage  {

  protected static transient NewsDao myNewsDao;

  public NewsListPage() {
    PageableListViewNews news =
    new PageableListViewNews(list, new NewsModel(), 15){

       �...@override
        protected void populateItem(final ListItemNews item) {
            ourLogger.debug(Getting item value
 +item.getModelObject().getTitle());

            News news = item.getModelObject();
                          item.add(new Label(date, new
 Model(news.getDate(;
                          LinkNews l = new LinkNews(edit){

               �...@override
                public void onClick() {
                    setResponsePage(new
 NewsPage(item.getModelObject()));
                                      }
 };

            item.add(l);
            l.add(new Label(title, news.getTitle()));

            item.add(new LinkNews(delete, new Model()){

               �...@override
                public void onClick() {
                    // TODO : check the refresh issue
                    getNewsDao().delete(item.getModelObject());
                    ourLogger.debug(News deleted);
                                      }
                              });
                      }

              };

    add(news);
    add(new OrPagingNavigator(navigator, news));
          add(new BookmarkablePageLinkVoid(add, NewsPage.class));

      }

  /**
  * Model for the news List to load the news from the db each time
  *
  */
  public class NewsModel extends LoadableDetachableModelListNews
 {

   �...@override
    protected ListNews load() {
        ourLogger.debug(Loading all news);
        return new NewsDao().load();
    }


  }
  }



 Jeremy Thomerson a écrit :

  You're probably not using models correctly - specifically for your
 list






 view.  You could post some code, but make sure that you're
 

Re: Page load after an action

2010-01-26 Thread Jeremy Thomerson
Yes - James is right here - it's a loadable detachable model - so it needs
to load the data in order to repopulate the list before deleting the item.

My guess is either you need to call the detach so that on the re-render it
gets reloaded, or you need to make sure your delete is being committed to
the DB before the re-render.  Perhaps the transaction was not committed?

--
Jeremy Thomerson
http://www.wickettraining.com



On Tue, Jan 26, 2010 at 1:14 PM, James Carman
jcar...@carmanconsulting.comwrote:

 Doesn't it have to load the model so that it knows what item it's talking
 to?

 On Tue, Jan 26, 2010 at 2:12 PM, Riyad Kalla rka...@gmail.com wrote:
  Seems weird to me as well that 'detach' has to be explicitly called. Also
  still curious why Stephane was seeing the log ordering he did when the
 link
  was clicked:
 
  
  Loading all news
  News deleted
  
 
  I'd expect to see news deleted first, from his onClick handler then the
  loading all news caused by the call to load() before the response was
  sent -- in which case it seems he wouldn't have run into this issue in
 the
  first place.
 
  It's entirely possible I'm missing the wicket processing sequence here
 being
  something else which would explain this.
 
  On Tue, Jan 26, 2010 at 9:59 AM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
  Thanks Pedro, it's ok now ;-)
 
  I use LoadableDetachableModel to avoid the call to detach() method. It
 does
  not seem that is the right way. Somebody can explain me why ?
 
  Stéphane
 
 
  Pedro Santos a écrit :
 
   by calling getDefaultModel inside onClick, you get an reference to the
  link
  component model. You need to detach the model on your list view. You
 has
  an
  reference to it on your variable news. So:
  news.getDefaultModel().detach()
  If you need, you can change that variable modifiers or turn it an
 instance
  variable for have acess to it inside your onClick implementation.
 
  On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
  The behaviour is the same with the following code :(
 
 
   public void onClick() {
   // TODO : check the refresh issue
   getNewsDao().delete(item.getModelObject());
   ourLogger.debug(News deleted);
   getDefaultModel().detach();
 }
 
 
  Pedro Santos a écrit :
 
   missing line: call detach method just after delete your item.
 
 
  On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
  wrote:
 
 
 
 
 
  Call news.getDefaultModel().detach(), and look for more info about
  detachable models.
 
  http://cwiki.apache.org/WICKET/detachable-models.html
 
  On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
 
 
  Hi,
 
  I don't use Hibernate. My persistence layer uses JDBC.
 
  What is strange when I click the delete link, it's the logs order :
 
  Loading all news
  News deleted
 
  So it seems that the deletion is done after the data reload :(
 
  Stéphane
 
 
  Riyad Kalla a écrit :
 
   Stephane,
 
 
 
 
  I'll let someone smarter than me address the wicket issue of
 removing
  the
  item from the ListView and seeing if that helps -- but is there a
  chance
  you
  are using Hibernate and the Level 2 ehcache plugin or any
 2nd-level
  caching
  with your persistence code? I ask because I've seen code like this
 I
  don't
  see my changes until the 2nd refresh! a lot with folks using 2nd
  level
  caches and not seeing immediate persistence of those changes.
 
  On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
 
 
 
 
  Please find my code just below :
 
 
  public class NewsListPage  {
 
   protected static transient NewsDao myNewsDao;
 
   public NewsListPage() {
 PageableListViewNews news =
 new PageableListViewNews(list, new NewsModel(), 15){
 
 @Override
 protected void populateItem(final ListItemNews item) {
 ourLogger.debug(Getting item value
  +item.getModelObject().getTitle());
 
 News news = item.getModelObject();
   item.add(new Label(date, new
  Model(news.getDate(;
   LinkNews l = new LinkNews(edit){
 
 @Override
 public void onClick() {
 setResponsePage(new
  NewsPage(item.getModelObject()));
   }
  };
 
 item.add(l);
 l.add(new Label(title, news.getTitle()));
 
 item.add(new LinkNews(delete, new Model()){
 
 @Override
 public void onClick() {
 // TODO : check the refresh issue
 getNewsDao().delete(item.getModelObject());
 ourLogger.debug(News deleted);
   }
 

Re: Page load after an action

2010-01-26 Thread James Carman
Or, call detach(), then call modelChanged()?

On Tue, Jan 26, 2010 at 4:02 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 Yes - James is right here - it's a loadable detachable model - so it needs
 to load the data in order to repopulate the list before deleting the item.

 My guess is either you need to call the detach so that on the re-render it
 gets reloaded, or you need to make sure your delete is being committed to
 the DB before the re-render.  Perhaps the transaction was not committed?

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Tue, Jan 26, 2010 at 1:14 PM, James Carman
 jcar...@carmanconsulting.comwrote:

 Doesn't it have to load the model so that it knows what item it's talking
 to?

 On Tue, Jan 26, 2010 at 2:12 PM, Riyad Kalla rka...@gmail.com wrote:
  Seems weird to me as well that 'detach' has to be explicitly called. Also
  still curious why Stephane was seeing the log ordering he did when the
 link
  was clicked:
 
  
  Loading all news
  News deleted
  
 
  I'd expect to see news deleted first, from his onClick handler then the
  loading all news caused by the call to load() before the response was
  sent -- in which case it seems he wouldn't have run into this issue in
 the
  first place.
 
  It's entirely possible I'm missing the wicket processing sequence here
 being
  something else which would explain this.
 
  On Tue, Jan 26, 2010 at 9:59 AM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
  Thanks Pedro, it's ok now ;-)
 
  I use LoadableDetachableModel to avoid the call to detach() method. It
 does
  not seem that is the right way. Somebody can explain me why ?
 
  Stéphane
 
 
  Pedro Santos a écrit :
 
   by calling getDefaultModel inside onClick, you get an reference to the
  link
  component model. You need to detach the model on your list view. You
 has
  an
  reference to it on your variable news. So:
  news.getDefaultModel().detach()
  If you need, you can change that variable modifiers or turn it an
 instance
  variable for have acess to it inside your onClick implementation.
 
  On Tue, Jan 26, 2010 at 2:01 PM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
  The behaviour is the same with the following code :(
 
 
                   public void onClick() {
                       // TODO : check the refresh issue
                       getNewsDao().delete(item.getModelObject());
                       ourLogger.debug(News deleted);
                       getDefaultModel().detach();
                                         }
 
 
  Pedro Santos a écrit :
 
   missing line: call detach method just after delete your item.
 
 
  On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com
  wrote:
 
 
 
 
 
  Call news.getDefaultModel().detach(), and look for more info about
  detachable models.
 
  http://cwiki.apache.org/WICKET/detachable-models.html
 
  On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
 
 
  Hi,
 
  I don't use Hibernate. My persistence layer uses JDBC.
 
  What is strange when I click the delete link, it's the logs order :
 
  Loading all news
  News deleted
 
  So it seems that the deletion is done after the data reload :(
 
  Stéphane
 
 
  Riyad Kalla a écrit :
 
   Stephane,
 
 
 
 
  I'll let someone smarter than me address the wicket issue of
 removing
  the
  item from the ListView and seeing if that helps -- but is there a
  chance
  you
  are using Hibernate and the Level 2 ehcache plugin or any
 2nd-level
  caching
  with your persistence code? I ask because I've seen code like this
 I
  don't
  see my changes until the 2nd refresh! a lot with folks using 2nd
  level
  caches and not seeing immediate persistence of those changes.
 
  On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean 
  stephane.jeanj...@softeam.com wrote:
 
 
 
 
 
 
 
  Please find my code just below :
 
 
  public class NewsListPage  {
 
   protected static transient NewsDao myNewsDao;
 
   public NewsListPage() {
     PageableListViewNews news =
     new PageableListViewNews(list, new NewsModel(), 15){
 
        �...@override
         protected void populateItem(final ListItemNews item) {
             ourLogger.debug(Getting item value
  +item.getModelObject().getTitle());
 
             News news = item.getModelObject();
                           item.add(new Label(date, new
  Model(news.getDate(;
                           LinkNews l = new LinkNews(edit){
 
                �...@override
                 public void onClick() {
                     setResponsePage(new
  NewsPage(item.getModelObject()));
                                       }
  };
 
             item.add(l);
             l.add(new Label(title, news.getTitle()));
 
             item.add(new LinkNews(delete, new Model()){
 
                �...@override
                 public void onClick() {
                     // TODO : check the refresh issue