Atendendo ao pedido do colega Agmar, segue o exemplo de um ManagedBean para o componente Primefaces TabView:
Aswering the request of the fellow Agmar, follows the ManagedBean example for Primefaces component TabView:
Exemplo Primefaces 3.3.1. TabView Effects...
Escrito por Cesar Barbosa
Primefaces AutoComplete com Converter...
Escrito por Cesar Barbosa
Olá, segue um exemplo da tag do Primefaces AutoComplete usando um converter. Hi, follows an example of the Primefaces tag AutoComplet, using a converter. Veja o vídeo/Watch the movie: O código/The code: // Bean: [cc lang=”java”] public class CompanyControl implements Serializable{ private CompanyMemoryDao dao = new CompanyMemoryDao(); private Company selected; public Company getSelected() { return selected; } public void setSelected(Company selected) { this.selected = selected; } // Actions public List completeCompany(){ return dao.listAll(); } public String clear(){ this.selected = null; return “”; } } [/cc] // Converter: [cc lang=”java”] public class CompanyConverter implements Converter { CompanyMemoryDao dao = new CompanyMemoryDao(); @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Company c = dao.getById( Long.parseLong(value) ); return c; } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { Company c = (Company) value; return String.valueOf( c.getId() ); } } [/cc] // Page: [cc lang=”xhtml”] [/cc] Um grande abraço e sucesso, See u and...
LightBox do primefaces dentro de um Dialog, estranho...
Escrito por Cesar Barbosa
Comportamento no mínimo estranho… Abraços e sucesso!
Combo Cidade UF com Primefaces e JSF 2...
Escrito por Cesar Barbosa
Segue para comunidade, com o objetivo de facilitar pra quem precisar um combo Cidade/ Unidade Federal com JSF 2 e Primefaces: Veja funcionando: index.xhtml [cc lang=”html”] [/cc] CidadeUFComboBean.java [cc] /** * CidadeUF Combo Controller * * @author César Barbosa */ @ManagedBean @ApplicationScoped public class CidadeUFComboBean implements Serializable{ EnderecoCidadeDAO cidDao = new EnderecoCidadeDAO(); EnderecoUFDAO ufDao = new EnderecoUFDAO(); /* * Construtor */ public CidadeUFComboBean() { populateUFs(); populateCidades(); } /* * Propriedades */ private String uf; public String getUF() { return uf; } public void setUF(String uf) { this.uf = uf; } private String cidade; public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } private SortedMap ufs = new TreeMap(); public SortedMap getUFs() { return ufs; } public void setUFs(SortedMap ufs) { this.ufs = ufs; } private SortedMap cidadesData = new TreeMap(); public SortedMap getCidadesData() { return cidadesData; } public void setCidadesData(SortedMap cidadesData) { this.cidadesData = cidadesData; } private SortedMap cidades = new TreeMap(); public SortedMap getCidades() { return cidades; } public void setCidades(SortedMap cidades) { this.cidades = cidades; } /* * Helpers */ private void populateUFs(){ System.out.println(“Populando Ufs…”); List enderecoUFs = ufDao.list(); for (EnderecoUF enderecoUF : enderecoUFs) { ufs.put(enderecoUF.getSigla(), enderecoUF.getSigla()); } System.out.println(“Populando Ufs com “+ufs.size()+” itens…”); } private void populateCidades(){ for (String ufName : ufs.keySet()) { cidadesData.put(ufName,cidDao.listCidadeNomes(ufName)); } } /* * Action handlers */ public void changeUF() { if(uf !=null && !uf.equals(“”)) cidades = cidadesData.get(uf); else cidades = new TreeMap(); } } [/cc] Um grande abraço e muito...
A documentação do Primefaces 2.2. agora é free...
Escrito por Cesar Barbosa
Segue link para baixar o pdf: http://www.primefaces.org/documentation.html A versão 3.0. também será gratuita, quando sair o novo release. Um grande abraço e muito sucesso! Se gostou, deixe um...
Recent Comments