select2 localization questions

2012-09-04 Thread Sandor Feher
Hi,

I successfuly created a Select2Choice item in my form. I fill it up from a
model and everything works fine but the listed choices' display in wrong
codepage. I use utf8 everywhere and have no problems with cp.
The second one is how to localize select2 messages from select2.js ?
E.g. formatNoMatches,  formatSearching and so one.

thnx., Sandor



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: select2 localization questions

2012-09-04 Thread Igor Vaynberg
On Tue, Sep 4, 2012 at 7:27 AM, Sandor Feher sfe...@bluesystem.hu wrote:
 Hi,

 I successfuly created a Select2Choice item in my form. I fill it up from a
 model and everything works fine but the listed choices' display in wrong
 codepage. I use utf8 everywhere and have no problems with cp.

i believe this was fixed recently in master.

 The second one is how to localize select2 messages from select2.js ?
 E.g. formatNoMatches,  formatSearching and so one.

select2 is localized by you providing those functions with the correct
strings. in wicket you can do the same by specifying them in the
config object.

-igor


 thnx., Sandor



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 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: select2 localization questions

2012-09-04 Thread Sandor Feher

Igor Vaynberg-2 wrote
 
 On Tue, Sep 4, 2012 at 7:27 AM, Sandor Feher lt;sfeher@gt; wrote:
 Hi,

 I successfuly created a Select2Choice item in my form. I fill it up from
 a
 model and everything works fine but the listed choices' display in wrong
 codepage. I use utf8 everywhere and have no problems with cp.
 
 i believe this was fixed recently in master.
 
I use 1.0 from maven repo. Is it possible that 1.0 does not contain that ?


Igor Vaynberg-2 wrote
 
 The second one is how to localize select2 messages from select2.js ?
 E.g. formatNoMatches,  formatSearching and so one.
 
 select2 is localized by you providing those functions with the correct
 strings. in wicket you can do the same by specifying them in the
 config object.
 
 -igor
 
 
Stupid I was. Figured out meanwhile.. Sorry.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732p4651741.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: select2 localization questions

2012-09-04 Thread Igor Vaynberg
On Tue, Sep 4, 2012 at 10:14 AM, Sandor Feher sfe...@bluesystem.hu wrote:

 Igor Vaynberg-2 wrote

 On Tue, Sep 4, 2012 at 7:27 AM, Sandor Feher lt;sfeher@gt; wrote:
 Hi,

 I successfuly created a Select2Choice item in my form. I fill it up from
 a
 model and everything works fine but the listed choices' display in wrong
 codepage. I use utf8 everywhere and have no problems with cp.

 i believe this was fixed recently in master.

 I use 1.0 from maven repo. Is it possible that 1.0 does not contain that ?

i know for sure that one does not.

-igor




 Igor Vaynberg-2 wrote

 The second one is how to localize select2 messages from select2.js ?
 E.g. formatNoMatches,  formatSearching and so one.

 select2 is localized by you providing those functions with the correct
 strings. in wicket you can do the same by specifying them in the
 config object.

 -igor


 Stupid I was. Figured out meanwhile.. Sorry.




 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732p4651741.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 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: select2 localization questions

2012-09-04 Thread Sandor Feher
Okay. Just one more question.

I have a domain model (HrpBbheerk) which contains a Short column. I would
like to fill this via Select2Choice.
I read the select2-examples but not able to get rid it.

So the steps I took.

1. Fill my hepar5list list from my domain model (HrpBbhepar5). This contains
couple of columns but I only need for two. One for value and one for
description. If possible I don't want to create another wrapper class just
for this case.
2. Create a form, added a model (HrpBbheerk)
3. Added a new Select2Choice to the form with that Short column mentioned
above.

Snippets:

...
fillHepar5(); // step 1
HrpBbheertk heertk = fillHeertk();  
IModel model=new CompoundPropertyModel(heertk);
sform.setModel(model);  // step 2
Select2Choice dimelemert = new Select2Choice(dimelemert,new
PropertyModel(sform.getModel(),dimelemert),new Hepar5Provider());  // step
3

..

  private static ListHrpBbhepar5 queryMatches(String term, int page, int
pageSize) {

ListHrpBbhepar5 result = new ArrayListHrpBbhepar5();
term = term.toUpperCase();

final int offset = page * pageSize;

int matched = 0;

for (HrpBbhepar5 hepar5 : hepar5list) {
if (result.size() == pageSize) {
break;
}

if (hepar5.getDertekmegnev().toUpperCase().startsWith(term)) {
matched++;
if (matched  offset) {
result.add(hepar5);
}
}
}
return result;
}


public class Hepar5Provider extends TextChoiceProviderHrpBbhepar5 {

@Override
protected String getDisplayText(HrpBbhepar5 choice) {
return choice.getDertekmegnev();
}

@Override
protected Object getId(HrpBbhepar5 choice) {
   return choice;
}

@Override
public void query(String term, int page, ResponseHrpBbhepar5
response) {
response.addAll(queryMatches(term, page, 10));
response.setHasMore(response.size() == 10);
}

@Override
public CollectionHrpBbhepar5 toChoices(CollectionString ids) {
ArrayListHrpBbhepar5 hepar5idlist = new
ArrayListHrpBbhepar5();

Iterator it = hepar5list.iterator();
while (it.hasNext()) {
HrpBbhepar5 h = (HrpBbhepar5) it.next();
hepar5idlist.add(h);
}
return hepar5idlist;
}
}

.

It complains that java.lang.Short cannot be cast to
hu.xxx.model.HrpBbhepar5.
Please let me know what  should I do.

thnx., Sandor








--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732p4651753.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: select2 localization questions

2012-09-04 Thread Igor Vaynberg
you should declare your Select2Choice as Select2ChoiceShort since
that is its model type. once you do this the compiler will tell you
that your TextChoiceProvider should be TextChoiceProviderShort
instead of HrpBbhepar5

-igor

On Tue, Sep 4, 2012 at 1:42 PM, Sandor Feher sfe...@bluesystem.hu wrote:
 Okay. Just one more question.

 I have a domain model (HrpBbheerk) which contains a Short column. I would
 like to fill this via Select2Choice.
 I read the select2-examples but not able to get rid it.

 So the steps I took.

 1. Fill my hepar5list list from my domain model (HrpBbhepar5). This contains
 couple of columns but I only need for two. One for value and one for
 description. If possible I don't want to create another wrapper class just
 for this case.
 2. Create a form, added a model (HrpBbheerk)
 3. Added a new Select2Choice to the form with that Short column mentioned
 above.

 Snippets:

 ...
 fillHepar5(); // step 1
 HrpBbheertk heertk = fillHeertk();
 IModel model=new CompoundPropertyModel(heertk);
 sform.setModel(model);  // step 2
 Select2Choice dimelemert = new Select2Choice(dimelemert,new
 PropertyModel(sform.getModel(),dimelemert),new Hepar5Provider());  // step
 3

 ..

   private static ListHrpBbhepar5 queryMatches(String term, int page, int
 pageSize) {

 ListHrpBbhepar5 result = new ArrayListHrpBbhepar5();
 term = term.toUpperCase();

 final int offset = page * pageSize;

 int matched = 0;

 for (HrpBbhepar5 hepar5 : hepar5list) {
 if (result.size() == pageSize) {
 break;
 }

 if (hepar5.getDertekmegnev().toUpperCase().startsWith(term)) {
 matched++;
 if (matched  offset) {
 result.add(hepar5);
 }
 }
 }
 return result;
 }


 public class Hepar5Provider extends TextChoiceProviderHrpBbhepar5 {

 @Override
 protected String getDisplayText(HrpBbhepar5 choice) {
 return choice.getDertekmegnev();
 }

 @Override
 protected Object getId(HrpBbhepar5 choice) {
return choice;
 }

 @Override
 public void query(String term, int page, ResponseHrpBbhepar5
 response) {
 response.addAll(queryMatches(term, page, 10));
 response.setHasMore(response.size() == 10);
 }

 @Override
 public CollectionHrpBbhepar5 toChoices(CollectionString ids) {
 ArrayListHrpBbhepar5 hepar5idlist = new
 ArrayListHrpBbhepar5();

 Iterator it = hepar5list.iterator();
 while (it.hasNext()) {
 HrpBbhepar5 h = (HrpBbhepar5) it.next();
 hepar5idlist.add(h);
 }
 return hepar5idlist;
 }
 }

 .

 It complains that java.lang.Short cannot be cast to
 hu.xxx.model.HrpBbhepar5.
 Please let me know what  should I do.

 thnx., Sandor








 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732p4651753.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 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