List of usage examples for org.apache.wicket Component isStateless
public final boolean isStateless()
From source file:name.martingeisse.admin.util.StatelessUtil.java
License:Open Source License
/** * Dumps the stateful components in the component hierarchy, starting at * the specified component.//w ww. jav a 2 s . com * * @param root the component to start at */ public static void dumpStatefulComponents(final Component root) { ParameterUtil.ensureNotNull(root, "root"); if (!root.isStateless()) { System.out.println("stateful component: " + root.getPath()); } if (root instanceof MarkupContainer) { final MarkupContainer container = (MarkupContainer) root; for (final Component child : container) { dumpStatefulComponents(child); } } }
From source file:name.martingeisse.wicket.util.StatelessUtil.java
License:Open Source License
/** * Dumps the stateful components in the component hierarchy, starting at * the specified component. The information is logged at INFO level. * //w w w . j a v a 2 s . com * @param root the component to start at */ public static void dumpStatefulComponents(final Component root) { ParameterUtil.ensureNotNull(root, "root"); if (!root.isStateless()) { logger.info("stateful component: " + root.getPath()); } if (root instanceof MarkupContainer) { final MarkupContainer container = (MarkupContainer) root; for (final Component child : container) { dumpStatefulComponents(child); } } }
From source file:org.cast.isi.page.ISIStatelessPage.java
License:Open Source License
private void checkIfPageStateless(Page p) { if (!p.isPageStateless()) { // find out why final List<Component> statefulComponents = new ArrayList<Component>(); p.visitChildren(Component.class, new IVisitor<Component, Void>() { public void component(Component component, IVisit<Void> visit) { if (!component.isStateless()) { statefulComponents.add(component); }/*from ww w . ja va2 s. co m*/ } }); String message = "Whoops! this page is no longer stateless"; if (statefulComponents.size() > 0) { message += " - the reason is that it contains the following stateful components: "; for (Component c : statefulComponents) { message += "\n" + c.getMarkupId() + "[" + c.getClass().getCanonicalName() + "]"; } } log.warn(message); } }
From source file:org.yes.cart.web.page.AbstractWebPage.java
License:Apache License
private void determineStatefulComponent() { final List<String> statefulComponentIds = new ArrayList<String>(); this.visitChildren(Component.class, new IVisitor<Component, Object>() { @Override/*from w ww. j a v a2 s. c o m*/ public void component(final Component object, final IVisit<Object> objectIVisit) { if (!object.isStateless()) { statefulComponentIds.add(object.getMarkupId()); } } }); LOG.warn("Page {} is stateful because of the following components: {}", getClass().getCanonicalName(), statefulComponentIds); }