RE: Change to API between Wicket 1.2 releases?

2008-04-29 Thread Frank Silbermann
I'm not sure what you mean by what part it really is?  Are you asking
me to find a simpler example exhibiting the problem?  I mean, the panel
class follows the RadioGroup component example quite closely:

http://wicketstuff.org/wicket13/compref/;jsessionid=C6F7701B642660179563
84008732211C?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compr
ef.RadioGroupPage

The only significant difference is that instead of using a submit button
I override wantOnSelectionChangedNotification() to return true.

 public class MyPanel extends Panel {

 public MyPanel( String id,
 String caption,
 PropertyModel groupModel, 
 ChoiceOption[] options ) {

  super(id, groupModel);

  add( new Label(caption, caption) );

  final RadioGroup group = new RadioGroup(group, groupModel) {
 //THIS IS THE ONLY PART THAT CHANGED FROM THE
COMPONENT EXAMPLE
 protected boolean wantOnSelectionChangedNotifications()
{ 
 return true;
 }
 //IT POSTS BACK ON ANY SELECTION
  };
  add(group);

  ListChoiceOption optionList = Arrays.asList( options );

  ListView radios = new ListView(radios, optionList) {
   protected void populateItem(ListItem listItem) {
 listItem.add( new Radio(radio,
   new PropertyModel(
listItem.getModel(),
  value)
   ) 
 );
 listItem.add( new Label(option,
   new PropertyModel(
listItem.getModel(), label )
)
 );
   }
  };

  group.add(radios);
 }

Did I do something wrong, or is that feature of RadioGroup indeed broken
in current releases of Wicket 1.2?

I really don't know enough about the Wicket internals to debug Wicket.
Can you suggest anything simpler that I could try to narrow down the
location of the problem?  Would it work in Wicket 1.3?  


-Original Message-
From: Johan Compagner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 29, 2008 3:54 AM
To: users@wicket.apache.org
Subject: Re: Change to API between Wicket 1.2 releases?

1.2 is a long time ago
I have no idea what change did break yours (and what did it fix) If you
could figure out what part it really is?

johan


On Tue, Apr 29, 2008 at 12:09 AM, Frank Silbermann 
[EMAIL PROTECTED] wrote:

 I completed a Wicket 1.2 project a couple of years ago, and I've been 
 maintaining it since then. I've been using Version 1.2.2 successfully,

 and figured I might as well use the lastest release of that version 
 (1.2.7). Well, I'm trying to figure out why Wicket 1.2.7 broke my
code.
 (I scrounged up a Wicket 1.2.6 release, and that also breaks it.)

 Am I using the Wicket 1.2 API incorrectly?  When it works in Wicket 
 1.2.2, am I using it in an unintended way?  Let me illustrate what 
 I've been doing with a small example.

 This is a simplified version of a component for creating and 
 displaying radio button groups without having to write HTML every 
 time.  I give the
 constructor:

 (1) a wicket-id,

 (2) a PropertyModel that initializes the component and keeps track of 
 the current choice, and

 (3) an array of ChoiceOption.  -- The array of choice options defines 
 the set of values offered by the radio buttons, and the corresponding 
 labels to be displayed.

 The component posts back immediately when a change is made to the 
 radio button.  (Think fast INTRAnet with a very small number of 
 simulaneous
 users.)  Here is my implementation:

 package common.play;

 import wicket.markup.html.basic.Label; import wicket.model.IModel; 
 import wicket.markup.html.panel.Panel; import 
 wicket.markup.html.form.Radio; import 
 wicket.markup.html.form.RadioGroup;
 import wicket.markup.html.list.ListItem; import 
 wicket.markup.html.list.ListView; import wicket.model.PropertyModel; 
 import java.util.List; import java.util.Arrays; import 
 common.play.ChoiceOption;

 public class MyPanel extends Panel {

  public MyPanel( String id, String caption, PropertyModel groupModel, 
 ChoiceOption[] options) {
super(id, groupModel);

add( new Label(caption, caption) );
final RadioGroup group = new RadioGroup(group, groupModel) {
  protected boolean wantOnSelectionChangedNotifications() { return
true; }
};
add(group);

ListChoiceOption optionList = Arrays.asList( options );
ListView radios = new ListView(radios, optionList) {
  protected void populateItem(ListItem listItem) {
listItem.add( new Radio(radio,
new PropertyModel( listItem.getModel(),
 value) ) );
listItem.add( new Label(option, new PropertyModel

Re: Change to API between Wicket 1.2 releases?

2008-04-29 Thread Johan Compagner
I dont know what this is, but 1.2 is pretty much end of life, so you
should try to debug what it is and patch your version
Or just use a 1.2 version that works for you

On 4/29/08, Frank Silbermann [EMAIL PROTECTED] wrote:
 I'm not sure what you mean by what part it really is?  Are you asking
 me to find a simpler example exhibiting the problem?  I mean, the panel
 class follows the RadioGroup component example quite closely:

 http://wicketstuff.org/wicket13/compref/;jsessionid=C6F7701B642660179563
 84008732211C?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compr
 ef.RadioGroupPage

 The only significant difference is that instead of using a submit button
 I override wantOnSelectionChangedNotification() to return true.

  public class MyPanel extends Panel {

  public MyPanel( String id,
  String caption,
  PropertyModel groupModel,
  ChoiceOption[] options ) {

   super(id, groupModel);

   add( new Label(caption, caption) );

   final RadioGroup group = new RadioGroup(group, groupModel) {
  //THIS IS THE ONLY PART THAT CHANGED FROM THE
 COMPONENT EXAMPLE
  protected boolean wantOnSelectionChangedNotifications()
 {
  return true;
  }
  //IT POSTS BACK ON ANY SELECTION
   };
   add(group);

   ListChoiceOption optionList = Arrays.asList( options );

   ListView radios = new ListView(radios, optionList) {
protected void populateItem(ListItem listItem) {
  listItem.add( new Radio(radio,
new PropertyModel(
 listItem.getModel(),
   value)
)
  );
  listItem.add( new Label(option,
new PropertyModel(
 listItem.getModel(), label )
 )
  );
}
   };

   group.add(radios);
  }

 Did I do something wrong, or is that feature of RadioGroup indeed broken
 in current releases of Wicket 1.2?

 I really don't know enough about the Wicket internals to debug Wicket.
 Can you suggest anything simpler that I could try to narrow down the
 location of the problem?  Would it work in Wicket 1.3?


 -Original Message-
 From: Johan Compagner [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 29, 2008 3:54 AM
 To: users@wicket.apache.org
 Subject: Re: Change to API between Wicket 1.2 releases?

 1.2 is a long time ago
 I have no idea what change did break yours (and what did it fix) If you
 could figure out what part it really is?

 johan


 On Tue, Apr 29, 2008 at 12:09 AM, Frank Silbermann 
 [EMAIL PROTECTED] wrote:

  I completed a Wicket 1.2 project a couple of years ago, and I've been
  maintaining it since then. I've been using Version 1.2.2 successfully,

  and figured I might as well use the lastest release of that version
  (1.2.7). Well, I'm trying to figure out why Wicket 1.2.7 broke my
 code.
  (I scrounged up a Wicket 1.2.6 release, and that also breaks it.)
 
  Am I using the Wicket 1.2 API incorrectly?  When it works in Wicket
  1.2.2, am I using it in an unintended way?  Let me illustrate what
  I've been doing with a small example.
 
  This is a simplified version of a component for creating and
  displaying radio button groups without having to write HTML every
  time.  I give the
  constructor:
 
  (1) a wicket-id,
 
  (2) a PropertyModel that initializes the component and keeps track of
  the current choice, and
 
  (3) an array of ChoiceOption.  -- The array of choice options defines
  the set of values offered by the radio buttons, and the corresponding
  labels to be displayed.
 
  The component posts back immediately when a change is made to the
  radio button.  (Think fast INTRAnet with a very small number of
  simulaneous
  users.)  Here is my implementation:
 
  package common.play;
 
  import wicket.markup.html.basic.Label; import wicket.model.IModel;
  import wicket.markup.html.panel.Panel; import
  wicket.markup.html.form.Radio; import
  wicket.markup.html.form.RadioGroup;
  import wicket.markup.html.list.ListItem; import
  wicket.markup.html.list.ListView; import wicket.model.PropertyModel;
  import java.util.List; import java.util.Arrays; import
  common.play.ChoiceOption;
 
  public class MyPanel extends Panel {
 
   public MyPanel( String id, String caption, PropertyModel groupModel,
  ChoiceOption[] options) {
 super(id, groupModel);
 
 add( new Label(caption, caption) );
 final RadioGroup group = new RadioGroup(group, groupModel) {
   protected boolean wantOnSelectionChangedNotifications() { return
 true; }
 };
 add(group);
 
 ListChoiceOption optionList

Change to API between Wicket 1.2 releases?

2008-04-28 Thread Frank Silbermann
I completed a Wicket 1.2 project a couple of years ago, and I've been
maintaining it since then. I've been using Version 1.2.2 successfully,
and figured I might as well use the lastest release of that version
(1.2.7). Well, I'm trying to figure out why Wicket 1.2.7 broke my code.
(I scrounged up a Wicket 1.2.6 release, and that also breaks it.)

Am I using the Wicket 1.2 API incorrectly?  When it works in Wicket
1.2.2, am I using it in an unintended way?  Let me illustrate what I've
been doing with a small example.

This is a simplified version of a component for creating and displaying
radio button groups without having to write HTML every time.  I give the
constructor:

(1) a wicket-id, 

(2) a PropertyModel that initializes the component and keeps track of
the current choice, and 

(3) an array of ChoiceOption.  -- The array of choice options defines
the set of values offered by the radio buttons, and the corresponding
labels to be displayed.

The component posts back immediately when a change is made to the radio
button.  (Think fast INTRAnet with a very small number of simulaneous
users.)  Here is my implementation:

package common.play;

import wicket.markup.html.basic.Label;
import wicket.model.IModel;
import wicket.markup.html.panel.Panel;
import wicket.markup.html.form.Radio;
import wicket.markup.html.form.RadioGroup;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.model.PropertyModel;
import java.util.List;
import java.util.Arrays;
import common.play.ChoiceOption;

public class MyPanel extends Panel {

  public MyPanel( String id, String caption, PropertyModel groupModel,
ChoiceOption[] options) {
super(id, groupModel);

add( new Label(caption, caption) );
final RadioGroup group = new RadioGroup(group, groupModel) {
  protected boolean wantOnSelectionChangedNotifications() { return
true; }
};
add(group);

ListChoiceOption optionList = Arrays.asList( options );
ListView radios = new ListView(radios, optionList) {
  protected void populateItem(ListItem listItem) {
listItem.add( new Radio(radio,
new PropertyModel( listItem.getModel(),
value) ) );
listItem.add( new Label(option, new PropertyModel(
listItem.getModel(), label )));
  }
};

group.add(radios);
  }



package common.play;

public class ChoiceOption implements java.io.Serializable {
  public String value;
  public String label;

  public ChoiceOption(String value, String label) {
this.value = value;
this.label = label;
  }
}




This is the layout for displaying my component.  It's a divided box that
puts the group caption in one half, and in the other half provides the
set of labeled buttons.  Note that I'm using a ListView, because each
usage may require a different number of choices.

html xmlns=http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml
 xmlns:wicket=http://wicket.sourceforge.net/
http://wicket.sourceforge.net/  xml:lang=en lang=en
head
link rel=stylesheet type=text/css href=style.css/
/head
body
wicket:panel
  table border=1
tr
  td
span wicket:id=captionCaption/span
  /td
  td
span wicket:id=group
  table cellpadding=5
tr
  td wicket:id=radios align=center
input type=radio wicket:id=radio/
span wicket:id=optionoption name/span
nbsp;
  /td
/tr
  /table
/span
  /td
/tr
  /table
/wicket:panel
/body
/html


Here is a page with two intances of this component; one set of radio
buttons below the other, within a form.  Below my form are two labels,
one below the other, which indicate the value currently chosen by the
corresponding radio-button set. 

import wicket.markup.html.WebPage;
import wicket.markup.html.panel.Panel;
import wicket.markup.html.form.Form;
import wicket.model.PropertyModel;
import wicket.markup.html.basic.Label;
import common.play.ChoiceOption;

public class MyPage extends WebPage {

  public String firstProperty = A;
  public String secondProperty = A;

  ChoiceOption[] options = {   new ChoiceOption(A, Ay),
   new ChoiceOption(B, Bee),
   new ChoiceOption(C, See),
   new ChoiceOption(D, Dee) };

  public MyPage() {

  Form form = new Form(form);
  add( form );

  Panel panel1 = new MyPanel( panel1,
  1st choice,
  new PropertyModel( this,
firstProperty),
  options
);
  form.add( panel1 );


  Panel panel2 = new MyPanel( panel2,
  2nd choice,
  new