"description"));
descriptionContainer.add(descriptionLabel);
// if we're editing an existing process show the description
if (existingProcess) {
Name name = Ows11Util.name(execute.processName);
ProcessFactory pf = Processors.createProcessFactory(name);
description = pf.getDescription(name).toString(Locale.ENGLISH);
}
// the process inputs
final WebMarkupContainer inputContainer = new WebMarkupContainer("inputContainer");
inputContainer.setVisible(existingProcess);
add(inputContainer);
final ListView inputView = new ListView("inputs", new PropertyModel(execute, "inputs")) {
@Override
protected void populateItem(ListItem item) {
InputParameterValues pv = (InputParameterValues) item.getModelObject();
Parameter p = pv.getParameter();
item.add(new Label("param", buildParamSpec(p)));
item.add(new Label("paramDescription", p.description.toString(Locale.ENGLISH)));
if (!pv.isComplex() && !pv.isCoordinateReferenceSystem() && !pv.isBoundingBox()) {
Fragment f = new Fragment("paramValue", "literal", WPSRequestBuilderPanel.this);
FormComponent literal = new TextField("literalValue", new PropertyModel(pv,
"values[0].value"));
literal.setRequired(p.minOccurs > 0);
literal.setLabel(new Model(p.key));
f.add(literal);
item.add(f);
} else if (pv.isBoundingBox()) {
EnvelopePanel envelope = new EnvelopePanel("paramValue", new PropertyModel(pv,
"values[0].value"));
envelope.setCRSFieldVisible(true);
item.add(envelope);
} else if (pv.isCoordinateReferenceSystem()) {
CRSPanel crs = new CRSPanel("paramValue", new PropertyModel(pv,
"values[0].value"));
item.add(crs);
} else {
ComplexInputPanel input = new ComplexInputPanel("paramValue", pv, 0);
item.add(input);
}
}
};
inputView.setReuseItems(true);
inputContainer.add(inputView);
// the process outputs
final WebMarkupContainer outputContainer = new WebMarkupContainer("outputContainer");
outputContainer.setVisible(existingProcess);
add(outputContainer);
final ListView outputView = new ListView("outputs", new PropertyModel(execute, "outputs")) {
@Override
protected void populateItem(ListItem item) {
OutputParameter pv = (OutputParameter) item.getModelObject();
Parameter p = pv.getParameter();
item.add(new CheckBox("include", new PropertyModel(pv, "include")));
item.add(new Label("param", buildParamSpec(p)));
item.add(new Label("paramDescription", p.description.toString(Locale.ENGLISH)));
if (pv.isComplex()) {
DropDownChoice mime = new DropDownChoice("mime", new PropertyModel(pv,
"mimeType"), pv.getSupportedMime());
item.add(mime);
} else {
item.add(new Label("mime", "").setVisible(false)); // placeholder
}
}
};
outputView.setReuseItems(true);
outputContainer.add(outputView);
// the output response window
responseWindow = new ModalWindow("responseWindow");
add(responseWindow);
responseWindow.setPageMapName("demoResponse");
responseWindow.setCookieName("demoResponse");
responseWindow.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
DemoRequest request = new DemoRequest(null);
HttpServletRequest http = ((WebRequest) WPSRequestBuilderPanel.this.getRequest())
.getHttpServletRequest();
String url = ResponseUtils.buildURL(ResponseUtils.baseURL(http), "ows", Collections
.singletonMap("strict", "true"), URLType.SERVICE);
request.setRequestUrl(url);
request.setRequestBody((String) responseWindow.getDefaultModelObject());
return new DemoRequestResponse(new Model(request));
}
});
// the describe process link
final GeoServerAjaxFormLink describeLink = new GeoServerAjaxFormLink("describeProcess") {
@Override
protected void onClick(AjaxRequestTarget target, Form form) {
processChoice.processInput();
if (execute.processName != null) {
responseWindow.setDefaultModel(new Model(getDescribeXML(execute.processName)));
responseWindow.show(target);
}
}
};
descriptionContainer.add(describeLink);
// the feedback panel, for validation errors
feedback = new FeedbackPanel("feedback");
feedback.setOutputMarkupId(true);
add(feedback);
// the process choice dropdown ajax behavior
processChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Name name = Ows11Util.name(execute.processName);
ProcessFactory pf = Processors.createProcessFactory(name);
if (pf == null) {
error("No such process: " + execute.processName);
descriptionContainer.setVisible(false);
inputContainer.setVisible(false);
outputContainer.setVisible(false);
} else {
description = pf.getDescription(name).toString(Locale.ENGLISH);
execute.inputs = buildInputParameters(pf, name);
execute.outputs = buildOutputParameters(pf, name);
inputView.removeAll();
outputView.removeAll();
descriptionContainer.setVisible(true);