List of usage examples for org.apache.wicket Component toString
@Override
public String toString()
From source file:com.conwax.ajax.SimpleAjaxRequestTarget.java
License:Apache License
public void setComponent(Component component) { Args.notNull(component, "component"); if (component.getOutputMarkupId() == false && !(component instanceof Page)) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); }//from w ww . j av a2s . co m this.component = component; }
From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java
License:Apache License
/** * Adds a component to the list of components to be rendered * /*from w w w .j av a 2 s . co m*/ * @param component * component to be rendered */ public void addComponent(Component component) { if (component == null) { throw new IllegalArgumentException("component cannot be null"); } if (component.getOutputMarkupId() == false) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); } addComponent(component, component.getMarkupId()); }
From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java
License:Apache License
/** * Sets the focus in the browser to the given component. The markup id must be set. If the * component is null the focus will not be set to any component. * /* w w w. j a v a 2s . c o m*/ * @param component * The component to get the focus or null. */ public final void focusComponent(Component component) { if (component != null && component.getOutputMarkupId() == false) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); } final String id = component != null ? ("'" + component.getMarkupId() + "'") : "null"; appendJavascript("Wicket.Focus.setFocusOnId(" + id + ");"); }
From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java
License:Apache License
/** * /*from www .j a va 2 s .c o m*/ * @param response * @param markupId * id of client-side dom element * @param component * component to render */ private void respondComponent(final Response response, final String markupId, final Component component, StringBuffer writer) { if (component.getRenderBodyOnly() == true) { throw new IllegalStateException( "Ajax render cannot be called on component that has setRenderBodyOnly enabled. Component: " + component.toString()); } component.setOutputMarkupId(true); // substitute our encoding response for the real one so we can capture // component's markup in a manner safe for transport inside CDATA block final Response originalResponse = response; encodingBodyResponse.reset(); RequestCycle.get().setResponse(encodingBodyResponse); // Initialize temporary variables final Page page = component.findParent(Page.class); if (page == null) { // dont throw an exception but just ignore this component, somehow // it got // removed from the page. // throw new IllegalStateException( // "Ajax request attempted on a component that is not associated // with a Page"); LOG.debug("component: " + component + " with markupid: " + markupId + " not rendered because it was already removed from page"); return; } page.startComponentRender(component); try { component.prepareForRender(); // render any associated headers of the component respondHeaderContribution(response, component, writer); } catch (RuntimeException e) { try { component.afterRender(); } catch (RuntimeException e2) { // ignore this one could be a result off. } // Restore original response RequestCycle.get().setResponse(originalResponse); encodingBodyResponse.reset(); throw e; } try { component.renderComponent(); } catch (RuntimeException e) { RequestCycle.get().setResponse(originalResponse); encodingBodyResponse.reset(); throw e; } page.endComponentRender(component); // Restore original response RequestCycle.get().setResponse(originalResponse); writer.append("<component id=\""); writer.append(markupId); writer.append("\" "); if (encodingBodyResponse.isContentsEncoded()) { writer.append(" encoding=\""); writer.append(getEncodingName()); writer.append("\" "); } writer.append("><![CDATA["); writer.append(encodingBodyResponse.getContents()); writer.append("]]></component>"); encodingBodyResponse.reset(); }
From source file:org.wicketstuff.dojo11.templates.DojoPackagedTextTemplate.java
License:Apache License
/** * Return a key to use in renderJavascript. * A WidgetUnique Key is a Key <b>Unique for <u>one</u> widget of the class</b>. * So if there are n widget on the same page, a resource rendered with a * WidgetUniqueKey will be displayed n times. But if a same widget is render m times, this resource wil render once * @param component component for which the uniqueKey will be generated * @return a key to use in renderJavascript *///from www . j av a2 s .c o m public String getWidgetUniqueKey(Component component) { //use memory adress to generate key return component.toString() + this.fileName; }
From source file:org.wicketstuff.push.dojo.DojoPackagedTextTemplate.java
License:Apache License
/** * Return a key to use in renderJavascript. A WidgetUnique Key is a Key * <b>Unique for <u>one</u> widget of the class</b>. So if there are n * widget on the same page, a resource rendered with a WidgetUniqueKey will * be displayed n times. But if a same widget is render m times, this * resource wil render once/*from w w w. j av a 2 s. c o m*/ * * @param component * component for which the uniqueKey will be generated * @return a key to use in renderJavascript */ public String getWidgetUniqueKey(final Component component) { // use memory address to generate key return component.toString() + fileName; }
From source file:sf.wicklet.gwt.server.ajax.impl.GwtAjaxWickletResponse.java
License:Apache License
@Override protected void writeComponent(final Response response, final String markupId, final Component component, final String encoding) { if (component.getRenderBodyOnly() == true) { throw new IllegalStateException( "Ajax render cannot be called on component that has setRenderBodyOnly enabled. Component: " + component.toString()); }//w ww. j av a 2s .com component.setOutputMarkupId(true); // substitute our encoding response for the real one so we can capture // component's markup in a manner safe for transport inside CDATA block encodingBodyResponse.reset(); RequestCycle.get().setResponse(encodingBodyResponse); // Initialize temporary variables final Page page = component.findParent(Page.class); if (page == null) { // dont throw an exception but just ignore this component, somehow // it got removed from the page. AbstractGwtAjaxResponse.LOG.debug("component: " + component + " with markupid: " + markupId + " not rendered because it was already removed from page"); return; } page.startComponentRender(component); try { component.prepareForRender(); // render any associated headers of the component writeHeaderContribution(response, component); } catch (final RuntimeException e) { try { component.afterRender(); } catch (final RuntimeException e2) { // ignore this one could be a result off. } // Restore original response RequestCycle.get().setResponse(response); encodingBodyResponse.reset(); throw e; } try { component.render(); } catch (final RuntimeException e) { RequestCycle.get().setResponse(response); encodingBodyResponse.reset(); throw e; } page.endComponentRender(component); // Restore original response RequestCycle.get().setResponse(response); response.write("<component id=\""); response.write(markupId); response.write("\" "); // if (encodingBodyResponse.isContentsEncoded()) { // response.write(" encoding=\""); // response.write(getEncodingName()); // response.write("\" "); // } response.write(" encoding=\"escaped-xml\" >"); response.write(XmlUtil.escXml(encodingBodyResponse.getContents())); response.write("</component>"); encodingBodyResponse.reset(); }
From source file:sf.wicklet.gwt.server.ajax.impl.GwtAjaxWickletTarget.java
License:Apache License
@Override public void add(final Component... components) { for (final Component component : components) { Args.notNull(component, "component"); if (component.getOutputMarkupId() == false && !(component instanceof Page)) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); }/*from w ww . jav a 2 s. c om*/ add(component, component.getMarkupId()); } }