Firefox : Refresh problem

2007-11-13 Thread pokkie

I seem to be having a refresh problem with the main page of my wicket
application. I am displaying 
a number of panels that are wrapped in a ListView. The contents of each
panel is build up from the 
database. 

If I refresh the page with either (F5 or clicking the refresh button, or
holding down shift+refresh button), 
then it works fine, for a little while (15 min if I had to guess). After
that, if I take any 
action to refresh the page, then it doesn't refresh the page. However, if I
close the current tab, and 
open a new tab, then the updated data is displayed. 

I am guessing that either the page and/or session times out, and Firefox
does not refresh the page properly. I did consider placing a meta-refresh
tag in the page, which would refresh the page every 5 minutes or so. 

- wicket 1.2.6
- tomcat 5.5.20
- hibernate 3.2
- spring 2.0.7

Any suggestions would be welcome




-- 
View this message in context: 
http://www.nabble.com/Firefox-%3A-Refresh-problem-tf4798170.html#a13727041
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Unit testing ListView

2007-09-12 Thread pokkie

I am trying to write a test case for my listView that contains some links.
When the user clicks on 
a link, a certain action should be performed, and it is for this action that
I wish to write a test case for. 

I can get a handle on the ListView by using the
wicketTester.getLastRenderedPage().get("pathToListView");, 
but the problem then is that the listView isn't populated. I thought about
extracting the above method call, 
into a variable, so that the listView is returned, i.e. 


MyListView listView =
(MyListView)wicketTester.getLastRenderedPage().get("pathToListView");

// Populate the listView with a model object so that it will populate the
ListView
listView.setModelObject(new ModelObject());

// Create a new ListItem so that the listView can be populated
ListItem listItem = new ListItem(0, listView.getModel());

// Populate the listView with the listItem
listView.populateItem(listItem);

// Execute ajax event
wicketTester.executeAjaxEvent("pathToLinkOnListView","onclick");


Would be greatful if somebody could advise me on how to proceed. 

Thanks, 

-- pokkie






-- 
View this message in context: 
http://www.nabble.com/Unit-testing-ListView-tf4427848.html#a12631265
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: AjaxFallbackLink inside ListView

2007-09-06 Thread pokkie

Worked like a charm, thanks Kent. 

You the same Kent Tong that wrote a online Tapestry book?



Kent Tong wrote:
> 
> 
> 
> pokkie wrote:
>> 
>> My question is, how do I use this information to get the selected entity
>> which represents a row in my listView? 
>> 
> 
> Try:
> 
> public class Test extends WebPage {
> 
>   public Test() {
>   List list = Arrays.asList(new String[] { "a", "b", "c" 
> });
>   ListView eachItem = new ListView("eachItem", list) {
>   @Override
>   protected void populateItem(ListItem item) {
>   item.add(new IndicatingAjaxFallbackLink("link") 
> {
>   @Override
>   public void onClick(AjaxRequestTarget 
> target) {
>   
> handleClick(getParent().getModelObjectAsString());
>   }
> 
>   });
>   }
>   };
>   add(eachItem);
>   }
> 
>   private void handleClick(String clickedItem) {
>   System.out.println(clickedItem);
>   }
> }
> 

-- 
View this message in context: 
http://www.nabble.com/AjaxFallbackLink-inside-ListView-tf4389622.html#a12527658
Sent from the Wicket - User mailing list archive at Nabble.com.


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



AjaxFallbackLink inside ListView

2007-09-05 Thread pokkie

I have a listView with several rows, each row has a AjaxFallbackLink
associated with it. 

I am using the getAjaxIndicatorMarkupId() method to determine which row was
selected, it returned the 
following in my case : 

placeHolderProgramPanel_addExerciseToProgramPanel_addExerciseToNewProgramForm_programExerciseListView_6_exerciseNameSelectLink--ajax-indicator

My question is, how do I use this information to get the selected entity
which represents a row in my 
listView? 

Do I have to call get("panel_panel_form_view"), which will return the view,
get the model of the view 
and see which element is at index 6 or is there another way?

Regards, 

-- pokkie
-- 
View this message in context: 
http://www.nabble.com/AjaxFallbackLink-inside-ListView-tf4389622.html#a12515472
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: Hibernate/Spring transaction problem

2007-08-29 Thread pokkie

Hey Vincenzo , 

thanks for your response. have tried it, but still having the problem. will
have a look again


Vincenzo Vitale wrote:
> 
> Have you the same problem using directly the Hibernate session?
> 
> It's also interesting to read this article about the Hibernate template:
> 
> http://blog.interface21.com/main/2007/06/26/so-should-you-still-use-springs-hibernatetemplate-andor-jpatemplate/
> 
> I remember I had in the past similar porblems with the hibernate
> template...  actually I didn't understand the problems I was
> experiencing but after having red the article I tried to use directly
> the session and it worked.
> 
> My code now looks in this way:
> 
> public Account saveOrUpdate(Account account) {
> account.setDateModified(new Date());
> getSession().saveOrUpdate(account);
> 
> //Maybe flush and refresh can be avoided...
> getSession().flush();
> getSession().refresh(account);
> return (Account) account;
> }
> 
> Hope this helps.
> 
> 
> Ciao,
> V.
> 
> 
> On 8/29/07, pokkie <[EMAIL PROTECTED]> wrote:
>>
>> i have a button on a form, when clicked it saves a object to the database
>> (via Spring's HibernateTemplate),
>> but for some reason when i look in the db it is not there, until i go to
>> another page, then suddenly the object is being written into the
>> database.
>>
>> i am presuming that the session is not being flushed, until i go to
>> another
>> page, so i added a flush
>> to my save method, but still experience the same behaviour.
>>
>> either the session or i am thinking that it might be running in a long
>> running transaction,
>> which only ends once a new request is coming in, and subsequently write
>> the
>> data to the database.
>>
>> any thoughts?
>>
>>  -- pokkie
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Hibernate-Spring-transaction-problem-tf4347663.html#a12386692
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Hibernate-Spring-transaction-problem-tf4347663.html#a12391502
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Hibernate/Spring transaction problem

2007-08-29 Thread pokkie

i have a button on a form, when clicked it saves a object to the database
(via Spring's HibernateTemplate), 
but for some reason when i look in the db it is not there, until i go to
another page, then suddenly the object is being written into the database.

i am presuming that the session is not being flushed, until i go to another
page, so i added a flush 
to my save method, but still experience the same behaviour. 

either the session or i am thinking that it might be running in a long
running transaction, 
which only ends once a new request is coming in, and subsequently write the
data to the database. 

any thoughts?

 -- pokkie

-- 
View this message in context: 
http://www.nabble.com/Hibernate-Spring-transaction-problem-tf4347663.html#a12386692
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: RepeatingView : Removing a table row

2007-08-27 Thread pokkie

Carlos, 

I kind of got the code to work, but it doesn't feel right. Any help would be
much appreciated

   1. public void buildView() {  
   2.   
   3. final BookListView bookListView = new
BookListView("bookListView", new ArrayList());  
   4.   
   5. Button addBookButton = new Button("addBookButton") {  
   6. protected void onSubmit() {  
   7. String selectedBookName = "The Travels Of John";  
   8. Book book = new Book();  
   9. book.setBookName(selectedBookName);  
  10.   
  11. List books = new ArrayList();  
  12. books.add(book);  
  13.   
  14. BookModel bookModel = new BookModel(books);  
  15.   
  16. ListItem bookItem = new
ListItem(bookListView.getModelIndex(), bookModel);  
  17. bookListView.populateItem(bookItem);  
  18. bookListView.setModel(bookModel);  
  19. bookListView.modelChanged();  
  20. }  
  21. };  
  22. }  
  23.   
  24. private class BookModel implements IModel {  
  25.   
  26. private List bookList;  
  27.   
  28. public BookModel(List bookList) {  
  29. this.bookList = bookList;  
  30. }  
  31.   
  32. public IModel getNestedModel() {  
  33. return null;  
  34. }  
  35.   
  36. public Object getObject(final Component component) {  
  37. return bookList;  
  38. }  
  39.   
  40. public void setObject(final Component component, final Object
object) {  
  41. }  
  42.   
  43. public void detach() {  
  44. }  
  45. }  
  46.   
  47. private class BookListView extends ListView {  
  48.   
  49. private int modelIndex;  
  50.   
  51. public BookListView(final String id, final List list) {  
  52. super(id, list);  
  53. }  
  54.   
  55. protected void populateItem(final ListItem listItem) {  
  56.   
  57. if (listItem.getModelObject() instanceof Book) {  
  58. Book book = (Book) listItem.getModelObject();  
  59.   
  60. Label bookName = new Label("bookName", new
PropertyModel(book, "bookName"));  
  61. listItem.add(bookName);  
  62.   
  63. setModelIndex(getModelIndex() + 1);  
  64. }  
  65. }  
  66.   
  67.   
  68. public int getModelIndex() {  
  69. return modelIndex;  
  70. }  
  71.   
  72. public void setModelIndex(int modelIndex) {  
  73. this.modelIndex = modelIndex;  
  74. }  
  75. }  
  76.   
  77. private class Book implements Serializable {  
  78. private int id;  
  79. private String bookName;  
  80. private boolean selected;  
  81.   
  82.   
  83. public int getId() {  
  84. return id;  
  85. }  
  86.   
  87. public void setId(int id) {  
  88. this.id = id;  
  89. }  
  90.   
  91. public String getBookName() {  
  92. return bookName;  
  93. }  
  94.   
  95. public void setBookName(String bookName) {  
  96. this.bookName = bookName;  
  97. }  
  98.   
  99. public boolean isSelected() {  
 100. return selected;  
 101. }  
 102.   
 103. public void setSelected(boolean selected) {  
 104. this.selected = selected;  
 105. }  
 106. }  


Carlos Pita-4 wrote:
> 
>>
>>
>> I am currently trying to convert the RepeatingView into a ListView, but I
>> am
>> having problems
>> setting the model on the ListView. I call populateItem with a model, but
>> afterwards the model
>> is not being set on the view.
> 
> 
> That's funny. Could you post the related code?
> 
> Regards,
> Carlos
> 
> 

-- 
View this message in context: 
http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12356657
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: RepeatingView : Removing a table row

2007-08-27 Thread pokkie

Thanks alot for the response Carlos. 

>> Btw, why don't you just use a listview with a model that filters out the
>> selected items?

I am currently trying to convert the RepeatingView into a ListView, but I am
having problems 
setting the model on the ListView. I call populateItem with a model, but
afterwards the model 
is not being set on the view. 

>> And another remark: you can bind your checkbox to a boolean (see my
>> example).

I am already doing that ;)

Regards, 

-- pokkie


Carlos Pita-4 wrote:
> 
> Hi,
> 
> it worked fine for me, I attach my own code so you can compare. Btw, why
> don't you just use a listview with a model that filters out the selected
> items? Imo it's simpler and more elegant. And another remark: you can bind
> your checkbox to a boolean (see my example).
> 
> Regards,
> Carlos
> 
> On 8/26/07, pokkie <[EMAIL PROTECTED]> wrote:
>>
>>
>> I have a RepeatingView that I generate, each row is represented as a
>> WebMarkupContainer.
>> At the end of each row I add a checkbox. When the "Delete Selected"
>> button
>> is called,
>> I wish to remove the selected row from the RepeatingView and update the
>> page
>> to reflect
>> this status.
>>
>> --
>> WebMarkupContainer mainExerciseItem = new
>> WebMarkupContainer(newChildId());
>>
>> add(mainExerciseItem);
>>
>> mainExerciseItem.add(new CheckBox("exerciseSelected", new
>> PropertyModel(mainMemberProgramExerciseHolder,
>> "memberProgramExerciseSelected")));
>> --
>>
>> Currently, I iterate over the items in the RepeatingView, check if they
>> are
>> selected, and
>> subsequently call remove(WebMarkupContainer).
>>
>> --
>> while (exerciseTable.iterator().hasNext()) {
>> WebMarkupContainer container = (WebMarkupContainer)
>> exerciseTable.iterator().next();
>> if
>> (container.get("exerciseSelected").getModelObjectAsString().equals(
>> StaticData.TRUE))
>> {
>> exerciseTable.remove(container);
>> }
>> --
>>
>> The problem is that it seems that after calling the remove() method, it
>> seems to be entering a loop and
>> never returns.
>>
>> I have tried to call the render() method, but haven't had any luck yet.
>>
>> Any help would be much appreciated
>>
>> -- pokkie
>> --
>> View this message in context:
>> http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12335918
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> package web.repeat;
> 
> import java.io.Serializable;
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> 
> import org.apache.wicket.markup.html.WebMarkupContainer;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.form.CheckBox;
> import org.apache.wicket.markup.html.form.Form;
> import org.apache.wicket.markup.repeater.RepeatingView;
> import org.apache.wicket.model.PropertyModel;
> 
> @SuppressWarnings("serial")
> public class RepeatingTest extends WebPage {
> 
> private static class Item implements Serializable {
> 
> public final int number;
> public boolean selected = false;
> 
> public Item(int number) {
> this.number = number;
> }
> }
> 
> private static class ItemContainer extends WebMarkupContainer {
> 
> public final Item item;
> 
> public ItemContainer(String id, Item item) {
> super(id);
> this.item = item;
> add(new Label("itemNumber", new PropertyModel(item,
> "number")));
> add(new CheckBox("itemSelected", new PropertyModel(item,
> "selected")));
> }
> }
> 
> private class ItemsForm extends Form {
> 
> private List itemContainers = new
> ArrayList();
> 
> public ItemsForm(String id) {
> super(id);
> RepeatingView itemRepeater = new
> RepeatingView(&quo

RepeatingView : Removing a table row

2007-08-26 Thread pokkie

I have a RepeatingView that I generate, each row is represented as a
WebMarkupContainer. 
At the end of each row I add a checkbox. When the "Delete Selected" button
is called, 
I wish to remove the selected row from the RepeatingView and update the page
to reflect 
this status. 

--
WebMarkupContainer mainExerciseItem = new WebMarkupContainer(newChildId());

add(mainExerciseItem);

mainExerciseItem.add(new CheckBox("exerciseSelected", new
PropertyModel(mainMemberProgramExerciseHolder,
"memberProgramExerciseSelected")));
--

Currently, I iterate over the items in the RepeatingView, check if they are
selected, and 
subsequently call remove(WebMarkupContainer). 

--
while (exerciseTable.iterator().hasNext()) {
WebMarkupContainer container = (WebMarkupContainer)
exerciseTable.iterator().next();
if
(container.get("exerciseSelected").getModelObjectAsString().equals(StaticData.TRUE))
{
exerciseTable.remove(container);
}
--

The problem is that it seems that after calling the remove() method, it
seems to be entering a loop and 
never returns. 

I have tried to call the render() method, but haven't had any luck yet. 

Any help would be much appreciated

-- pokkie
-- 
View this message in context: 
http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12335918
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RepeatingView : Removing a table row

2007-08-26 Thread pokkie

I have a RepeatingView that I generate, each row is represented as a
WebMarkupContainer. 
At the end of each row I add a checkbox. When the "Delete Selected" button
is called, 
I wish to remove the selected row from the RepeatingView and update the page
to reflect 
this status. 

--
WebMarkupContainer mainExerciseItem = new WebMarkupContainer(newChildId());

add(mainExerciseItem);

mainExerciseItem.add(new CheckBox("exerciseSelected", new
PropertyModel(mainMemberProgramExerciseHolder,
"memberProgramExerciseSelected")));
--

Currently, I iterate over the items in the RepeatingView, check if they are
selected, and 
subsequently call remove(WebMarkupContainer). 

--
while (exerciseTable.iterator().hasNext()) {
WebMarkupContainer container = (WebMarkupContainer)
exerciseTable.iterator().next();
if
(container.get("exerciseSelected").getModelObjectAsString().equals(StaticData.TRUE))
{
exerciseTable.remove(container);
}
--

The problem is that it seems that after calling the remove() method, it
seems to be entering a loop and 
never returns. 

I have tried to call the render() method, but haven't had any luck yet. 

Any help would be much appreciated

-- pokkie
-- 
View this message in context: 
http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331443.html#a12335916
Sent from the Wicket - User mailing list archive at Nabble.com.


wicket-spring Javadoc

2007-08-06 Thread pokkie


Could somebody please point me to the location of the javadoc/api for the
wicket.spring package?

-- pokkie
-- 
View this message in context: 
http://www.nabble.com/wicket-spring-Javadoc-tf4223609.html#a12014729
Sent from the Wicket - User mailing list archive at Nabble.com.


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