You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Volker Weber <us...@weber-oldenburg.de> on 2005/11/23 15:46:58 UTC

Re: {Filename?} German Umlauts with InputSuggestAjax, Stylesheets and Speed of Code with InputSuggestAjax

Hi Andy,



andreas.mitter@magnasteyr.com wrote:
> Hi all!
> 
> I have now achieved that the InputSuggestAjax Component works, but I
> have still three questions and I would be terribly grateful, if somebody
> could answer me:
> 
> 1) How can I add stylesheet attributes for the List and the Inputfield.
> I have already tried to add a styleClass attribute, but it doesn't work
> like I want it.

No idea, i think this is not supported yet. Martin?

> 
> 2) I have Problems with German Umlauts like äöü .. They are display with
> a ? in the List... How can I change this? Is this done per purpose or is
> this a bug?

This is a bug i think, the response is not specialy encoded before send.

> 
> ole0.bmp
> 
> 
> 3) My code works, but I'm afraid that it will be too slow, if the list
> contains too much records. Perhaps some of you can tell me, if there
> could be problems with my code and what I can do better
> 
> (I get the List of Fnames from an Hibernate Query)
> 
>         public List getItems(String prefix, Integer maxSize) {
> 
>                 qh = (QueryHelper) FacesUtil.getManagedBean("queryHelper");
>                 Iterator it = qh.getFnames().iterator();
> 
>                 List li = new ArrayList();
> 
>                 try {
>                         while (it.hasNext()) {
> 
>                                 EtCompany company = (EtCompany) it.next();
> 
>                                 String fname =
> company.getCompany().toUpperCase();
>                                                        
>                                 if
> (fname.startsWith(prefix.toUpperCase())) {
>                                         if(li.size()<maxSize.intValue())
>                                         {
>                                         li.add(fname);
>                                         }
>                                 }
> 
>                         }
>                 }
>                 catch (Exception e) {
>                         e.printStackTrace();
>                 }
>                 return li;
>         }
> 

1. get the prefix.toUpperCase() out of the loop.
2. break the loop if maxSize is reached, don't continue looping without
any adding to result list:

  int max = maxSize.intValue() - 1;
  String upperCasePrefix = prefix.toUpperCase();

  while (it.hasNext()) {
    if (li.size() > max) {
      break;
    }
    EtCompany company = (EtCompany) it.next();
    String fname = company.getCompany().toUpperCase();

    if (fname.startsWith(upperCasePrefix)) {
      li.add(fname);
    }
  }

Regards,

  Volker



> Regards
> Andy
> 
-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.