List of usage examples for org.apache.wicket Component getPage
@Override public final Page getPage()
From source file:org.wicketstuff.poi.excel.TableParser.java
License:Apache License
/** * Mock a request to table component and return its response. * * @param tableComponent/* w ww. j av a2s . co m*/ * @return */ private BufferedWebResponse doRequest(Component tableComponent) { originalResponse = RequestCycle.get().getResponse(); BufferedWebResponse mockResponse = new BufferedWebResponse(null); RequestCycle.get().setResponse(mockResponse); Application.get().getComponentPreOnBeforeRenderListeners().add(PathSetupListener.INSTANCE); Page page = tableComponent.getPage(); page.startComponentRender(tableComponent); tableComponent.prepareForRender(); tableComponent.render(); return mockResponse; }
From source file:org.wicketstuff.poi.excel.TableParser.java
License:Apache License
private void afterParse(Component tableComponent) { tableComponent.getPage().endComponentRender(tableComponent); Application.get().getComponentPreOnBeforeRenderListeners().remove(PathSetupListener.INSTANCE); RequestCycle.get().setResponse(originalResponse); originalResponse = null;//w ww . j av a 2s .c om }
From source file:org.wicketstuff.security.components.SecureComponentHelper.java
License:Apache License
/** * Builds a 'unique' name for the component. The name is based on the page class alias and the * relative path to the page (if not a page itself). Note that although it is unlikely, it is * not impossible for two components to have the same alias. * // w w w. j a va 2 s . c o m * @param component * @return an alias. * @throws SecurityException * if the component is null, or if the page of the component is not available. */ public static String alias(Component component) { // might be useful in wicket core itself if (component == null) throw new SecurityException("Specified component is null"); Page page = null; try { page = component.getPage(); } catch (IllegalStateException e) { throw new SecurityException("Unable to create alias for component: " + component, e); } String alias = alias(page.getClass()); String relative = component.getPageRelativePath(); if (relative == null || "".equals(relative)) return alias; return alias + PATH_SEPARATOR + relative; }
From source file:sf.wicklet.gwt.server.ajax.impl.AbstractGwtAjaxResponse.java
License:Apache License
/** * @param response//from w w w . j a v a 2 s .co m * 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; }