Combo

View: New views
5 Messages — Rating Filter:   Alert me  

Combo

by aru1959 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Merhabalar,

Jsf ve Rich faces ile uygulama geliştiriyorum.
İller ve ilçeler gibi iki adet combo var,
ilçeler combo sunun
bir önceki il kombosunda seçilen ile göre dolmasına ihtiyacım var.

Yardımcı olanlara şimdiden teşekkür ediyorum.
Herkeze iyi çalışmalar.


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/jsf_tr/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/jsf_tr/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:jsf_tr-digest@...
    mailto:jsf_tr-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    jsf_tr-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Re: Combo

by hasan tolak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

merhabalar

Siz il ilce icin istemistiniz RichFaces suggestionBox iliskin cozum asagida

ulke ve sehir icin verilmistir.

Kolay gelsin

Hasan

adress.jsp
.....
// country Suggestion Box
<h:panelGrid columns="3" align="left" style="margin-left:-3px">
        <h:inputText value="#{jobSeekerCreateBean.country}" id="country" required="true"
                     styleClass="inputShort" validator="#{jobSeekerCreateBean.validateCountry}"/>
       
        <rich:suggestionbox id="suggestCountryId" for="country" tokens=",["
                            rules="#{suggestionBox.rules}"
                            suggestionAction="#{jobSeekerCreateBean.countryComplete}" var="country"
                            fetchValue="#{country}"
                            first="#{suggestionBox.intFirst}"
                            minChars="#{suggestionBox.minchars}"
                            shadowOpacity="#{suggestionBox.shadowOpacity}"
                            border="#{suggestionBox.border}" width="#{suggestionBox.width}"
                            height="#{suggestionBox.height}"
                            shadowDepth="#{suggestionBox.shadowDepth}"
                            cellpadding="#{suggestionBox.cellpadding}"
                            nothingLabel="#{msgs.noCountryFound}">
            <a4j:support event="onselect" actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
                         immediate="true" reRender="country"/>
            <h:column>
                <h:outputText value="#{country}"/>
            </h:column>
        </rich:suggestionbox>
    </h:panelGrid>
   
   
    // city Suggestion Box
    <h:panelGrid columns="3" align="left" style="margin-left:-3px">
            <h:inputText value="#{jobSeekerCreateBean.city}" id="city" required="true" styleClass="inputShort"/>
   
            <rich:suggestionbox id="suggestCityId" for="city" tokens=",["
                                rules="#{suggestionBox.rules}"
                                suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
                                fetchValue="#{city}"
                                first="#{suggestionBox.intFirst}"
                                minChars="#{suggestionBox.minchars}"
                                shadowOpacity="#{suggestionBox.shadowOpacity}"
                                border="#{suggestionBox.border}" width="#{suggestionBox.width}"
                                height="#{suggestionBox.height}"
                                shadowDepth="#{suggestionBox.shadowDepth}"
                                cellpadding="#{suggestionBox.cellpadding}"
                                nothingLabel="#{msgs.noCityFound}">
                <a4j:support event="onselect" actionListener="#{jobSeekerCreateBean.selectCityAListener}"
                             immediate="true" reRender="city"/>
                <h:column>
                    <h:outputText value="#{city}"/>
                </h:column>
            </rich:suggestionbox>
    </h:panelGrid>
    ....
   
    //countries methods
   
    private void setCountries() {
            countries.clear();
            List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
            Country c;
            if (isNullOrEmpty(cs)) return;
   
            for (Object o : cs) {
                c = (Country) o;
                countries.add(c.getCountryName());
            }
            // System.out.println("counries initialized: " + countries.size());
    }
   
   
    public List<String> countryComplete(Object suggest) {
                String pref = trim((String) suggest);
                result.clear();
                System.out.println("countryComplete(): " + suggest);
                for (String country_ : countries) {
                    if (!isNullOrEmpty(country_) &&
                            country_.toLowerCase().startsWith(pref.toLowerCase())) {
                        result.add(country_);
                    }
                }
       
                return result;
        }
       
       
    public void selectCountryAListener(ActionEvent event) {
                System.out.println("selectCountryAListener() ");
                country = trim(FacesUtils.getReqParam("country"));
                setCities();
                FacesContext.getCurrentInstance().renderResponse();
    }
   
   
    public void validateCountry(FacesContext context, UIComponent toValidate, Object value) {
            // Date dob_ = (Date) dobInput.getSubmittedValue();
            String country = (String) value;
            if (!isNullOrEmpty(country)) {
                if (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) == null) {
                    Object[] params = {Messages.getString(Keys.APP_MESSAGES, "country", null)};
                    FacesMessage message
                            = Messages.getMessage(
                            Keys.APP_MESSAGES, "isNotValid_param1", params);
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    throw new ValidatorException(message);
                }
            }
    }
   
   
   
   
    //cities methods
   
    protected void setCities() {
            cities.clear();
            List cs = null;
            if (!isNullOrEmpty(country)) {
                cs = DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
            }
            if (isNullOrEmpty(cs)) return;
   
            City c;
            for (Object o : cs) {
                c = (City) o;
                cities.add(c.getCityName());
            }
            System.out.println(country + " cities initialized: " + cities.size());
    }
   
    public List<String> cityComplete(Object suggest) {
            String pref = trim((String) suggest);
            result.clear();
            for (String city_ : cities) {
                if (!isNullOrEmpty(city_) &&
                        city_.toLowerCase().startsWith(pref.toLowerCase())) {
                    result.add(city_);
                }
            }
            if (isNullOrEmpty(result) && isAddInputToCity()) {
                result.add(pref);
            }
            return result;
    }
   
   
     public void selectCityAListener(ActionEvent event) {
            System.out.println("selectCityAListener() ");
            city = trim(FacesUtils.getReqParam("city"));
            FacesContext.getCurrentInstance().renderResponse();
    }
   
   
   
   

 


--- On Mon, 17/11/08, aru1959 <aru1959@...> wrote:

> From: aru1959 <aru1959@...>
> Subject: [jsf_tr] Combo
> To: jsf_tr@...
> Date: Monday, 17 November, 2008, 3:50 PM
> Merhabalar,
>
> Jsf ve Rich faces ile uygulama geliştiriyorum.
> İller ve ilçeler gibi iki adet combo var,
> ilçeler combo sunun
> bir önceki il kombosunda seçilen ile göre dolmasına
> ihtiyacım var.
>
> Yardımcı olanlara şimdiden teşekkür ediyorum.
> Herkeze iyi çalışmalar.
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

     
adress.jsp
.....
// country Suggestion Box
<h:panelGrid columns="3" align="left" style="margin-left:-3px">
        <h:inputText value="#{jobSeekerCreateBean.country}" id="country" required="true"
                     styleClass="inputShort" validator="#{jobSeekerCreateBean.validateCountry}"/>
       
        <rich:suggestionbox id="suggestCountryId" for="country" tokens=",["
                            rules="#{suggestionBox.rules}"
                            suggestionAction="#{jobSeekerCreateBean.countryComplete}" var="country"
                            fetchValue="#{country}"
                            first="#{suggestionBox.intFirst}"
                            minChars="#{suggestionBox.minchars}"
                            shadowOpacity="#{suggestionBox.shadowOpacity}"
                            border="#{suggestionBox.border}" width="#{suggestionBox.width}"
                            height="#{suggestionBox.height}"
                            shadowDepth="#{suggestionBox.shadowDepth}"
                            cellpadding="#{suggestionBox.cellpadding}"
                            nothingLabel="#{msgs.noCountryFound}">
            <a4j:support event="onselect" actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
                         immediate="true" reRender="country"/>
            <h:column>
                <h:outputText value="#{country}"/>
            </h:column>
        </rich:suggestionbox>
    </h:panelGrid>
   
   
    // city Suggestion Box
    <h:panelGrid columns="3" align="left" style="margin-left:-3px">
            <h:inputText value="#{jobSeekerCreateBean.city}" id="city" required="true" styleClass="inputShort"/>
   
            <rich:suggestionbox id="suggestCityId" for="city" tokens=",["
                                rules="#{suggestionBox.rules}"
                                suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
                                fetchValue="#{city}"
                                first="#{suggestionBox.intFirst}"
                                minChars="#{suggestionBox.minchars}"
                                shadowOpacity="#{suggestionBox.shadowOpacity}"
                                border="#{suggestionBox.border}" width="#{suggestionBox.width}"
                                height="#{suggestionBox.height}"
                                shadowDepth="#{suggestionBox.shadowDepth}"
                                cellpadding="#{suggestionBox.cellpadding}"
                                nothingLabel="#{msgs.noCityFound}">
                <a4j:support event="onselect" actionListener="#{jobSeekerCreateBean.selectCityAListener}"
                             immediate="true" reRender="city"/>
                <h:column>
                    <h:outputText value="#{city}"/>
                </h:column>
            </rich:suggestionbox>
    </h:panelGrid>
    ....
   
    //countries methods
   
    private void setCountries() {
            countries.clear();
            List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
            Country c;
            if (isNullOrEmpty(cs)) return;
   
            for (Object o : cs) {
                c = (Country) o;
                countries.add(c.getCountryName());
            }
            // System.out.println("counries initialized: " + countries.size());
    }
   
   
    public List<String> countryComplete(Object suggest) {
                String pref = trim((String) suggest);
                result.clear();
                System.out.println("countryComplete(): " + suggest);
                for (String country_ : countries) {
                    if (!isNullOrEmpty(country_) &&
                            country_.toLowerCase().startsWith(pref.toLowerCase())) {
                        result.add(country_);
                    }
                }
       
                return result;
        }
       
       
    public void selectCountryAListener(ActionEvent event) {
                System.out.println("selectCountryAListener() ");
                country = trim(FacesUtils.getReqParam("country"));
                setCities();
                FacesContext.getCurrentInstance().renderResponse();
    }
   
   
    public void validateCountry(FacesContext context, UIComponent toValidate, Object value) {
            // Date dob_ = (Date) dobInput.getSubmittedValue();
            String country = (String) value;
            if (!isNullOrEmpty(country)) {
                if (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) == null) {
                    Object[] params = {Messages.getString(Keys.APP_MESSAGES, "country", null)};
                    FacesMessage message
                            = Messages.getMessage(
                            Keys.APP_MESSAGES, "isNotValid_param1", params);
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    throw new ValidatorException(message);
                }
            }
    }
   
   
   
   
    //cities methods
   
    protected void setCities() {
            cities.clear();
            List cs = null;
            if (!isNullOrEmpty(country)) {
                cs = DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
            }
            if (isNullOrEmpty(cs)) return;
   
            City c;
            for (Object o : cs) {
                c = (City) o;
                cities.add(c.getCityName());
            }
            System.out.println(country + " cities initialized: " + cities.size());
    }
   
    public List<String> cityComplete(Object suggest) {
            String pref = trim((String) suggest);
            result.clear();
            for (String city_ : cities) {
                if (!isNullOrEmpty(city_) &&
                        city_.toLowerCase().startsWith(pref.toLowerCase())) {
                    result.add(city_);
                }
            }
            if (isNullOrEmpty(result) && isAddInputToCity()) {
                result.add(pref);
            }
            return result;
    }
   
   
     public void selectCityAListener(ActionEvent event) {
            System.out.println("selectCityAListener() ");
            city = trim(FacesUtils.getReqParam("city"));
            FacesContext.getCurrentInstance().renderResponse();
    }
   
   
   

Re: Combo

by aru1959 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Teþekkürler, deniyorum.





--- In jsf_tr@..., hasan tolak <h_tolak@...> wrote:
>
> merhabalar
>
> Siz il ilce icin istemistiniz RichFaces suggestionBox iliskin cozum
asagida

>
> ulke ve sehir icin verilmistir.
>
> Kolay gelsin
>
> Hasan
>
> adress.jsp
> .....
> // country Suggestion Box
> <h:panelGrid columns="3" align="left" style="margin-left:-3px">
>         <h:inputText value="#{jobSeekerCreateBean.country}"
id="country" required="true"
>                      styleClass="inputShort"
validator="#{jobSeekerCreateBean.validateCountry}"/>
>        
>         <rich:suggestionbox id="suggestCountryId" for="country"
tokens=",["
>                             rules="#{suggestionBox.rules}"
>                            
suggestionAction="#{jobSeekerCreateBean.countryComplete}"
var="country"
>                             fetchValue="#{country}"
>                             first="#{suggestionBox.intFirst}"
>                             minChars="#{suggestionBox.minchars}"
>                            
shadowOpacity="#{suggestionBox.shadowOpacity}"
>                             border="#{suggestionBox.border}"
width="#{suggestionBox.width}"
>                             height="#{suggestionBox.height}"
>                            
shadowDepth="#{suggestionBox.shadowDepth}"
>                            
cellpadding="#{suggestionBox.cellpadding}"
>                             nothingLabel="#{msgs.noCountryFound}">
>             <a4j:support event="onselect"
actionListener="#{jobSeekerCreateBean.selectCountryAListener}"

>                          immediate="true" reRender="country"/>
>             <h:column>
>                 <h:outputText value="#{country}"/>
>             </h:column>
>         </rich:suggestionbox>
>     </h:panelGrid>
>    
>    
>     // city Suggestion Box
>     <h:panelGrid columns="3" align="left" style="margin-left:-3px">
>             <h:inputText value="#{jobSeekerCreateBean.city}"
id="city" required="true" styleClass="inputShort"/>
>    
>             <rich:suggestionbox id="suggestCityId" for="city"
tokens=",["
>                                 rules="#{suggestionBox.rules}"
>                                
suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
>                                 fetchValue="#{city}"
>                                 first="#{suggestionBox.intFirst}"
>                                 minChars="#{suggestionBox.minchars}"
>                                
shadowOpacity="#{suggestionBox.shadowOpacity}"
>                                 border="#{suggestionBox.border}"
width="#{suggestionBox.width}"
>                                 height="#{suggestionBox.height}"
>                                
shadowDepth="#{suggestionBox.shadowDepth}"
>                                
cellpadding="#{suggestionBox.cellpadding}"
>                                 nothingLabel="#{msgs.noCityFound}">
>                 <a4j:support event="onselect"
actionListener="#{jobSeekerCreateBean.selectCityAListener}"

>                              immediate="true" reRender="city"/>
>                 <h:column>
>                     <h:outputText value="#{city}"/>
>                 </h:column>
>             </rich:suggestionbox>
>     </h:panelGrid>
>     ....
>    
>     //countries methods
>    
>     private void setCountries() {
>             countries.clear();
>             List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
>             Country c;
>             if (isNullOrEmpty(cs)) return;
>    
>             for (Object o : cs) {
>                 c = (Country) o;
>                 countries.add(c.getCountryName());
>             }
>             // System.out.println("counries initialized: " +
countries.size());

>     }
>    
>    
>     public List<String> countryComplete(Object suggest) {
>                 String pref = trim((String) suggest);
>                 result.clear();
>                 System.out.println("countryComplete(): " + suggest);
>                 for (String country_ : countries) {
>                     if (!isNullOrEmpty(country_) &&
>                            
country_.toLowerCase().startsWith(pref.toLowerCase())) {

>                         result.add(country_);
>                     }
>                 }
>        
>                 return result;
>         }
>        
>        
>     public void selectCountryAListener(ActionEvent event) {
>                 System.out.println("selectCountryAListener() ");
>                 country = trim(FacesUtils.getReqParam("country"));
>                 setCities();
>                 FacesContext.getCurrentInstance().renderResponse();
>     }
>    
>    
>     public void validateCountry(FacesContext context, UIComponent
toValidate, Object value) {
>             // Date dob_ = (Date) dobInput.getSubmittedValue();
>             String country = (String) value;
>             if (!isNullOrEmpty(country)) {
>                 if
(DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
null) {
>                     Object[] params =
{Messages.getString(Keys.APP_MESSAGES, "country", null)};
>                     FacesMessage message
>                             = Messages.getMessage(
>                             Keys.APP_MESSAGES, "isNotValid_param1",
params);
>                    
message.setSeverity(FacesMessage.SEVERITY_ERROR);

>                     throw new ValidatorException(message);
>                 }
>             }
>     }
>    
>    
>    
>    
>     //cities methods
>    
>     protected void setCities() {
>             cities.clear();
>             List cs = null;
>             if (!isNullOrEmpty(country)) {
>                 cs =
DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
>             }
>             if (isNullOrEmpty(cs)) return;
>    
>             City c;
>             for (Object o : cs) {
>                 c = (City) o;
>                 cities.add(c.getCityName());
>             }
>             System.out.println(country + " cities initialized: " +
cities.size());
>     }
>    
>     public List<String> cityComplete(Object suggest) {
>             String pref = trim((String) suggest);
>             result.clear();
>             for (String city_ : cities) {
>                 if (!isNullOrEmpty(city_) &&
>                        
city_.toLowerCase().startsWith(pref.toLowerCase())) {

>                     result.add(city_);
>                 }
>             }
>             if (isNullOrEmpty(result) && isAddInputToCity()) {
>                 result.add(pref);
>             }
>             return result;
>     }
>    
>    
>      public void selectCityAListener(ActionEvent event) {
>             System.out.println("selectCityAListener() ");
>             city = trim(FacesUtils.getReqParam("city"));
>             FacesContext.getCurrentInstance().renderResponse();
>     }
>    
>    
>    
>    
>
>  
>
>
> --- On Mon, 17/11/08, aru1959 <aru1959@...> wrote:
>
> > From: aru1959 <aru1959@...>
> > Subject: [jsf_tr] Combo
> > To: jsf_tr@...
> > Date: Monday, 17 November, 2008, 3:50 PM
> > Merhabalar,
> >
> > Jsf ve Rich faces ile uygulama geliştiriyorum.
> > İller ve ilçeler gibi iki adet combo var,
> > ilçeler combo sunun
> > bir önceki il kombosunda seçilen ile göre dolmasına
> > ihtiyacım var.
> >
> > Yardımcı olanlara şimdiden teşekkür ediyorum.
> > Herkeze iyi çalışmalar.
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>      
> adress.jsp
> .....
> // country Suggestion Box
> <h:panelGrid columns="3" align="left" style="margin-left:-3px">
>         <h:inputText value="#{jobSeekerCreateBean.country}"
id="country" required="true"
>                      styleClass="inputShort"
validator="#{jobSeekerCreateBean.validateCountry}"/>
>        
>         <rich:suggestionbox id="suggestCountryId" for="country"
tokens=",["
>                             rules="#{suggestionBox.rules}"
>                            
suggestionAction="#{jobSeekerCreateBean.countryComplete}"
var="country"
>                             fetchValue="#{country}"
>                             first="#{suggestionBox.intFirst}"
>                             minChars="#{suggestionBox.minchars}"
>                            
shadowOpacity="#{suggestionBox.shadowOpacity}"
>                             border="#{suggestionBox.border}"
width="#{suggestionBox.width}"
>                             height="#{suggestionBox.height}"
>                            
shadowDepth="#{suggestionBox.shadowDepth}"
>                            
cellpadding="#{suggestionBox.cellpadding}"
>                             nothingLabel="#{msgs.noCountryFound}">
>             <a4j:support event="onselect"
actionListener="#{jobSeekerCreateBean.selectCountryAListener}"

>                          immediate="true" reRender="country"/>
>             <h:column>
>                 <h:outputText value="#{country}"/>
>             </h:column>
>         </rich:suggestionbox>
>     </h:panelGrid>
>    
>    
>     // city Suggestion Box
>     <h:panelGrid columns="3" align="left" style="margin-left:-3px">
>             <h:inputText value="#{jobSeekerCreateBean.city}"
id="city" required="true" styleClass="inputShort"/>
>    
>             <rich:suggestionbox id="suggestCityId" for="city"
tokens=",["
>                                 rules="#{suggestionBox.rules}"
>                                
suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
>                                 fetchValue="#{city}"
>                                 first="#{suggestionBox.intFirst}"
>                                 minChars="#{suggestionBox.minchars}"
>                                
shadowOpacity="#{suggestionBox.shadowOpacity}"
>                                 border="#{suggestionBox.border}"
width="#{suggestionBox.width}"
>                                 height="#{suggestionBox.height}"
>                                
shadowDepth="#{suggestionBox.shadowDepth}"
>                                
cellpadding="#{suggestionBox.cellpadding}"
>                                 nothingLabel="#{msgs.noCityFound}">
>                 <a4j:support event="onselect"
actionListener="#{jobSeekerCreateBean.selectCityAListener}"

>                              immediate="true" reRender="city"/>
>                 <h:column>
>                     <h:outputText value="#{city}"/>
>                 </h:column>
>             </rich:suggestionbox>
>     </h:panelGrid>
>     ....
>    
>     //countries methods
>    
>     private void setCountries() {
>             countries.clear();
>             List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
>             Country c;
>             if (isNullOrEmpty(cs)) return;
>    
>             for (Object o : cs) {
>                 c = (Country) o;
>                 countries.add(c.getCountryName());
>             }
>             // System.out.println("counries initialized: " +
countries.size());

>     }
>    
>    
>     public List<String> countryComplete(Object suggest) {
>                 String pref = trim((String) suggest);
>                 result.clear();
>                 System.out.println("countryComplete(): " + suggest);
>                 for (String country_ : countries) {
>                     if (!isNullOrEmpty(country_) &&
>                            
country_.toLowerCase().startsWith(pref.toLowerCase())) {

>                         result.add(country_);
>                     }
>                 }
>        
>                 return result;
>         }
>        
>        
>     public void selectCountryAListener(ActionEvent event) {
>                 System.out.println("selectCountryAListener() ");
>                 country = trim(FacesUtils.getReqParam("country"));
>                 setCities();
>                 FacesContext.getCurrentInstance().renderResponse();
>     }
>    
>    
>     public void validateCountry(FacesContext context, UIComponent
toValidate, Object value) {
>             // Date dob_ = (Date) dobInput.getSubmittedValue();
>             String country = (String) value;
>             if (!isNullOrEmpty(country)) {
>                 if
(DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
null) {
>                     Object[] params =
{Messages.getString(Keys.APP_MESSAGES, "country", null)};
>                     FacesMessage message
>                             = Messages.getMessage(
>                             Keys.APP_MESSAGES, "isNotValid_param1",
params);
>                    
message.setSeverity(FacesMessage.SEVERITY_ERROR);

>                     throw new ValidatorException(message);
>                 }
>             }
>     }
>    
>    
>    
>    
>     //cities methods
>    
>     protected void setCities() {
>             cities.clear();
>             List cs = null;
>             if (!isNullOrEmpty(country)) {
>                 cs =
DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
>             }
>             if (isNullOrEmpty(cs)) return;
>    
>             City c;
>             for (Object o : cs) {
>                 c = (City) o;
>                 cities.add(c.getCityName());
>             }
>             System.out.println(country + " cities initialized: " +
cities.size());
>     }
>    
>     public List<String> cityComplete(Object suggest) {
>             String pref = trim((String) suggest);
>             result.clear();
>             for (String city_ : cities) {
>                 if (!isNullOrEmpty(city_) &&
>                        
city_.toLowerCase().startsWith(pref.toLowerCase())) {

>                     result.add(city_);
>                 }
>             }
>             if (isNullOrEmpty(result) && isAddInputToCity()) {
>                 result.add(pref);
>             }
>             return result;
>     }
>    
>    
>      public void selectCityAListener(ActionEvent event) {
>             System.out.println("selectCityAListener() ");
>             city = trim(FacesUtils.getReqParam("city"));
>             FacesContext.getCurrentInstance().renderResponse();
>     }
>




Re: Re: Combo

by serkan koyun ide :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Selamlar.  Benim  de müs,teri ve ona ait departmanlar? için için
ihtiyac?m olmus,tu. As,ag(?daki gibi çözdük. a4j:support ta bir action
listener yazd?m. O listener combo içinde ki Musteri clas?n? al?yor.
Ald?g(?m Musteri clas?n? da departman lar? dolduran metoda parametre
olarak pass edip o müs,terinin departmanlar?n? dolduruyor:
*
müs,teri kombosu:*
* <s:decorate id="musteriDecoration" template="layout/display.xhtml">
<ui:define name="label">Müs,teri</ui:define>
<h:selectOneMenu value="#{alimSiparisHome.instance.musteri}"
                                 rendered="#{empty
loginKullanici.musteri.musteriId}"
                                 required="true"
                                 id="musteriKutusu" >
<s:selectItems value="#{musteriList.resultList}" var="muster"
                                     id="musteriSI"
label="#{muster.unvani}" noSelectionLabel=" "></s:selectItems>
<s:convertEntity />
<a:support event="onchange"
                                   
 reRender="musteriDecoration,departmanDecoration"
actionListener="#{alimSiparisHome.musteriComboListener}"
                                     bypassUpdates="true"
ajaxSingle="true" />
</h:selectOneMenu>
<h:message for="musteriKutusu" styleClass="message" rendered="true" />
</s:decorate>*
*departman** combosu:*
* <s:decorate id="departmanDecoration" template="layout/display.xhtml">
<ui:define name="label">Departman</ui:define>
<h:selectOneMenu value="#{alimSiparisHome.instance.departman}"
                         required="true"
                         requiredMessage="#{messages['belirtilmemis.Alan']}"
                         id="departmanKutusu">
<s:selectItems
value="#{departmanList.depAl(alimSiparisHome.departmanIcinMusteri)}"
var="dept" id="departamID"
                             label="#{dept.adi}" noSelectionLabel="
"></s:selectItems>
<s:convertEntity />
</h:selectOneMenu>
<h:message for="departmanKutusu" styleClass="message"
                         rendered="true" />
</s:decorate>*

*action listener metodu**:*
*    public void musteriComboListener (ActionEvent event)
         {
             HtmlSelectOneMenu  combo
=(HtmlSelectOneMenu)facesContext.getViewRoot().findComponent("alimSiparis:musteriDecoration:musteriKutusu");
             departmanIcinMusteri=(Musteri)combo.getValue();
         }*

bu da departman?n doldug(u yer:
*    public List<Departman> depAl(Musteri musteri) {
         System.out.println("***Buras? girdig(inde");
         if (musteri != null) {
             System.out.println("***Buras? da müs,teri geldi ise"
                     + musteri.getUnvani());
         }
         try {
             String query = "select departman from Departman departman "
                     + " where (departman.iptalKodu IS NULL "
                     + " or departman.iptalKodu = ' ' "
                     + " or departman.iptalKodu <> '*') ";
               query +=" and departman.musteri.musteriId=";
               query +=musteri.getMusteriId();

             return entityManager.createQuery(query).getResultList();
         } catch (Exception e) {
             e.printStackTrace();
             return null;
         }
     }*




aru1959 wrote:

>
> Teþekkürler, deniyorum.
>
> --- In jsf_tr@... <mailto:jsf_tr%40yahoogroups.com>, hasan
> tolak <h_tolak@...> wrote:
> >
> > merhabalar
> >
> > Siz il ilce icin istemistiniz RichFaces suggestionBox iliskin cozum
> asagida
> >
> > ulke ve sehir icin verilmistir.
> >
> > Kolay gelsin
> >
> > Hasan
> >
> > adress.jsp
> > .....
> > // country Suggestion Box
> > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > <h:inputText value="#{jobSeekerCreateBean.country}"
> id="country" required="true"
> > styleClass="inputShort"
> validator="#{jobSeekerCreateBean.validateCountry}"/>
> >
> > <rich:suggestionbox id="suggestCountryId" for="country"
> tokens=",["
> > rules="#{suggestionBox.rules}"
> >
> suggestionAction="#{jobSeekerCreateBean.countryComplete}"
> var="country"
> > fetchValue="#{country}"
> > first="#{suggestionBox.intFirst}"
> > minChars="#{suggestionBox.minchars}"
> >
> shadowOpacity="#{suggestionBox.shadowOpacity}"
> > border="#{suggestionBox.border}"
> width="#{suggestionBox.width}"
> > height="#{suggestionBox.height}"
> >
> shadowDepth="#{suggestionBox.shadowDepth}"
> >
> cellpadding="#{suggestionBox.cellpadding}"
> > nothingLabel="#{msgs.noCountryFound}">
> > <a4j:support event="onselect"
> actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
> > immediate="true" reRender="country"/>
> > <h:column>
> > <h:outputText value="#{country}"/>
> > </h:column>
> > </rich:suggestionbox>
> > </h:panelGrid>
> >
> >
> > // city Suggestion Box
> > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > <h:inputText value="#{jobSeekerCreateBean.city}"
> id="city" required="true" styleClass="inputShort"/>
> >
> > <rich:suggestionbox id="suggestCityId" for="city"
> tokens=",["
> > rules="#{suggestionBox.rules}"
> >
> suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
> > fetchValue="#{city}"
> > first="#{suggestionBox.intFirst}"
> > minChars="#{suggestionBox.minchars}"
> >
> shadowOpacity="#{suggestionBox.shadowOpacity}"
> > border="#{suggestionBox.border}"
> width="#{suggestionBox.width}"
> > height="#{suggestionBox.height}"
> >
> shadowDepth="#{suggestionBox.shadowDepth}"
> >
> cellpadding="#{suggestionBox.cellpadding}"
> > nothingLabel="#{msgs.noCityFound}">
> > <a4j:support event="onselect"
> actionListener="#{jobSeekerCreateBean.selectCityAListener}"
> > immediate="true" reRender="city"/>
> > <h:column>
> > <h:outputText value="#{city}"/>
> > </h:column>
> > </rich:suggestionbox>
> > </h:panelGrid>
> > ....
> >
> > //countries methods
> >
> > private void setCountries() {
> > countries.clear();
> > List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
> > Country c;
> > if (isNullOrEmpty(cs)) return;
> >
> > for (Object o : cs) {
> > c = (Country) o;
> > countries.add(c.getCountryName());
> > }
> > // System.out.println("counries initialized: " +
> countries.size());
> > }
> >
> >
> > public List<String> countryComplete(Object suggest) {
> > String pref = trim((String) suggest);
> > result.clear();
> > System.out.println("countryComplete(): " + suggest);
> > for (String country_ : countries) {
> > if (!isNullOrEmpty(country_) &&
> >
> country_.toLowerCase().startsWith(pref.toLowerCase())) {
> > result.add(country_);
> > }
> > }
> >
> > return result;
> > }
> >
> >
> > public void selectCountryAListener(ActionEvent event) {
> > System.out.println("selectCountryAListener() ");
> > country = trim(FacesUtils.getReqParam("country"));
> > setCities();
> > FacesContext.getCurrentInstance().renderResponse();
> > }
> >
> >
> > public void validateCountry(FacesContext context, UIComponent
> toValidate, Object value) {
> > // Date dob_ = (Date) dobInput.getSubmittedValue();
> > String country = (String) value;
> > if (!isNullOrEmpty(country)) {
> > if
> (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
> null) {
> > Object[] params =
> {Messages.getString(Keys.APP_MESSAGES, "country", null)};
> > FacesMessage message
> > = Messages.getMessage(
> > Keys.APP_MESSAGES, "isNotValid_param1",
> params);
> >
> message.setSeverity(FacesMessage.SEVERITY_ERROR);
> > throw new ValidatorException(message);
> > }
> > }
> > }
> >
> >
> >
> >
> > //cities methods
> >
> > protected void setCities() {
> > cities.clear();
> > List cs = null;
> > if (!isNullOrEmpty(country)) {
> > cs =
> DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
> > }
> > if (isNullOrEmpty(cs)) return;
> >
> > City c;
> > for (Object o : cs) {
> > c = (City) o;
> > cities.add(c.getCityName());
> > }
> > System.out.println(country + " cities initialized: " +
> cities.size());
> > }
> >
> > public List<String> cityComplete(Object suggest) {
> > String pref = trim((String) suggest);
> > result.clear();
> > for (String city_ : cities) {
> > if (!isNullOrEmpty(city_) &&
> >
> city_.toLowerCase().startsWith(pref.toLowerCase())) {
> > result.add(city_);
> > }
> > }
> > if (isNullOrEmpty(result) && isAddInputToCity()) {
> > result.add(pref);
> > }
> > return result;
> > }
> >
> >
> > public void selectCityAListener(ActionEvent event) {
> > System.out.println("selectCityAListener() ");
> > city = trim(FacesUtils.getReqParam("city"));
> > FacesContext.getCurrentInstance().renderResponse();
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> > --- On Mon, 17/11/08, aru1959 <aru1959@...> wrote:
> >
> > > From: aru1959 <aru1959@...>
> > > Subject: [jsf_tr] Combo
> > > To: jsf_tr@... <mailto:jsf_tr%40yahoogroups.com>
> > > Date: Monday, 17 November, 2008, 3:50 PM
> > > Merhabalar,
> > >
> > > Jsf ve Rich faces ile uygulama geliÅY"tiriyorum.
> > > İller ve ilçeler gibi iki adet combo var,
> > > ilçeler combo sunun
> > > bir önceki il kombosunda seçilen ile göre dolmasına
> > > ihtiyacım var.
> > >
> > > Yardımcı olanlara ÅY"imdiden teÅY"ekkür ediyorum.
> > > Herkeze iyi çalıÅY"malar.
> > >
> > >
> > > ------------------------------------
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> >
> >
> > adress.jsp
> > .....
> > // country Suggestion Box
> > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > <h:inputText value="#{jobSeekerCreateBean.country}"
> id="country" required="true"
> > styleClass="inputShort"
> validator="#{jobSeekerCreateBean.validateCountry}"/>
> >
> > <rich:suggestionbox id="suggestCountryId" for="country"
> tokens=",["
> > rules="#{suggestionBox.rules}"
> >
> suggestionAction="#{jobSeekerCreateBean.countryComplete}"
> var="country"
> > fetchValue="#{country}"
> > first="#{suggestionBox.intFirst}"
> > minChars="#{suggestionBox.minchars}"
> >
> shadowOpacity="#{suggestionBox.shadowOpacity}"
> > border="#{suggestionBox.border}"
> width="#{suggestionBox.width}"
> > height="#{suggestionBox.height}"
> >
> shadowDepth="#{suggestionBox.shadowDepth}"
> >
> cellpadding="#{suggestionBox.cellpadding}"
> > nothingLabel="#{msgs.noCountryFound}">
> > <a4j:support event="onselect"
> actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
> > immediate="true" reRender="country"/>
> > <h:column>
> > <h:outputText value="#{country}"/>
> > </h:column>
> > </rich:suggestionbox>
> > </h:panelGrid>
> >
> >
> > // city Suggestion Box
> > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > <h:inputText value="#{jobSeekerCreateBean.city}"
> id="city" required="true" styleClass="inputShort"/>
> >
> > <rich:suggestionbox id="suggestCityId" for="city"
> tokens=",["
> > rules="#{suggestionBox.rules}"
> >
> suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
> > fetchValue="#{city}"
> > first="#{suggestionBox.intFirst}"
> > minChars="#{suggestionBox.minchars}"
> >
> shadowOpacity="#{suggestionBox.shadowOpacity}"
> > border="#{suggestionBox.border}"
> width="#{suggestionBox.width}"
> > height="#{suggestionBox.height}"
> >
> shadowDepth="#{suggestionBox.shadowDepth}"
> >
> cellpadding="#{suggestionBox.cellpadding}"
> > nothingLabel="#{msgs.noCityFound}">
> > <a4j:support event="onselect"
> actionListener="#{jobSeekerCreateBean.selectCityAListener}"
> > immediate="true" reRender="city"/>
> > <h:column>
> > <h:outputText value="#{city}"/>
> > </h:column>
> > </rich:suggestionbox>
> > </h:panelGrid>
> > ....
> >
> > //countries methods
> >
> > private void setCountries() {
> > countries.clear();
> > List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
> > Country c;
> > if (isNullOrEmpty(cs)) return;
> >
> > for (Object o : cs) {
> > c = (Country) o;
> > countries.add(c.getCountryName());
> > }
> > // System.out.println("counries initialized: " +
> countries.size());
> > }
> >
> >
> > public List<String> countryComplete(Object suggest) {
> > String pref = trim((String) suggest);
> > result.clear();
> > System.out.println("countryComplete(): " + suggest);
> > for (String country_ : countries) {
> > if (!isNullOrEmpty(country_) &&
> >
> country_.toLowerCase().startsWith(pref.toLowerCase())) {
> > result.add(country_);
> > }
> > }
> >
> > return result;
> > }
> >
> >
> > public void selectCountryAListener(ActionEvent event) {
> > System.out.println("selectCountryAListener() ");
> > country = trim(FacesUtils.getReqParam("country"));
> > setCities();
> > FacesContext.getCurrentInstance().renderResponse();
> > }
> >
> >
> > public void validateCountry(FacesContext context, UIComponent
> toValidate, Object value) {
> > // Date dob_ = (Date) dobInput.getSubmittedValue();
> > String country = (String) value;
> > if (!isNullOrEmpty(country)) {
> > if
> (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
> null) {
> > Object[] params =
> {Messages.getString(Keys.APP_MESSAGES, "country", null)};
> > FacesMessage message
> > = Messages.getMessage(
> > Keys.APP_MESSAGES, "isNotValid_param1",
> params);
> >
> message.setSeverity(FacesMessage.SEVERITY_ERROR);
> > throw new ValidatorException(message);
> > }
> > }
> > }
> >
> >
> >
> >
> > //cities methods
> >
> > protected void setCities() {
> > cities.clear();
> > List cs = null;
> > if (!isNullOrEmpty(country)) {
> > cs =
> DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
> > }
> > if (isNullOrEmpty(cs)) return;
> >
> > City c;
> > for (Object o : cs) {
> > c = (City) o;
> > cities.add(c.getCityName());
> > }
> > System.out.println(country + " cities initialized: " +
> cities.size());
> > }
> >
> > public List<String> cityComplete(Object suggest) {
> > String pref = trim((String) suggest);
> > result.clear();
> > for (String city_ : cities) {
> > if (!isNullOrEmpty(city_) &&
> >
> city_.toLowerCase().startsWith(pref.toLowerCase())) {
> > result.add(city_);
> > }
> > }
> > if (isNullOrEmpty(result) && isAddInputToCity()) {
> > result.add(pref);
> > }
> > return result;
> > }
> >
> >
> > public void selectCityAListener(ActionEvent event) {
> > System.out.println("selectCityAListener() ");
> > city = trim(FacesUtils.getReqParam("city"));
> > FacesContext.getCurrentInstance().renderResponse();
> > }
> >
>
>  


Re: Combo

by aru1959 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yardimlariniz icin cok teþekkur ederim Serkan Bey,
sorunum sayenizde cozuldu
yonteminizi kendi uygulamama yerlestirdim
cuk sesini aldým.
Hasan Tolak Bey size de tesekkurler
Hepinize iyi calismaar diliyorum.





--- In jsf_tr@..., serkan koyun-gmail <serkankoyun@...>
wrote:
>
> Selamlar.  Benim  de müs,teri ve ona ait departmanlar? için için
> ihtiyac?m olmus,tu. As,ag(?daki gibi çözdük. a4j:support ta bir
action
> listener yazd?m. O listener combo içinde ki Musteri clas?n? al?yor.
> Ald?g(?m Musteri clas?n? da departman lar? dolduran metoda parametre
> olarak pass edip o müs,terinin departmanlar?n? dolduruyor:
> *
> müs,teri kombosu:*
> * <s:decorate id="musteriDecoration"
template="layout/display.xhtml">

> <ui:define name="label">Müs,teri</ui:define>
> <h:selectOneMenu value="#{alimSiparisHome.instance.musteri}"
>                                  rendered="#{empty
> loginKullanici.musteri.musteriId}"
>                                  required="true"
>                                  id="musteriKutusu" >
> <s:selectItems value="#{musteriList.resultList}" var="muster"
>                                      id="musteriSI"
> label="#{muster.unvani}" noSelectionLabel=" "></s:selectItems>
> <s:convertEntity />
> <a:support event="onchange"
>                                    
>  reRender="musteriDecoration,departmanDecoration"
> actionListener="#{alimSiparisHome.musteriComboListener}"
>                                      bypassUpdates="true"
> ajaxSingle="true" />
> </h:selectOneMenu>
> <h:message for="musteriKutusu" styleClass="message" rendered="true"
/>
> </s:decorate>*
> *departman** combosu:*
> * <s:decorate id="departmanDecoration"
template="layout/display.xhtml">
> <ui:define name="label">Departman</ui:define>
> <h:selectOneMenu value="#{alimSiparisHome.instance.departman}"
>                          required="true"
>                          
requiredMessage="#{messages['belirtilmemis.Alan']}"

>                          id="departmanKutusu">
> <s:selectItems
> value="#{departmanList.depAl(alimSiparisHome.departmanIcinMusteri)}"
> var="dept" id="departamID"
>                              label="#{dept.adi}" noSelectionLabel="
> "></s:selectItems>
> <s:convertEntity />
> </h:selectOneMenu>
> <h:message for="departmanKutusu" styleClass="message"
>                          rendered="true" />
> </s:decorate>*
>
> *action listener metodu**:*
> *    public void musteriComboListener (ActionEvent event)
>          {
>              HtmlSelectOneMenu  combo
>
=(HtmlSelectOneMenu)facesContext.getViewRoot().findComponent("alimSipa
ris:musteriDecoration:musteriKutusu");

>              departmanIcinMusteri=(Musteri)combo.getValue();
>          }*
>
> bu da departman?n doldug(u yer:
> *    public List<Departman> depAl(Musteri musteri) {
>          System.out.println("***Buras? girdig(inde");
>          if (musteri != null) {
>              System.out.println("***Buras? da müs,teri geldi ise"
>                      + musteri.getUnvani());
>          }
>          try {
>              String query = "select departman from Departman
departman "
>                      + " where (departman.iptalKodu IS NULL "
>                      + " or departman.iptalKodu = ' ' "
>                      + " or departman.iptalKodu <> '*') ";
>                query +=" and departman.musteri.musteriId=";
>                query +=musteri.getMusteriId();
>
>              return
entityManager.createQuery(query).getResultList();

>          } catch (Exception e) {
>              e.printStackTrace();
>              return null;
>          }
>      }*
>
>
>
>
> aru1959 wrote:
> >
> > Teþekkürler, deniyorum.
> >
> > --- In jsf_tr@... <mailto:jsf_tr%40yahoogroups.com>,
hasan
> > tolak <h_tolak@> wrote:
> > >
> > > merhabalar
> > >
> > > Siz il ilce icin istemistiniz RichFaces suggestionBox iliskin
cozum

> > asagida
> > >
> > > ulke ve sehir icin verilmistir.
> > >
> > > Kolay gelsin
> > >
> > > Hasan
> > >
> > > adress.jsp
> > > .....
> > > // country Suggestion Box
> > > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > > <h:inputText value="#{jobSeekerCreateBean.country}"
> > id="country" required="true"
> > > styleClass="inputShort"
> > validator="#{jobSeekerCreateBean.validateCountry}"/>
> > >
> > > <rich:suggestionbox id="suggestCountryId" for="country"
> > tokens=",["
> > > rules="#{suggestionBox.rules}"
> > >
> > suggestionAction="#{jobSeekerCreateBean.countryComplete}"
> > var="country"
> > > fetchValue="#{country}"
> > > first="#{suggestionBox.intFirst}"
> > > minChars="#{suggestionBox.minchars}"
> > >
> > shadowOpacity="#{suggestionBox.shadowOpacity}"
> > > border="#{suggestionBox.border}"
> > width="#{suggestionBox.width}"
> > > height="#{suggestionBox.height}"
> > >
> > shadowDepth="#{suggestionBox.shadowDepth}"
> > >
> > cellpadding="#{suggestionBox.cellpadding}"
> > > nothingLabel="#{msgs.noCountryFound}">
> > > <a4j:support event="onselect"
> > actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
> > > immediate="true" reRender="country"/>
> > > <h:column>
> > > <h:outputText value="#{country}"/>
> > > </h:column>
> > > </rich:suggestionbox>
> > > </h:panelGrid>
> > >
> > >
> > > // city Suggestion Box
> > > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > > <h:inputText value="#{jobSeekerCreateBean.city}"
> > id="city" required="true" styleClass="inputShort"/>
> > >
> > > <rich:suggestionbox id="suggestCityId" for="city"
> > tokens=",["
> > > rules="#{suggestionBox.rules}"
> > >
> > suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
> > > fetchValue="#{city}"
> > > first="#{suggestionBox.intFirst}"
> > > minChars="#{suggestionBox.minchars}"
> > >
> > shadowOpacity="#{suggestionBox.shadowOpacity}"
> > > border="#{suggestionBox.border}"
> > width="#{suggestionBox.width}"
> > > height="#{suggestionBox.height}"
> > >
> > shadowDepth="#{suggestionBox.shadowDepth}"
> > >
> > cellpadding="#{suggestionBox.cellpadding}"
> > > nothingLabel="#{msgs.noCityFound}">
> > > <a4j:support event="onselect"
> > actionListener="#{jobSeekerCreateBean.selectCityAListener}"
> > > immediate="true" reRender="city"/>
> > > <h:column>
> > > <h:outputText value="#{city}"/>
> > > </h:column>
> > > </rich:suggestionbox>
> > > </h:panelGrid>
> > > ....
> > >
> > > //countries methods
> > >
> > > private void setCountries() {
> > > countries.clear();
> > > List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
> > > Country c;
> > > if (isNullOrEmpty(cs)) return;
> > >
> > > for (Object o : cs) {
> > > c = (Country) o;
> > > countries.add(c.getCountryName());
> > > }
> > > // System.out.println("counries initialized: " +
> > countries.size());
> > > }
> > >
> > >
> > > public List<String> countryComplete(Object suggest) {
> > > String pref = trim((String) suggest);
> > > result.clear();
> > > System.out.println("countryComplete(): " + suggest);
> > > for (String country_ : countries) {
> > > if (!isNullOrEmpty(country_) &&
> > >
> > country_.toLowerCase().startsWith(pref.toLowerCase())) {
> > > result.add(country_);
> > > }
> > > }
> > >
> > > return result;
> > > }
> > >
> > >
> > > public void selectCountryAListener(ActionEvent event) {
> > > System.out.println("selectCountryAListener() ");
> > > country = trim(FacesUtils.getReqParam("country"));
> > > setCities();
> > > FacesContext.getCurrentInstance().renderResponse();
> > > }
> > >
> > >
> > > public void validateCountry(FacesContext context, UIComponent
> > toValidate, Object value) {
> > > // Date dob_ = (Date) dobInput.getSubmittedValue();
> > > String country = (String) value;
> > > if (!isNullOrEmpty(country)) {
> > > if
> > (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
> > null) {
> > > Object[] params =
> > {Messages.getString(Keys.APP_MESSAGES, "country", null)};
> > > FacesMessage message
> > > = Messages.getMessage(
> > > Keys.APP_MESSAGES, "isNotValid_param1",
> > params);
> > >
> > message.setSeverity(FacesMessage.SEVERITY_ERROR);
> > > throw new ValidatorException(message);
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > >
> > > //cities methods
> > >
> > > protected void setCities() {
> > > cities.clear();
> > > List cs = null;
> > > if (!isNullOrEmpty(country)) {
> > > cs =
> > DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
> > > }
> > > if (isNullOrEmpty(cs)) return;
> > >
> > > City c;
> > > for (Object o : cs) {
> > > c = (City) o;
> > > cities.add(c.getCityName());
> > > }
> > > System.out.println(country + " cities initialized: " +
> > cities.size());
> > > }
> > >
> > > public List<String> cityComplete(Object suggest) {
> > > String pref = trim((String) suggest);
> > > result.clear();
> > > for (String city_ : cities) {
> > > if (!isNullOrEmpty(city_) &&
> > >
> > city_.toLowerCase().startsWith(pref.toLowerCase())) {
> > > result.add(city_);
> > > }
> > > }
> > > if (isNullOrEmpty(result) && isAddInputToCity()) {
> > > result.add(pref);
> > > }
> > > return result;
> > > }
> > >
> > >
> > > public void selectCityAListener(ActionEvent event) {
> > > System.out.println("selectCityAListener() ");
> > > city = trim(FacesUtils.getReqParam("city"));
> > > FacesContext.getCurrentInstance().renderResponse();
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- On Mon, 17/11/08, aru1959 <aru1959@> wrote:
> > >
> > > > From: aru1959 <aru1959@>
> > > > Subject: [jsf_tr] Combo
> > > > To: jsf_tr@... <mailto:jsf_tr%40yahoogroups.com>
> > > > Date: Monday, 17 November, 2008, 3:50 PM
> > > > Merhabalar,
> > > >
> > > > Jsf ve Rich faces ile uygulama geliÅY"tiriyorum.
> > > > İller ve ilçeler gibi iki adet combo var,
> > > > ilçeler combo sunun
> > > > bir önceki il kombosunda seçilen ile göre dolmasına
> > > > ihtiyacım var.
> > > >
> > > > Yardımcı olanlara ÅY"imdiden teÅY"ekkür ediyorum.
> > > > Herkeze iyi çalıÅY"malar.
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > >
> > >
> > > adress.jsp
> > > .....
> > > // country Suggestion Box
> > > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > > <h:inputText value="#{jobSeekerCreateBean.country}"
> > id="country" required="true"
> > > styleClass="inputShort"
> > validator="#{jobSeekerCreateBean.validateCountry}"/>
> > >
> > > <rich:suggestionbox id="suggestCountryId" for="country"
> > tokens=",["
> > > rules="#{suggestionBox.rules}"
> > >
> > suggestionAction="#{jobSeekerCreateBean.countryComplete}"
> > var="country"
> > > fetchValue="#{country}"
> > > first="#{suggestionBox.intFirst}"
> > > minChars="#{suggestionBox.minchars}"
> > >
> > shadowOpacity="#{suggestionBox.shadowOpacity}"
> > > border="#{suggestionBox.border}"
> > width="#{suggestionBox.width}"
> > > height="#{suggestionBox.height}"
> > >
> > shadowDepth="#{suggestionBox.shadowDepth}"
> > >
> > cellpadding="#{suggestionBox.cellpadding}"
> > > nothingLabel="#{msgs.noCountryFound}">
> > > <a4j:support event="onselect"
> > actionListener="#{jobSeekerCreateBean.selectCountryAListener}"
> > > immediate="true" reRender="country"/>
> > > <h:column>
> > > <h:outputText value="#{country}"/>
> > > </h:column>
> > > </rich:suggestionbox>
> > > </h:panelGrid>
> > >
> > >
> > > // city Suggestion Box
> > > <h:panelGrid columns="3" align="left" style="margin-left:-3px">
> > > <h:inputText value="#{jobSeekerCreateBean.city}"
> > id="city" required="true" styleClass="inputShort"/>
> > >
> > > <rich:suggestionbox id="suggestCityId" for="city"
> > tokens=",["
> > > rules="#{suggestionBox.rules}"
> > >
> > suggestionAction="#{jobSeekerCreateBean.cityComplete}" var="city"
> > > fetchValue="#{city}"
> > > first="#{suggestionBox.intFirst}"
> > > minChars="#{suggestionBox.minchars}"
> > >
> > shadowOpacity="#{suggestionBox.shadowOpacity}"
> > > border="#{suggestionBox.border}"
> > width="#{suggestionBox.width}"
> > > height="#{suggestionBox.height}"
> > >
> > shadowDepth="#{suggestionBox.shadowDepth}"
> > >
> > cellpadding="#{suggestionBox.cellpadding}"
> > > nothingLabel="#{msgs.noCityFound}">
> > > <a4j:support event="onselect"
> > actionListener="#{jobSeekerCreateBean.selectCityAListener}"
> > > immediate="true" reRender="city"/>
> > > <h:column>
> > > <h:outputText value="#{city}"/>
> > > </h:column>
> > > </rich:suggestionbox>
> > > </h:panelGrid>
> > > ....
> > >
> > > //countries methods
> > >
> > > private void setCountries() {
> > > countries.clear();
> > > List cs = DAOFactory.DEFAULT.getCountryDAO().findAll();
> > > Country c;
> > > if (isNullOrEmpty(cs)) return;
> > >
> > > for (Object o : cs) {
> > > c = (Country) o;
> > > countries.add(c.getCountryName());
> > > }
> > > // System.out.println("counries initialized: " +
> > countries.size());
> > > }
> > >
> > >
> > > public List<String> countryComplete(Object suggest) {
> > > String pref = trim((String) suggest);
> > > result.clear();
> > > System.out.println("countryComplete(): " + suggest);
> > > for (String country_ : countries) {
> > > if (!isNullOrEmpty(country_) &&
> > >
> > country_.toLowerCase().startsWith(pref.toLowerCase())) {
> > > result.add(country_);
> > > }
> > > }
> > >
> > > return result;
> > > }
> > >
> > >
> > > public void selectCountryAListener(ActionEvent event) {
> > > System.out.println("selectCountryAListener() ");
> > > country = trim(FacesUtils.getReqParam("country"));
> > > setCities();
> > > FacesContext.getCurrentInstance().renderResponse();
> > > }
> > >
> > >
> > > public void validateCountry(FacesContext context, UIComponent
> > toValidate, Object value) {
> > > // Date dob_ = (Date) dobInput.getSubmittedValue();
> > > String country = (String) value;
> > > if (!isNullOrEmpty(country)) {
> > > if
> > (DAOFactory.DEFAULT.getCountryDAO().findCountryByName(country) ==
> > null) {
> > > Object[] params =
> > {Messages.getString(Keys.APP_MESSAGES, "country", null)};
> > > FacesMessage message
> > > = Messages.getMessage(
> > > Keys.APP_MESSAGES, "isNotValid_param1",
> > params);
> > >
> > message.setSeverity(FacesMessage.SEVERITY_ERROR);
> > > throw new ValidatorException(message);
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > >
> > > //cities methods
> > >
> > > protected void setCities() {
> > > cities.clear();
> > > List cs = null;
> > > if (!isNullOrEmpty(country)) {
> > > cs =
> > DAOFactory.DEFAULT.getCityDAO().findAllCityByCountryName(country);
> > > }
> > > if (isNullOrEmpty(cs)) return;
> > >
> > > City c;
> > > for (Object o : cs) {
> > > c = (City) o;
> > > cities.add(c.getCityName());
> > > }
> > > System.out.println(country + " cities initialized: " +
> > cities.size());
> > > }
> > >
> > > public List<String> cityComplete(Object suggest) {
> > > String pref = trim((String) suggest);
> > > result.clear();
> > > for (String city_ : cities) {
> > > if (!isNullOrEmpty(city_) &&
> > >
> > city_.toLowerCase().startsWith(pref.toLowerCase())) {
> > > result.add(city_);
> > > }
> > > }
> > > if (isNullOrEmpty(result) && isAddInputToCity()) {
> > > result.add(pref);
> > > }
> > > return result;
> > > }
> > >
> > >
> > > public void selectCityAListener(ActionEvent event) {
> > > System.out.println("selectCityAListener() ");
> > > city = trim(FacesUtils.getReqParam("city"));
> > > FacesContext.getCurrentInstance().renderResponse();
> > > }
> > >
> >
> >
>