List of usage examples for org.apache.wicket Component renderHead
@Override public void renderHead(IHeaderResponse response)
From source file:com.servoy.j2db.server.headlessclient.dataui.WebCellBasedView.java
License:Open Source License
private void respondHeaderContribution(final StringBuilder headerJS, final Component component) { if (header == null) { header = new ScrollResponseHeaderContainer(); }//from www . j a v a 2s. co m header.setOutput(headerJS); component.renderHead(header); if (component instanceof MarkupContainer) { ((MarkupContainer) component).visitChildren(new Component.IVisitor<Component>() { public Object component(Component c) { if (c.isVisibleInHierarchy()) { c.renderHead(header); return CONTINUE_TRAVERSAL; } else { return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } } }); } }
From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java
License:Apache License
/** * /*from w w w .ja va 2 s.c o m*/ * @param response * @param component */ private void respondHeaderContribution(final Response response, final Component component, StringBuffer writer) { headerRendering = true; // create the htmlheadercontainer if needed if (header == null) { header = new AjaxHtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID, this); final Page page = component.getPage(); page.addOrReplace(header); } // save old response, set new Response oldResponse = RequestCycle.get().setResponse(encodingHeaderResponse); encodingHeaderResponse.reset(); // render the head of component and all it's children component.renderHead(header); if (component instanceof MarkupContainer) { ((MarkupContainer) component).visitChildren(new Component.IVisitor<Component>() { public Object component(Component component) { if (component.isVisibleInHierarchy()) { component.renderHead(header); return CONTINUE_TRAVERSAL; } else { return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } } }); } // revert to old response RequestCycle.get().setResponse(oldResponse); if (encodingHeaderResponse.getContents().length() != 0) { writer.append("<header-contribution"); if (encodingHeaderResponse.isContentsEncoded()) { writer.append(" encoding=\""); writer.append(getEncodingName()); writer.append("\" "); } // we need to write response as CDATA and parse it on client, // because // konqueror crashes when there is a <script> element writer.append("><![CDATA[<head xmlns:wicket=\"http://wicket.apache.org\">"); writer.append(encodingHeaderResponse.getContents()); writer.append("</head>]]>"); writer.append("</header-contribution>"); } headerRendering = false; }
From source file:sf.wicklet.gwt.server.ajax.impl.AbstractGwtAjaxResponse.java
License:Apache License
/** * @param response/*ww w . j a v a 2s . com*/ * the response to write to * @param component * to component which will contribute to the header */ protected void writeHeaderContribution(final Response response, final Component component) { headerRendering = true; // create the htmlheadercontainer if needed if (header == null) { header = new AjaxHtmlHeaderContainer(this); final Page parentPage = component.getPage(); parentPage.addOrReplace(header); } final RequestCycle requestCycle = component.getRequestCycle(); // save old response, set new final Response oldResponse = requestCycle.setResponse(encodingHeaderResponse); try { encodingHeaderResponse.reset(); // render the head of component and all it's children component.renderHead(header); if (component instanceof MarkupContainer) { ((MarkupContainer) component).visitChildren(new IVisitor<Component, Void>() { @Override public void component(final Component component, final IVisit<Void> visit) { if (component.isVisibleInHierarchy()) { component.renderHead(header); } else { visit.dontGoDeeper(); } } }); } } finally { // revert to old response requestCycle.setResponse(oldResponse); } writeHeaderContribution(response); headerRendering = false; }