Created
June 14, 2012 23:53
-
-
Save randycoulman/2933711 to your computer and use it in GitHub Desktop.
Why is the optional block starting out unchecked, but expanded?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<f:optionalBlock name="generatingParcelBuilderInputFile" checked="${instance.getParcelBuilderInputFilename() != null}" | |
title="Generate input file for ParcelBuilder?"> | |
<f:entry title="Filename" field="parcelBuilderInputFilename"> | |
<f:textbox/> | |
</f:entry> | |
</f:optionalBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StoreSCM extends SCM { | |
private String parcelBuilderInputFilename; | |
@DataBoundConstructor | |
public StoreSCM(String parcelBuilderInputFilename) { | |
this.parcelBuilderInputFilename = parcelBuilderInputFilename; | |
} | |
public String getParcelBuilderInputFilename() { | |
return parcelBuilderInputFilename; | |
} | |
//... | |
@Override | |
public DescriptorImpl getDescriptor() { | |
return (DescriptorImpl)super.getDescriptor(); | |
} | |
@Extension | |
public static final class DescriptorImpl extends SCMDescriptor<StoreSCM> { | |
public DescriptorImpl() { | |
super(StoreSCM.class, null); | |
load(); | |
} | |
@Override | |
public String getDisplayName() { | |
return "Store"; | |
} | |
@Override | |
public boolean configure(StaplerRequest request, JSONObject formData) throws FormException { | |
request.bindJSON(this, formData); | |
save(); | |
return true; | |
} | |
@Override | |
public StoreSCM newInstance(StaplerRequest request, JSONObject formData) throws FormException { | |
String parcelBuilderInputFilename = null; | |
Object parcelBuilderOptions = formData.get("generatingParcelBuilderInputFile"); | |
if (parcelBuilderOptions != null) { | |
parcelBuilderInputFilename = ((JSONObject) parcelBuilderOptions).getString("parcelBuilderInputFilename"); | |
} | |
return new StoreSCM(parcelBuilderInputFilename); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment