Tree do RichFaces já expandida

1 resposta
P

Tenho uma árvore do RichFaces e gostaria que quando carregasse, abrisse a página com a tree, o primeiro nó ja estivesse expandido. Alguém tem alguma idéia? ou como faz, qual tag usar, algo do tipo.
Obrigado.

1 Resposta

P

consegui com:

no meu controller da arvore:

public Boolean adviseNodeOpened(UITree tree) {
        if (!AuthorizationListener.isPostback()) {
            Object key = tree.getRowKey();
            TreeRowKey treeRowKey = (TreeRowKey) key;
            if (treeRowKey == null || treeRowKey.depth() <= 1) {
                return Boolean.TRUE;
            }
        }

        return null;
    }

tenho uma classe implementando PhaseListener e possui:

public static boolean isPostback() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
            ExternalContext externalContext = facesContext.getExternalContext();
            if (externalContext != null) {
                return Boolean.TRUE.equals(
                        externalContext.getRequestMap().get(POSTBACK_ATTRIBUTE_NAME));
            }
        }

        return false;
    }

o método da arvore, onde tem treeRowKey.depth() <= 1, 1 é o numero de expansões.

adviseNodeOpened="#{arvoreListagem.adviseNodeOpened}"
a tag da tree.

obrigado.

Criado 29 de março de 2010
Ultima resposta 29 de mar. de 2010
Respostas 1
Participantes 1