AnsweredAssumed Answered

How to use r:propertySheetGrid

Question asked by ppy62 on May 25, 2009
Hello,

I'm trying to build a custom wizard to create and fill the custom properties of a node.
The wizard is starting, a new node is created and the properties are editable.

What should I do in the finishImpl of my managed bean to update the created node with the edited properties?

I do it manually, property by property, but I guess there is an easiest way.

Jsp:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<r:propertySheetGrid
  id="bdexpFilePropertyGrid"
  value="#{WizardManager.bean.fileNode}"
  var="fileProperties"
  externalConfig="true"
  mode="edit"
>
</r:propertySheetGrid>

Managed bean

public class CreateFileWizardBean extends BaseWizardBean{


private NodeRef currentFile;
private Node fileNode;

protected String finishImpl(FacesContext context, String outcome) throws Exception {
   Map<String, Object> props = fileNode.getProperties();
   i = props.keySet().iterator();
   while (i.hasNext()) {
     String key = (String) i.next();
     Object prop = props.get(key);
     if (MyModel.PROP_CoFileId.equals(QName.createQName(key))) {
       nodeService.setProperty(currentFile, QName.createQName(key), (Serializable) prop);
     }
   }
}

public Node getFileNode() {
   if (fileNode == null) {
     createNewFileNode();
   }
   return fileNode;
}

private void createNewFileNode() {
   …
   currentFile = copyService.copy(templateNode, destinationNode, ContentModel.ASSOC_CONTAINS, destinationName, true);
   fileNode = new Node(currentFile);
}

Alfresco 2.1
Windows XP / Linux
Java jdk 1.5

Thank you for your help.

Kind regards,
Patrick

Outcomes