Re: Bug of Wicket when iterate the form using iterator()?

2008-12-01 Thread jWeekend

Yes, your suggestion should stop that runtime exception being thrown. A new
(or more comprehensive) test for that method could confirm this.

What I described addresses a not totally unrelated but slightly broader
concern, and would not impact on any optimisations; it is not more important
than fixing a known bug that is disturbing a user.

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



Matej Knopp-2 wrote:
 
 The only problem right now is the cast to Component[]. The fix is
 easy, just change it to Object[]. The optimization makes a lot of
 sense and there is reason why it can't really be simple.
 
 -Matej
 
 On Mon, Dec 1, 2008 at 2:29 AM, jWeekend [EMAIL PROTECTED]
 wrote:

 MarkupContainer's children field is declared as an Object and can refer
 to

 a ChildList - which is a List, hopefully (until it's genericised) of
 Components,
 an Object[] - again, hopefully of Components,
 a Component - ie a single child, or, even
 a ComponentSourceEntry - a bare-bones representation of only the
 essentials of a Component from which it can be reconstructed.

 I assume MarkupContainer's implementation was refactored (_from_
 something
 much more straight-forward) as an optimisation, in particular related to
 serialisation, with the argument probably along the lines of: it is
 common
 for a MarkupContainer to have just a single child, so we don't want the
 luggage of a List in those cases etc ...

 All this can make MarkupContainer pretty fragile, easy to accidentally
 break. If the optimisation argument is really strong enough (I expect it
 must have been at the time and may still be), at the very least, all the
 messy operations on children could be encapsulated in a class (perhaps
 called FunkyChildren, possibly as an inner class if it necessarily needs
 access to its owning MarkupContainer instance's guts and is never used
 outside this context) that exposes only friendly methods like
 set(int index,Component child) and
 remove(Component child)
 etc ...

 Apart from simplifying MarkupContainer, the above design would also have
 the
 benefit of making it possible to address the problem in hand (with the
 illegal runtime array cast), mend what's broken and test this funky,
 edge-case(?) behaviour without having to interfere with MarkupContainer.
 And, if there's a simpler/better/more efficient FunkyChildren possible
 for
 1.5 just plug in the new implementation. Importantly, as this an internal
 change (internal to MarkupContainer), there will be no API break (neither
 within Wicket nor in the public API).

 Regards - Cemal
 http://www.jWeekend.co.uk http://jWeekend.co.uk



 Matej Knopp-2 wrote:

 this

 sorted = Arrays.asList((Component[])children);

 doesn't look right. I think it should have been (Object[])children
 although a type check would be appropriate.

 -Matej

 On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED]
 wrote:

 Not quite.
 String[] bO = (String[])(new Object[]{yes,we,can});
 compiles but fails at run time.

 Regards - Cemal
 http://www.jWeekend.co.uk  http://jWeekend.co.uk



 Valentine2008 wrote:

 It will bring the compilation error when trying to cast arrays in
 Java.

 So you mean it is a bug in Wicket?


 Timo Rantalaiho wrote:

 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 No, I think it's a limitation of Java. You cannnot cast
 arrays.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

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






 --
 View this message in context:
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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




 --
 View this message in context:
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html
 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 

Re: Bug of Wicket when iterate the form using iterator()?

2008-12-01 Thread Johan Compagner
i am busy fixing it
but it is not as straightforward as just replacing it with Object[]

On Mon, Dec 1, 2008 at 16:38, jWeekend [EMAIL PROTECTED] wrote:


 Yes, your suggestion should stop that runtime exception being thrown. A new
 (or more comprehensive) test for that method could confirm this.

 What I described addresses a not totally unrelated but slightly broader
 concern, and would not impact on any optimisations; it is not more
 important
 than fixing a known bug that is disturbing a user.

 Regards - Cemal
 http://www.jWeekend.co.uk http://jWeekend.co.uk



 Matej Knopp-2 wrote:
 
  The only problem right now is the cast to Component[]. The fix is
  easy, just change it to Object[]. The optimization makes a lot of
  sense and there is reason why it can't really be simple.
 
  -Matej
 
  On Mon, Dec 1, 2008 at 2:29 AM, jWeekend [EMAIL PROTECTED]
  wrote:
 
  MarkupContainer's children field is declared as an Object and can refer
  to
 
  a ChildList - which is a List, hopefully (until it's genericised) of
  Components,
  an Object[] - again, hopefully of Components,
  a Component - ie a single child, or, even
  a ComponentSourceEntry - a bare-bones representation of only the
  essentials of a Component from which it can be reconstructed.
 
  I assume MarkupContainer's implementation was refactored (_from_
  something
  much more straight-forward) as an optimisation, in particular related to
  serialisation, with the argument probably along the lines of: it is
  common
  for a MarkupContainer to have just a single child, so we don't want the
  luggage of a List in those cases etc ...
 
  All this can make MarkupContainer pretty fragile, easy to accidentally
  break. If the optimisation argument is really strong enough (I expect it
  must have been at the time and may still be), at the very least, all the
  messy operations on children could be encapsulated in a class (perhaps
  called FunkyChildren, possibly as an inner class if it necessarily needs
  access to its owning MarkupContainer instance's guts and is never used
  outside this context) that exposes only friendly methods like
  set(int index,Component child) and
  remove(Component child)
  etc ...
 
  Apart from simplifying MarkupContainer, the above design would also have
  the
  benefit of making it possible to address the problem in hand (with the
  illegal runtime array cast), mend what's broken and test this funky,
  edge-case(?) behaviour without having to interfere with MarkupContainer.
  And, if there's a simpler/better/more efficient FunkyChildren possible
  for
  1.5 just plug in the new implementation. Importantly, as this an
 internal
  change (internal to MarkupContainer), there will be no API break
 (neither
  within Wicket nor in the public API).
 
  Regards - Cemal
  http://www.jWeekend.co.uk http://jWeekend.co.uk
 
 
 
  Matej Knopp-2 wrote:
 
  this
 
  sorted = Arrays.asList((Component[])children);
 
  doesn't look right. I think it should have been (Object[])children
  although a type check would be appropriate.
 
  -Matej
 
  On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED]
 
  wrote:
 
  Not quite.
  String[] bO = (String[])(new Object[]{yes,we,can});
  compiles but fails at run time.
 
  Regards - Cemal
  http://www.jWeekend.co.uk  http://jWeekend.co.uk
 
 
 
  Valentine2008 wrote:
 
  It will bring the compilation error when trying to cast arrays in
  Java.
 
  So you mean it is a bug in Wicket?
 
 
  Timo Rantalaiho wrote:
 
  On Thu, 27 Nov 2008, Valentine2008 wrote:
  java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
  [Lorg.apache
  .wicket.Component;
  at
 
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
  .
 
  The code on line 478 of MarkupContainer.java is:
  sorted = Arrays.asList((Component[])children);
 
  Is it a bug of Wicket?
 
  No, I think it's a limitation of Java. You cannnot cast
  arrays.
 
  Best wishes,
  Timo
 
  --
  Timo Rantalaiho
  Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
  --
  View this message in context:
 
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  View this message in context:
 
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html
  Sent from the Wicket - User 

Re: Bug of Wicket when iterate the form using iterator()?

2008-12-01 Thread Johan Compagner
fixed

On Mon, Dec 1, 2008 at 16:48, Johan Compagner [EMAIL PROTECTED] wrote:

 i am busy fixing it
 but it is not as straightforward as just replacing it with Object[]


 On Mon, Dec 1, 2008 at 16:38, jWeekend [EMAIL PROTECTED]wrote:


 Yes, your suggestion should stop that runtime exception being thrown. A
 new
 (or more comprehensive) test for that method could confirm this.

 What I described addresses a not totally unrelated but slightly broader
 concern, and would not impact on any optimisations; it is not more
 important
 than fixing a known bug that is disturbing a user.

 Regards - Cemal
 http://www.jWeekend.co.uk http://jWeekend.co.uk



 Matej Knopp-2 wrote:
 
  The only problem right now is the cast to Component[]. The fix is
  easy, just change it to Object[]. The optimization makes a lot of
  sense and there is reason why it can't really be simple.
 
  -Matej
 
  On Mon, Dec 1, 2008 at 2:29 AM, jWeekend [EMAIL PROTECTED]
  wrote:
 
  MarkupContainer's children field is declared as an Object and can refer
  to
 
  a ChildList - which is a List, hopefully (until it's genericised) of
  Components,
  an Object[] - again, hopefully of Components,
  a Component - ie a single child, or, even
  a ComponentSourceEntry - a bare-bones representation of only the
  essentials of a Component from which it can be reconstructed.
 
  I assume MarkupContainer's implementation was refactored (_from_
  something
  much more straight-forward) as an optimisation, in particular related
 to
  serialisation, with the argument probably along the lines of: it is
  common
  for a MarkupContainer to have just a single child, so we don't want the
  luggage of a List in those cases etc ...
 
  All this can make MarkupContainer pretty fragile, easy to accidentally
  break. If the optimisation argument is really strong enough (I expect
 it
  must have been at the time and may still be), at the very least, all
 the
  messy operations on children could be encapsulated in a class
 (perhaps
  called FunkyChildren, possibly as an inner class if it necessarily
 needs
  access to its owning MarkupContainer instance's guts and is never used
  outside this context) that exposes only friendly methods like
  set(int index,Component child) and
  remove(Component child)
  etc ...
 
  Apart from simplifying MarkupContainer, the above design would also
 have
  the
  benefit of making it possible to address the problem in hand (with the
  illegal runtime array cast), mend what's broken and test this funky,
  edge-case(?) behaviour without having to interfere with
 MarkupContainer.
  And, if there's a simpler/better/more efficient FunkyChildren possible
  for
  1.5 just plug in the new implementation. Importantly, as this an
 internal
  change (internal to MarkupContainer), there will be no API break
 (neither
  within Wicket nor in the public API).
 
  Regards - Cemal
  http://www.jWeekend.co.uk http://jWeekend.co.uk
 
 
 
  Matej Knopp-2 wrote:
 
  this
 
  sorted = Arrays.asList((Component[])children);
 
  doesn't look right. I think it should have been (Object[])children
  although a type check would be appropriate.
 
  -Matej
 
  On Fri, Nov 28, 2008 at 7:30 PM, jWeekend 
 [EMAIL PROTECTED]
  wrote:
 
  Not quite.
  String[] bO = (String[])(new Object[]{yes,we,can});
  compiles but fails at run time.
 
  Regards - Cemal
  http://www.jWeekend.co.uk  http://jWeekend.co.uk
 
 
 
  Valentine2008 wrote:
 
  It will bring the compilation error when trying to cast arrays in
  Java.
 
  So you mean it is a bug in Wicket?
 
 
  Timo Rantalaiho wrote:
 
  On Thu, 27 Nov 2008, Valentine2008 wrote:
  java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast
 to
  [Lorg.apache
  .wicket.Component;
  at
 
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
  .
 
  The code on line 478 of MarkupContainer.java is:
  sorted = Arrays.asList((Component[])children);
 
  Is it a bug of Wicket?
 
  No, I think it's a limitation of Java. You cannnot cast
  arrays.
 
  Best wishes,
  Timo
 
  --
  Timo Rantalaiho
  Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
  --
  View this message in context:
 
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  View this message in context:
 
 

Re: Bug of Wicket when iterate the form using iterator()?

2008-11-30 Thread jWeekend

MarkupContainer's children field is declared as an Object and can refer to 

a ChildList - which is a List, hopefully (until it's genericised) of
Components, 
an Object[] - again, hopefully of Components,
a Component - ie a single child, or, even  
a ComponentSourceEntry - a bare-bones representation of only the
essentials of a Component from which it can be reconstructed.

I assume MarkupContainer's implementation was refactored (_from_ something
much more straight-forward) as an optimisation, in particular related to
serialisation, with the argument probably along the lines of: it is common
for a MarkupContainer to have just a single child, so we don't want the
luggage of a List in those cases etc ... 

All this can make MarkupContainer pretty fragile, easy to accidentally
break. If the optimisation argument is really strong enough (I expect it
must have been at the time and may still be), at the very least, all the
messy operations on children could be encapsulated in a class (perhaps
called FunkyChildren, possibly as an inner class if it necessarily needs
access to its owning MarkupContainer instance's guts and is never used
outside this context) that exposes only friendly methods like 
set(int index,Component child) and
remove(Component child) 
etc ...

Apart from simplifying MarkupContainer, the above design would also have the
benefit of making it possible to address the problem in hand (with the
illegal runtime array cast), mend what's broken and test this funky,
edge-case(?) behaviour without having to interfere with MarkupContainer.
And, if there's a simpler/better/more efficient FunkyChildren possible for
1.5 just plug in the new implementation. Importantly, as this an internal
change (internal to MarkupContainer), there will be no API break (neither
within Wicket nor in the public API).

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



Matej Knopp-2 wrote:
 
 this
 
 sorted = Arrays.asList((Component[])children);
 
 doesn't look right. I think it should have been (Object[])children
 although a type check would be appropriate.
 
 -Matej
 
 On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED]
 wrote:

 Not quite.
 String[] bO = (String[])(new Object[]{yes,we,can});
 compiles but fails at run time.

 Regards - Cemal
 http://www.jWeekend.co.uk  http://jWeekend.co.uk



 Valentine2008 wrote:

 It will bring the compilation error when trying to cast arrays in Java.

 So you mean it is a bug in Wicket?


 Timo Rantalaiho wrote:

 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 No, I think it's a limitation of Java. You cannnot cast
 arrays.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

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






 --
 View this message in context:
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-30 Thread Matej Knopp
The only problem right now is the cast to Component[]. The fix is
easy, just change it to Object[]. The optimization makes a lot of
sense and there is reason why it can't really be simple.

-Matej

On Mon, Dec 1, 2008 at 2:29 AM, jWeekend [EMAIL PROTECTED] wrote:

 MarkupContainer's children field is declared as an Object and can refer to

 a ChildList - which is a List, hopefully (until it's genericised) of
 Components,
 an Object[] - again, hopefully of Components,
 a Component - ie a single child, or, even
 a ComponentSourceEntry - a bare-bones representation of only the
 essentials of a Component from which it can be reconstructed.

 I assume MarkupContainer's implementation was refactored (_from_ something
 much more straight-forward) as an optimisation, in particular related to
 serialisation, with the argument probably along the lines of: it is common
 for a MarkupContainer to have just a single child, so we don't want the
 luggage of a List in those cases etc ...

 All this can make MarkupContainer pretty fragile, easy to accidentally
 break. If the optimisation argument is really strong enough (I expect it
 must have been at the time and may still be), at the very least, all the
 messy operations on children could be encapsulated in a class (perhaps
 called FunkyChildren, possibly as an inner class if it necessarily needs
 access to its owning MarkupContainer instance's guts and is never used
 outside this context) that exposes only friendly methods like
 set(int index,Component child) and
 remove(Component child)
 etc ...

 Apart from simplifying MarkupContainer, the above design would also have the
 benefit of making it possible to address the problem in hand (with the
 illegal runtime array cast), mend what's broken and test this funky,
 edge-case(?) behaviour without having to interfere with MarkupContainer.
 And, if there's a simpler/better/more efficient FunkyChildren possible for
 1.5 just plug in the new implementation. Importantly, as this an internal
 change (internal to MarkupContainer), there will be no API break (neither
 within Wicket nor in the public API).

 Regards - Cemal
 http://www.jWeekend.co.uk http://jWeekend.co.uk



 Matej Knopp-2 wrote:

 this

 sorted = Arrays.asList((Component[])children);

 doesn't look right. I think it should have been (Object[])children
 although a type check would be appropriate.

 -Matej

 On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED]
 wrote:

 Not quite.
 String[] bO = (String[])(new Object[]{yes,we,can});
 compiles but fails at run time.

 Regards - Cemal
 http://www.jWeekend.co.uk  http://jWeekend.co.uk



 Valentine2008 wrote:

 It will bring the compilation error when trying to cast arrays in Java.

 So you mean it is a bug in Wicket?


 Timo Rantalaiho wrote:

 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 No, I think it's a limitation of Java. You cannnot cast
 arrays.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

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






 --
 View this message in context:
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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




 --
 View this message in context: 
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html
 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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread Timo Rantalaiho
On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?

No, I think it's a limitation of Java. You cannnot cast
arrays.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread jWeekend

String[] bO = (String[])(new Object[]{yes,we,can});

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 




Timo Rantalaiho wrote:
 
 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 No, I think it's a limitation of Java. You cannnot cast
 arrays.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20735617.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread jWeekend

Timo.

You're right: 
http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#20232
no we can't !

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



jWeekend wrote:
 
 String[] bO = (String[])(new Object[]{yes,we,can});
 
 Regards - Cemal
  http://www.jWeekend.co.uk http://jWeekend.co.uk 
 
 
 
 
 Timo Rantalaiho wrote:
 
 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 No, I think it's a limitation of Java. You cannnot cast
 arrays.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20735743.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread Valentine2008

It will bring the compilation error when trying to cast arrays in Java.

So you mean it is a bug in Wicket?


Timo Rantalaiho wrote:
 
 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 No, I think it's a limitation of Java. You cannnot cast
 arrays.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738178.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread jWeekend

Not quite.
String[] bO = (String[])(new Object[]{yes,we,can}); 
compiles but fails at run time.

Regards - Cemal
http://www.jWeekend.co.uk  http://jWeekend.co.uk

 

Valentine2008 wrote:
 
 It will bring the compilation error when trying to cast arrays in Java.
 
 So you mean it is a bug in Wicket?
 
 
 Timo Rantalaiho wrote:
 
 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 No, I think it's a limitation of Java. You cannnot cast
 arrays.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread Matej Knopp
this

sorted = Arrays.asList((Component[])children);

doesn't look right. I think it should have been (Object[])children
although a type check would be appropriate.

-Matej

On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED] wrote:

 Not quite.
 String[] bO = (String[])(new Object[]{yes,we,can});
 compiles but fails at run time.

 Regards - Cemal
 http://www.jWeekend.co.uk  http://jWeekend.co.uk



 Valentine2008 wrote:

 It will bring the compilation error when trying to cast arrays in Java.

 So you mean it is a bug in Wicket?


 Timo Rantalaiho wrote:

 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 No, I think it's a limitation of Java. You cannnot cast
 arrays.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

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






 --
 View this message in context: 
 http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html
 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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-28 Thread Valentine2008

Sorry, not the compilation error but the run-time exception.

Thanks,
Valentine


jWeekend wrote:
 
 Not quite.
 String[] bO = (String[])(new Object[]{yes,we,can}); 
 compiles but fails at run time.
 
 Regards - Cemal
  http://www.jWeekend.co.uk  http://jWeekend.co.uk
  
  
 
 Valentine2008 wrote:
 
 It will bring the compilation error when trying to cast arrays in Java.
 
 So you mean it is a bug in Wicket?
 
 
 Timo Rantalaiho wrote:
 
 On Thu, 27 Nov 2008, Valentine2008 wrote:
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 No, I think it's a limitation of Java. You cannnot cast
 arrays.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738485.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Igor Vaynberg
show us the full code please

-igor

On Thu, Nov 27, 2008 at 10:39 AM, Valentine2008
[EMAIL PROTECTED] wrote:

 Hi,

 I wrote the following code to print out all the children of the an input
 form.
 ---
 Iterator iterator = getInputForm().iterator(new Comparator() {

public int compare(Object o1, Object o2)
{
System.out.format(:%s, %s%n, o1, o2);

Component component1 = (Component) o1;
Component component2 = (Component) o2;
return
 component1.getId().compareTo(component2.getId());
}
});

while(iterator.hasNext())
{
System.out.format(---Child of input form:
 id=%s%n, ((Component)iterator.next()).getId());
}
 -

 When running, the following error occurs:
 ---
 [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
 org.ap
 ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
 [Lorg.apache.wick
 et.Component;
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 Thanks,
 Valentine
 --
 View this message in context: 
 http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20723903.html
 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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Valentine2008

The getInputForm() will return an instance of Form class in Wicket.
After creating the form, 
---
// 3. create, setup, and add the input form
inputForm = new Form(inputForm);
inputForm.setOutputMarkupId(true);
add(inputForm);
--

I added the following to the form:
1. a FeedbackPanel component;
2. a AjaxSubmitLink component;
3. a AjaxLink component;
4. A Button component;
5. Several Label components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
6. Several TextField components;
7. Several DropDownList components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
8. Several ListMultipleChoice components, some are invisible (Which are in a
WebMarkupContainer to control its visibility).

Thanks.


Valentine2008 wrote:
 
 Hi,
 
 I wrote the following code to print out all the children of the an input
 form.
 ---
 Iterator iterator = getInputForm().iterator(new Comparator() {
 
 public int compare(Object o1, Object o2)
 {
 System.out.format(:%s, %s%n, o1, o2);
 
 Component component1 = (Component) o1;
 Component component2 = (Component) o2;
 return 
 component1.getId().compareTo(component2.getId());
 }
 });
 
 while(iterator.hasNext())
 {
 System.out.format(---Child of input form:
 id=%s%n, ((Component)iterator.next()).getId());
 }
 -
 
 When running, the following error occurs:
 ---
 [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
 org.ap
 ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
 [Lorg.apache.wick
 et.Component;
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .
 
 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);
 
 Is it a bug of Wicket?
 
 Thanks,
 Valentine
 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.html
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: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Igor Vaynberg
i cannot put this into my ide and run it to confirm the error you are getting.

-igor

On Thu, Nov 27, 2008 at 11:22 AM, Valentine2008
[EMAIL PROTECTED] wrote:

 The getInputForm() will return an instance of Form class in Wicket.
 After creating the form,
 ---
 // 3. create, setup, and add the input form
inputForm = new Form(inputForm);
inputForm.setOutputMarkupId(true);
add(inputForm);
 --

 I added the following to the form:
 1. a FeedbackPanel component;
 2. a AjaxSubmitLink component;
 3. a AjaxLink component;
 4. A Button component;
 5. Several Label components, some are invisible (Which are in a
 WebMarkupContainer to control its visibility);
 6. Several TextField components;
 7. Several DropDownList components, some are invisible (Which are in a
 WebMarkupContainer to control its visibility);
 8. Several ListMultipleChoice components, some are invisible (Which are in a
 WebMarkupContainer to control its visibility).

 Thanks.


 Valentine2008 wrote:

 Hi,

 I wrote the following code to print out all the children of the an input
 form.
 ---
 Iterator iterator = getInputForm().iterator(new Comparator() {

 public int compare(Object o1, Object o2)
 {
 System.out.format(:%s, %s%n, o1, o2);

 Component component1 = (Component) o1;
 Component component2 = (Component) o2;
 return
 component1.getId().compareTo(component2.getId());
 }
 });

 while(iterator.hasNext())
 {
 System.out.format(---Child of input form:
 id=%s%n, ((Component)iterator.next()).getId());
 }
 -

 When running, the following error occurs:
 ---
 [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
 org.ap
 ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
 [Lorg.apache.wick
 et.Component;
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 Thanks,
 Valentine


 --
 View this message in context: 
 http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.html
 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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Valentine2008

Hi Igor,

I understand. I cannot dump all my code here. It is too much.

I will try to give you a runnable code.

Now, I am using iterator() instead of iterator(Comparator) to bypass the
problem.

Thanks,
Valentine


igor.vaynberg wrote:
 
 i cannot put this into my ide and run it to confirm the error you are
 getting.
 
 -igor
 
 On Thu, Nov 27, 2008 at 11:22 AM, Valentine2008
 [EMAIL PROTECTED] wrote:

 The getInputForm() will return an instance of Form class in Wicket.
 After creating the form,
 ---
 // 3. create, setup, and add the input form
inputForm = new Form(inputForm);
inputForm.setOutputMarkupId(true);
add(inputForm);
 --

 I added the following to the form:
 1. a FeedbackPanel component;
 2. a AjaxSubmitLink component;
 3. a AjaxLink component;
 4. A Button component;
 5. Several Label components, some are invisible (Which are in a
 WebMarkupContainer to control its visibility);
 6. Several TextField components;
 7. Several DropDownList components, some are invisible (Which are in a
 WebMarkupContainer to control its visibility);
 8. Several ListMultipleChoice components, some are invisible (Which are
 in a
 WebMarkupContainer to control its visibility).

 Thanks.


 Valentine2008 wrote:

 Hi,

 I wrote the following code to print out all the children of the an input
 form.
 ---
 Iterator iterator = getInputForm().iterator(new Comparator() {

 public int compare(Object o1, Object o2)
 {
 System.out.format(:%s, %s%n, o1, o2);

 Component component1 = (Component) o1;
 Component component2 = (Component) o2;
 return
 component1.getId().compareTo(component2.getId());
 }
 });

 while(iterator.hasNext())
 {
 System.out.format(---Child of input form:
 id=%s%n, ((Component)iterator.next()).getId());
 }
 -

 When running, the following error occurs:
 ---
 [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432)
 -
 org.ap
 ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
 [Lorg.apache.wick
 et.Component;
 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
 [Lorg.apache
 .wicket.Component;
 at
 org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
 .

 The code on line 478 of MarkupContainer.java is:
 sorted = Arrays.asList((Component[])children);

 Is it a bug of Wicket?

 Thanks,
 Valentine


 --
 View this message in context:
 http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724952.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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