CustomConverter.java :  » JBoss » richfaces-ui-3.3.2 » org » richfaces » Java Open Source

Java Open Source » JBoss » richfaces ui 3.3.2 
richfaces ui 3.3.2 » org » richfaces » CustomConverter.java
package org.richfaces;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

public class CustomConverter implements Converter {

  public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Bean bean = (Bean)context.getExternalContext().getSessionMap().get("pickBean");
    return bean.getStore().get(value);
  }

  public String getAsString(FacesContext context, UIComponent component, Object value) {
    if(value != null) {
      return ((Animal)value).getName();
    } else {
      return "";
    }
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.