Boa Tarde pessoal,
Estou com um problema quanto ao alinhamento dos nós da minha rich:tree. Quando abro minha página, os 'itens pai' são carregados normalmente, porém ao clicar para expandir e trazer os filhos, os mesmos vêm, porém no mesmo alinhamento do pai, quando deveria vir ligeiramente á direita:
Notem que abri o 'Pai B' e os filhos: A, B...ficam justamente abaixo dele.
[IMG]http://imageshack.us/a/img197/7296/arvore.jpg[/IMG]
Uploaded with ImageShack.us
Abaixo o código fonte JSP e Managed Bean
<rich:tree id="arvore" style="valign: top !important;"
changeExpandListener="#{cadastroFatorConvResgateBean.changeExpandListener}"
ajaxSubmitSelection="true" switchType="server"
reRender="selectedNode"
value="#{cadastroFatorConvResgateBean.rootNode}" var="item">
<br:brOutputLabel value="item.nomeCategoriaBeneficio"></br:brOutputLabel>
</rich:tree>
ublic class CadastroFatorConvResgateBean extends AbstractBackingBean<CadastroFatorConvResgateViewHelper>{
/**
* Instancia um novo CadastroFatorConvResgateBean.
*/
public CadastroFatorConvResgateBean(){
setViewHelper(new CadastroFatorConvResgateViewHelper());
}
/** Atributo cadastramento fator conversao service. */
private ICadastramentoFatorConversaoService cadastramentoFatorConversaoService;
/** Atributo combos diversos service. */
private ICombosDiversosService combosDiversosService;
/** Atributo cadastro fator conv resgate det bean. */
private CadastroFatorConvResgateDetBean cadastroFatorConvResgateDetBean;
/** The cadastro fator conv resgate lupa bean. */
private CadastroFatorConvResgateLupaBean cadastroFatorConvResgateLupaBean;
/** The codigo tipo beneficio. */
private String codigoTipoBeneficio;
/** The codigo categoria comp. */
private String codigoCategoriaComp;
/** The codigo categoria restart. */
private String codigoCategoriaRestart;
/** Atributo lista pai. */
private List < ItemArvore > listaPai = null;
/** The root node. */
private TreeNode rootNode = new TreeNodeImpl();
/** The mensagem. */
private String mensagem;
/** The fator conv resgate alt bean. */
private FatorConvResgateAltBean fatorConvResgateAltBean;
/**
* Nome: iniciarPagina.
*
* @return string
* @see br.com.bradesco.web.pfcp.view.bean.AbstractBackingBean#iniciarPagina()
*/
public String iniciarPagina(){
getViewHelper().inicializar();
inicializaCampos();
return super.iniciarPagina();
}
/**
* Abrir tela inclusao.
*
* @return the string
*/
public String abrirTelaInclusao(){
ListaFatorConversaoResgate listaFatorConversaoResgate = new ListaFatorConversaoResgate();
listaFatorConversaoResgate = getViewHelper().getListaFatorConversaoResgate().get(getViewHelper().getIndiceLista());
FatorConvResgateInclBean fatorConvResgateInclBean = (FatorConvResgateInclBean)SiteUtil.getBeanFromVariableResolver("fatorConvResgateInclBean");
FatorConvResgate resgate = new FatorConvResgate();
resgate.setSegmento(listaFatorConversaoResgate.getSegmento());
resgate.setTipo(String.valueOf(listaFatorConversaoResgate.getTipo()));
resgate.setCategoria(String.valueOf(listaFatorConversaoResgate.getCategoria()));
resgate.setBeneficio(String.valueOf(listaFatorConversaoResgate.getBeneficio()));
return fatorConvResgateInclBean.iniciarPagina(resgate);
}
/**
* Nome: inicializaCampos
*
* Inicializa campos.
*
* @see
*/
private void inicializaCampos() {
carregarComboSegmento();
carregarComboTipo();
rootNode = new TreeNodeImpl();
}
/**
* Nome: detalhar
*
* Detalhar.
*
* @return string
* @see
*/
public String detalhar(){
return getCadastroFatorConvResgateDetBean().iniciarPagina(this);
}
/**
* Pesquisar.
*
* @return the string
*/
public String pesquisar(){
getViewHelper().setListaFatorConversaoResgate(cadastramentoFatorConversaoService.pesquisarListafatorConvResgate(getViewHelper().getSegmentoSelected(),
getViewHelper().getTipoSelected(),
getViewHelper().getCodigoCategoriaTree(),
getViewHelper().getLupaBeneficio()));
getViewHelper().setListaRadioLista(ViewHelperUtils.carregarRadiosGrid(getViewHelper().getListaFatorConversaoResgate().size()));
if(getViewHelper().getListaFatorConversaoResgate().size() == 0){
BradescoFacesUtils.addInfoModalMessage("NENHUM REGISTRO ENCONTRADO", false);
}
return "";
}
/**
* Carregar combo tipo.
*/
public void carregarComboTipo(){
List<Combo> obj1 = getCadastramentoFatorConversaoService().carregarComboTipo();
getViewHelper().setComboTipo(new ArrayList<SelectItem>());
for (Combo obj2 : obj1) {
getViewHelper().getComboTipo().add(new SelectItem(String.valueOf(obj2.getCodigo()),obj2.getDescricao()));
}
}
/**
* Carregar combo segmento.
*/
public void carregarComboSegmento(){
getViewHelper().setComboSegmento(combosDiversosService.preencherComboSegmento());
}
/**
* Nome: changeExpandListener
*
* Change expand listener.
*
* @param event
* the event
* @see
*/
public void changeExpandListener(NodeExpandedEvent event) {
// pego o elemento selecionado
HtmlTree tree = (HtmlTree) event.getComponent();
// pego o TreeNode
TreeNode nodePaiSelecionado = tree.getTreeNode(tree.getRowKey());
ArvoreCategoria categoria = null;
for(ArvoreCategoria categ : getViewHelper().getListaFilho()){
if(categ.getNomeCategoriaBeneficio().equalsIgnoreCase(String.valueOf(nodePaiSelecionado.getData()))){
categoria = categ;
}
}
Arvore arvorePai = new Arvore();
setCodigoTipoBeneficio(String.valueOf(getViewHelper().getTipoSelected()));
setCodigoCategoriaComp(categoria.getCodigoCategoriaBeneficio());
setCodigoCategoriaRestart(getViewHelper().getListaFilho().get(getViewHelper().getListaFilho().size() -1).getCodigoCategoriaBeneficio());
getViewHelper().setListaFilho(cadastramentoFatorConversaoService.carregarArvore(getCodigoTipoBeneficio(), getCodigoCategoriaComp(), getCodigoCategoriaRestart()));
//Recupera campo Codigo Categoria da Arvore para Pesquisa.
getViewHelper().setCodigoCategoriaTree(Integer.parseInt(getViewHelper().getListaFilho().get(0).getCodigoCategoriaBeneficio()));
/*
* if (nodePaiSelecionado.getData().toString().equals("Pai 1")) {
*
* Arvore filho1 = new Arvore("ARNALDO"); Arvore filho2 = new
* Arvore("ALICE"); Arvore filho3 = new Arvore("ALBANO");
*
* arvorePai.adicionaFilho(filho1); arvorePai.adicionaFilho(filho2);
* arvorePai.adicionaFilho(filho3); }
*/
Arvore filhoVazio = new Arvore(null);
for (int i = Numeros.ZERO; i < getViewHelper().getListaFilho().size(); i++) {
Arvore filho = new Arvore(getViewHelper().getListaFilho().get(i).getNomeCategoriaBeneficio());
if (getViewHelper().getListaFilho().get(i).getFilho().equals("S")) {
filho.adicionaFilho(filhoVazio);
}
arvorePai.adicionaFilho(filho);
arvorePai.montaArvore(nodePaiSelecionado);
}
}
/**
* Nome: carregarPais
*
* Carregar pais.
*
* @return the string
* @see
*/
public String carregarPais(){
if(getViewHelper().getTipoSelected() != -1){
Arvore raiz = new Arvore();
Arvore filhoVazio = new Arvore(null);
setCodigoTipoBeneficio(String.valueOf(getViewHelper().getTipoSelected()));
setCodigoCategoriaComp(String.valueOf(0));
setCodigoCategoriaRestart(String.valueOf(0));
getViewHelper().setListaFilho(cadastramentoFatorConversaoService.carregarArvore(getCodigoTipoBeneficio(), getCodigoCategoriaComp(), getCodigoCategoriaRestart()));
//Recupera campo Codigo Categoria da Arvore para Pesquisa.
getViewHelper().setCodigoCategoriaTree(Integer.parseInt(getViewHelper().getListaFilho().get(0).getCodigoCategoriaBeneficio()));
for (int i = Numeros.ZERO; i < getViewHelper().getListaFilho().size(); i++) {
Arvore pai_um = new Arvore(getViewHelper().getListaFilho().get(i).getNomeCategoriaBeneficio());
if (getViewHelper().getListaFilho().get(i).getFilho().equals("S")) {
pai_um.adicionaFilho(filhoVazio);
}
raiz.adicionaFilho(pai_um);
}
/*
* Arvore pai_um = new Arvore("Pai 1"); Arvore pai_dois = new
* Arvore("Pai 2"); Arvore pai_tres = new Arvore("Pai 3");
*
* pai_um.adicionaFilho(filhoVazio); pai_dois.adicionaFilho(filhoVazio);
* pai_tres.adicionaFilho(filhoVazio); raiz.adicionaFilho(pai_um);
* raiz.adicionaFilho(pai_dois); raiz.adicionaFilho(pai_tres);
*/
this.setRootNode(raiz.montaArvore());
}else{
rootNode = new TreeNodeImpl();
getViewHelper().setLupaBeneficio("");
}
return "";
}
/**
* Limpar campos.
*
* @return the string
*/
public String limparCampos(){
inicializaCampos();
return "";
}
/**
* Recupera variavel.
*
* @param event the event
*/
public void recuperaVariavel(ActionEvent event){
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String codigo = request.getParameter("nodeTree");
}
/**
* Alterar.
*
* @return the string
*/
public String alterar(){
getViewHelper().setListaFatorConversaoResgateSelected(getListaFatorConversaoResgateSelected());
return fatorConvResgateAltBean.iniciarPagina(this);
}
/**
* Lupa.
*
* @return the string
*/
public String abrirLupa(){
return getCadastroFatorConvResgateLupaBean().iniciarPagina(this);
}
//-------------------- Getters / Setters --------------------//
/**
* Gets the lista fator conversao resgate selected.
*
* @return the lista fator conversao resgate selected
*/
private ListaFatorConversaoResgate getListaFatorConversaoResgateSelected() {
ListaFatorConversaoResgate itemSelecionado = null;
try {
itemSelecionado = getViewHelper().getListaFatorConversaoResgate().get(getViewHelper().getIndiceLista());
} catch (Exception e) {
//TODO TRATAMETO DE EXCESSAO
}
return itemSelecionado;
}
/**
* Nome: setCadastramentoFatorConversaoService
*
* Seta o valor do atributo 'cadastramentoFatorConversaoService'.
*
* @param cadastramentoFatorConversaoService valor do atributo cadastramento fator conversao service
* @see
*/
public void setCadastramentoFatorConversaoService(
ICadastramentoFatorConversaoService cadastramentoFatorConversaoService) {
this.cadastramentoFatorConversaoService = cadastramentoFatorConversaoService;
}
/**
* Nome: getCadastramentoFatorConversaoService
*
* Recupera o valor do atributo 'cadastramentoFatorConversaoService'.
*
* @return valor do atributo 'cadastramentoFatorConversaoService'
* @see
*/
public ICadastramentoFatorConversaoService getCadastramentoFatorConversaoService() {
return cadastramentoFatorConversaoService;
}
/**
* Nome: getCadastroFatorConvResgateDetBean
*
* Recupera o valor do atributo 'cadastroFatorConvResgateDetBean'.
*
* @return valor do atributo 'cadastroFatorConvResgateDetBean'
* @see
*/
public CadastroFatorConvResgateDetBean getCadastroFatorConvResgateDetBean() {
return cadastroFatorConvResgateDetBean;
}
/**
* Nome: setCadastroFatorConvResgateDetBean
*
* Seta o valor do atributo 'cadastroFatorConvResgateDetBean'.
*
* @param cadastroFatorConvResgateDetBean valor do atributo cadastro fator conv resgate det bean
* @see
*/
public void setCadastroFatorConvResgateDetBean(
CadastroFatorConvResgateDetBean cadastroFatorConvResgateDetBean) {
this.cadastroFatorConvResgateDetBean = cadastroFatorConvResgateDetBean;
}
/**
* Gets the combos diversos service.
*
* @return the combos diversos service
*/
public ICombosDiversosService getCombosDiversosService() {
return combosDiversosService;
}
/**
* Sets the combos diversos service.
*
* @param combosDiversosService the new combos diversos service
*/
public void setCombosDiversosService(
ICombosDiversosService combosDiversosService) {
this.combosDiversosService = combosDiversosService;
}
/**
* Sets the lista pai.
*
* @param listaPai the new lista pai
*/
public void setListaPai(List < ItemArvore > listaPai) {
this.listaPai = listaPai;
}
/**
* Gets the lista pai.
*
* @return the lista pai
*/
public List < ItemArvore > getListaPai() {
return listaPai;
}
/**
* Gets the codigo tipo beneficio.
*
* @return the codigo tipo beneficio
*/
public String getCodigoTipoBeneficio() {
return codigoTipoBeneficio;
}
/**
* Sets the codigo tipo beneficio.
*
* @param codigoTipoBeneficio the new codigo tipo beneficio
*/
public void setCodigoTipoBeneficio(String codigoTipoBeneficio) {
this.codigoTipoBeneficio = codigoTipoBeneficio;
}
/**
* Gets the codigo categoria comp.
*
* @return the codigo categoria comp
*/
public String getCodigoCategoriaComp() {
return codigoCategoriaComp;
}
/**
* Sets the codigo categoria comp.
*
* @param codigoCategoriaComp the new codigo categoria comp
*/
public void setCodigoCategoriaComp(String codigoCategoriaComp) {
this.codigoCategoriaComp = codigoCategoriaComp;
}
/**
* Gets the codigo categoria restart.
*
* @return the codigo categoria restart
*/
public String getCodigoCategoriaRestart() {
return codigoCategoriaRestart;
}
/**
* Sets the codigo categoria restart.
*
* @param codigoCategoriaRestart the new codigo categoria restart
*/
public void setCodigoCategoriaRestart(String codigoCategoriaRestart) {
this.codigoCategoriaRestart = codigoCategoriaRestart;
}
/**
* Sets the root node.
*
* @param rootNode the new root node
*/
public void setRootNode(TreeNode rootNode) {
this.rootNode = rootNode;
}
/**
* Gets the root node.
*
* @return the root node
*/
public TreeNode getRootNode() {
return rootNode;
}
/**
* Sets the mensagem.
*
* @param mensagem the new mensagem
*/
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
/**
* Gets the mensagem.
*
* @return the mensagem
*/
public String getMensagem() {
return mensagem;
}
/**
* Sets the fator conv resgate alt bean.
*
* @param fatorConvResgateAltBean the new fator conv resgate alt bean
*/
public void setFatorConvResgateAltBean(FatorConvResgateAltBean fatorConvResgateAltBean) {
this.fatorConvResgateAltBean = fatorConvResgateAltBean;
}
/**
* Gets the fator conv resgate alt bean.
*
* @return the fator conv resgate alt bean
*/
public FatorConvResgateAltBean getFatorConvResgateAltBean() {
return fatorConvResgateAltBean;
}
/**
* Gets the cadastro fator conv resgate lupa bean.
*
* @return the cadastro fator conv resgate lupa bean
*/
public CadastroFatorConvResgateLupaBean getCadastroFatorConvResgateLupaBean() {
return cadastroFatorConvResgateLupaBean;
}
/**
* Sets the cadastro fator conv resgate lupa bean.
*
* @param cadastroFatorConvResgateLupaBean the new cadastro fator conv resgate lupa bean
*/
public void setCadastroFatorConvResgateLupaBean(
CadastroFatorConvResgateLupaBean cadastroFatorConvResgateLupaBean) {
this.cadastroFatorConvResgateLupaBean = cadastroFatorConvResgateLupaBean;
}
}
Obrigado Pela ajuda