Ok, sorry for this and thanks a lot for the answer

On Thu, Feb 19, 2009 at 3:50 PM, Martin Grigorov <[email protected]>wrote:

> Hi Loic,
>
> The label could be i18n-ized by using "NavigatorLabel".
> The last String parameter to StringResourceModel is the default which
> will be used if there is nothing in the bundles
>
> Use users@ mailing list for such kind of questions.
>
>
> El jue, 19-02-2009 a las 15:23 +0100, Loic Descotte escribió:
> > Sorry, i kept a part of the text in french in last mail,
> >
> > navigatorLabel = Lignes {0} to {2} of{1}
> >
> > should be
> >
> > navigatorLabel = Showing from {0} to {2} of{1}
> >
> >
> > Thanks,
> >
> > Loic Descotte
> >
> > On Thu, Feb 19, 2009 at 3:19 PM, Loic Descotte <[email protected]
> >wrote:
> >
> > > Hi all,
> > > i found a little problem using Datatable component.
> > > I use Wicket for a french software development.
> > > Ib the datatable, the text "Showing 1 to 10 of N" in the navigation
> toolbar
> > > can not be internationalized.
> > >
> > > The Datatable component is associated to a NavigatorToolBar component,
> wich
> > > is associated to a NavigatorLabel.
> > > I've found this code in the NavigatorLabel.java file : "Showing ${from}
> to
> > > ${to} of ${of}"
> > >
> > > To make the datatable internationalizable, i must create new Components
> > > inherited from  DataTable, NavigatorToolBar, NavigatorLabel, etc...
> > >  and change the following text : "Showing ${from} to ${to} of ${of}"
> > >
> > > This could be fixed in NavigatorLabel class,  with a call to a
> .properties
> > > file like  :
> > >
> > > protected WebComponent newNavigatorLabel(String navigatorId, final
> > > DataTable table)
> > >     {
> > >         IModel model = new NavigatorLabelModel(table);
> > >
> > >                 return new Label(
> > >                     navigatorId,
> > >                     new StringResourceModel(
> > >                         "navigatorLabel",
> > >                         this,
> > >                         model,
> > >                         new Object[] {
> > >                             new PropertyModel(model, "from"),
> > >                             new PropertyModel(model, "of"),
> > >                             new PropertyModel(model, "to")
> > >                         }
> > >                     )
> > >                 );
> > >     }
> > >
> > >
> > > with  in .properties file :
> > >
> > > navigatorLabel = Lignes {0} to {2} of{1}
> > >
> > > and this classes :
> > >
> > > public class NavigatorLabelModel extends LoadableDetachableModel {
> > >
> > >     private static final long serialVersionUID = 1L;
> > >     private DataTable dataTable;
> > >
> > >     public NavigatorLabelModel(DataTable dataTable) {
> > >         super();
> > >         this.dataTable = dataTable;
> > >     }
> > >
> > >
> > >     protected Object load() {
> > >
> > >         int of = 0;
> > >         int from = 0;
> > >         int to = 0;
> > >
> > >         of = this.dataTable.getRowCount();
> > >         from = this.dataTable.getCurrentPage() *
> > > this.dataTable.getRowsPerPage();
> > >         to = Math.min(of, from + this.dataTable.getRowsPerPage());
> > >         from++;
> > >
> > >         if (of == 0) {
> > >             from = 0;
> > >             to = 0;
> > >         }
> > >
> > >         return new NavigationLabelBean(from, of, to);
> > >     }
> > >
> > > }
> > >
> > > and
> > >
> > > public class NavigationLabelBean {
> > >
> > >     private int from;
> > >     private int of;
> > >     private int to;
> > >
> > >     public NavigationLabelBean(int from, int of, int to) {
> > >         this.from = from;
> > >         this.of = of;
> > >         this.to = to;
> > >     }
> > >
> > > //getters and setters ...
> > >
> > > }
> > >
> > > I've tried and it works fine.
> > >
> > > Do you think it could be added in sources?
> > > If you think it's a good idea i can try to get a acccount on SVN to add
> > > this, or maybe someone here wants to do it.
> > >
> > > Thanks,
> > >
> > > --
> > > Loïc Descotte
> > > 9 rue Sébastien Gryphe
> > > 69007 Lyon
> > >
> > > 06 23 23 36 80
> > >
> >
> >
> >
>
>


-- 
Loïc Descotte
9 rue Sébastien Gryphe
69007 Lyon

06 23 23 36 80

Reply via email to