Re: Migration to wicket 1.5 and properties.xml files

2012-05-01 Thread jensiator
This seems to be working. I'm will just using for a couple of days. Until I
have been able to check all the other changes. Then in one chunk I will
replace all the xml files when I have confirmed that the application is
behaving well.

In init of application

and 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Migration-to-wicket-1-5-and-properties-xml-files-tp4597473p4600499.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



ModalWindow parameters

2012-05-01 Thread Brian Mulholland
I am popping up a modal window when an ajax event fires.  The event
has a parameter of which key the user selected.  I know I can get the
parameters from the AjaxRequestTarget in the onClick event, but in
ModalWindow.PageCreator.createPage(), how can I get the parameters so
that I can load the right record into the popup?

Brian Mulholland
For every complex problem, there is an answer that is clear, simple and wrong.
--H.L. Mencken
Politics is the art of looking for trouble, finding it everywhere,
diagnosing it incorrectly, and applying the wrong remedies.
--Groucho Marx

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



Re: ModalWindow parameters

2012-05-01 Thread Melinda Dweer
Have you tried AjaxRequestTarget.get()? If you are in a middle of an AJAX
request cycle it should give you the request target.

Regards,

Melinda.


On Tue, May 1, 2012 at 2:51 PM, Brian Mulholland blmulholl...@gmail.comwrote:

 I am popping up a modal window when an ajax event fires.  The event
 has a parameter of which key the user selected.  I know I can get the
 parameters from the AjaxRequestTarget in the onClick event, but in
 ModalWindow.PageCreator.createPage(), how can I get the parameters so
 that I can load the right record into the popup?

 Brian Mulholland
 For every complex problem, there is an answer that is clear, simple and
 wrong.
 --H.L. Mencken
 Politics is the art of looking for trouble, finding it everywhere,
 diagnosing it incorrectly, and applying the wrong remedies.
 --Groucho Marx

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




AutoCompleteField returning null

2012-05-01 Thread cmagnollay
I am having an issue with DefaultCssAutoCompleteTextField where calling
getModelObject returns null. The autocomplete behavior itself is functioning
as intended, as I see the options come up, and am able to select one.

Definition:

itemField = new DefaultCssAutoCompleteTextFieldString(itemField, new
ModelString()){

I then use an AjaxLink to try and dynamically add a label to a
WebMarkupContainer. That resulted in a nullpointerexception (because I do
some string manipulation of itemField.getModelObject() ). So I changed the
code to this to debug:

addItemLink = new AjaxLinkString(addItemLink, new ModelString(Add
Item)){

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) 
{
String selectedItem = itemField.getValue();
String[] fields = selectedItem.split( | );

info(Value of input:  + selectedItem);

target.add(feedback);
}
};

Where feedback is a feedback panel. The feedbackpanel always shows that the
value it is getting back from itemField is empty. I tried getModelObject,
getValue to no avail. Is there something I am missing about the
AutoCompleteTextField or is there an error somewhere else in my code that is
messing up.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764.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: AutoCompleteField returning null

2012-05-01 Thread Sebastien
Hi,

 The feedbackpanel always shows that the value it is getting back from
itemField is empty.

itemField.getValue or getModelObject will returns empty if it is not in
your form... (this is the only reason I see regarding to the code you
supplied)

Sebastien.

On Tue, May 1, 2012 at 3:54 PM, cmagnollay cmagnol...@gmail.com wrote:

 I am having an issue with DefaultCssAutoCompleteTextField where calling
 getModelObject returns null. The autocomplete behavior itself is
 functioning
 as intended, as I see the options come up, and am able to select one.

 Definition:

 itemField = new DefaultCssAutoCompleteTextFieldString(itemField, new
 ModelString()){

 I then use an AjaxLink to try and dynamically add a label to a
 WebMarkupContainer. That resulted in a nullpointerexception (because I do
 some string manipulation of itemField.getModelObject() ). So I changed the
 code to this to debug:

 addItemLink = new AjaxLinkString(addItemLink, new ModelString(Add
 Item)){

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
String selectedItem = itemField.getValue();
String[] fields = selectedItem.split( | );

info(Value of input:  + selectedItem);

target.add(feedback);
}
 };

 Where feedback is a feedback panel. The feedbackpanel always shows that the
 value it is getting back from itemField is empty. I tried getModelObject,
 getValue to no avail. Is there something I am missing about the
 AutoCompleteTextField or is there an error somewhere else in my code that
 is
 messing up.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764.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




JSessionID breaking my dropdown

2012-05-01 Thread Fergal Keating
I have the following Dropdown added to my code.

DropDownChoiceString listSites = new
DropDownChoiceString(localeSelect, new PropertyModelString(this,
selected), currentProductLocales)
{
/**
 *
 */
private static final long serialVersionUID = 1L;

protected boolean wantOnSelectionChangedNotifications()
{
return true;
}

/**
 * Called when a option is selected of a dropdown list that wants to
 * be notified of this event.
 *
 * @param newSelection
 *The newly selected object of the backing model
 */
protected void onSelectionChanged(final String newSelection)
{
ListLocaleCurrency ListofLocalesCurrency = new
ArrayListLocaleCurrency();
ListofLocalesCurrency =
productController.getCurrencyCountry(MyAuthenticatedWebSession.get().getProduct());

ListString currentProductLocales = new ArrayListString();

// get the list of currencies/countries/languages for this
// product, and set them as default
for (LocaleCurrency localeCurrency : ListofLocalesCurrency)
{

if (selected.equals(localeCurrency.getDisplayName()))
{
MyAuthenticatedWebSession.get().setLocalCurrency(localeCurrency);
localeCurrency.setDefaultLocale();
}

}
;
}
};


Re: JSessionID breaking my dropdown

2012-05-01 Thread Fergal Keating
sorry sent accidentally.

On 1 May 2012 16:16, Fergal Keating fergal.keat...@directski.com wrote:


 I have the following Dropdown added to my code.

 DropDownChoiceString listSites = new
 DropDownChoiceString(localeSelect, new PropertyModelString(this,
 selected), currentProductLocales)
  {
 /**
  *
  */
 private static final long serialVersionUID = 1L;

  protected boolean wantOnSelectionChangedNotifications()
 {
 return true;
  }

 /**
  * Called when a option is selected of a dropdown list that wants to
  * be notified of this event.
  *
  * @param newSelection
  *The newly selected object of the backing model
  */
 protected void onSelectionChanged(final String newSelection)
  {
 ListLocaleCurrency ListofLocalesCurrency = new
 ArrayListLocaleCurrency();
  ListofLocalesCurrency =
 productController.getCurrencyCountry(MyAuthenticatedWebSession.get().getProduct());

 ListString currentProductLocales = new ArrayListString();

 // get the list of currencies/countries/languages for this
 // product, and set them as default
  for (LocaleCurrency localeCurrency : ListofLocalesCurrency)
 {

  if (selected.equals(localeCurrency.getDisplayName()))
 {
 MyAuthenticatedWebSession.get().setLocalCurrency(localeCurrency);
  localeCurrency.setDefaultLocale();
 }

 }
  ;
 }
 };





-- 
Fergal Keating
IT Senior Engineer
---
e. fergal.keat...@directski.com
p. NA
w. www.directski.com


Re: AutoCompleteField returning null

2012-05-01 Thread cmagnollay
Well, that is not the case unfortunately. Here is my code as stripped down as
I could get it, to still supply information about what I am doing. If you
have any questions I would be happy to answer.


public class MyPage extends WebPage 
{
private TextField quantityField;

private Button doneButton = new Button(doneButton);

/**List of version numbers*/
private static final List versions = Arrays.asList(new Integer[]{6, 5, 
4});
/**Selected version of item to search for*/
private int version = 6;

private AutoCompleteTextField itemField;
/**ListView of items currently selected by user*/
private ListViewMap.Entrylt;Item, Integer itemList;
/**Container for list view so AJAX calls can reference it*/
private WebMarkupContainer itemListContainer;

/**Link prompting AJAX response to display the item that was added*/
private AjaxLink addItemLink;

private FeedbackPanel feedback = new FeedbackPanel(feedback); 

private MapItem, Integer itemMap = new HashMapItem, Integer();

public MyPage(final PageParameters params)
{
super(params);

feedback.setOutputMarkupId(true);

Form? customerForm = new Form(customerForm){

private static final long serialVersionUID = 1L;

protected void onSubmit()
{
//do stuff
}
};
customerForm.setOutputMarkupId(true);

final DropDownChoice versionChoice = new 
DropDownChoice(versionChoice,
new PropertyModel(this, version), versions);

itemField = new DefaultCssAutoCompleteTextField(itemField, 
new Model()){

private static final long serialVersionUID = 1L;

@Override
protected Iterator getChoices(String text) 
{
List items = new LinkedList();

//fill items and do some string manipulation 
and database access

Collections.sort(items);

return items.iterator();
}

};
itemField.setOutputMarkupId(true);

quantityField = new TextField(quantityField, new Model());
quantityField.setOutputMarkupId(true);

addItemLink = new AjaxLink(addItemLink, new Model(Add 
Item)){

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) 
{
String selectedItem = itemField.getValue();
String[] fields = selectedItem.split( | );

info(Value of input:  + selectedItem);

target.add(feedback);
}

};
addItemLink.setOutputMarkupId(true);

customerForm.add(itemField);
customerForm.add(versionChoice);
customerForm.add(quantityField);
customerForm.add(addItemLink);
customerForm.add(doneButton);

IModelListlt;Map.Entrylt;Item, Integer lvModel = new
LoadableDetachableModelListlt;Map.Entrylt;Item, Integer(){
private static final long serialVersionUID = 1L;

@Override
protected ListEntrylt;Item, Integer load() 
{
return new 
ArrayListMap.Entrylt;Item,Integer(itemMap.entrySet());
}

};

itemList = new ListViewMap.Entrylt;Item, 
Integer(itemList, lvModel){
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItemMap.Entrylt;Item, 
Integer item) 
{
Item i = item.getModelObject().getKey();
int quantity = item.getModelObject().getValue();

item.add(new Label(quantity + x  + 
getItemText(i, true)));

JsessionID breaking my DropDownChoice#onSelectionChanged

2012-05-01 Thread Fergal Keating
Apologies if this has been covered before, but i havn't found anything with
this specific issue.

I have a Dropdown added to my code, but when a user first accesses the
site, the URL gets appended with JsessionID. This seems to break the link,
and the #onSelectionChanged never gets called. Is there any way to prevent
this?

When i select initially it calls
http://localhost:8080/;jsessionid=1ftbjrge1ri51hpybjnwcuhe5?0-1.IFormSubmitListener-headerPanel-content-localePanel-form

and the page just reloads.

I want my code to work with JSessionID so I can support lack of cookies up
to a point. has there been any workaround for this?


DROPDOWN CODE
DropDownChoiceString listSites = new
DropDownChoiceString(localeSelect, new PropertyModelString(this,
selected), currentProductLocales)
 {
 private static final long serialVersionUID = 1L;

protected boolean wantOnSelectionChangedNotifications()
{return true;}

protected void onSelectionChanged(final String newSelection)
 {
ListLocaleCurrency ListofLocalesCurrency = new
ArrayListLocaleCurrency();
ListofLocalesCurrency =
productController.getCurrencyCountry(MyAuthenticatedWebSession.get().getProduct());

ListString currentProductLocales = new ArrayListString();

for (LocaleCurrency localeCurrency : ListofLocalesCurrency)
 {

if (selected.equals(localeCurrency.getDisplayName()))
{
MyAuthenticatedWebSession.get().setLocalCurrency(localeCurrency);
 localeCurrency.setDefaultLocale();
}

}
 ;
}
};


Re: AutoCompleteField returning null

2012-05-01 Thread Sebastien
Oops, I did not saw you was using an AjaxLink... You have to use an
AjaxButton instead.

Sebastien.

On Tue, May 1, 2012 at 5:51 PM, cmagnollay cmagnol...@gmail.com wrote:

 Well, that is not the case unfortunately. Here is my code as stripped down
 as
 I could get it, to still supply information about what I am doing. If you
 have any questions I would be happy to answer.


 public class MyPage extends WebPage
 {
private TextField quantityField;

private Button doneButton = new Button(doneButton);

/**List of version numbers*/
private static final List versions = Arrays.asList(new Integer[]{6,
 5, 4});
/**Selected version of item to search for*/
private int version = 6;

private AutoCompleteTextField itemField;
/**ListView of items currently selected by user*/
private ListViewMap.Entrylt;Item, Integer itemList;
/**Container for list view so AJAX calls can reference it*/
private WebMarkupContainer itemListContainer;

/**Link prompting AJAX response to display the item that was added*/
private AjaxLink addItemLink;

private FeedbackPanel feedback = new FeedbackPanel(feedback);

private MapItem, Integer itemMap = new HashMapItem, Integer();

public MyPage(final PageParameters params)
{
super(params);

feedback.setOutputMarkupId(true);

Form? customerForm = new Form(customerForm){

private static final long serialVersionUID = 1L;

 protected void onSubmit()
{
//do stuff
}
};
customerForm.setOutputMarkupId(true);

final DropDownChoice versionChoice = new
 DropDownChoice(versionChoice,
 new PropertyModel(this, version), versions);

itemField = new
 DefaultCssAutoCompleteTextField(itemField, new Model()){

private static final long serialVersionUID = 1L;

@Override
 protected Iterator getChoices(String text)
{
List items = new LinkedList();

//fill items and do some string
 manipulation and database access

Collections.sort(items);

return items.iterator();
}

};
itemField.setOutputMarkupId(true);

quantityField = new TextField(quantityField, new Model());
quantityField.setOutputMarkupId(true);

addItemLink = new AjaxLink(addItemLink, new Model(Add
 Item)){

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
String selectedItem = itemField.getValue();
String[] fields = selectedItem.split( | );

info(Value of input:  + selectedItem);

target.add(feedback);
}

};
 addItemLink.setOutputMarkupId(true);

customerForm.add(itemField);
customerForm.add(versionChoice);
customerForm.add(quantityField);
customerForm.add(addItemLink);
customerForm.add(doneButton);

IModelListlt;Map.Entrylt;Item, Integer lvModel = new
 LoadableDetachableModelListlt;Map.Entrylt;Item, Integer(){
 private static final long serialVersionUID = 1L;

@Override
 protected ListEntrylt;Item, Integer load()
{
return new
 ArrayListMap.Entrylt;Item,Integer(itemMap.entrySet());
}

};

itemList = new ListViewMap.Entrylt;Item,
 Integer(itemList, lvModel){
 private static final long serialVersionUID = 1L;

@Override
 protected void
 populateItem(ListItemMap.Entrylt;Item, Integer item)
{
Item i = item.getModelObject().getKey();
int quantity =
 item.getModelObject().getValue();

item.add(new Label(quantity + x  +
 getItemText(i, true)));
}
};

itemListContainer = new
 WebMarkupContainer(itemListContainer);
itemListContainer.add(itemList);
itemListContainer.setOutputMarkupId(true);

add(new NavigationBar(nav));
add(feedback);

Re: AutoCompleteField returning null

2012-05-01 Thread cmagnollay
Hmm,

The reason I used AjaxLink was because of this post I saw regarding stopping
button from submitting to the form. Could you elaborate on why I cannot use
AjaxLink, like Igor seems to recommend? Should I do
setDefaultFormProcessingBehavior(false) to have the button not submit the
form and cause a redirect?

Or perhaps, I am misunderstanding what he means. He is talking about 
attaching a link to the button, but I suppose I am just unsure what he is
talking about.

Here is the link to the post I am referring to:

http://apache-wicket.1842946.n4.nabble.com/A-button-that-does-NOT-submit-form-td1849785.html


Thank you for your help once again.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764p4601153.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: JsessionID breaking my DropDownChoice#onSelectionChanged

2012-05-01 Thread Sven Meier

Hi,

I just verified with blocked cookies on a quickstart and it works fine here.

ServletWebRequest#getContextRelativeUrl() strips the session id from the 
uri, so running without cookies should be no problem.


Perhaps something else is going wrong, you should build a quickstart and 
attach it to a JIRA issue.


Sven

On 05/01/2012 06:02 PM, Fergal Keating wrote:

Apologies if this has been covered before, but i havn't found anything with
this specific issue.

I have a Dropdown added to my code, but when a user first accesses the
site, the URL gets appended with JsessionID. This seems to break the link,
and the #onSelectionChanged never gets called. Is there any way to prevent
this?

When i select initially it calls
http://localhost:8080/;jsessionid=1ftbjrge1ri51hpybjnwcuhe5?0-1.IFormSubmitListener-headerPanel-content-localePanel-form

and the page just reloads.

I want my code to work with JSessionID so I can support lack of cookies up
to a point. has there been any workaround for this?


DROPDOWN CODE
DropDownChoiceString  listSites = new
DropDownChoiceString(localeSelect, new PropertyModelString(this,
selected), currentProductLocales)
  {
  private static final long serialVersionUID = 1L;

protected boolean wantOnSelectionChangedNotifications()
{return true;}

protected void onSelectionChanged(final String newSelection)
  {
ListLocaleCurrency  ListofLocalesCurrency = new
ArrayListLocaleCurrency();
ListofLocalesCurrency =
productController.getCurrencyCountry(MyAuthenticatedWebSession.get().getProduct());

ListString  currentProductLocales = new ArrayListString();

for (LocaleCurrency localeCurrency : ListofLocalesCurrency)
  {

if (selected.equals(localeCurrency.getDisplayName()))
{
MyAuthenticatedWebSession.get().setLocalCurrency(localeCurrency);
  localeCurrency.setDefaultLocale();
}

}
  ;
}
};




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



Re: AutoCompleteField returning null

2012-05-01 Thread Sebastien
Hi again,

The discussion you point to is related to a case where it is not desired to
send the form. I may be wrong but if you need get the field value, you need
to have send the form (it is possible to post a single component without
sending the whole form but that's another discussion).

As you said, an AjaxLink does not send the form, whereas an AjaxButton
does. Setting addItemLink.setDefaultFormProcessing(false) seems to be a
good option here because it will send the form but will not process it and
you will get your field value (the user choice), using getValue() (but not
getModelObject, which might return null in that case). Thus, the onSubmit
(the one of the form) will not be called (once again, because the form has
not been processed), only the button#onSubmit will.

Hope this helps,
Sebastien.


On Tue, May 1, 2012 at 6:51 PM, cmagnollay cmagnol...@gmail.com wrote:

 Hmm,

 The reason I used AjaxLink was because of this post I saw regarding
 stopping
 button from submitting to the form. Could you elaborate on why I cannot use
 AjaxLink, like Igor seems to recommend? Should I do
 setDefaultFormProcessingBehavior(false) to have the button not submit the
 form and cause a redirect?

 Or perhaps, I am misunderstanding what he means. He is talking about
 attaching a link to the button, but I suppose I am just unsure what he is
 talking about.

 Here is the link to the post I am referring to:


 http://apache-wicket.1842946.n4.nabble.com/A-button-that-does-NOT-submit-form-td1849785.html


 Thank you for your help once again.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764p4601153.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: AutoCompleteField returning null

2012-05-01 Thread cmagnollay
No, this looks very promising. Thank you very much for elaborating. I still
do not understand what is different about AutoCompleteTextField that it will
not give me back the textual value (getModelObject()) reliably, but I will
definitely try this out. Thank you for staying with me until we reached a
possible conclusion.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764p4601358.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: AutoCompleteField returning null

2012-05-01 Thread Sebastien
You're welcome.

You can not rely on the model object in that case because the form is not
proceed (it is sent but not proceed, because of defaultFormProcessing set
to false). For the model object of form components to be updated, the form
should be proceed and validators (if any) should not have failed.

Sebastien.

On Tue, May 1, 2012 at 8:21 PM, cmagnollay cmagnol...@gmail.com wrote:

 No, this looks very promising. Thank you very much for elaborating. I still
 do not understand what is different about AutoCompleteTextField that it
 will
 not give me back the textual value (getModelObject()) reliably, but I will
 definitely try this out. Thank you for staying with me until we reached a
 possible conclusion.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AutoCompleteField-returning-null-tp4600764p4601358.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




deserialization - got nulll lastPage

2012-05-01 Thread Dale Ogilvie
What does this warning from our wicket 1.4.20 app signify?

WARN org.apache.wicket.protocol.http.SecondLevelCacheSessionStore
PageMap deserialization - got nulll lastPage

It seems to occur in a couple of situations:

a) when the application is reloaded due to a web.xml change
b) when restarting the tomcat instance

nothing out of the ordinary is being done here, just re-loading the app.

Thanks

Dale


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



browser resolution info .. ClientProperties question

2012-05-01 Thread mlabs
So I added a call to:

 getRequestCycleSettings().setGatherExtendedBrowserInfo(true);

in my app.init()

and sure enough I can now see the client's browser resolution...

but I also see it briefly redirect to a page with some 'if you see this..'
text on it...

Q: Is there any way to stop that showing up?

Q: if not, is there a better way to detect the client's browser resolution?

TIA

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/browser-resolution-info-ClientProperties-question-tp4602259.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