Rich:listShuttle - Estou quase desistindo [RESOLVIDO] não desisto mais

Opa! lucianotome
Será que você poderia enviar esse tutorial ou postar por aqui msm? Vc poderia adiantar alguma coisa, como faço para remover os botões de “copiar todos” e “remover todos”
Obrigado!

Boa tarde pessoal,

estou com o mesmo problema.

Alguém poderia me ajudar ?

Não consigo implementar um converter para a minha listShuttle.

Luciano e dahenz

Favor enviar para o meu e-mail exemplo do listShuttle, to com o mesmo problema aq
Brunoheri@hotmail.com

Desculpe pessoal, mas eu nao tenho mais os exemplos para enviar, diga qual o seu problema, oque ocorre? talvez seja mais util identificar e tratar para melhor aprender, como o Dahenz, outra vez me desculpem por nao poder enviar os arquivos, posta ai os erros que podemos fazer juntos

Luciano…

To enviar os meus codigos para dar uma olhada.

Minha classe no pacote Modelo

Entity
@Table(name = “…Assuntos”)
public class Assunto implements Comparable, Serializable,
ComponentViewable, ILogableEntity {

private static final long serialVersionUID = 1L;


@Column(name = "NUMR_DigitoCodigo")
private Integer digito;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "NUMG_Assunto")
private Integer id;

@Column(name = "DESC_Assunto")
private String descricao;

@Column(name = "DESC_Detalhamento", length = 300)
private String detalhamento;


@OneToMany(mappedBy = "assunto", fetch = FetchType.LAZY)
@Fetch(FetchMode.SELECT)
private Set<AssuntoTipoDocumento> assuntoTiposDocumentos; (relacionamento )

Hash e equals

public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((descricao == null) ? 0 : descricao.hashCode());
return result;
}

/*
 * (non-Javadoc)
 * 
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    final Assunto other = (Assunto) obj;
    if (id == null) {
        if (other.id != null)
            return false;
    } else if (!id.equals(other.id))
        return false;

    if (descricao == null) {
        if (other.descricao != null)
            return false;
    } else if (!descricao.equals(other.descricao))
        return false;

    return true;
}

Na classe assuntoTiposDocumentos
Tenho somente tenho id e o restante é fk de assunto.

Hash e equals

public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());

    return result;
}

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    AssuntoTipoDocumento other = (AssuntoTipoDocumento) obj;
    if (id == null) {
        if (other.id != null)
            return false;
    } else if (!id.equals(other.id))
        return false;
    return true;
}

Meu jsp

<rich:panel id=“panelShuttle” rendered=“true” style=“border-color:#ffffff; background-color:#ffffff”>
<rich:listShuttle
id=“ModelosSecaoListShuttle” immediate=“true”
converter=“listShuttleConverter”
style=“width: 90%;” sourceListWidth=“325” targetListWidth=“325”
fastOrderControlsVisible=“false” orderControlsVisible=“false”
copyControlLabel="" removeControlLabel="" copyAllControlLabel=""
removeAllControlLabel="" var=“atd”
sourceCaptionLabel=“Modelos a Autorizar”
targetCaptionLabel=“Modelos Autorizados”
sourceValue="#{assuntoSecoesActions.listaSourceATD}"
targetValue="#{assuntoSecoesActions.listaTargetATD}"
rendered="#{assuntoSecoesActions.modoManter.novo}">
rich:column
<h:outputText value="#{atd.label}" />
</rich:column>
<a4j:support event=“onlistchanged”
onsubmit=“if(animacao_ajax_play(this)){ setMsg(‘conteudo:assuntosSecoesForm’,‘mensagemInformacao’, ‘Por favor, Aguarde!’); return false;}”
oncomplete =“animacao_ajax_stop(this); setMsg(‘conteudo:assuntosSecoesForm’,‘mensagemInformacao’, ‘’);”/>
</rich:listShuttle>
</rich:panel>

Tá funcionando, carregando as listas normalmente. O erro acontece quando vou salvar um itens que foi selecionado para a outra coluna.
sourceId=conteudo:assuntosSecoesForm:ModelosSecaoListShuttle[severity=(ERROR 2), summary=(“Component conteudo:assuntosSecoesForm:ModelosSecaoListShuttle has invalid value expression null”), detail=(“Component conteudo:assuntosSecoesForm:ModelosSecaoListShuttle has invalid value expression null”)]
Ou seja, qdo vai atualizar verificar que o objeto não está mais na lista source…, a qual é informa que ta null.
Estou usando tomahawk para manter os objetos na seção.

Meu converter

public Object getAsObject(FacesContext arg0, UIComponent arg1, String str) {
	HtmlListShuttle tmp = (HtmlListShuttle) arg1;
	Object tList = tmp.getTargetValue();
	Object sList = tmp.getSourceValue();
	
	System.out.println("String de busca-->" + str);
	System.out.println("Lista Target -->" + tList);
	
	if (tList instanceof List && sList instanceof List && str != null) {
		for (ComponentViewable cv : ((List<ComponentViewable>) tList))
			if (str.equals(cv.getLabel()))
				return cv;
		for (ComponentViewable cv : ((List<ComponentViewable>) sList))
			if (str.equals(cv.getLabel()))
				return cv;
	}
	return null;
}

O converter está declarado no faces.config

Cara, tem como vc colocar o codigo entre as tags [color=red]Code[/color], assim ta meio dificil ler.