-
1. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
bleathem Aug 29, 2011 9:25 PM (in response to valmir)Valmir,
To make it a bit easier to get straight to the problem, could you copy and paste the facelet and backing bean source into this forum thread?
-
2. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
valmir Aug 30, 2011 12:02 PM (in response to bleathem)Brian,
Excuse me.
AcessoCentroCustoHandler.java
package br.com.techsage.handler;
import java.util.ArrayList;
import java.util.List;import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.servlet.http.HttpSession;import org.hibernate.Query;
import org.hibernate.Session;import br.com.techsage.dao.Dao;
import br.com.techsage.tabela.AcessoCentroCusto;
import br.com.techsage.tabela.AcessoEmpresa;
import br.com.techsage.tabela.CentroCusto;
import br.com.techsage.tabela.Usuario;
import br.com.techsage.util.HibernateUtil;public class AcessoCentroCustoHandler {
private AcessoCentroCusto acessoCentroCusto = new AcessoCentroCusto();
private Dao<AcessoCentroCusto> dao;
private Dao<CentroCusto> daoCentroCusto;
private Dao<Usuario> daoUsuario;
private List<AcessoCentroCusto> listaAcessoCentroCusto;
private List<Long> listaAcessoCentroCustoDestino = new ArrayList<Long>();
private String nomeUsuario;
private String idNewUser;
private HtmlSelectOneMenu empresaSelecionado;public AcessoCentroCusto getAcessoCentroCusto() {
return acessoCentroCusto;
}public void setAcessoCentroCusto(AcessoCentroCusto acessoCentroCusto) {
this.acessoCentroCusto = acessoCentroCusto;
}public List<AcessoCentroCusto> getListaAcessoCentroCusto() {
return listaAcessoCentroCusto;
}public void setListaAcessoCentroCusto(
List<AcessoCentroCusto> listaAcessoCentroCusto) {
this.listaAcessoCentroCusto = listaAcessoCentroCusto;
}public List<Long> getListaAcessoCentroCustoDestino() {
return listaAcessoCentroCustoDestino;
}public void setListaAcessoCentroCustoDestino(
List<Long> listaAcessoCentroCustoDestino) {
this.listaAcessoCentroCustoDestino = listaAcessoCentroCustoDestino;
}public String getNomeUsuario() {
return nomeUsuario;
}public void setNomeUsuario(String nomeUsuario) {
this.nomeUsuario = nomeUsuario;
}public String getIdNewUser() {
return idNewUser;
}public void setIdNewUser(String idNewUser) {
this.idNewUser = idNewUser;
}public HtmlSelectOneMenu getEmpresaSelecionado() {
return empresaSelecionado;
}public void setEmpresaSelecionado(HtmlSelectOneMenu empresaSelecionado) {
this.empresaSelecionado = empresaSelecionado;
}public void setSessao(Session session) {
this.dao = new Dao<AcessoCentroCusto>(session, AcessoCentroCusto.class);
this.daoCentroCusto = new Dao<CentroCusto>(session, CentroCusto.class);
this.daoUsuario = new Dao<Usuario>(session, Usuario.class);
HttpSession ses = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
if (ses.getAttribute("idNewUser") != null)
{
String id = ses.getAttribute("idNewUser").toString();
this.setIdNewUser(id);
this.setNomeUsuario(this.daoUsuario.load(Long.parseLong(id)).getNomeAcesso());
// this.setListaAcessoCentroCustoDestino(this.listaAcessoCentroCusto(id));
}
else
{
this.setIdNewUser("0");
this.listaAcessoCentroCustoDestino.add(0L);
}
org.hibernate.Filter filter = session.getEnabledFilter("AcessoCentrosCusto");
if (filter != null) {
session.disableFilter("AcessoCentrosCusto");
}
}public String salvar() throws Exception
{
this.dao.merge(this.acessoCentroCusto);
this.acessoCentroCusto = new AcessoCentroCusto();
this.setListaAcessoCentroCusto(null);
return "sucesso";
}public String deletar() throws Exception
{
Long idNewUser = 0L;
Long centroCusto = 0L;
if (this.getIdNewUser() != null) {
idNewUser = Long.parseLong(this.getIdNewUser());
this.acessoCentroCusto.setUsuario(daoUsuario.load(idNewUser));
this.acessoCentroCusto.setCentroCusto(daoCentroCusto.load(centroCusto));
this.dao.delete(this.acessoCentroCusto);
}
this.acessoCentroCusto = new AcessoCentroCusto();
this.setListaAcessoCentroCusto(null);
return "stayhere";
}public String cancelar()
{
this.acessoCentroCusto = new AcessoCentroCusto();
this.setListaAcessoCentroCusto(null);
return "stayhere";
}public List<AcessoCentroCusto> getAcessoCentroCustos() {
List<AcessoCentroCusto> list = this.getListaAcessoCentroCusto();
if (list == null || list.size() == 0)
{
String[] args = new String[1];
String[] sort = new String[2];
sort[0] = "usuario";
sort[1] = "centroCusto";
list = this.dao.search(args, sort);
}
return list;
}public String buscar()
{
String centroCusto = this.acessoCentroCusto.getCentroCusto().getId().toString();
String usuario = this.acessoCentroCusto.getUsuario().getId().toString();
String[] args = new String[2];
String[] sort = new String[2];
if (centroCusto != null && centroCusto != "") {
args[0] = "centroCusto.id;" + centroCusto + ";eqL";
}
if (usuario != null && usuario != "") {
args[1] = "usuario.id;" + usuario + ";eqL";
}
sort[0] = "usuario";
sort[1] = "centroCusto";
List<AcessoCentroCusto> lista = this.dao.search(args, sort);
this.setListaAcessoCentroCusto(lista);
return "stayhere";
}public void escolheAcessoCentroCusto(ActionEvent event) {
/*
UIComponent link = event.getComponent();
UIParameter param = (UIParameter) link.findComponent("editId");
String id = (String) param.getValue();
*/
FacesContext context = FacesContext.getCurrentInstance();
String id = context.getExternalContext().getRequestParameterMap().get("editId").toString();
if (this.getIdNewUser() != null) {
Long idNewUser = Long.parseLong(this.getIdNewUser());
this.acessoCentroCusto.setUsuario(this.daoUsuario.load(idNewUser));
this.acessoCentroCusto.setCentroCusto(this.daoCentroCusto.load(Long.parseLong(id)));
}
}@SuppressWarnings("unchecked")
public List<SelectItem> getCentroCustoPickList() {
List<SelectItem> lista = new ArrayList<SelectItem>();
Long empresa = (this.empresaSelecionado != null && this.empresaSelecionado.getValue() != null ? Long.parseLong(this.empresaSelecionado.getValue().toString()) : 0L);
if (empresa != 0L) {
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
String hql = "from CentroCusto where empresa.id = :empresa order by centroCusto";
Query query = session.createQuery(hql);
query.setLong("empresa", empresa);
query.setCacheable(false);
List<CentroCusto> list = query.list();
if (list.size() > 0) {
for (CentroCusto cc : list) {
lista.add(new SelectItem(cc.getId(), cc.getCentroCusto() + " - " + cc.getDescricao()));
}
}
session.getTransaction().commit();
this.setListaAcessoCentroCustoDestino(this.listaAcessoCentroCusto(this.getIdNewUser()));
}
return lista;
}
public String salvarAcessoCentroCusto()
{
if (this.getIdNewUser() != null) {
Long idNewUser = Long.parseLong(this.getIdNewUser());
Long empresa = (this.empresaSelecionado != null && this.empresaSelecionado.getValue() != null ? Long.parseLong(this.empresaSelecionado.getValue().toString()) : 0L);
Object[] ctos = this.listaAcessoCentroCustoDestino.toArray();
/*
* Deleção dos centros de custo
*/
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
String hql;
Query query;
if (ctos.length > 0) {
hql = "delete from AcessoCentroCusto where usuario.id = :user and str(centroCusto.id) not in (:ctos) and centroCusto.id in (select id from CentroCusto where str(empresa.id) = (:empresa))";
}
else {
hql = "delete from AcessoCentroCusto where usuario.id = :user and centroCusto.id in (select id from CentroCusto where str(empresa.id) = (:empresa))";
}
query = session.createQuery(hql);
query.setLong("user", idNewUser);
query.setLong("empresa", empresa);
if (ctos.length > 0) {
query.setParameterList("ctos", this.listaAcessoCentroCustoDestino);
}
int rowCount = query.executeUpdate();
System.out.println("Ctos Custo Apagados: " + rowCount);
//
for (int i = 0; i < ctos.length; i++) {
this.acessoCentroCusto = new AcessoCentroCusto();
this.acessoCentroCusto.setUsuario(daoUsuario.load(idNewUser));
this.acessoCentroCusto.setCentroCusto(daoCentroCusto.load(Long.parseLong(ctos[i].toString())));
try {
session.saveOrUpdate(this.acessoCentroCusto);
// this.salvar();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "erro";
}
}
session.getTransaction().commit();
this.setListaAcessoCentroCustoDestino(this.listaAcessoCentroCusto(String.valueOf(idNewUser)));
@SuppressWarnings("unused")
List<SelectItem> lista = this.getCentroCustoPickList();
}
return "sucesso";
}
@SuppressWarnings("unchecked")
private List<Long> listaAcessoCentroCusto(String user) {
List<Long> lista = new ArrayList<Long>();
Long empresa = (this.empresaSelecionado != null && this.empresaSelecionado.getValue() != null ? Long.parseLong(this.empresaSelecionado.getValue().toString()) : 0L);
if (empresa != 0L) {
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
/* String hql = "from AcessoCentroCusto where usuario.id = :user and centroCusto.id in (select id from CentroCusto where empresa.id = :empresa) order by centroCusto.centroCusto"; */
String hql = "from AcessoCentroCusto ac where ac.usuario.id = :user and ac.centroCusto.empresa.id = :empresa order by ac.centroCusto.centroCusto";
Query query = session.createQuery(hql);
query.setLong("user", Long.parseLong(user));
query.setLong("empresa", empresa);
query.setCacheable(false);
List<AcessoCentroCusto> centroCustoUser = query.list();
if (centroCustoUser.size() > 0) {
for (AcessoCentroCusto cc : centroCustoUser) {
lista.add(cc.getCentroCusto().getId());
}
}
session.getTransaction().commit();
}
return(lista);
}
public void populateSector(ValueChangeEvent event) {
@SuppressWarnings("unused")
List<SelectItem> lista = this.getCentroCustoPickList();
}
@SuppressWarnings("unchecked")
public List<SelectItem> getEmpresaComboBox() {
List<SelectItem> lista = new ArrayList<SelectItem>();
String user = this.getIdNewUser();
lista.add(new SelectItem("0", "---- Selecione uma empresa ----"));
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
String hql = "from AcessoEmpresa where usuario.id = :user order by empresa.razaoSocial";
Query query = session.createQuery(hql);
query.setLong("user", Long.parseLong(user));
List<AcessoEmpresa> empresaUser = query.list();
session.getTransaction().commit();
for (AcessoEmpresa ae : empresaUser) {
lista.add(new SelectItem(ae.getEmpresa().getId(), ae.getEmpresa().getRazaoSocial()));
}
return lista;
}
public String voltar() {
return "voltar";
}public String proximo() {
return "proximo";
}
}acessocentrocusto.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="content-language" content="en" />
<meta content="Developer - Techsage Tecnologia e Informatica Ltda" name="author" />
<meta http-equiv="Reply-to" content="developer@techsage.com.br" />
<meta http-equiv="expires" content="Tue, 23 Jun 1998 01:46:05 GMT" />
<title>..::ACESSO AOS CENTROS DE CUSTO::..</title>
<link rel="shortcut icon" href="../resources/Images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="../resources/App_Themes/tabelas.css" />
</h:head>
<h:body>
<div id="geral">
<f:view>
<f:loadBundle basename="messages" var="msgs" />
<div id="menu">
<ui:include src="/Util/menu.xhtml"></ui:include>
</div>
<h:form><fieldset>
<legend>
<h:outputFormat value="#{msgs['acessocentrocusto']}:"></h:outputFormat>
</legend>
<p>
<h:outputLabel for="lblUsuario" value="#{msgs['usuario']}:"></h:outputLabel>
<h:outputFormat value="#{acessoCentroCustoHandler.nomeUsuario}" id="lblUsuario" style="height:15px;background-color:#ccc;"></h:outputFormat>
</p>
<p>
<h:outputLabel for="cmbEmpresa" value="#{msgs['empresa']}:"></h:outputLabel>
<h:selectOneMenu binding="#{acessoCentroCustoHandler.empresaSelecionado}" id="cmbEmpresa" style="width:400px" valueChangeListener="#{acessoCentroCustoHandler.populateSector}">
<a4j:ajax event="change" render="result, itens"/>
<f:selectItems value="#{acessoCentroCustoHandler.empresaComboBox}" />
</h:selectOneMenu>
</p>
<rich:pickList id="result" value="#{acessoCentroCustoHandler.listaAcessoCentroCustoDestino}" listHeight="175px" listWidth="325px" addAllText="#{msgs['copyall']}" addText="#{msgs['copy']}" removeAllText="#{msgs['removeall']}" removeText="#{msgs['remove']}">
<f:selectItems id="itens" value="#{acessoCentroCustoHandler.centroCustoPickList}"/>
</rich:pickList>
<p align="center">
<h:commandButton value="#{msgs['salvar']}" action="#{acessoCentroCustoHandler.salvarAcessoCentroCusto}" >
</h:commandButton>
</p><p align="center">
<h:commandButton value="« #{msgs['voltar']}" action="#{acessoCentroCustoHandler.voltar}"></h:commandButton>
<h:commandButton value="#{msgs['proximo']} »" action="#{acessoCentroCustoHandler.proximo}"></h:commandButton>
</p>
<p>
<a4j:outputPanel ajaxRendered="true"><rich:messages /></a4j:outputPanel>
</p>
</fieldset>
</h:form>
</f:view>
</div>
</h:body>
</html>faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"> -<application> <message-bundle> messages </message-bundle> -<resource-bundle> <base-name>messages</base-name> <var>msgs</var> </resource-bundle> -<locale-config> <default-locale>pt</default-locale> <supported-locale>en</supported-locale> </locale-config> </application> -<lifecycle> <phase-listener>br.com.techsage.util.LifeCycleListener</phase-listener> <phase-listener>br.com.techsage.authorizer.Authorizer</phase-listener> </lifecycle> -<managed-bean> <managed-bean-name>authorizer</managed-bean-name> <managed-bean-class>br.com.techsage.handler.LoginHandler</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> -<managed-bean> <managed-bean-name>autenticadorHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AutenticadorHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>unidadeFederacaoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.UnidadeFederacaoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>responsavelEmpresaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ResponsavelEmpresaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>bancoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.BancoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>agenciaBancoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AgenciaBancoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>empresaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.EmpresaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>ctaCorrenteEmpresaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.CtaCorrenteEmpresaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>centroCustoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.CentroCustoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>edicaoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.EdicaoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>usuarioHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.UsuarioHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>rotinaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.RotinaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>formaPagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.FormaPagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>irrfCodigoRetencaoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.IrrfCodigoRetencaoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>issCodigoRetencaoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.IssCodigoRetencaoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>csllCofinsPisHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.CsllCofinsPisHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>inssAutonomoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.InssAutonomoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>areaGerencialHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AreaGerencialHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>contaGerencialHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ContaGerencialHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>area_Conta_GerencialHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.Area_Conta_GerencialHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>motivoCancelamentoPagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.MotivoCancelamentoPagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>documentoServicoTomadoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.DocumentoServicoTomadoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>irrfValidadeHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.IrrfValidadeHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>irrfHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.IrrfHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>tipoDocumentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.TipoDocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>fornecedorHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.FornecedorHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>ctaCorrenteFornecedorHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.CtaCorrenteFornecedorHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>contatoFornecedorHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ContatoFornecedorHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>dependenteFornecedorHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.DependenteFornecedorHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>acessoEmpresaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AcessoEmpresaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>acessoCentroCustoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AcessoCentroCustoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>acessoContaGerencialHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AcessoContaGerencialHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>acessoTipoDocumentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AcessoTipoDocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>acessoRotinaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.AcessoRotinaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>parametroHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ParametroHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>regraVencimentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.RegraVencimentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>tipoLancamentoContabilHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.TipoLancamentoContabilHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>feriadoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.FeriadoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>meioPagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.MeioPagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>documentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.DocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>impostoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ImpostoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>pagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.PagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>contabilGerencialHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ContabilGerencialHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>reembolsoItemHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ReembolsoItemHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>doctoFornecedorInssHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.DoctoFornecedorInssHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>solicitacaoPagamentoEmailHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.SolicitacaoPagamentoEmailHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>validacaoDocumentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ValidacaoDocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>localizacaoDocumentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.LocalizacaoDocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>menuHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.MenuHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>relatorioHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.RelatorioHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>protocoloEntregaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ProtocoloEntregaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>rateioDocumentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.RateioDocumentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>demonstrativoPagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.DemonstrativoPagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>posicaoDiariaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.PosicaoDiariaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>impressaoFormularioHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ImpressaoFormularioHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>pagamentosHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.PagamentosHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>baixaHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.BaixaHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>pagamentoCancelamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.PagamentoCancelamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>impressaoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.ImpressaoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<managed-bean> <managed-bean-name>selecaoPagamentoHandler</managed-bean-name> <managed-bean-class>br.com.techsage.handler.SelecaoPagamentoHandler</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> -<managed-property> <property-name>sessao</property-name> <value>#{requestScope.sessao}</value> </managed-property> </managed-bean> -<navigation-rule> <display-name>login</display-name> <from-view-id>/login.xhtml</from-view-id> -<navigation-case> <from-outcome>sucesso</from-outcome> <to-view-id>/index.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> -<navigation-case> <from-outcome>login</from-outcome> <to-view-id>/login.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>usuario</display-name> <from-view-id>/Tabelas/usuario.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/acessoempresa.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/usuario.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>acessoEmpresa</display-name> <from-view-id>/Tabelas/acessoempresa.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/acessocentrocusto.xhtml</to-view-id> </navigation-case> -<navigation-case> <from-outcome>voltar</from-outcome> <to-view-id>/Tabelas/usuario.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/acessoempresa.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>acessoCentroCusto</display-name> <from-view-id>/Tabelas/acessocentrocusto.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/acessocontagerencial.xhtml</to-view-id> </navigation-case> -<navigation-case> <from-outcome>voltar</from-outcome> <to-view-id>/Tabelas/acessoempresa.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/acessocentrocusto.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>acessoContaGerencial</display-name> <from-view-id>/Tabelas/acessocontagerencial.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/acessotipodocumento.xhtml</to-view-id> </navigation-case> -<navigation-case> <from-outcome>voltar</from-outcome> <to-view-id>/Tabelas/acessocentrocusto.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/acessocontagerencial.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>acessoTipoDocumento</display-name> <from-view-id>/Tabelas/acessotipodocumento.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/acessorotina.xhtml</to-view-id> </navigation-case> -<navigation-case> <from-outcome>voltar</from-outcome> <to-view-id>/Tabelas/acessocontagerencial.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/acessotipodocumento.xhtml</to-view-id> </navigation-case> </navigation-rule> -<navigation-rule> <display-name>acessoRotina</display-name> <from-view-id>/Tabelas/acessorotina.xhtml</from-view-id> -<navigation-case> <from-outcome>proximo</from-outcome> <to-view-id>/Tabelas/usuario.xhtml</to-view-id> </navigation-case> -<navigation-case> <from-outcome>voltar</from-outcome> <to-view-id>/Tabelas/acessotipodocumento.xhtml</to-view-id> </navigation-case> -<navigation-case> <to-view-id>/Tabelas/acessorotina.xhtml</to-view-id> </navigation-case> </navigation-rule> </faces-config> -
3. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
bleathem Aug 31, 2011 2:20 AM (in response to valmir)I'm sorry Valmir, I can't take the time to look through *all* that code. Please present the code *relevant* to the problem you are trying to solve.
-
4. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
valmir Aug 31, 2011 10:07 PM (in response to bleathem)Brian,
I'm sorry *again* !
The following code is from where picklist is.
The bean's code is not necessary because nothing works after a submit. The error message is
"java.lang.IndexOutOfBoundsException: Index: 1, Size: 1"
If you think the bean's code is important, *please*, read my post before this. It was named AcessoCentroCustoHandler.java.
The tag "<a4j:ajax event="change" render="result, itens"/>"
works properly before submit after that fails without any message.
Thanks
acessocentrocusto.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="content-language" content="en" /> <meta content="Developer - Techsage Tecnologia e Informatica Ltda" name="author" /> <meta http-equiv="Reply-to" content="developer@techsage.com.br" /> <meta http-equiv="expires" content="Tue, 23 Jun 1998 01:46:05 GMT" /> <title>..::ACESSO AOS CENTROS DE CUSTO::..</title> <link rel="shortcut icon" href="../resources/Images/favicon.ico"/> <link rel="stylesheet" type="text/css" href="../resources/App_Themes/tabelas.css" /> </h:head> <h:body> <div id="geral"> <f:view> <f:loadBundle basename="messages" var="msgs" /> <div id="menu"> <ui:include src="/Util/menu.xhtml"></ui:include> </div> <h:form> <fieldset> <legend> <h:outputFormat value="#{msgs['acessocentrocusto']}:"></h:outputFormat> </legend> <p> <h:outputLabel for="lblUsuario" value="#{msgs['usuario']}:"></h:outputLabel> <h:outputFormat value="#{acessoCentroCustoHandler.nomeUsuario}" id="lblUsuario" style="height:15px;background-color:#ccc;"></h:outputFormat> </p> <p> <h:outputLabel for="cmbEmpresa" value="#{msgs['empresa']}:"></h:outputLabel> <h:selectOneMenu binding="#{acessoCentroCustoHandler.empresaSelecionado}" id="cmbEmpresa" style="width:400px" valueChangeListener="#{acessoCentroCustoHandler.populateSector}"> <a4j:ajax event="change" render="result, itens"/> <f:selectItems value="#{acessoCentroCustoHandler.empresaComboBox}" /> </h:selectOneMenu> </p> <rich:pickList id="result" value="#{acessoCentroCustoHandler.listaAcessoCentroCustoDestino}" listHeight="175px" listWidth="325px" addAllText="#{msgs['copyall']}" addText="#{msgs['copy']}" removeAllText="#{msgs['removeall']}" removeText="#{msgs['remove']}"> <f:selectItems id="itens" value="#{acessoCentroCustoHandler.centroCustoPickList}"/> </rich:pickList> <p align="center"> <h:commandButton value="#{msgs['salvar']}" action="#{acessoCentroCustoHandler.salvarAcessoCentroCusto}" > </h:commandButton> </p> <p align="center"> <h:commandButton value="« #{msgs['voltar']}" action="#{acessoCentroCustoHandler.voltar}"></h:commandButton> <h:commandButton value="#{msgs['proximo']} »" action="#{acessoCentroCustoHandler.proximo}"></h:commandButton> </p> <p> <a4j:outputPanel ajaxRendered="true"><rich:messages /></a4j:outputPanel> </p> </fieldset> </h:form> </f:view> </div> </h:body> </html>
-
5. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
bleathem Aug 31, 2011 10:10 PM (in response to valmir)Try nesting a converter in your pickList.
-
6. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
valmir Sep 1, 2011 10:09 AM (in response to bleathem)Brian,
I'm sorry, but I can't understand.
Could you explain how I can do this ?
Thanks.
-
7. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
valmir Sep 5, 2011 10:48 PM (in response to valmir)Brian,
I'm sorry, but have you seen my post ? The post before this.
Thanks.
-
8. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
bleathem Sep 6, 2011 11:01 AM (in response to valmir)Write a converter [1] for your ojbject class, and nest that converter in the rich:pickList tag with an f:converter tag [2].
The purpose of this converter is to translate between your object instance, and a string representation of that instance for the web browser (The string value of your converter will not be visible to the user).
[1] http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/index.html
[2] http://javaserverfaces.java.net/nonav/docs/2.0/vdldocs/facelets/index.html
-
9. Re: Richfaces 4.1.0.20110805-M1 - picklist problem
valmir Sep 6, 2011 11:37 PM (in response to bleathem)Brian,
I did like you wrote, but I have no sucess.
My code in xhtml is:
>
>
/>
I wrote a class named DummyConverter where I override hashcode and equals methods.
Unfortunatelly, all I could get is error message:
Validation Error: the value is not valid
Could you give an example ?