cancel
Showing results for 
Search instead for 
Did you mean: 

show child association properties in property page

alex_lu
Champ in-the-making
Champ in-the-making
Hello all,

There are a few posts relating showing properties of a child node in parent node's property page. But no one seemed to have made any progress. I've made some progress but still need some help.

so in web-client-config-custom.xml, I defined

   <config evaluator="node-type" condition="eum:recipientsspace">
        <property-sheet>
            <separator name="eventSep" display-label="Recipients" component-generator="HeaderSeparatorGenerator" />
            <show-child-association name="cm:contains" component-generator="RecipientsListGenerator" />
        </property-sheet>
    </config>

I also declared the generator in faces-config-custom.xml and I extended the jsf component from UIChildAssociationEditor.

public class UIRecipientsList extends UIChildAssociationEditor {


    @Override
    protected void populateAssocationMaps(Node node, NodeService nodeService) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected void renderReadOnlyAssociations(FacesContext context, ResponseWriter responseWriter, NodeService nodeService) throws IOException {

        TemplateService templateService = (TemplateService) FacesContextUtils.getRequiredWebApplicationContext(context).getBean("templateService");

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("test", "test1");
        templateService.processTemplate("com/dods/alfresco/web/ui/repo/component/UIRecipientsPickerTest.ftl",
            model, responseWriter);
    }

    @Override
    protected void renderExistingAssociations(FacesContext context, ResponseWriter responseWriter, NodeService nodeService, boolean b) throws IOException {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected void removeTarget(Node node, String s) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected void addTarget(Node node, String[] strings) {
        //To change body of implemented methods use File | Settings | File Templates.
    }
   
    @Override
    public void encodeBegin(FacesContext context) {
       
    }
   
    @Override
    public void decode(FacesContext context) {
       
    }
}

I managed to show "test1" (that i declared) in the property page. Look at the screenshot https://docs.google.com/leaf?id=0B_-CypINafm6ZjFiMTY1YTItOTc1NC00NjIzLTlkNTctZDc0ODU1ZGEyNjUz&hl=en_...

How do I go and get the child associations from here?

Hope someone can help. Thanks lots.
1 REPLY 1

alex_lu
Champ in-the-making
Champ in-the-making
RIght. This is a breakthrough for quite a few posts out there.

This is how you get nodref of the node you select. Then using the noderef, you can get child associations.
Node node = (Node) context.getExternalContext().getSessionMap().get("spaceProps");