Is there a way to simplify this further?  It strikes me as a basic pattern for 
anybody implementing a JobProperty...

I currently have the following jelly for a JobProperty

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
> <f:optionalBlock name="useTemplate" title="${%Use another job as a 
> template}" checked="${instance != null}" inline="true">
>   <f:entry field="templateJobName" ...
>

Notes:
* uses existence of the property to indicate "checked".
* use of "inline" to avoid useTemplate becoming a container of the rest of the 
form.

But it still requires a custom Descriptor.newInstance: 

@Extension
> public static class DescriptorImpl extends JobPropertyDescriptor {
>   @Override
>   public JobProperty<?> newInstance(StaplerRequest request, JSONObject 
> formData) throws FormException {
>     return formData.has("useTemplate"
> )?request.bindJSON(TemplateImplementationProperty.class, formData):null;
>   }



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/d78b27ec-3bd8-47a9-b4f9-2a20bfe2bfc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to