Re: getChoices from ListMultipleChoice

2012-07-24 Thread cosmindumy
Hi,
Just tried at home and still get null on getModelObject(). 
Here is the complete code: 
http://shorttext.com/oSTpzOm

Thanks. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650745.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: getChoices from ListMultipleChoice

2012-07-24 Thread Igor Vaynberg
AjaxLink does not submit the form. use AjaxButton instead.

also, you need to give the dropdownchoice a model (somewhere to store
the value)...see form examples.

-igor

On Tue, Jul 24, 2012 at 9:20 AM, cosmindumy cosmind...@yahoo.com wrote:
 Hi,
 Just tried at home and still get null on getModelObject().
 Here is the complete code:
 http://shorttext.com/oSTpzOm

 Thanks.



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650745.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 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: Unable to use wicket tester to simulate ajax behavior

2012-07-24 Thread Giovanni Cuccu

Hi,
sorry for the late response. Should I file a bug for this?
Thanks,
Giovanni
Il 11/07/12 15.13, Giovanni Cuccu ha scritto:

Hi Martin,
 I did the change you suggested but the test fails with esame error:

junit.framework.AssertionFailedError: expect no error message, but 
contains

   Field 'combo1' is required.

Thanks,
 Giovanni
Il 11/07/12 09.23, Martin Grigorov ha scritto:

Hi,

Try with:

tester.getRequest().setParameter(form:combo1, 0);
tester.executeAjaxEvent(form:combo1, onchange);

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
giovanni.cu...@cup2000.it wrote:

Hi,
 can someone give me an hint on this?
I tried to explain my problem providing a complete example and 
explaining

what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer 
so I can

change something on my side the next time I need to write to the list.
Thanks,
 Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
 I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which 
selects

a value on combo2.
If I use the application everything is working as expected but If I 
try

to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

 WicketTester tester= new WicketTester(new 
WicketApplication());

 tester.startPage(TestAjaxDropDown.class);
 FormTester formTester=tester.newFormTester(form);
 formTester.select(combo1, 0);
 tester.executeAjaxEvent(form:combo1, onchange);
 formTester.submit();
 tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a 
browser. If

I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
   Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

 private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

 public TestAjaxDropDown() {
 add(new FeedbackPanel(feedback));
 add(new TestAjaxDropDownFrom(form));
 }

 private class DomainObject1 implements Serializable {
 public DomainObject1(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }
 private static final long serialVersionUID = 1L;
 private long id;
 private String description;

 public long getId() {
 return id;
 }
 public void setId(long id) {
 this.id = id;
 }
 public String getDescription() {
 return description;
 }
 public void setDescription(String description) {
 this.description = description;
 }
 @Override
 public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + getOuterType().hashCode();
 result = prime * result + (int) (id ^ (id  32));
 return result;
 }
 @Override
 public boolean equals(Object obj) {
 if (this == obj)
 return true;
 if (obj == null)
 return false;
 if (getClass() != obj.getClass())
 return false;
 DomainObject1 other = (DomainObject1) obj;
 if (!getOuterType().equals(other.getOuterType()))
 return false;
 if (id != other.id)
 return false;
 return true;
 }
 private TestAjaxDropDown getOuterType() {
 return TestAjaxDropDown.this;
 }

 }

 private class DomainObject2 implements Serializable {
 public DomainObject2(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }
 private static final long serialVersionUID = 1L;
 private long id;
 private String description;

 public long 

Re: DropDownChoice Default Value

2012-07-24 Thread David Hosier
I think it's likely because your KeyValue class does not implement equals. Your 
defaultValue has its own new instance of KeyValue that contains the key JAVA 
and the value java. Your defaultValue instance and what you think is the same 
instance in your list are not the same unless you correctly implement equals() 
to identify them as the same. So you are telling the dropdown that it should 
select something that it does not have in the list. Also, and this may just be 
semantics, but it's probably inappropriate to call that thing a default value 
since the dropdown will update the defaultValue value with whatever you select 
in the dropdown (i.e. that defaultValue will only be the default value until 
you change the selected value in the dropdown). So it's probably more 
appropriately named selectedValue. 

-David 


On Sunday, July 22, 2012 at 10:12 AM, vimal kumar wrote:

 Hi All, 
 I have searched and wasted much of my time figuring out the default Value for 
 DropDownChoice for Object as dropdown but couldn't find the solution. For 
 String dropdown i was able to make it work but somehow for object it is not 
 working. 
 Below is the Simple example that i have been trying, DropDownChoicePage.html 
 and DropDownChoicePage.java files. 
 Can someone please help me that what am i missing into 
 DropDownChoicePage.java class that is not setting the Drop Down Default 
 value? 
  
 DropDownChoicePage.html 
 html xmlns=http://www.w3.org/1999/xhtml;head titleDropDown 
 Example/title/headbody Select your favorite Language select 
 wicket:id=languageDropDown/select /body/html
 --- 
 DropDownChoicePage.java 
 public class DropDownChoicePage extends WebPage { 
 public class KeyValue { 
 private String key; private String value; 
 public KeyValue(String key, String value) { this.key = key; this.value = 
 value; } 
 public String getKey() { return key; } 
 public String getValue() { return value; } 
 public void setKey(String key) { this.key = key; } 
 public void setValue(String value) { this.value = value; } 
 @Override public String toString() { return getKey(); } } 
 private static final long serialVersionUID = 2304448232406333188L; 
 private KeyValue defaultValue = new KeyValue(JAVA, Java); 
 /** * Constructor */ public DropDownChoicePage() { 
 ListKeyValue keyValues = new ArrayListDropDownChoicePage.KeyValue(); 
 keyValues.add(new KeyValue(PHP, php)); keyValues.add(new KeyValue(JAVA, 
 Java)); keyValues.add(new KeyValue(DOT_NET, Dot Net)); 
 DropDownChoiceKeyValue dropDownChoice = new DropDownChoiceKeyValue( 
 languageDropDown, new PropertyModelKeyValue(this, defaultValue), 
 keyValues, new ChoiceRendererKeyValue(key, value)); 
 add(dropDownChoice); 
 } 
 public KeyValue getDefaultValue() { return defaultValue; } 
 public void setDefaultValue(KeyValue defaultValue) { this.defaultValue = 
 defaultValue; } 
 } 
 Thanks, Vimal. 




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



Re: DropDownChoice Default Value

2012-07-24 Thread David Hosier
Aww, crap. I see it was already answered in a different thread….or something 
that showed up under a different thread in my mail reader at least. Sorry for 
the noise.  


On Monday, July 23, 2012 at 11:46 PM, David Hosier wrote:

 I think it's likely because your KeyValue class does not implement equals. 
 Your defaultValue has its own new instance of KeyValue that contains the key 
 JAVA and the value java. Your defaultValue instance and what you think is the 
 same instance in your list are not the same unless you correctly implement 
 equals() to identify them as the same. So you are telling the dropdown that 
 it should select something that it does not have in the list. Also, and this 
 may just be semantics, but it's probably inappropriate to call that thing a 
 default value since the dropdown will update the defaultValue value with 
 whatever you select in the dropdown (i.e. that defaultValue will only be the 
 default value until you change the selected value in the dropdown). So it's 
 probably more appropriately named selectedValue.  
  
 -David  
  
  
 On Sunday, July 22, 2012 at 10:12 AM, vimal kumar wrote:
  
  Hi All,  
  I have searched and wasted much of my time figuring out the default Value 
  for DropDownChoice for Object as dropdown but couldn't find the solution. 
  For String dropdown i was able to make it work but somehow for object it 
  is not working.  
  Below is the Simple example that i have been trying, 
  DropDownChoicePage.html and DropDownChoicePage.java files.  
  Can someone please help me that what am i missing into 
  DropDownChoicePage.java class that is not setting the Drop Down Default 
  value?  
    
  DropDownChoicePage.html  
  html xmlns=http://www.w3.org/1999/xhtml;head titleDropDown 
  Example/title/headbody Select your favorite Language select 
  wicket:id=languageDropDown/select /body/html
  ---  
  DropDownChoicePage.java  
  public class DropDownChoicePage extends WebPage {  
  public class KeyValue {  
  private String key; private String value;  
  public KeyValue(String key, String value) { this.key = key; this.value = 
  value; }  
  public String getKey() { return key; }  
  public String getValue() { return value; }  
  public void setKey(String key) { this.key = key; }  
  public void setValue(String value) { this.value = value; }  
  @Override public String toString() { return getKey(); } }  
  private static final long serialVersionUID = 2304448232406333188L;  
  private KeyValue defaultValue = new KeyValue(JAVA, Java);  
  /** * Constructor */ public DropDownChoicePage() {  
  ListKeyValue keyValues = new ArrayListDropDownChoicePage.KeyValue(); 
  keyValues.add(new KeyValue(PHP, php)); keyValues.add(new 
  KeyValue(JAVA, Java)); keyValues.add(new KeyValue(DOT_NET, Dot 
  Net));  
  DropDownChoiceKeyValue dropDownChoice = new DropDownChoiceKeyValue( 
  languageDropDown, new PropertyModelKeyValue(this, defaultValue), 
  keyValues, new ChoiceRendererKeyValue(key, value)); 
  add(dropDownChoice);  
  }  
  public KeyValue getDefaultValue() { return defaultValue; }  
  public void setDefaultValue(KeyValue defaultValue) { this.defaultValue = 
  defaultValue; }  
  }  
  Thanks, Vimal.  
  




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



Re: Unable to use wicket tester to simulate ajax behavior

2012-07-24 Thread Martin Grigorov
Hi,

File a ticket with a test case.

On Tue, Jul 24, 2012 at 9:34 AM, Giovanni Cuccu
giovanni.cu...@cup2000.it wrote:
 Hi,
 sorry for the late response. Should I file a bug for this?
 Thanks,
 Giovanni
 Il 11/07/12 15.13, Giovanni Cuccu ha scritto:

 Hi Martin,
  I did the change you suggested but the test fails with esame error:

 junit.framework.AssertionFailedError: expect no error message, but
 contains
Field 'combo1' is required.

 Thanks,
  Giovanni
 Il 11/07/12 09.23, Martin Grigorov ha scritto:

 Hi,

 Try with:

 tester.getRequest().setParameter(form:combo1, 0);
 tester.executeAjaxEvent(form:combo1, onchange);

 On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
 giovanni.cu...@cup2000.it wrote:

 Hi,
  can someone give me an hint on this?
 I tried to explain my problem providing a complete example and
 explaining
 what I was trying to achieve.
 I'd like to know if there is a specific reason of getting no answer so I
 can
 change something on my side the next time I need to write to the list.
 Thanks,
  Giovanni
 Il 05/07/12 08.10, Giovanni Cuccu ha scritto:

 Hi all,
  I'm trying to test a wicket 1.5.7 application and I'm hitting a
 strange (at least for me) issue.
 I have two dropdowns (combo 1 and combo2) and when I select one value
 from combo1 I fire an AjaxUpdateBehavior on onchange event which
 selects
 a value on combo2.
 If I use the application everything is working as expected but If I try
 to simulate the application with wicket tester I come into trouble.
 Basically the test code is the following one:

  WicketTester tester= new WicketTester(new
 WicketApplication());
  tester.startPage(TestAjaxDropDown.class);
  FormTester formTester=tester.newFormTester(form);
  formTester.select(combo1, 0);
  tester.executeAjaxEvent(form:combo1, onchange);
  formTester.submit();
  tester.assertNoErrorMessage();

 what I got is that after firing the onchange event combo1 gets a null
 value as object model and this does not happen when I use a browser. If
 I do not fire the event the application reports that combo2 has no
 element selected.
 Am I  missing something or is it a bug?

 Grazie,
Giovanni

 P.S. I built a simple test case that I insert here

 main page class

 package com.sg2net.test;

 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;

 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.panel.FeedbackPanel;
 import org.apache.wicket.model.PropertyModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;


 public class TestAjaxDropDown extends WebPage {

  private static final Logger
 logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

  public TestAjaxDropDown() {
  add(new FeedbackPanel(feedback));
  add(new TestAjaxDropDownFrom(form));
  }

  private class DomainObject1 implements Serializable {
  public DomainObject1(long id, String description) {
  super();
  this.id = id;
  this.description = description;
  }
  private static final long serialVersionUID = 1L;
  private long id;
  private String description;

  public long getId() {
  return id;
  }
  public void setId(long id) {
  this.id = id;
  }
  public String getDescription() {
  return description;
  }
  public void setDescription(String description) {
  this.description = description;
  }
  @Override
  public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + getOuterType().hashCode();
  result = prime * result + (int) (id ^ (id  32));
  return result;
  }
  @Override
  public boolean equals(Object obj) {
  if (this == obj)
  return true;
  if (obj == null)
  return false;
  if (getClass() != obj.getClass())
  return false;
  DomainObject1 other = (DomainObject1) obj;
  if (!getOuterType().equals(other.getOuterType()))
  return false;
  if (id != other.id)
  return false;
  return true;
  }
  private TestAjaxDropDown getOuterType() {
  return TestAjaxDropDown.this;
  }

  }

  private class DomainObject2 implements Serializable {
  public DomainObject2(long id, String description) {
  

RE: Wicket jQuery Validator integration

2012-07-24 Thread kbhuvi07
Hi,

I am more interested to know about 'Wicket jQuery Validator integration' .
Could you please post some more information with example. That would be
really great!

Thanks in advance! :) 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-jQuery-Validator-integration-tp4390885p4650750.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Page State not updated via call back from IFrame // AjaxRequestTarget

2012-07-24 Thread sb
Hi, 

I'm writing a component that uploads an image file and then updates a list
(ArrayList) of image files in the containing page.

The UploadImageComponent is implemented with an IFrame which contains the
form that actually uploads the Image File and then calls back to the
UploadImageComponent to indicate when the ImageFile has been uploaded and
saved successfully.

When the IFrame reloads having successfully uploaded the image it then then
calls back again to the UploadImageComponent with an AjaxRequestTarget this
then calls the containing Page which updates the List of ImageFiles that
have been added.

The problem that I'm having is that every time the UploadImageComponent
calls the imageUploaded(ImageFile) call back in containing Page which adds
the ImageFile to an internal List, the List is empty and in fact a different
List (I checked this by calling System.identityHashCode(imageFileList)),
even if I've previously uploaded an ImageFile.  

I'm not sure why this is, I think it might be something to do with marking
the page as Dirty and Page versioning and the way that wicket serializes the
versions of a page.  

Has anyone had a similar problem, I think the issue is that I don't fully
understand the nature of Pages and Page versioning, Page Serialization etc

Any suggestions very welcome.

Simon




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Page-State-not-updated-via-call-back-from-IFrame-AjaxRequestTarget-tp4650753.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket 1.6 - strange behavior with Fragment, ModalWindow and resources

2012-07-24 Thread Dan Simko
done, WICKET-4669

On Tue, Jul 24, 2012 at 1:38 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 File a ticket please.

 On Tue, Jul 24, 2012 at 12:14 PM, Dan Simko wicke...@gmail.com wrote:
  Hi,
 
  I am not sure if it's a bug but in version 1.5 this code was working:
 
 
  public class HomePage extends WebPage {
  private static final long serialVersionUID = 1L;
 
 
  public HomePage(final PageParameters parameters) {
  super(parameters);
 
  final ModalWindow window = new ModalWindow(modal);
  window.setContent(new MyFragment(ModalWindow.CONTENT_ID, this));
  add(window);
  add(new AjaxLink(link) {
  @Override
  public void onClick(AjaxRequestTarget target) {
  window.show(target);
  }
  });
 
  }
  // FIXME: If you uncomment this, resources will be added to the page and
  carousel will be created,
  // but only first time when you click on show modal link. Second time
  carousel is not created.
  //@Override
  //public void renderHead(IHeaderResponse response) {
  //response.render(JavaScriptHeaderItem.forReference(new
  PackageResourceReference(MyFragment.class, jquery.jcarousel.js)));
  //response.render(CssHeaderItem.forReference(new
  PackageResourceReference(MyFragment.class, skin.css)));
  //}
 
  private static class MyFragment extends Fragment{
 
  public MyFragment(String id, MarkupContainer container) {
  super(id, fragment, container);
  }
 
  //FIXME: resources are not added to the page head
  @Override
  public void renderHead(IHeaderResponse response) {
  response.render(JavaScriptHeaderItem.forReference(new
  PackageResourceReference(MyFragment.class, jquery.jcarousel.js)));
  response.render(CssHeaderItem.forReference(new
  PackageResourceReference(MyFragment.class, skin.css)));
  }
 
  }
  }
 
 
  Should I create a Jira? Quickstart is attached.
 
  Thanks in advance!
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




Re: Unable to use wicket tester to simulate ajax behavior

2012-07-24 Thread Giovanni Cuccu

Hi,
  here it is
https://issues.apache.org/jira/browse/WICKET-4670
Thanks,
  Giovanni

Il 24/07/12 09.22, Martin Grigorov ha scritto:

Hi,

File a ticket with a test case.

On Tue, Jul 24, 2012 at 9:34 AM, Giovanni Cuccu
giovanni.cu...@cup2000.it wrote:

Hi,
 sorry for the late response. Should I file a bug for this?
Thanks,
 Giovanni
Il 11/07/12 15.13, Giovanni Cuccu ha scritto:


Hi Martin,
  I did the change you suggested but the test fails with esame error:

junit.framework.AssertionFailedError: expect no error message, but
contains
Field 'combo1' is required.

Thanks,
  Giovanni
Il 11/07/12 09.23, Martin Grigorov ha scritto:

Hi,

Try with:

tester.getRequest().setParameter(form:combo1, 0);
tester.executeAjaxEvent(form:combo1, onchange);

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
giovanni.cu...@cup2000.it wrote:

Hi,
  can someone give me an hint on this?
I tried to explain my problem providing a complete example and
explaining
what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer so I
can
change something on my side the next time I need to write to the list.
Thanks,
  Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
  I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which
selects
a value on combo2.
If I use the application everything is working as expected but If I try
to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

  WicketTester tester= new WicketTester(new
WicketApplication());
  tester.startPage(TestAjaxDropDown.class);
  FormTester formTester=tester.newFormTester(form);
  formTester.select(combo1, 0);
  tester.executeAjaxEvent(form:combo1, onchange);
  formTester.submit();
  tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a browser. If
I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

  private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

  public TestAjaxDropDown() {
  add(new FeedbackPanel(feedback));
  add(new TestAjaxDropDownFrom(form));
  }

  private class DomainObject1 implements Serializable {
  public DomainObject1(long id, String description) {
  super();
  this.id = id;
  this.description = description;
  }
  private static final long serialVersionUID = 1L;
  private long id;
  private String description;

  public long getId() {
  return id;
  }
  public void setId(long id) {
  this.id = id;
  }
  public String getDescription() {
  return description;
  }
  public void setDescription(String description) {
  this.description = description;
  }
  @Override
  public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + getOuterType().hashCode();
  result = prime * result + (int) (id ^ (id  32));
  return result;
  }
  @Override
  public boolean equals(Object obj) {
  if (this == obj)
  return true;
  if (obj == null)
  return false;
  if (getClass() != obj.getClass())
  return false;
  DomainObject1 other = (DomainObject1) obj;
  if (!getOuterType().equals(other.getOuterType()))
  return false;
  if (id != other.id)
  return false;
  return true;
  }
  private TestAjaxDropDown getOuterType() {
  return TestAjaxDropDown.this;
  }

  }

  private class DomainObject2 implements 

Re: I think it's time for a new book.... Igor and Co ?

2012-07-24 Thread Bertrand Guay-Paquet

Hi Martin (and other devs),

Must a Jira issue accompany each pull request? Also, is it ok to use a 
feature branch (based on the snapshot branch) for the pull request?


Bertrand

On 23/07/2012 3:15 AM, Martin Grigorov wrote:

Hi,

You can create tickets in our Jira with attached patches if you don't
know how to use GitHub or you don't want to use it.

If you want to try GitHub:
1) create an account at GitHub (https://github.com/)
2) go to https://github.com/apache/wicket and click the Fork button
3) clone the fork locally: git clone
https://github.com/MY_ACCOUNT/wicket.git (replace MY_ACCIUNT with your
real username.)
4) make your improvements in the code
5) git commit
6) git push
7) go to https://github.com/MY_ACCOUNT/wicket and press the Pull
Request button

That's it.

On Mon, Jul 23, 2012 at 12:27 AM, Paul Bors p...@bors.ws wrote:

I second improving the current code documentation as I recently migrated a
mid-size project to Wicket 1.5.7 from 1.3.7 and I've notice myself having to
dig into the framework implementation more often than normal because of the
weak or at times wrong JavaDocs.

I won't mind submitting small patches if someone would point the way. Last I
asked I was told to submit a push via git hub. Is there a wiki page on how
to submit such code changes patches to a wicket branch?

At the same time I do feel that a book explaining the inner works of Wicket
will also benefit everyone to better understand the framework faster and be
able to contribute as needed. I remember couple of years ago when I first
started working with Wicket and how lost I was until after I read two books
on the subject just to learn how to use it.

That's my 2 cents :)

~ Thank you,
   p...@bors.ws

-Original Message-
From: snekse [mailto:sne...@gmail.com]
Sent: Sunday, July 22, 2012 2:23 PM
To: users@wicket.apache.org
Subject: Re: I think it's time for a new book Igor and Co ?

Putting in my 2 cents.

I'd rather see more people put in time and effort to submit patches for
documentation that would reduce the need to dig into the guts of Wicket.

Now that I'm more familiar with Wicket, I'll try to start doing this.  I
hope others will too.
On Jul 22, 2012 10:55 AM, Michael Mosmann mich...@mosmann.de wrote:


I would put the bell on the cat .. but maybe someone would join..

Mm:)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
gesendet.



Igor Vaynberg igor.vaynb...@gmail.com schrieb:

lol. my thoughts exactly :)

-igor

On Sun, Jul 22, 2012 at 12:53 PM, Josh Kamau joshnet2...@gmail.com
wrote:

Who will bell http://en.wikipedia.org/wiki/Belling_the_cat; the cat ?

On Sun, Jul 22, 2012 at 12:51 PM, Michael Mosmann
mich...@mosmann.de
wrote:


Had the same idea...
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
gesendet.



mlabs mlabs@gmail.com schrieb:

The title would be ... 'Wicket Internals' ...
Dive DEEPER into the parts other programmers never reach
The inner workings of response cycles... what really happens ...
Oh and esp the Ajax stuff... jQuery integration ... etc...

TIA



--
View this message in context:


http://apache-wicket.1842946.n4.nabble.com/I-think-it-s-time-for-a-new
-book-Igor-and-Co-tp4650687.html

Sent from the Users forum mailing list archive at Nabble.com.

_
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







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



ajax and browser back button in wicket 6

2012-07-24 Thread Steve Lowery
I did a search in the user list and found several references of various
ways to solve the back button using ajax problem, but most were a few years
old.  I was wondering if wicket 6 does can do this out of the box now.  One
of the stated goals on the wicket site is that it will Fully solve back
button problem.  Does this hold true for ajax requests or just plain http
requests (or both)?


Re: renderHead() / wicket:head page / component order

2012-07-24 Thread Pierre Goiffon
Hello !

Le 22/07/2012 21:39, Martin Grigorov a écrit :
 For exemple I am just dealing with a problem in a page hierarchy like
 the one below :
 pageA : adds mycss.css using renderHead and a ResourceReference
 pageB : adds 6 lines of css to change the behavior in wicket:head
 pageC : adds 1 line of css to override a margin in wicket:head

 But as a developper I still see some issues :
 - It's not very convenient to write static css in the Java code instead
 of simply leave it in the html file in a wicket:head block. In prev 1.5
 version it was a very simple way to add static client side code !

 In Wicket 6 this is still valid. The only change is the order in which
 the content in wicket:heads found in base/sub page, base/sub panels
 is rendered.
 The order is now consistent - no matter if you contribute the CSS via
 markup (head or wicket:head) or via code (in .java).

I didn't understand your statement ? Particularly the order is now 
consistent.

My problem was originally about the delivery order of wicket:head 
contributions that was changed in wicket 1.5.
Reading your statement I understand wicket:head do still render parent 
first in Wicket 1.5 but in Wicket 6 renders child first, like the other 
Java way (renderHead() right ?), so I guess I don't understand well what 
you wrote ?

 Wicket defines two simple rules:
 1) component-first contribution - if you use a library that provides
 Wicket components (e.g. WiQuery) then the components will contribute
 first and then your page. This way you have the last word what CSS
 rules to apply. I.e. you can override WiQuery's default CSS rules.
 2) child-component contributes after its parent - when you use
 #renderHead(IHeaderResponse) you are in control to call
 super.renderHead() at the top  of the method body or at the bottom.
 Most of the time developers put it at the top. You don't have the
 control for that for wicket:head though. Here Wicket contributes
 first the parent's markup and then the child's one.

When you define a simple page strategy like in my problem, you could 
have static css overrides and wants to deal with it in the css order, 
that means most specific last. And those css overrides (like 
.main-section { margin-top: 0;}) are quite static so wicket:head is a 
perfect place for them : quick to find, quick to write, quick to modify.
Having to move them to the java file isn't that awful, but a little more 
heavier. Plus in Wicket 1.5 I don't have CssContentHeaderItem so the UA 
will get a css link for each contribution, and that is very bad.

We were using WiQuery in previous versions of our product, back then we 
served a global css for wiquery component. I've just search how we were 
dealing with WiQuery css but can't find anything. Indeed the last 
WiQuery jar we used, the 1.2.3 version, don't contains any .css file ?
Anyway we have lots of shared components, but we do have a common 
abstract class for each application, and so we are able to serve a 
common css file.

 In org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy#get()
 method there is intentionally hard way to switch the header
 contribution strategy. It uses a system property named
 'Wicket_HeaderRenderStrategy' which value may be the fully qualified
 name of the strategy to use.
 org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy
 is the one that has been used in Wicket 1.4- and is considered
 deprecated.
 So you can set this system property in your MyApp#init() but I cannot
 guarantee for how long it will work.

Very good to know, thanks a lot !

Not sure though how to fix the property ? Is it by inserting the 
following line in the application init() method :
System.setProperty(Wicket_HeaderRenderStrategy,org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy);
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: renderHead() / wicket:head page / component order

2012-07-24 Thread Martin Grigorov
I'll let Emond to answer you.

On Tue, Jul 24, 2012 at 5:24 PM, Pierre Goiffon
pierre.goif...@interview-efm.com wrote:
 Hello !

 Le 22/07/2012 21:39, Martin Grigorov a écrit :
 For exemple I am just dealing with a problem in a page hierarchy like
 the one below :
 pageA : adds mycss.css using renderHead and a ResourceReference
 pageB : adds 6 lines of css to change the behavior in wicket:head
 pageC : adds 1 line of css to override a margin in wicket:head

 But as a developper I still see some issues :
 - It's not very convenient to write static css in the Java code instead
 of simply leave it in the html file in a wicket:head block. In prev 1.5
 version it was a very simple way to add static client side code !

 In Wicket 6 this is still valid. The only change is the order in which
 the content in wicket:heads found in base/sub page, base/sub panels
 is rendered.
 The order is now consistent - no matter if you contribute the CSS via
 markup (head or wicket:head) or via code (in .java).

 I didn't understand your statement ? Particularly the order is now
 consistent.

 My problem was originally about the delivery order of wicket:head
 contributions that was changed in wicket 1.5.
 Reading your statement I understand wicket:head do still render parent
 first in Wicket 1.5 but in Wicket 6 renders child first, like the other
 Java way (renderHead() right ?), so I guess I don't understand well what
 you wrote ?

 Wicket defines two simple rules:
 1) component-first contribution - if you use a library that provides
 Wicket components (e.g. WiQuery) then the components will contribute
 first and then your page. This way you have the last word what CSS
 rules to apply. I.e. you can override WiQuery's default CSS rules.
 2) child-component contributes after its parent - when you use
 #renderHead(IHeaderResponse) you are in control to call
 super.renderHead() at the top  of the method body or at the bottom.
 Most of the time developers put it at the top. You don't have the
 control for that for wicket:head though. Here Wicket contributes
 first the parent's markup and then the child's one.

 When you define a simple page strategy like in my problem, you could
 have static css overrides and wants to deal with it in the css order,
 that means most specific last. And those css overrides (like
 .main-section { margin-top: 0;}) are quite static so wicket:head is a
 perfect place for them : quick to find, quick to write, quick to modify.
 Having to move them to the java file isn't that awful, but a little more
 heavier. Plus in Wicket 1.5 I don't have CssContentHeaderItem so the UA
 will get a css link for each contribution, and that is very bad.

 We were using WiQuery in previous versions of our product, back then we
 served a global css for wiquery component. I've just search how we were
 dealing with WiQuery css but can't find anything. Indeed the last
 WiQuery jar we used, the 1.2.3 version, don't contains any .css file ?
 Anyway we have lots of shared components, but we do have a common
 abstract class for each application, and so we are able to serve a
 common css file.

 In org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy#get()
 method there is intentionally hard way to switch the header
 contribution strategy. It uses a system property named
 'Wicket_HeaderRenderStrategy' which value may be the fully qualified
 name of the strategy to use.
 org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy
 is the one that has been used in Wicket 1.4- and is considered
 deprecated.
 So you can set this system property in your MyApp#init() but I cannot
 guarantee for how long it will work.

 Very good to know, thanks a lot !

 Not sure though how to fix the property ? Is it by inserting the
 following line in the application init() method :
 System.setProperty(Wicket_HeaderRenderStrategy,org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy);
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: I think it's time for a new book.... Igor and Co ?

2012-07-24 Thread Martin Grigorov
If it is just a patch for the javadocs then you may skip Jira.
No need to explain the same in several tools. It should be easy for
you to contribute.

On Tue, Jul 24, 2012 at 4:25 PM, Bertrand Guay-Paquet
ber...@step.polymtl.ca wrote:
 Hi Martin (and other devs),

 Must a Jira issue accompany each pull request? Also, is it ok to use a
 feature branch (based on the snapshot branch) for the pull request?

 Bertrand


 On 23/07/2012 3:15 AM, Martin Grigorov wrote:

 Hi,

 You can create tickets in our Jira with attached patches if you don't
 know how to use GitHub or you don't want to use it.

 If you want to try GitHub:
 1) create an account at GitHub (https://github.com/)
 2) go to https://github.com/apache/wicket and click the Fork button
 3) clone the fork locally: git clone
 https://github.com/MY_ACCOUNT/wicket.git (replace MY_ACCIUNT with your
 real username.)
 4) make your improvements in the code
 5) git commit
 6) git push
 7) go to https://github.com/MY_ACCOUNT/wicket and press the Pull
 Request button

 That's it.

 On Mon, Jul 23, 2012 at 12:27 AM, Paul Bors p...@bors.ws wrote:

 I second improving the current code documentation as I recently migrated
 a
 mid-size project to Wicket 1.5.7 from 1.3.7 and I've notice myself having
 to
 dig into the framework implementation more often than normal because of
 the
 weak or at times wrong JavaDocs.

 I won't mind submitting small patches if someone would point the way.
 Last I
 asked I was told to submit a push via git hub. Is there a wiki page on
 how
 to submit such code changes patches to a wicket branch?

 At the same time I do feel that a book explaining the inner works of
 Wicket
 will also benefit everyone to better understand the framework faster and
 be
 able to contribute as needed. I remember couple of years ago when I first
 started working with Wicket and how lost I was until after I read two
 books
 on the subject just to learn how to use it.

 That's my 2 cents :)

 ~ Thank you,
p...@bors.ws

 -Original Message-
 From: snekse [mailto:sne...@gmail.com]
 Sent: Sunday, July 22, 2012 2:23 PM
 To: users@wicket.apache.org
 Subject: Re: I think it's time for a new book Igor and Co ?

 Putting in my 2 cents.

 I'd rather see more people put in time and effort to submit patches for
 documentation that would reduce the need to dig into the guts of Wicket.

 Now that I'm more familiar with Wicket, I'll try to start doing this.  I
 hope others will too.
 On Jul 22, 2012 10:55 AM, Michael Mosmann mich...@mosmann.de wrote:

 I would put the bell on the cat .. but maybe someone would join..

 Mm:)
 --
 Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
 gesendet.



 Igor Vaynberg igor.vaynb...@gmail.com schrieb:

 lol. my thoughts exactly :)

 -igor

 On Sun, Jul 22, 2012 at 12:53 PM, Josh Kamau joshnet2...@gmail.com
 wrote:

 Who will bell http://en.wikipedia.org/wiki/Belling_the_cat; the cat ?

 On Sun, Jul 22, 2012 at 12:51 PM, Michael Mosmann
 mich...@mosmann.de
 wrote:

 Had the same idea...
 --
 Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
 gesendet.



 mlabs mlabs@gmail.com schrieb:

 The title would be ... 'Wicket Internals' ...
 Dive DEEPER into the parts other programmers never reach
 The inner workings of response cycles... what really happens ...
 Oh and esp the Ajax stuff... jQuery integration ... etc...

 TIA



 --
 View this message in context:

 http://apache-wicket.1842946.n4.nabble.com/I-think-it-s-time-for-a-new
 -book-Igor-and-Co-tp4650687.html

 Sent from the Users forum mailing list archive at Nabble.com.

 _
 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





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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: ajax and browser back button in wicket 6

2012-07-24 Thread Martin Grigorov
Hi Steve,

There is nothing new about this in Wicket 6.
It is as in Wicket 1.5 - back button is not supported out of the box for Ajax.

On Tue, Jul 24, 2012 at 4:48 PM, Steve Lowery
slow...@gatessolutions.com wrote:
 I did a search in the user list and found several references of various
 ways to solve the back button using ajax problem, but most were a few years
 old.  I was wondering if wicket 6 does can do this out of the box now.  One
 of the stated goals on the wicket site is that it will Fully solve back
 button problem.  Does this hold true for ajax requests or just plain http
 requests (or both)?



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Really slow code

2012-07-24 Thread Brown, Berlin [GCG-PFS]
With code like this, I have a model and within the 'load' method, I am
making a slower call that I don't want to call to get the data again.  

 

I may need the result 'bean' for another part of the UI on that
particular page and I don't want to make that call again.  How can I do
this?

 

1.   OnBeforeRender, get a reference to the component and return the
defaultmodelobject?

2.   Use a field reference in my parent component to the result set?

 

final LoadableDetachableModelBean modelReqList = new
LoadableDetachableModelBean() {

public Bean load() {

  return
runReallySlowCodeOnlyWantToCallOnce();

}

};

 

-

 



Re: Really slow code

2012-07-24 Thread Igor Vaynberg
cache it in request cycle's metadata

-igor

On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 With code like this, I have a model and within the 'load' method, I am
 making a slower call that I don't want to call to get the data again.



 I may need the result 'bean' for another part of the UI on that
 particular page and I don't want to make that call again.  How can I do
 this?



 1.   OnBeforeRender, get a reference to the component and return the
 defaultmodelobject?

 2.   Use a field reference in my parent component to the result set?



 final LoadableDetachableModelBean modelReqList = new
 LoadableDetachableModelBean() {

 public Bean load() {

   return
 runReallySlowCodeOnlyWantToCallOnce();

 }

 };



 -




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



RE: Really slow code

2012-07-24 Thread Brown, Berlin [GCG-PFS]
You have any more specifics or an example?  Is there a metadata class?

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, July 24, 2012 1:34 PM
To: users@wicket.apache.org
Subject: Re: Really slow code

cache it in request cycle's metadata

-igor

On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 With code like this, I have a model and within the 'load' method, I am

 making a slower call that I don't want to call to get the data again.



 I may need the result 'bean' for another part of the UI on that 
 particular page and I don't want to make that call again.  How can I 
 do this?



 1.   OnBeforeRender, get a reference to the component and return
the
 defaultmodelobject?

 2.   Use a field reference in my parent component to the result
set?



 final LoadableDetachableModelBean modelReqList = new
 LoadableDetachableModelBean() {

 public Bean load() {

   return
 runReallySlowCodeOnlyWantToCallOnce();

 }

 };



 -




-
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: Really slow code

2012-07-24 Thread Igor Vaynberg
static class MetaDataKeyMyData MYDATA=new MetaDateKeyMyData() {};

^ thats the type-safe singleton key you use to acces the metadata store

checking for metadata

MyData data=RequestCycle.get().getMetaData(MYDATA);

^ null means none

writing metadata

RequestCycle.get().setMetaData(MYDATA, data);

-igor


On Tue, Jul 24, 2012 at 9:26 PM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 You have any more specifics or an example?  Is there a metadata class?

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Tuesday, July 24, 2012 1:34 PM
 To: users@wicket.apache.org
 Subject: Re: Really slow code

 cache it in request cycle's metadata

 -igor

 On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS]
 berlin.br...@primerica.com wrote:
 With code like this, I have a model and within the 'load' method, I am

 making a slower call that I don't want to call to get the data again.



 I may need the result 'bean' for another part of the UI on that
 particular page and I don't want to make that call again.  How can I
 do this?



 1.   OnBeforeRender, get a reference to the component and return
 the
 defaultmodelobject?

 2.   Use a field reference in my parent component to the result
 set?



 final LoadableDetachableModelBean modelReqList = new
 LoadableDetachableModelBean() {

 public Bean load() {

   return
 runReallySlowCodeOnlyWantToCallOnce();

 }

 };



 -




 -
 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: Really slow code

2012-07-24 Thread Brown, Berlin [GCG-PFS]
Thanks,
I just found some code that uses 'session' as opposed to the request
cycle for caching.  Does that matter?  Or is the requestcycle preferred?

getSession().setMetaData

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, July 24, 2012 3:20 PM
To: users@wicket.apache.org
Subject: Re: Really slow code

static class MetaDataKeyMyData MYDATA=new MetaDateKeyMyData() {};

^ thats the type-safe singleton key you use to acces the metadata store

checking for metadata

MyData data=RequestCycle.get().getMetaData(MYDATA);

^ null means none

writing metadata

RequestCycle.get().setMetaData(MYDATA, data);

-igor


On Tue, Jul 24, 2012 at 9:26 PM, Brown, Berlin [GCG-PFS]
berlin.br...@primerica.com wrote:
 You have any more specifics or an example?  Is there a metadata class?

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Tuesday, July 24, 2012 1:34 PM
 To: users@wicket.apache.org
 Subject: Re: Really slow code

 cache it in request cycle's metadata

 -igor

 On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS] 
 berlin.br...@primerica.com wrote:
 With code like this, I have a model and within the 'load' method, I 
 am

 making a slower call that I don't want to call to get the data again.



 I may need the result 'bean' for another part of the UI on that 
 particular page and I don't want to make that call again.  How can I 
 do this?



 1.   OnBeforeRender, get a reference to the component and return
 the
 defaultmodelobject?

 2.   Use a field reference in my parent component to the result
 set?



 final LoadableDetachableModelBean modelReqList = new
 LoadableDetachableModelBean() {

 public Bean load() {

   return
 runReallySlowCodeOnlyWantToCallOnce();

 }

 };



 -




 -
 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




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



Re: Really slow code

2012-07-24 Thread Dan Retzlaff
Pro: session is a broader scope, so query will happen less often
Con: session is serialized so cached value needs to be serializable or
transient/detached
Con: session is accessed by multiple threads simultaneously, so you need to
handle synchronization

Your call. :)

On Tue, Jul 24, 2012 at 12:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 Thanks,
 I just found some code that uses 'session' as opposed to the request
 cycle for caching.  Does that matter?  Or is the requestcycle preferred?

 getSession().setMetaData

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Tuesday, July 24, 2012 3:20 PM
 To: users@wicket.apache.org
 Subject: Re: Really slow code

 static class MetaDataKeyMyData MYDATA=new MetaDateKeyMyData() {};

 ^ thats the type-safe singleton key you use to acces the metadata store

 checking for metadata

 MyData data=RequestCycle.get().getMetaData(MYDATA);

 ^ null means none

 writing metadata

 RequestCycle.get().setMetaData(MYDATA, data);

 -igor


 On Tue, Jul 24, 2012 at 9:26 PM, Brown, Berlin [GCG-PFS]
 berlin.br...@primerica.com wrote:
  You have any more specifics or an example?  Is there a metadata class?
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Tuesday, July 24, 2012 1:34 PM
  To: users@wicket.apache.org
  Subject: Re: Really slow code
 
  cache it in request cycle's metadata
 
  -igor
 
  On Tue, Jul 24, 2012 at 8:18 PM, Brown, Berlin [GCG-PFS]
  berlin.br...@primerica.com wrote:
  With code like this, I have a model and within the 'load' method, I
  am
 
  making a slower call that I don't want to call to get the data again.
 
 
 
  I may need the result 'bean' for another part of the UI on that
  particular page and I don't want to make that call again.  How can I
  do this?
 
 
 
  1.   OnBeforeRender, get a reference to the component and return
  the
  defaultmodelobject?
 
  2.   Use a field reference in my parent component to the result
  set?
 
 
 
  final LoadableDetachableModelBean modelReqList = new
  LoadableDetachableModelBean() {
 
  public Bean load() {
 
return
  runReallySlowCodeOnlyWantToCallOnce();
 
  }
 
  };
 
 
 
  -
 
 
 
 
  -
  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




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




Re: Getting an instance of page from the session

2012-07-24 Thread Martin Grigorov
pageRef = page.getPageReference();
.
page = getSession().getPageManager().getPage(pageRef.getPageId())

On Wed, Jul 25, 2012 at 12:31 AM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi there ;

 Is there a way i can pull an instance of a specific page from the session ?

 I have a page that has some information  i navigate to several other
 pages.. .now i need to get back to the first page. But i want the instance
 that has my information .



 is there a way of doing this?

 Josh.



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Getting an instance of page from the session

2012-07-24 Thread Josh Kamau
THanks Martin. That helps.

Josh

On Wed, Jul 25, 2012 at 12:37 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 pageRef = page.getPageReference();
 .
 page = getSession().getPageManager().getPage(pageRef.getPageId())

 On Wed, Jul 25, 2012 at 12:31 AM, Josh Kamau joshnet2...@gmail.com
 wrote:
  Hi there ;
 
  Is there a way i can pull an instance of a specific page from the
 session ?
 
  I have a page that has some information  i navigate to several other
  pages.. .now i need to get back to the first page. But i want the
 instance
  that has my information .
 
 
 
  is there a way of doing this?
 
  Josh.



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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