use of org.apache.wicket.Response in project servoy-client by Servoy.
the class MultiFileUpload method renderHead.
@Override
public void renderHead(final IHeaderResponse response) {
// overwrites the MultiFileUploadField.js completely (can't be extended using prototypes because it assigns it's methods in the constructor)
response.renderJavascriptReference(JS);
// the HeaderResponse dummy is a hack to be able to intercept the object creation and replace some of the code in parent JS (it is using private fields)
super.renderHead(new HeaderResponse() {
@Override
public void renderJavascriptReference(ResourceReference reference) {
response.renderJavascriptReference(reference);
}
@Override
public void renderOnDomReadyJavascript(String javascript) {
// $NON-NLS-1$
int splitIdx = javascript.lastIndexOf(".addElement(");
if (splitIdx >= 0) {
String constructorCall = javascript.substring(0, splitIdx);
String functionCall = javascript.substring(splitIdx);
String translatedMessages = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"[ '" + application.getI18NMessage("servoy.filechooser.upload.addMoreFiles") + "' , '" + application.getI18NMessage("servoy.filechooser.upload.filesUploading") + // $NON-NLS-1$ //$NON-NLS-2$
"' ]";
response.renderOnDomReadyJavascript(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"var o = " + constructorCall + "; MultipleFileUploadInterceptor(o, " + translatedMessages + ")" + functionCall);
} else
response.renderOnDomReadyJavascript(javascript);
}
@Override
protected Response getRealResponse() {
// not interested
return null;
}
});
}
use of org.apache.wicket.Response in project gitblit by gitblit.
the class ShockWaveComponent method onComponentTagBody.
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
super.onComponentTagBody(markupStream, openTag);
Response response = getResponse();
// add all object's parameters in embed tag too:
response.write("<embed");
addParameter(response, "type", CONTENTTYPE);
for (String name : getParameterNames()) {
String value = getValue(name);
if (value != null) {
name = "movie".equals(name) ? "src" : name;
addParameter(response, name, value);
}
}
for (String name : getAttributeNames()) {
if ("width".equals(name) || "height".equals(name)) {
String value = getValue(name);
if (value != null) {
addParameter(response, name, value);
}
}
}
response.write(" />\n");
}
Aggregations