Re[2]: Alternative to Wicket data binding

2007-08-26 Thread Oleg Taranenko




Hi Igor and Eelco,

Sorry, for interventing in your discussion :)

May java annotations can help us?

Say [EMAIL PROTECTED]/Write
or [EMAIL PROTECTED] or ever to protect all bean.

It would protect the field from accidently access in Wicket models
without any assumption on set/get functions.

How it lead to additional lag on processing the model, i can't estimate.

Cheers,

Oleg


alliaskedjohantodowastotweakpropertyresolvertoallowaccessto
privatestuff.iwasundertheimpressionthatthepropertyresolveralways
triestoaccessthegetter/setterfirst,thenthefield.

halfofthisthreadyouarearguingthatweshouldntallowaccesstoprivate
fields/methodsandhalfofityouarearguingthatweshouldbuttrythe
getterfirst,soimprettyconfused.

No,again,I'marguingto*either*allowingaccesstoallprivate,or
don'tallowitatall.Iamnotagainstprivatememberaccessperse,
justwantittobeconsistent.

Eelco

-
Tounsubscribe,e-mail:[EMAIL PROTECTED]
Foradditionalcommands,e-mail:[EMAIL PROTECTED]



--
,
Olegmailto:[EMAIL PROTECTED]




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



Re: Alternative to Wicket data binding

2007-08-26 Thread Matej Knopp


 For the sake of clarity, I think this:

 with public getXXX and private setXXX the property is read only
 with public getXXX and no setXXX the property is read only


So do I. I think it needs to be fixed. If there is a private setter, we
should use it. Period. Johaaan?!

-Matej


Re: AJAX form submit and validation

2007-08-26 Thread Gerolf Seitz
concerning one field depends on another:
have you already taken a look at
http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields?
the code is still 1.2, but it should get you started.

hth,
  gerolf

On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:

 Hi

 I have a form that is submitted by ajax.

 I have validation on fields of the form.

 Using AjaxFormValidatingBehavior the form will be validated and error
 messages displayed when the onblur event is used.

 However this is not what I need as the validation of one field depends on
 another. I have tried to set the AjaxFormValidatingBehavior to onsubmit but
 it appears that if the form is invalid then its not submitted so no errors
 are displayed.

 Is there any way I can validate my form using ajax only when it is
 submited ?


 Ian




   ___
 Yahoo! Answers - Got a question? Someone out there knows the answer. Try
 it
 now.
 http://uk.answers.yahoo.com/


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.


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]



Re: Re[2]: Alternative to Wicket data binding

2007-08-26 Thread Igor Vaynberg
the processing impart would be nil because we cache a lot of the
information. however forcing wicket annotations on middle tier objects is
not a very good approach.

if people really wanted to do this they can create this kind of annotation
themselves and then install a security manager that would check it.

i really dont think this is breaking encapsulation. i will concede that
there is one case where it can break encapsulation and that is when you
start out with what is publically accessible and then later you change your
mind and make it completely private, but forget to remap the property model.
it is a case where it is easy to make the mistake of not updating property
models. all other cases i believe are unimportant because you would have to
go poke around the class to even know that private field is there to start
with.

-igor


On 8/25/07, Oleg Taranenko [EMAIL PROTECTED] wrote:

  Hi Igor and Eelco,


 Sorry, for interventing in your discussion :)


 May java annotations can help us?


 Say [EMAIL PROTECTED]/Write

 or [EMAIL PROTECTED] or ever to protect all bean.


 It would protect the field from accidently access in Wicket models

 without any assumption on set/get functions.


 How it lead to additional lag on processing the model, i can't estimate.


 Cheers,


 Oleg




  all i asked johan to do was to tweak property resolver to allow access to


  private stuff. i was under the impression that the property resolver always

  tries to access the getter/setter first, then the field.



  half of this thread you are arguing that we shouldnt allow access to 
  private


  fields/methods and half of it you are arguing that we should but try the

  getter first, so im pretty confused.


  No, again, I'm arguing to *either* allowing access to all private, or

  don't allow it at all. I am not against private member access per se,

  just want it to be consistent.


  Eelco


  -

  To unsubscribe, e-mail: [EMAIL PROTECTED]

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




 --

 С уважением,

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


Re: AJAX form submit and validation

2007-08-26 Thread Gerolf Seitz
have you tried AjaxFormComponentUpdatingBehavior?

  gerolf

On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:

 Thanks but this does not solve my problem.

 I am submitting the form via ajax using an AjaxSubmitLink. If the form has
 errors on it then I do not get the submit, if the form has no errors then
 the submit code runs ok. The errors are not displayed.

 If I add a AjaxFormValidatingBehavior for the onblur event then I can see
 the errors but they check for required fields etc as soon as the first field
 is left therefore displaying errors too soon.

 With the AjaxFormValidatingBehavior set to onsubmit event I get no error
 reporting and no submit.

 I need to validate the entire form only when submit button is pressed
 pressed. One possibility is to do the validation by hand in the submit
 processing code.


 Ian


 - Original Message 
 From: Gerolf Seitz [EMAIL PROTECTED]
 To: users@wicket.apache.org
 Sent: Sunday, 26 August, 2007 2:10:01 PM
 Subject: Re: AJAX form submit and validation

 concerning one field depends on another:
 have you already taken a look at

 http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields
 ?
 the code is still 1.2, but it should get you started.

 hth,
   gerolf

 On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
 
  Hi
 
  I have a form that is submitted by ajax.
 
  I have validation on fields of the form.
 
  Using AjaxFormValidatingBehavior the form will be validated and error
  messages displayed when the onblur event is used.
 
  However this is not what I need as the validation of one field depends
 on
  another. I have tried to set the AjaxFormValidatingBehavior to onsubmit
 but
  it appears that if the form is invalid then its not submitted so no
 errors
  are displayed.
 
  Is there any way I can validate my form using ajax only when it is
  submited ?
 
 
  Ian
 
 
 
 
___
  Yahoo! Answers - Got a question? Someone out there knows the answer. Try
  it
  now.
  http://uk.answers.yahoo.com/







   ___
 Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
 http://uk.promotions.yahoo.com/forgood/environment.html


Re: RepeatingView : Removing a table row

2007-08-26 Thread Carlos Pita
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 ListItemContainer itemContainers = new ArrayListItemContainer();

public ItemsForm(String id) {
super(id);
RepeatingView itemRepeater = new RepeatingView(itemRepeater);
add(itemRepeater);
for (int i = 0 ; i  10 ; i++) {
ItemContainer itemContainer = new ItemContainer(itemContainer + i, new Item(i));
itemContainers.add(itemContainer);
itemRepeater.add(itemContainer);
}
}

protected void onSubmit() {
IteratorItemContainer itemContainerIterator = itemContainers.iterator();
while (itemContainerIterator.hasNext()) {
ItemContainer itemContainer = itemContainerIterator.next();
if (itemContainer.item.selected) {
itemContainer.remove();
itemContainerIterator.remove();
}
}
}
}

public RepeatingTest() {
add(new ItemsForm(itemsForm));
}
}
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: RepeatingView : Removing a table row

2007-08-26 Thread Igor Vaynberg
that is rather peculiar, could you please reproduce this in a quickstart?

-igor


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]




Re: RepeatingView : Removing a table row

2007-08-26 Thread Carlos Pita
And now that I *really* look at this

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

}

you should be removing items from you collection while iterating over it
with the iterator's own remove, not the collection's one.


On 8/26/07, Igor Vaynberg [EMAIL PROTECTED] wrote:

 that is rather peculiar, could you please reproduce this in a quickstart?

 -igor


 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]
 
 



Re: DownloadLink hanging

2007-08-26 Thread Thomas Singer
BTW, as long as this issue is not fixed, we can't take our Wicket-based 
website online. This is a show-stopper bug for us. :(


--
Best regards,
Thomas Singer
_
SyntEvo GmbH
Brunnfeld 11
83404 Ainring
Germany
www.syntevo.com


Thomas Singer wrote:

Done: https://issues.apache.org/jira/browse/WICKET-878

Tom


Igor Vaynberg wrote:

yep

-igor


On 8/23/07, Thomas Singer [EMAIL PROTECTED] wrote:

Should I report a bug in JIRA?

--
Best regards,
Thomas Singer
_
SyntEvo GmbH
Brunnfeld 11
83404 Ainring
Germany
www.syntevo.com


Igor Vaynberg wrote:

hm, this looks like an old bug. johan didnt we fix this a while ago?

-igor


On 8/23/07, Thomas Singer [EMAIL PROTECTED] wrote:

inside shared
resource you can simply call Session.get() to get to wicket session.

Unfortunately, it looks like this is not possible, because I'm getting
following exception:


java.lang.IllegalStateException: you can only locate or create

sessions

in the context of a request cycle

  org.apache.wicket.Session.findOrCreate(Session.java:250)
  org.apache.wicket.Session.get(Session.java:279)
  com.syntevo.hpsmart.DownloadResource.getResourceStream(

DownloadResource.java:18)

  org.apache.wicket.protocol.http.WicketFilter.getLastModified(

WicketFilter.java:708)

  org.apache.wicket.protocol.http.WicketFilter.doFilter(

WicketFilter.java:122)

Our resource code looks like this:


final class DownloadResource extends Resource {

  public IResourceStream getResourceStream() {
final OurSession session = (OurSession)Session.get();
if (session == null) {
  return null;
}

final File file = session.getFileToDownload();
if (file == null) {
  return null;
}

return new MyFileResourceStream(file);
  }

--
Best regards,
Thomas Singer
_
SyntEvo GmbH
Brunnfeld 11
83404 Ainring
Germany
www.syntevo.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]



Re: AJAX form submit and validation

2007-08-26 Thread Eelco Hillenius
On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
 Thanks but this does not solve my problem.

 I am submitting the form via ajax using an AjaxSubmitLink. If the form has 
 errors on it then I do not get the submit, if the form has no errors then the 
 submit code runs ok. The errors are not displayed.

That's the whole idea. Models are only updated and onSubmit is only
called when validation passes.

 If I add a AjaxFormValidatingBehavior for the onblur event then I can see the 
 errors but they check for required fields etc as soon as the first field is 
 left therefore displaying errors too soon.

 With the AjaxFormValidatingBehavior set to onsubmit event I get no error 
 reporting and no submit.

Do you tell Wicket to re-render whatever you have in place for error
reporting (typically a feedback panel)? You should.

 I need to validate the entire form only when submit button is pressed 
 pressed. One possibility is to do the validation by hand in the submit 
 processing code.

If you have a cancel button for instance, you would do
setDefaultFormProcessing(false), so that it skips validation.

Eelco

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



Dynamically created popup window, IE7 wicket 1.3

2007-08-26 Thread Wilko Hische

Hi,

For a chat application I would like to display a list of chat requests that
have come in.
This list is updated by making use of an AbstractAjaxTimerBehavior.

When the user clicks a chat request in the list, a popup window will open
containing that particular chat conversation. In FF all works fine.

The unfortunate thing is that whatever I try, in IE7, the window containing
the list will become the active window whenever the timer fires, thus hiding
the popup window.

Even more strange:

- If the popup was started from a static (ie non dynamically updated)
element the popup doesn't lose focus.

- In wicket 1.2.6 it works fine.

I have been trying various approaches, for instance my own little Java
script creating the popup links, but for some reason I just can't get it to
work. I am willing to accept that is another IE7 feature , but that
doesn't help me much.

I am not really comfortable with Javascript, so before I dive into the
Javascript differences between Wicket version 1.2.6 and 1.3.x I would like
to ask whether somebody on this list might have some suggestions.

I have attached the Index.html and Index.java for the current 1.3 snapshot.
In 1.2.6 it works (mutatis mutandis).

Regards,

Wilko Hische



- org.apache.wicket.quickstart.Index.java


package org.apache.wicket.quickstart;

import java.util.Date;

import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.util.time.Duration;

/**
 * Basic bookmarkable index page.
 * 
 * NOTE: You can get session properties from QuickStartSession via
 * getQuickStartSession()
 */
public class Index extends QuickStartPage {

/**
 * Constructor that is invoked when page is invoked without a session.
 * 
 * @param parameters
 *Page parameters
 */
public Index(final PageParameters parameters)
{
WebMarkupContainer timer = new WebMarkupContainer(timer);
timer.setOutputMarkupId(true);

final Label timeLabel = new Label( time, new 
AbstractReadOnlyModel(){
public Object getObject() {
return new Date().toString();
}
});
timeLabel.setOutputMarkupId(true);
timer.add(timeLabel );
timer.add(
new 
AbstractAjaxTimerBehavior(Duration.seconds(2)) {
protected void 
onTimer(AjaxRequestTarget target) {
target.addComponent(timeLabel);
target.appendJavascript( 
addPopupLinkIfNotExists());
}   
}   
);
add( timer );
}
}


- org.apache.wicket.quickstart.Index.html


html
head
titleQuickStart/title
script type=text/javascript 
function openPopup(e) {
window.open( 'http://wicket.apache.org' );
}

function addPopupLinkIfNotExists() {
var e = document.getElementById( 'popup' );
if (e != null) {
return;
}
var parent = document.getElementById( 'links' );
var link = document.createElement('a');
link.setAttribute( 'id', 'popup' );
link.setAttribute( 'href', '#' );
if (link.addEventListener){
link.addEventListener('click', openPopup, false);
}
else {
link.attachEvent('onclick', openPopup );
}
link.appendChild(document.createTextNode(Dynamic popup));
parent.appendChild( link ); 

}

/script
/head
body
h1QuickStart/h1
p wicket:id=timerLast refresh: /p
p
 # A stable link 
/p
p id=links

/p
/body
/html




-- 
View this message in context: 
http://www.nabble.com/Dynamically-created-popup-window%2C-IE7---wicket-1.3-tf4331823.html#a12337162
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Re: AJAX form submit and validation

2007-08-26 Thread Ian Godman
From what I can see AjaxFormComponentUpdateingBehaviour does not help.

It appears that the only way to do this is to not use component validation but 
to write my own validation in the submit processing code.

Not the most maintainable of solutions :(


Ian

- Original Message 
From: Gerolf Seitz [EMAIL PROTECTED]
To: users@wicket.apache.org
Sent: Sunday, 26 August, 2007 6:05:00 PM
Subject: Re: AJAX form submit and validation

have you tried AjaxFormComponentUpdatingBehavior?

  gerolf

On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:

 Thanks but this does not solve my problem.

 I am submitting the form via ajax using an AjaxSubmitLink. If the form has
 errors on it then I do not get the submit, if the form has no errors then
 the submit code runs ok. The errors are not displayed.

 If I add a AjaxFormValidatingBehavior for the onblur event then I can see
 the errors but they check for required fields etc as soon as the first field
 is left therefore displaying errors too soon.

 With the AjaxFormValidatingBehavior set to onsubmit event I get no error
 reporting and no submit.

 I need to validate the entire form only when submit button is pressed
 pressed. One possibility is to do the validation by hand in the submit
 processing code.


 Ian


 - Original Message 
 From: Gerolf Seitz [EMAIL PROTECTED]
 To: users@wicket.apache.org
 Sent: Sunday, 26 August, 2007 2:10:01 PM
 Subject: Re: AJAX form submit and validation

 concerning one field depends on another:
 have you already taken a look at

 http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields
 ?
 the code is still 1.2, but it should get you started.

 hth,
   gerolf

 On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
 
  Hi
 
  I have a form that is submitted by ajax.
 
  I have validation on fields of the form.
 
  Using AjaxFormValidatingBehavior the form will be validated and error
  messages displayed when the onblur event is used.
 
  However this is not what I need as the validation of one field depends
 on
  another. I have tried to set the AjaxFormValidatingBehavior to onsubmit
 but
  it appears that if the form is invalid then its not submitted so no
 errors
  are displayed.
 
  Is there any way I can validate my form using ajax only when it is
  submited ?
 
 
  Ian
 
 
 
 
___
  Yahoo! Answers - Got a question? Someone out there knows the answer. Try
  it
  now.
  http://uk.answers.yahoo.com/







   ___
 Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
 http://uk.promotions.yahoo.com/forgood/environment.html







  ___ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  
http://uk.promotions.yahoo.com/forgood/environment.html

Re: AJAX form submit and validation

2007-08-26 Thread Ian Godman
I worked it out. Very simple solution!

On the AjaxSubmitLink override the onError method and add the feedback panel to 
the AjaxRequestTarget !


Ian
 

- Original Message 
From: Gerolf Seitz [EMAIL PROTECTED]
To: users@wicket.apache.org
Sent: Sunday, 26 August, 2007 6:05:00 PM
Subject: Re: AJAX form submit and validation

have you tried AjaxFormComponentUpdatingBehavior?

  gerolf

On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:

 Thanks but this does not solve my problem.

 I am submitting the form via ajax using an AjaxSubmitLink. If the form has
 errors on it then I do not get the submit, if the form has no errors then
 the submit code runs ok. The errors are not displayed.

 If I add a AjaxFormValidatingBehavior for the onblur event then I can see
 the errors but they check for required fields etc as soon as the first field
 is left therefore displaying errors too soon.

 With the AjaxFormValidatingBehavior set to onsubmit event I get no error
 reporting and no submit.

 I need to validate the entire form only when submit button is pressed
 pressed. One possibility is to do the validation by hand in the submit
 processing code.


 Ian


 - Original Message 
 From: Gerolf Seitz [EMAIL PROTECTED]
 To: users@wicket.apache.org
 Sent: Sunday, 26 August, 2007 2:10:01 PM
 Subject: Re: AJAX form submit and validation

 concerning one field depends on another:
 have you already taken a look at

 http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields
 ?
 the code is still 1.2, but it should get you started.

 hth,
   gerolf

 On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
 
  Hi
 
  I have a form that is submitted by ajax.
 
  I have validation on fields of the form.
 
  Using AjaxFormValidatingBehavior the form will be validated and error
  messages displayed when the onblur event is used.
 
  However this is not what I need as the validation of one field depends
 on
  another. I have tried to set the AjaxFormValidatingBehavior to onsubmit
 but
  it appears that if the form is invalid then its not submitted so no
 errors
  are displayed.
 
  Is there any way I can validate my form using ajax only when it is
  submited ?
 
 
  Ian
 
 
 
 
___
  Yahoo! Answers - Got a question? Someone out there knows the answer. Try
  it
  now.
  http://uk.answers.yahoo.com/







   ___
 Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
 http://uk.promotions.yahoo.com/forgood/environment.html








___ 
24 FIFA World Cup tickets to be won with Yahoo! Mail http://uk.mail.yahoo.com

Re: Newbie questions

2007-08-26 Thread Eelco Hillenius
On 8/26/07, Otan [EMAIL PROTECTED] wrote:
 I hope that chapter on Models be free to download as well for the benefits
 of newbies.

Sorry, I'm afraid we can't do that. Only chapter 1 is free to download.

Eelco

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



Re: Markup of type 'html' for component 'wicket.contrib.gmap.GMap2' not found

2007-08-26 Thread Martin Funk

Hi Hung,

this addition to the pom.xml of
   groupIdorg.wicketstuff/groupId
   artifactIdwicket-contrib-gmap2-examples/artifactId

should not be needed since that pom inherits that setting form
the pom.xml of
   groupIdorg.apache.wicket/groupId
   artifactIdwicket-parent/artifactId
   version1.3.0-SNAPSHOT/version

All that should need to be done after checking the project out using svn is:

mvn eclipce:eclipes

or

mvn eclipse:clean eclipse:eclipse
if, for whatever reason, a '.project' file is already present.

After that should be importable into an eclispse workspace, as an 
eclipse project.


Martin

hhuynh schrieb:

Thanks for tip. I added this to my pom and it works fine now. Eclipse doesn't
copy non-java files over automatically.

resources
resource
directorysrc/main/java/directory
includes
include**/include
/includes
excludes
exclude**/*.java/exclude
/excludes
/resource
/resources

Hung-


igor.vaynberg wrote:
  

either the example is broken or your ide does not copy .html files from
the
src dir to the classes dir.

-igor


On 8/25/07, hhuynh [EMAIL PROTECTED] wrote:


Hi all,

I've tried out the examples of wicket-contrib-gmap2-examples and got this
below error. I'm pretty new to Wicket so I'm not sure where to start
debugging this error.

Anybody has idea?

Thank you,

Hung-


WicketMessage: Markup of type 'html' for component
'wicket.contrib.gmap.GMap2' not found. Enable debug messages for
org.apache.wicket.util.resource to get a list of all filenames tried:
[MarkupContainer [Component id = topPanel, page =
wicket.contrib.examples.gmap.HomePage, path = 0:topPanel.GMap2, isVisible
=
true, isVersioned = true]]

Root cause:

org.apache.wicket.markup.MarkupNotFoundException: Markup not found.
Component class: wicket.contrib.gmap.GMap2 Enable debug messages for
org.apache.wicket.util.resource to get a list of all filenames tried
at
org.apache.wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java:199)
at
org.apache.wicket.MarkupContainer.getAssociatedMarkupStream(
MarkupContainer.java:331)
at
org.apache.wicket.MarkupContainer.renderAssociatedMarkup(
MarkupContainer.java:601)
at
org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java
:107)
at org.apache.wicket.Component.renderComponent(Component.java:2114)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1294)
at org.apache.wicket.Component.render(Component.java:1941)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1179)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(
MarkupContainer.java:1349)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java
:1284)
at org.apache.wicket.Component.renderComponent(Component.java:2114)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1294)
at org.apache.wicket.Component.render(Component.java:1941)
--
View this message in context:
http://www.nabble.com/Markup-of-type-%27html%27-for-component-%27wicket.contrib.gmap.GMap2%27-not-found-tf4329975.html#a12331945
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]



DataTable with DropDownChoice to set rowsPerPage

2007-08-26 Thread Jerry Anders
I would like to be able to add a dropdown to a DataTable so that a user can 
change the rowsPerPage.  Has anyone done this before?  If not, what is the best 
/ recommended approach?
I tried the following, but I get:

IllegalStateException: Attempt to set model object on null model of component: 
rowsFINALDataTable contacts = NEWDataTable(contacts, columns, 
contactProvider, rowsPerPage) {
@Override
PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
RETURNNEWOddEvenItem(id, index, model);
}
};

List rows = Arrays._asList_(NEWString[] {5, 10, 15, 20, all});
add(NEWDropDownChoice(rows, rows) {
@Override
PROTECTEDBOOLEANwantOnSelectionChangedNotifications() {
RETURNTRUE;
}
@Override
PROTECTEDVOIDonSelectionChanged(FINALObject newSelection) {
IF(newSelection == all) {
contacts.setRowsPerPage(10); // use really big number to 
display all
} ELSE{
contacts.setRowsPerPage((Integer) newSelection);
}
}
});

- JA



Re: DataTable with DropDownChoice to set rowsPerPage

2007-08-26 Thread janders

The format of the Exception got munged with the example code. This should
read as:

IllegalStateException: Attempt to set model object on null model of
component: rows

final DataTable contacts = NEWDataTable(contacts, columns,
contactProvider, rowsPerPage) {
@Override
PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
RETURNNEWOddEvenItem(id, index, model);
}
};


janders wrote:
 
 I would like to be able to add a dropdown to a DataTable so that a user
 can change the rowsPerPage.  Has anyone done this before?  If not, what is
 the best / recommended approach?
 I tried the following, but I get:
 
 IllegalStateException: Attempt to set model object on null model of
 component: rowsFINALDataTable contacts = NEWDataTable(contacts, columns,
 contactProvider, rowsPerPage) {
 @Override
 PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
 RETURNNEWOddEvenItem(id, index, model);
 }
 };
 
 List rows = Arrays._asList_(NEWString[] {5, 10, 15, 20, all});
 add(NEWDropDownChoice(rows, rows) {
 @Override
 PROTECTEDBOOLEANwantOnSelectionChangedNotifications() {
 RETURNTRUE;
 }
 @Override
 PROTECTEDVOIDonSelectionChanged(FINALObject newSelection) {
 IF(newSelection == all) {
 contacts.setRowsPerPage(10); // use really big number to
 display all
 } ELSE{
 contacts.setRowsPerPage((Integer) newSelection);
 }
 }
 });
 
 - JA
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DataTable-with-DropDownChoice-to-set-rowsPerPage-tf4332526.html#a12339585
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RefreshingView only gets rendered when TreeTable node is opened twice

2007-08-26 Thread Gerolf Seitz
hi,

i have a refreshingview in a treetable column, but it only gets rendered
after opening, closing and again opening the corresponding treenode.

did anyone else notice this misbehavior?


thanks for any hints,
  gerolf


Re: DataTable with DropDownChoice to set rowsPerPage

2007-08-26 Thread Igor Vaynberg
class mypage() {
  static int[] pages=new int[] {10,15,20,25};

  public mypage () {
final DataTable dt=new datatable(..);

   add(new dropdownchoice(pages, new imodel() {
   void setObject(Object e) { dt.setrowsperpage((Integer)e); }
   Object getObject() { return td.getrowsperpage(); }
   void detach() {}), pages);
}

-igor


On 8/26/07, janders [EMAIL PROTECTED] wrote:


 The format of the Exception got munged with the example code. This should
 read as:

 IllegalStateException: Attempt to set model object on null model of
 component: rows

 final DataTable contacts = NEWDataTable(contacts, columns,
 contactProvider, rowsPerPage) {
 @Override
 PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
 RETURNNEWOddEvenItem(id, index, model);
 }
 };


 janders wrote:
 
  I would like to be able to add a dropdown to a DataTable so that a user
  can change the rowsPerPage.  Has anyone done this before?  If not, what
 is
  the best / recommended approach?
  I tried the following, but I get:
 
  IllegalStateException: Attempt to set model object on null model of
  component: rowsFINALDataTable contacts = NEWDataTable(contacts,
 columns,
  contactProvider, rowsPerPage) {
  @Override
  PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
  RETURNNEWOddEvenItem(id, index, model);
  }
  };
 
  List rows = Arrays._asList_(NEWString[] {5, 10, 15, 20, all});
  add(NEWDropDownChoice(rows, rows) {
  @Override
  PROTECTEDBOOLEANwantOnSelectionChangedNotifications() {
  RETURNTRUE;
  }
  @Override
  PROTECTEDVOIDonSelectionChanged(FINALObject newSelection) {
  IF(newSelection == all) {
  contacts.setRowsPerPage(10); // use really big number to
  display all
  } ELSE{
  contacts.setRowsPerPage((Integer) newSelection);
  }
  }
  });
 
  - JA
 
 
 

 --
 View this message in context:
 http://www.nabble.com/DataTable-with-DropDownChoice-to-set-rowsPerPage-tf4332526.html#a12339585
 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: RefreshingView only gets rendered when TreeTable node is opened twice

2007-08-26 Thread Gerolf Seitz
i'm using trunk (as of yesterday) 1.3.0-SNAPSHOT
i'll file a jira issue later today, including a quickstart
  gerolf

On 8/27/07, Matej Knopp [EMAIL PROTECTED] wrote:

 It's probably a bug, can you please fill in a JIRA entry and assign it to
 me? What wicket version are you using?

 -Matej

 On 8/27/07, Gerolf Seitz [EMAIL PROTECTED] wrote:
 
  hi,
 
  i have a refreshingview in a treetable column, but it only gets rendered
  after opening, closing and again opening the corresponding treenode.
 
  did anyone else notice this misbehavior?
 
 
  thanks for any hints,
gerolf
 



Re: AJAX form submit and validation

2007-08-26 Thread Carlos Pita
On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:

 I worked it out. Very simple solution!

 On the AjaxSubmitLink override the onError method and add the feedback
 panel to the AjaxRequestTarget !


 Ian



Yes, that or setDefaultFormProcessing(false) as Eelco suggested before.
That's not doing validation by hand, just postponing the moment of
validation to fit your needs. Then, when validation should be done, call
process() on the form and that will carry on validation and model updating
as usual. It's as simple as that.


- Original Message 
 From: Gerolf Seitz [EMAIL PROTECTED]
 To: users@wicket.apache.org
 Sent: Sunday, 26 August, 2007 6:05:00 PM
 Subject: Re: AJAX form submit and validation

 have you tried AjaxFormComponentUpdatingBehavior?

   gerolf

 On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
 
  Thanks but this does not solve my problem.
 
  I am submitting the form via ajax using an AjaxSubmitLink. If the form
 has
  errors on it then I do not get the submit, if the form has no errors
 then
  the submit code runs ok. The errors are not displayed.
 
  If I add a AjaxFormValidatingBehavior for the onblur event then I can
 see
  the errors but they check for required fields etc as soon as the first
 field
  is left therefore displaying errors too soon.
 
  With the AjaxFormValidatingBehavior set to onsubmit event I get no error
  reporting and no submit.
 
  I need to validate the entire form only when submit button is pressed
  pressed. One possibility is to do the validation by hand in the submit
  processing code.
 
 
  Ian
 
 
  - Original Message 
  From: Gerolf Seitz [EMAIL PROTECTED]
  To: users@wicket.apache.org
  Sent: Sunday, 26 August, 2007 2:10:01 PM
  Subject: Re: AJAX form submit and validation
 
  concerning one field depends on another:
  have you already taken a look at
 
 
 http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields
  ?
  the code is still 1.2, but it should get you started.
 
  hth,
gerolf
 
  On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote:
  
   Hi
  
   I have a form that is submitted by ajax.
  
   I have validation on fields of the form.
  
   Using AjaxFormValidatingBehavior the form will be validated and error
   messages displayed when the onblur event is used.
  
   However this is not what I need as the validation of one field depends
  on
   another. I have tried to set the AjaxFormValidatingBehavior to
 onsubmit
  but
   it appears that if the form is invalid then its not submitted so no
  errors
   are displayed.
  
   Is there any way I can validate my form using ajax only when it is
   submited ?
  
  
   Ian
  
  
  
  
 ___
   Yahoo! Answers - Got a question? Someone out there knows the answer.
 Try
   it
   now.
   http://uk.answers.yahoo.com/
 
 
 
 
 
 
 
___
  Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
  http://uk.promotions.yahoo.com/forgood/environment.html








 ___
 24 FIFA World Cup tickets to be won with Yahoo! Mail
 http://uk.mail.yahoo.com