Editor Template for UIControl Properties that use Value Binding

<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="java" deleted="false" description="Getter which Checks private field then value binding then default" enabled="true" name="vbgettersetter">public ${valuetype} get${name}() {&#13;
&#13;
	if (this.${privateField} != null) {&#13;
		return this.${privateField};&#13;
	}&#13;
&#13;
	ValueBinding vb = getValueBinding("${privateField}");&#13;
&#13;
	if (vb != null) {&#13;
		return (${valuetype})vb.getValue(getFacesContext());&#13;
	}&#13;
&#13;
	return ${defaultValue}${cursor};&#13;
&#13;
}&#13;
&#13;
public void set${name}(${valuetype} ${privateField}) {&#13;
	this.${privateField} = ${privateField};&#13;
}&#13;
${:import(javax.faces.el.ValueBinding)}</template></templates>





This is an Editor Template named 'vbgettersetter' that can be imported into Domino Designer for quick generation of the getters and setters required for Control properties that need to check for Value Bindings. Save the xml to a file 'something.xml' and then import in the Preferences -> Java ->Editor -> Template

XML
Cameron Gregor
October 25, 2015 7:31 AM
Rating
9

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...