Re: DecimalFormatLabel (proposed)

2011-09-27 Thread Pranav kacholia
I have submitted a patch https://issues.apache.org/jira/browse/WICKET-4085 Wicket-4085 . for a formatted label. I cant figure what would be the best way to handle an IllegalArgumentException which is thrown when the supplied format object in not valid for the underlying data object. -- View

Re: DecimalFormatLabel (proposed)

2011-09-27 Thread Igor Vaynberg
wrap it in a wicket runtime exception -igor On Tue, Sep 27, 2011 at 6:32 AM, Pranav kacholia pranav.kacho...@gmail.com wrote: I have submitted a patch  https://issues.apache.org/jira/browse/WICKET-4085 Wicket-4085 . for a formatted label. I cant figure what would be the best way to handle

Re: DecimalFormatLabel (proposed)

2011-09-27 Thread Pranav kacholia
Updated the patch and resubmitted. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DecimalFormatLabel-proposed-tp3834813p3847952.html Sent from the Users forum mailing list archive at Nabble.com. -

Re: DecimalFormatLabel (proposed)

2011-09-26 Thread Yves-Marie LAINÉ
I agree with you. Yves-Marie 2011/9/25 Pranav kacholia pranav.kacho...@gmail.com One way or the other, i think Wicket needs a label of that sort. There are too many places where i have to display currency. It should have something inbuilt that allows us to display formatted strings and

Re: DecimalFormatLabel (proposed)

2011-09-25 Thread Pranav kacholia
One way or the other, i think Wicket needs a label of that sort. There are too many places where i have to display currency. It should have something inbuilt that allows us to display formatted strings and numbers (a label) -- View this message in context:

Re: DecimalFormatLabel (proposed)

2011-09-23 Thread Viktoras
Wouldn't it be better to create a model of String type which is constructed with a Number and NumberFormat as arguments, and use it as model for standard label? On 2011.09.22 23:45, Pranav kacholia wrote: I have foound many places where i need to format a number and display it in a label. Can

RE: DecimalFormatLabel (proposed)

2011-09-23 Thread Pranav kacholia
(myPojo)); container.add(new DecimalFormatLabel(myInt, new DecimalFormat()); From: uiron [via Apache Wicket] [mailto:ml-node+s1842946n383594...@n4.nabble.com] Sent: 23 September 2011 12:17 To: Pranav kacholia Subject: Re: DecimalFormatLabel (proposed) Wouldn't it be better to create

RE: DecimalFormatLabel (proposed)

2011-09-23 Thread Pranav kacholia
Perhaps we can keep it as a NumberFormatLabel for greater flexibility import java.text.NumberFormat; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.model.IModel; import

Re: DecimalFormatLabel (proposed)

2011-09-23 Thread Yves-Marie LAINÉ
Hi all, Personnaly I did it like that (simpler for i18n, i think) : public class FormatLabel extends Label { public FormatLabel(String id,final String formatKey, final IModel? extends Serializable model) { super (id); setDefaultModel(new AbstractReadOnlyModelString() {

RE: DecimalFormatLabel (proposed)

2011-09-23 Thread Pranav kacholia
Wicket] [mailto:ml-node+s1842946n3837008...@n4.nabble.com] Sent: 23 September 2011 19:57 To: Pranav kacholia Subject: Re: DecimalFormatLabel (proposed) Hi all, Personnaly I did it like that (simpler for i18n, i think) : public class FormatLabel extends Label { public FormatLabel(String

Re: DecimalFormatLabel (proposed)

2011-09-23 Thread Yves-Marie LAINÉ
September 2011 19:57 To: Pranav kacholia Subject: Re: DecimalFormatLabel (proposed) Hi all, Personnaly I did it like that (simpler for i18n, i think) : public class FormatLabel extends Label { public FormatLabel(String id,final String formatKey, final IModel? extends Serializable

Re: DecimalFormatLabel (proposed)

2011-09-23 Thread Pranav kacholia
Or we go one step further back. I think this would handle all use cases. If we want to put in a NumberFormat or a DecimalFormat , in both cases it should work. public class FormattedLabel extends Label{ final private Format formatter; public FormattedLabel(String id, IModel?

Re: DecimalFormatLabel (proposed)

2011-09-23 Thread Yves-Marie LAINÉ
In my opinion, it could be more usefull to nest a StringResourceModel directly in a ResourceLabel, as formating number is often application wide and sometimes Locale dependent. And it covers more use case. It's just my point of view. Maybe like this : protected void onComponentTagBody(final

Re: DecimalFormatLabel (proposed)

2011-09-22 Thread Igor Vaynberg
not sure DecimalFormat is really serializable. Format is, but DecimalFormat's DigitList is not -igor On Thu, Sep 22, 2011 at 1:45 PM, Pranav kacholia pranav.kacho...@gmail.com wrote: I have foound many places where i need to format a number and display it in a label. Can we have a simple

Re: DecimalFormatLabel (proposed)

2011-09-22 Thread Pranav kacholia
I have been using it since earlier today. Havent seen any exceptions thrown. Im relatively new to wicket , so what should i look out for in case it isnt actually serializable? -- View this message in context:

Re: DecimalFormatLabel (proposed)

2011-09-22 Thread Pranav kacholia
Looking over the sourcecode of DecimalFormat (Java 6) there are a few fields which do not implements Serializable. Those are all of type DigitList and FieldPosition. however, in all the cases they are marked as Transient, so they shouldnt interfere with the serialization? -- View this message

Re: DecimalFormatLabel (proposed)

2011-09-22 Thread Igor Vaynberg
yeah, transient fields are ok... -igor On Thu, Sep 22, 2011 at 2:20 PM, Pranav kacholia pranav.kacho...@gmail.com wrote: Looking over the sourcecode of DecimalFormat (Java 6) there are a few fields which do not implements Serializable. Those are all of type DigitList and FieldPosition.