Re: DateTextField design issue

2009-05-07 Thread Eyal Golan
I'm going to review on Sunday the code my team mate has made .
I'll be able to give you more information and see if maybe we misunderstood
something.


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 what is the full name of this class? there are two DateTextField
 classes in wicket codebase.

 -igor

 On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
  Hello,
  We use Wicket 1.3.5 and I found something annoying with the
 DateTextField.
  In the constructor of that class, the converter is created internally.
  If I want to use my own converter, I need to inherit DateTextField, add a
  converter as a member, and return it in the getConverter method.
 
  Why not have a protected method (that can be overridden) that returns the
  converter:
  Instead of:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = new DateConverter()
 {
 private static final long serialVersionUID = 1L;
 
 /**
  * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };*
 }
 
  Do something like:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = newDateConverter();*
 }
  and
 
  protected newDateConverter() {
  return new DateConverter()
 {
 private static final long serialVersionUID = 1L;
 
 /**
  * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };
  }
 
  BTW, I know that we can also use the newConverterLocator() in our
  application.
 
  Do you think I should open a JIRA issue with 'wish' for that?
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 

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




Re: DateTextField design issue

2009-05-07 Thread Igor Vaynberg
if you want to use your own converter then override getconverter() and
return whatever you like.

-igor

On Thu, May 7, 2009 at 1:38 AM, Eyal Golan egola...@gmail.com wrote:
 I'm going to review on Sunday the code my team mate has made .
 I'll be able to give you more information and see if maybe we misunderstood
 something.


 Eyal Golan
 egola...@gmail.com

 Visit: http://jvdrums.sourceforge.net/
 LinkedIn: http://www.linkedin.com/in/egolan74

 P  Save a tree. Please don't print this e-mail unless it's really necessary


 On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 what is the full name of this class? there are two DateTextField
 classes in wicket codebase.

 -igor

 On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
  Hello,
  We use Wicket 1.3.5 and I found something annoying with the
 DateTextField.
  In the constructor of that class, the converter is created internally.
  If I want to use my own converter, I need to inherit DateTextField, add a
  converter as a member, and return it in the getConverter method.
 
  Why not have a protected method (that can be overridden) that returns the
  converter:
  Instead of:
     public DateTextField(String id, IModel model, String datePattern)
     {
         super(id, model, Date.class);
         this.datePattern = datePattern;
         *this.converter = new DateConverter()
         {
             private static final long serialVersionUID = 1L;
 
             /**
              * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
              */
             public DateFormat getDateFormat(Locale locale)
             {
                 return new
 SimpleDateFormat(DateTextField.this.datePattern);
             }
         };*
     }
 
  Do something like:
     public DateTextField(String id, IModel model, String datePattern)
     {
         super(id, model, Date.class);
         this.datePattern = datePattern;
         *this.converter = newDateConverter();*
     }
  and
 
  protected newDateConverter() {
      return new DateConverter()
         {
             private static final long serialVersionUID = 1L;
 
             /**
              * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
              */
             public DateFormat getDateFormat(Locale locale)
             {
                 return new
 SimpleDateFormat(DateTextField.this.datePattern);
             }
         };
  }
 
  BTW, I know that we can also use the newConverterLocator() in our
  application.
 
  Do you think I should open a JIRA issue with 'wish' for that?
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 

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




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



Re: DateTextField design issue

2009-05-07 Thread Eyal Golan
if you want to use your own converter then override getconverter() and
return whatever you like.

True. This is what I suggested my mate when we discussed it. And I guess
this what we'll do.
But isn't using a converter for the whole application eliminates the need to
create a custom component?

Thanks


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 if you want to use your own converter then override getconverter() and
 return whatever you like.

 -igor

 On Thu, May 7, 2009 at 1:38 AM, Eyal Golan egola...@gmail.com wrote:
  I'm going to review on Sunday the code my team mate has made .
  I'll be able to give you more information and see if maybe we
 misunderstood
  something.
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 
 
  On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  what is the full name of this class? there are two DateTextField
  classes in wicket codebase.
 
  -igor
 
  On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
   Hello,
   We use Wicket 1.3.5 and I found something annoying with the
  DateTextField.
   In the constructor of that class, the converter is created internally.
   If I want to use my own converter, I need to inherit DateTextField,
 add a
   converter as a member, and return it in the getConverter method.
  
   Why not have a protected method (that can be overridden) that returns
 the
   converter:
   Instead of:
  public DateTextField(String id, IModel model, String datePattern)
  {
  super(id, model, Date.class);
  this.datePattern = datePattern;
  *this.converter = new DateConverter()
  {
  private static final long serialVersionUID = 1L;
  
  /**
   * @see
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
   */
  public DateFormat getDateFormat(Locale locale)
  {
  return new
  SimpleDateFormat(DateTextField.this.datePattern);
  }
  };*
  }
  
   Do something like:
  public DateTextField(String id, IModel model, String datePattern)
  {
  super(id, model, Date.class);
  this.datePattern = datePattern;
  *this.converter = newDateConverter();*
  }
   and
  
   protected newDateConverter() {
   return new DateConverter()
  {
  private static final long serialVersionUID = 1L;
  
  /**
   * @see
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
   */
  public DateFormat getDateFormat(Locale locale)
  {
  return new
  SimpleDateFormat(DateTextField.this.datePattern);
  }
  };
   }
  
   BTW, I know that we can also use the newConverterLocator() in our
   application.
  
   Do you think I should open a JIRA issue with 'wish' for that?
  
  
   Eyal Golan
   egola...@gmail.com
  
   Visit: http://jvdrums.sourceforge.net/
   LinkedIn: http://www.linkedin.com/in/egolan74
  
   P  Save a tree. Please don't print this e-mail unless it's really
  necessary
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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




Re: DateTextField design issue

2009-05-07 Thread Igor Vaynberg
problem is datetextfield suppports different formats which require
different converters, so it is a bit of a special case with regard to
using a global date converter.

-igor

On Thu, May 7, 2009 at 11:16 AM, Eyal Golan egola...@gmail.com wrote:
 if you want to use your own converter then override getconverter() and
 return whatever you like.

 True. This is what I suggested my mate when we discussed it. And I guess
 this what we'll do.
 But isn't using a converter for the whole application eliminates the need to
 create a custom component?

 Thanks


 Eyal Golan
 egola...@gmail.com

 Visit: http://jvdrums.sourceforge.net/
 LinkedIn: http://www.linkedin.com/in/egolan74

 P  Save a tree. Please don't print this e-mail unless it's really necessary


 On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 if you want to use your own converter then override getconverter() and
 return whatever you like.

 -igor

 On Thu, May 7, 2009 at 1:38 AM, Eyal Golan egola...@gmail.com wrote:
  I'm going to review on Sunday the code my team mate has made .
  I'll be able to give you more information and see if maybe we
 misunderstood
  something.
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 
 
  On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  what is the full name of this class? there are two DateTextField
  classes in wicket codebase.
 
  -igor
 
  On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
   Hello,
   We use Wicket 1.3.5 and I found something annoying with the
  DateTextField.
   In the constructor of that class, the converter is created internally.
   If I want to use my own converter, I need to inherit DateTextField,
 add a
   converter as a member, and return it in the getConverter method.
  
   Why not have a protected method (that can be overridden) that returns
 the
   converter:
   Instead of:
      public DateTextField(String id, IModel model, String datePattern)
      {
          super(id, model, Date.class);
          this.datePattern = datePattern;
          *this.converter = new DateConverter()
          {
              private static final long serialVersionUID = 1L;
  
              /**
               * @see
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
               */
              public DateFormat getDateFormat(Locale locale)
              {
                  return new
  SimpleDateFormat(DateTextField.this.datePattern);
              }
          };*
      }
  
   Do something like:
      public DateTextField(String id, IModel model, String datePattern)
      {
          super(id, model, Date.class);
          this.datePattern = datePattern;
          *this.converter = newDateConverter();*
      }
   and
  
   protected newDateConverter() {
       return new DateConverter()
          {
              private static final long serialVersionUID = 1L;
  
              /**
               * @see
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
               */
              public DateFormat getDateFormat(Locale locale)
              {
                  return new
  SimpleDateFormat(DateTextField.this.datePattern);
              }
          };
   }
  
   BTW, I know that we can also use the newConverterLocator() in our
   application.
  
   Do you think I should open a JIRA issue with 'wish' for that?
  
  
   Eyal Golan
   egola...@gmail.com
  
   Visit: http://jvdrums.sourceforge.net/
   LinkedIn: http://www.linkedin.com/in/egolan74
  
   P  Save a tree. Please don't print this e-mail unless it's really
  necessary
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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




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



Re: DateTextField design issue

2009-05-07 Thread Eyal Golan
What we actually want to do is, to use the regular converter for Date.class
with a small addition.
The converter uses a DateFormat. We want to set this DateFormat:
setLenient(true).
I thought to put it in the application scope as we want this everywhere in
the application.
Following this thread, I start thinking that your previous suggestion is the
best solution for us: just override the getConverter.


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, May 7, 2009 at 9:36 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 problem is datetextfield suppports different formats which require
 different converters, so it is a bit of a special case with regard to
 using a global date converter.

 -igor

 On Thu, May 7, 2009 at 11:16 AM, Eyal Golan egola...@gmail.com wrote:
  if you want to use your own converter then override getconverter() and
  return whatever you like.
 
  True. This is what I suggested my mate when we discussed it. And I guess
  this what we'll do.
  But isn't using a converter for the whole application eliminates the need
 to
  create a custom component?
 
  Thanks
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 
 
  On Thu, May 7, 2009 at 6:16 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  if you want to use your own converter then override getconverter() and
  return whatever you like.
 
  -igor
 
  On Thu, May 7, 2009 at 1:38 AM, Eyal Golan egola...@gmail.com wrote:
   I'm going to review on Sunday the code my team mate has made .
   I'll be able to give you more information and see if maybe we
  misunderstood
   something.
  
  
   Eyal Golan
   egola...@gmail.com
  
   Visit: http://jvdrums.sourceforge.net/
   LinkedIn: http://www.linkedin.com/in/egolan74
  
   P  Save a tree. Please don't print this e-mail unless it's really
  necessary
  
  
   On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg 
 igor.vaynb...@gmail.com
  wrote:
  
   what is the full name of this class? there are two DateTextField
   classes in wicket codebase.
  
   -igor
  
   On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com
 wrote:
Hello,
We use Wicket 1.3.5 and I found something annoying with the
   DateTextField.
In the constructor of that class, the converter is created
 internally.
If I want to use my own converter, I need to inherit DateTextField,
  add a
converter as a member, and return it in the getConverter method.
   
Why not have a protected method (that can be overridden) that
 returns
  the
converter:
Instead of:
   public DateTextField(String id, IModel model, String
 datePattern)
   {
   super(id, model, Date.class);
   this.datePattern = datePattern;
   *this.converter = new DateConverter()
   {
   private static final long serialVersionUID = 1L;
   
   /**
* @see
   
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
*/
   public DateFormat getDateFormat(Locale locale)
   {
   return new
   SimpleDateFormat(DateTextField.this.datePattern);
   }
   };*
   }
   
Do something like:
   public DateTextField(String id, IModel model, String
 datePattern)
   {
   super(id, model, Date.class);
   this.datePattern = datePattern;
   *this.converter = newDateConverter();*
   }
and
   
protected newDateConverter() {
return new DateConverter()
   {
   private static final long serialVersionUID = 1L;
   
   /**
* @see
   
  
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
*/
   public DateFormat getDateFormat(Locale locale)
   {
   return new
   SimpleDateFormat(DateTextField.this.datePattern);
   }
   };
}
   
BTW, I know that we can also use the newConverterLocator() in our
application.
   
Do you think I should open a JIRA issue with 'wish' for that?
   
   
Eyal Golan
egola...@gmail.com
   
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
   
P  Save a tree. Please don't print this e-mail unless it's really
   necessary
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
 
  -
  To unsubscribe, e-mail: 

Re: DateTextField design issue

2009-05-06 Thread Eyal Golan
More on that,
we used the newConverterLocator() in out application exactly as it is
suggested in WIA, page 297.
However, because the DateTextField has its own converter, we even don't get
to our customized converter.

Is it a bug?

Please advise.


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Tue, May 5, 2009 at 7:51 PM, Eyal Golan egola...@gmail.com wrote:

 Hello,
 We use Wicket 1.3.5 and I found something annoying with the DateTextField.
 In the constructor of that class, the converter is created internally.
 If I want to use my own converter, I need to inherit DateTextField, add a
 converter as a member, and return it in the getConverter method.

 Why not have a protected method (that can be overridden) that returns the
 converter:
 Instead of:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = new DateConverter()
 {
 private static final long serialVersionUID = 1L;

 /**
  * @see
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };*
 }

 Do something like:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = newDateConverter();*
 }
 and

 protected newDateConverter() {
  return new DateConverter()
 {
 private static final long serialVersionUID = 1L;

 /**
  * @see
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };
 }

 BTW, I know that we can also use the newConverterLocator() in our
 application.

 Do you think I should open a JIRA issue with 'wish' for that?


 Eyal Golan
 egola...@gmail.com

 Visit: http://jvdrums.sourceforge.net/
 LinkedIn: http://www.linkedin.com/in/egolan74

 P  Save a tree. Please don't print this e-mail unless it's really necessary



Re: DateTextField design issue

2009-05-06 Thread Igor Vaynberg
what is the full name of this class? there are two DateTextField
classes in wicket codebase.

-igor

On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
 Hello,
 We use Wicket 1.3.5 and I found something annoying with the DateTextField.
 In the constructor of that class, the converter is created internally.
 If I want to use my own converter, I need to inherit DateTextField, add a
 converter as a member, and return it in the getConverter method.

 Why not have a protected method (that can be overridden) that returns the
 converter:
 Instead of:
    public DateTextField(String id, IModel model, String datePattern)
    {
        super(id, model, Date.class);
        this.datePattern = datePattern;
        *this.converter = new DateConverter()
        {
            private static final long serialVersionUID = 1L;

            /**
             * @see
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
             */
            public DateFormat getDateFormat(Locale locale)
            {
                return new SimpleDateFormat(DateTextField.this.datePattern);
            }
        };*
    }

 Do something like:
    public DateTextField(String id, IModel model, String datePattern)
    {
        super(id, model, Date.class);
        this.datePattern = datePattern;
        *this.converter = newDateConverter();*
    }
 and

 protected newDateConverter() {
     return new DateConverter()
        {
            private static final long serialVersionUID = 1L;

            /**
             * @see
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
             */
            public DateFormat getDateFormat(Locale locale)
            {
                return new SimpleDateFormat(DateTextField.this.datePattern);
            }
        };
 }

 BTW, I know that we can also use the newConverterLocator() in our
 application.

 Do you think I should open a JIRA issue with 'wish' for that?


 Eyal Golan
 egola...@gmail.com

 Visit: http://jvdrums.sourceforge.net/
 LinkedIn: http://www.linkedin.com/in/egolan74

 P  Save a tree. Please don't print this e-mail unless it's really necessary


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



Re: DateTextField design issue

2009-05-06 Thread Eyal Golan
we looked the one from wicket-extensions


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Wed, May 6, 2009 at 6:43 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 what is the full name of this class? there are two DateTextField
 classes in wicket codebase.

 -igor

 On Tue, May 5, 2009 at 9:51 AM, Eyal Golan egola...@gmail.com wrote:
  Hello,
  We use Wicket 1.3.5 and I found something annoying with the
 DateTextField.
  In the constructor of that class, the converter is created internally.
  If I want to use my own converter, I need to inherit DateTextField, add a
  converter as a member, and return it in the getConverter method.
 
  Why not have a protected method (that can be overridden) that returns the
  converter:
  Instead of:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = new DateConverter()
 {
 private static final long serialVersionUID = 1L;
 
 /**
  * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };*
 }
 
  Do something like:
 public DateTextField(String id, IModel model, String datePattern)
 {
 super(id, model, Date.class);
 this.datePattern = datePattern;
 *this.converter = newDateConverter();*
 }
  and
 
  protected newDateConverter() {
  return new DateConverter()
 {
 private static final long serialVersionUID = 1L;
 
 /**
  * @see
 
 org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
  */
 public DateFormat getDateFormat(Locale locale)
 {
 return new
 SimpleDateFormat(DateTextField.this.datePattern);
 }
 };
  }
 
  BTW, I know that we can also use the newConverterLocator() in our
  application.
 
  Do you think I should open a JIRA issue with 'wish' for that?
 
 
  Eyal Golan
  egola...@gmail.com
 
  Visit: http://jvdrums.sourceforge.net/
  LinkedIn: http://www.linkedin.com/in/egolan74
 
  P  Save a tree. Please don't print this e-mail unless it's really
 necessary
 

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




DateTextField design issue

2009-05-05 Thread Eyal Golan
Hello,
We use Wicket 1.3.5 and I found something annoying with the DateTextField.
In the constructor of that class, the converter is created internally.
If I want to use my own converter, I need to inherit DateTextField, add a
converter as a member, and return it in the getConverter method.

Why not have a protected method (that can be overridden) that returns the
converter:
Instead of:
public DateTextField(String id, IModel model, String datePattern)
{
super(id, model, Date.class);
this.datePattern = datePattern;
*this.converter = new DateConverter()
{
private static final long serialVersionUID = 1L;

/**
 * @see
org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
 */
public DateFormat getDateFormat(Locale locale)
{
return new SimpleDateFormat(DateTextField.this.datePattern);
}
};*
}

Do something like:
public DateTextField(String id, IModel model, String datePattern)
{
super(id, model, Date.class);
this.datePattern = datePattern;
*this.converter = newDateConverter();*
}
and

protected newDateConverter() {
 return new DateConverter()
{
private static final long serialVersionUID = 1L;

/**
 * @see
org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
 */
public DateFormat getDateFormat(Locale locale)
{
return new SimpleDateFormat(DateTextField.this.datePattern);
}
};
}

BTW, I know that we can also use the newConverterLocator() in our
application.

Do you think I should open a JIRA issue with 'wish' for that?


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary