Hello
I read the wiki page about Adding a Custom Dialog and I tried to use it to create my own custom Dialog to add tags to a Document node.I followed the instructions but when I test the Dialog, there's a NullPointerException in my AddTagsDialog.java class. The BrowseBean.getDocument() is null. Therefore, I can't get the noderef of the current document and set its tags property.There is my code for the entire custom dialog:in web-client-config-custom.xml (There I used BrowseBean.setupContentAction instead of BrowseBean.setupSpaceAction used in the wiki page)
<action id="add_tags">
<permissions>
<permission allow="true">Contributor</permission>
</permissions>
<label-id>add-tags</label-id>
<image>/custom/images/icons/pencil.png</image>
<action>dialog:addTags</action>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<params>
<param name="ref">#{actionContext.id}</param>
</params>
</action>My jsp page :
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="2" class="mainSubTitle"><h:outputText value="Enter some Tags" /></td>
</tr>
<tr>
<td colspan="2" class="paddingRow"></td>
</tr>
<tr>
<td>
<h:outputText value="Tags :"/>
</td>
<td width="95%">
<h:inputText id="tags" value="" size="50" maxlength="1024" />
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
</table>
My AddTagsDialog class : (this.browseBean.getDocument() return null and so do the getNodeRef()…)
protected String finishImpl(FacesContext context, String outcome) throws Throwable {
// get the space the action will apply to
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
// add the aspect if it is not already present on the node
QName tagAspect = QName.createQName("extension.tags", "taggable");
if (getNodeService().hasAspect(nodeRef, tagAspect) == false)
{
getNodeService().addAspect(nodeRef, tagAspect, null);
}
// create the tags as a list
List<String> tagsList = new ArrayList<String>();
if (this.tags != null && this.tags.length() > 0)
{
StringTokenizer tokenizer = new StringTokenizer(this.tags, ",");
while (tokenizer.hasMoreTokens())
{
tagsList.add(tokenizer.nextToken().trim());
}
}
// set the tags property
QName tagsProp = QName.createQName("extension.tags", "tags");
getNodeService().setProperty(nodeRef, tagsProp, (Serializable)tagsList);
// return the default outcome
return outcome;
}
public boolean getFinishButtonDisabled(){
return false;
}
public void setTags(String tags){
this.tags = tags;
}
public String getTags(){
return tags;
}And my faces-config-custom.xml file :
<managed-bean>
<managed-bean-name>AddTagsDialog</managed-bean-name>
<managed-bean-class>my.custom.web.ui.dialogs.AddTagsDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
</managed-bean>Did I missed something?