public void endTransformingElement(String uri,
String name,
String raw) throws IOException, SAXException, ProcessingException {
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("BEGIN endTransformingElement uri=" + uri + ", name=" + name + ", raw=" + raw);
}
if (name.equals(DELETECONTEXT_ELEMENT) == true) {
// do nothing, the context was destroyed on the startElement event
// Element: setxml
} else if (name.equals(SETXML_ELEMENT) == true) {
String path = (String)stack.pop();
String contextName = (String)stack.pop();
this.getSunShineComponent().setContextFragment(contextName, path, this.endRecording());
// Element: mergexml
} else if (name.equals(MERGEXML_ELEMENT) == true) {
String path = (String)stack.pop();
String contextName = (String)stack.pop();
this.getSunShineComponent().mergeContextFragment(contextName, path, this.endRecording());
// Element: appendxml
} else if (name.equals(APPENDXML_ELEMENT) == true) {
String path = (String)stack.pop();
String contextName = (String)stack.pop();
this.getSunShineComponent().appendContextFragment(contextName, path, this.endRecording());
// Element: removexml
} else if (name.equals(REMOVEXML_ELEMENT) == true) {
String path = (String)stack.pop();
String contextName = (String)stack.pop();
String text = this.endTextRecording(); //this is ignored
this.getSunShineComponent().removeContextFragment(contextName, path);
// Element: savexml
} else if (name.equals(SAVECONTEXT_ELEMENT) == true) {
String path = (String)stack.pop();
String contextName = (String)stack.pop();
SourceParameters pars = this.endParametersRecording((SourceParameters)null);
pars.setSingleParameterValue("contextname", contextName);
pars.setSingleParameterValue("path", path);
this.getSunShineComponent().getContext(contextName).saveXML(path,
pars,
this.objectModel,
this.resolver,
this.manager);
// Element: inputxml
} else if (name.equals(INPUTXML_ELEMENT) == true) {
String path = (String)this.stack.pop();
String fieldname = (String)this.stack.pop();
String contextname = (String)this.stack.pop();
DocumentFragment defaultFragment = this.endRecording();
if (this.formName == null) {
throw new ProcessingException("The inputxml must be contained inside a sunShine form.");
}
DocumentFragment value = this.getSunShineComponent().registerInputField(contextname, path, fieldname, formName);
if (value == null) value = defaultFragment;
this.sendEvents(value);
super.endTransformingElement("", name, name);
// Element form
} else if (name.equals(FORM_ELEMENT) == true
&& this.state == STATE_FORM) {
this.state = ((Integer)this.stack.pop()).intValue();
this.sendEndElementEvent("form");
this.formName = null;
// Element form action
} else if (name.equals(FORM_ACTION_ELEMENT) == true
&& this.state == STATE_FORM) {
String action = this.endTextRecording();
AttributesImpl a = (AttributesImpl)this.stack.pop();
// append a unique number to the form
synchronized (this.getClass()) {
this.formName = a.getValue("name") + '_" + currentFormNumber;
currentFormNumber++;
if (currentFormNumber > 99999) currentFormNumber = 0;
}
boolean hasPars = (action.indexOf("?") != -1);
action = this.response.encodeURL(action + (hasPars ? '&" : '?") + SunShineConstants.SUNSHINE_FORM_PARAMETER+'="+this.formName);
a.addAttribute("", "action", "action", "CDATA", action);
if (a.getValue("method") == null) {
a.addAttribute("", "method", "method", "CDATA", "POST");
}
this.sendStartElementEvent("form", a);
// Element form content
} else if (name.equals(FORM_CONTENT_ELEMENT) == true
&& this.state == STATE_FORM) {
// ignore this
} else {
super.endTransformingElement(uri, name, raw);
}
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("END endTransformingElement");
}
}
|