DateTime.setLabel() issue and a related (but general) setLabel() question

2008-03-12 Thread Phil Grimm
Hey Guys,
I'm building my first Wicket app and, so far, am really loving Wicket!

I've built my first form and am stumped on a issue with the DateTime
component. I call setLabel() on all the fields in my form and all the labels
I provide appear in the validation error messages except one, the DateTime
field.

Here's the code

HTML:
tr
  tdMy Date:/td
  tdspan wicket:id=myDate/span/td
/tr

JAVA:
form.add(new DateField(myDate).setLabel(new Model(My Date));

The problem is that the validation error message refers to the field as
date and not My Date.

Looking at the source, DateTime.java, I can see why. It appears the
setLabel() is being applied to the FormComponentPanel, which DateTime
extends and not the 'private final DateTextField dateField' within DateTime.

I don't see a way to get at the private dateField to setLabel() on it.
How should this be done?


And a related setLabel() question

Looking at my example code above, you can see that the label My Date is
being maintained in both the HTML and the Java. It would be nice if I could
just specify it in the Java and have Wicket apply it in the HTML.

For example...

HTML:
tr
  tdspan wicket:id=myDate.label[wicket puts label here - with
colon?]/span/td
  tdspan wicket:id=myDate/span/td
/tr

Is this possible now?
Or is it a reasonable feature idea?


Thanks!
Phil


Re: DateTime.setLabel() issue and a related (but general) setLabel() question

2008-03-12 Thread Gerolf Seitz
you can override newDateTextField(..) and call .setLabel() directly on the
DateTextField in there.

  Gerolf

On Wed, Mar 12, 2008 at 10:26 PM, Phil Grimm [EMAIL PROTECTED] wrote:

 Hey Guys,
 I'm building my first Wicket app and, so far, am really loving Wicket!

 I've built my first form and am stumped on a issue with the DateTime
 component. I call setLabel() on all the fields in my form and all the
 labels
 I provide appear in the validation error messages except one, the DateTime
 field.

 Here's the code

 HTML:
tr
  tdMy Date:/td
  tdspan wicket:id=myDate/span/td
/tr

 JAVA:
form.add(new DateField(myDate).setLabel(new Model(My Date));

 The problem is that the validation error message refers to the field as
 date and not My Date.

 Looking at the source, DateTime.java, I can see why. It appears the
 setLabel() is being applied to the FormComponentPanel, which DateTime
 extends and not the 'private final DateTextField dateField' within
 DateTime.

 I don't see a way to get at the private dateField to setLabel() on it.
 How should this be done?


 And a related setLabel() question

 Looking at my example code above, you can see that the label My Date is
 being maintained in both the HTML and the Java. It would be nice if I
 could
 just specify it in the Java and have Wicket apply it in the HTML.

 For example...

 HTML:
tr
  tdspan wicket:id=myDate.label[wicket puts label here - with
 colon?]/span/td
  tdspan wicket:id=myDate/span/td
/tr

 Is this possible now?
 Or is it a reasonable feature idea?


 Thanks!
 Phil



Re: DateTime.setLabel() issue and a related (but general) setLabel() question

2008-03-12 Thread Igor Vaynberg
shouldnt DateField forward its label to the internal field?

-igor


On Wed, Mar 12, 2008 at 2:32 PM, Gerolf Seitz [EMAIL PROTECTED] wrote:
 you can override newDateTextField(..) and call .setLabel() directly on the
  DateTextField in there.

   Gerolf



  On Wed, Mar 12, 2008 at 10:26 PM, Phil Grimm [EMAIL PROTECTED] wrote:

   Hey Guys,
   I'm building my first Wicket app and, so far, am really loving Wicket!
  
   I've built my first form and am stumped on a issue with the DateTime
   component. I call setLabel() on all the fields in my form and all the
   labels
   I provide appear in the validation error messages except one, the DateTime
   field.
  
   Here's the code
  
   HTML:
  tr
tdMy Date:/td
tdspan wicket:id=myDate/span/td
  /tr
  
   JAVA:
  form.add(new DateField(myDate).setLabel(new Model(My Date));
  
   The problem is that the validation error message refers to the field as
   date and not My Date.
  
   Looking at the source, DateTime.java, I can see why. It appears the
   setLabel() is being applied to the FormComponentPanel, which DateTime
   extends and not the 'private final DateTextField dateField' within
   DateTime.
  
   I don't see a way to get at the private dateField to setLabel() on it.
   How should this be done?
  
  
   And a related setLabel() question
  
   Looking at my example code above, you can see that the label My Date is
   being maintained in both the HTML and the Java. It would be nice if I
   could
   just specify it in the Java and have Wicket apply it in the HTML.
  
   For example...
  
   HTML:
  tr
tdspan wicket:id=myDate.label[wicket puts label here - with
   colon?]/span/td
tdspan wicket:id=myDate/span/td
  /tr
  
   Is this possible now?
   Or is it a reasonable feature idea?
  
  
   Thanks!
   Phil
  


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



Re: DateTime.setLabel() issue and a related (but general) setLabel() question

2008-03-12 Thread phil59

Igor,
That's what I was thinking to suggest too, but I think that solution breaks
down when the component has more than one internal field like DateTimeField
does.

Gerolf,
Thanks for the tip. I think that should work for the dateField.
Any ideas on what would one do to set the label on the
DateTimeField.hoursField and DateTimeField.minutesField?

--Phil


igor.vaynberg wrote:
 
 shouldnt DateField forward its label to the internal field?
 
 -igor
 
 
 On Wed, Mar 12, 2008 at 2:32 PM, Gerolf Seitz [EMAIL PROTECTED]
 wrote:
 you can override newDateTextField(..) and call .setLabel() directly on
 the
  DateTextField in there.

   Gerolf

 
 

-- 
View this message in context: 
http://www.nabble.com/DateTime.setLabel%28%29-issue-and-a-related-%28but-general%29-setLabel%28%29-question-tp16015278p16019096.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]