Search in sources :

Example 6 with Response

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;
        }
    });
}
Also used : Response(org.apache.wicket.Response) IHeaderResponse(org.apache.wicket.markup.html.IHeaderResponse) HeaderResponse(org.apache.wicket.markup.html.internal.HeaderResponse) IHeaderResponse(org.apache.wicket.markup.html.IHeaderResponse) HeaderResponse(org.apache.wicket.markup.html.internal.HeaderResponse) ResourceReference(org.apache.wicket.ResourceReference) JavascriptResourceReference(org.apache.wicket.markup.html.resources.JavascriptResourceReference)

Example 7 with Response

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");
}
Also used : Response(org.apache.wicket.Response)

Aggregations

Response (org.apache.wicket.Response)7 IHeaderResponse (org.apache.wicket.markup.html.IHeaderResponse)4 Component (org.apache.wicket.Component)3 IComponent (com.servoy.j2db.ui.IComponent)2 IFieldComponent (com.servoy.j2db.ui.IFieldComponent)2 IRuntimeComponent (com.servoy.j2db.ui.runtime.IRuntimeComponent)2 Point (java.awt.Point)2 DisplayString (com.servoy.j2db.dataprocessing.CustomValueList.DisplayString)1 IFormDataDragNDrop (com.servoy.j2db.dnd.IFormDataDragNDrop)1 BaseComponent (com.servoy.j2db.persistence.BaseComponent)1 WrapperContainer (com.servoy.j2db.server.headlessclient.WrapperContainer)1 WebTabPanel (com.servoy.j2db.server.headlessclient.dataui.WebTabPanel)1 DraggableBehavior (com.servoy.j2db.server.headlessclient.dnd.DraggableBehavior)1 Font (java.awt.Font)1 Insets (java.awt.Insets)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 WeakHashMap (java.util.WeakHashMap)1 IVisitor (org.apache.wicket.Component.IVisitor)1