List of usage examples for org.apache.wicket Component getBehaviors
public final List<? extends Behavior> getBehaviors()
From source file:org.odlabs.wiquery.core.util.WiQueryPluginVisitor.java
License:Open Source License
public void component(Component component, IVisit<Boolean> visit) { if (component.getBehaviors().contains(this.wiQueryPlugin)) { visit.stop(Boolean.TRUE); }//from w w w .j ava2 s . com if (component.equals(this.wiQueryPlugin)) { visit.stop(Boolean.TRUE); } }
From source file:org.odlabs.wiquery.tester.WiQueryTester.java
License:Open Source License
public List<IHeaderContributor> getHeaderContributors() { Page renderedPage = getLastRenderedPage(); final List<IHeaderContributor> contributors = new ArrayList<IHeaderContributor>(); renderedPage.visitChildren(new IVisitor<Component, Void>() { public void component(Component component, IVisit<Void> visit) { for (Behavior behavior : component.getBehaviors()) if (behavior instanceof IHeaderContributor) contributors.add((IHeaderContributor) behavior); }//from ww w . ja v a2 s . co m }); return contributors; }
From source file:org.opensingular.form.wicket.helpers.STypeTester.java
License:Apache License
private <T> void executeSingularEvents(IBiConsumer<String, T> valueSetter, Component component, T value) { Set<String> eventSet = new HashSet<>(); List<Behavior> behaviorList = new ArrayList<>(); component.getBehaviors().stream().filter(ajaxUpdateListenersFactory::isSingularBehavior).forEach(b -> { if (b instanceof AjaxEventBehavior) { eventSet.addAll(collectEvents((AjaxEventBehavior) b)); } else {//w w w. j a va 2 s . c o m behaviorList.add(b); } }); executarBehavior(valueSetter, component, value, behaviorList); executarEventos(valueSetter, component, value, eventSet); }
From source file:org.projectforge.web.wicket.WicketUtils.java
License:Open Source License
/** * Searchs the attribute behavior (SimpleAttributeModifier or AttibuteApendModifier) with the given attribute name and returns it if * found, otherwise null./*from w ww.j a v a 2s. c o m*/ * @param comp * @param name Name of attribute. */ public static AttributeModifier getAttributeModifier(final Component comp, final String name) { for (final Behavior behavior : comp.getBehaviors()) { if (behavior instanceof AttributeAppender && name.equals(((AttributeAppender) behavior).getAttribute()) == true) { return (AttributeAppender) behavior; } else if (behavior instanceof AttributeModifier && name.equals(((AttributeModifier) behavior).getAttribute()) == true) { return (AttributeModifier) behavior; } } return null; }
From source file:org.wicketstuff.dojo11.DojoTargetRefresherManager.java
License:Apache License
/** * @see org.apache.wicket.ajax.AjaxRequestTarget.IListener#onAfterRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget.IJavascriptResponse) *//*from w w w . ja va 2 s . c o m*/ @SuppressWarnings("unchecked") public void onAfterRespond(Map map, IJavaScriptResponse response) { //we need to find all dojoWidget that should be reParsed Iterator<Entry<String, Component>> it = dojoComponents.entrySet().iterator(); HashMap<String, Component> real = new HashMap<String, Component>(); String requires = ""; while (it.hasNext()) { Component c = (Component) ((Entry<String, Component>) it.next()).getValue(); for (Object behavior : c.getBehaviors()) { if (behavior instanceof AbstractRequireDojoBehavior) { requires += ((AbstractRequireDojoBehavior) behavior).getRequire(); } } if (!hasParentAdded(c) && c instanceof IDojoWidget) { //we do not need to reParse This widget, remove it real.put(c.getMarkupId(), c); } } dojoComponents = real; if (generateReParseJs() != null) { response.addJavaScript(requires + generateReParseJs()); } }
From source file:org.wicketstuff.js.ext.ExtComponent.java
License:Apache License
private void addThemeBehavior() { if (isExtRoot()) { Component component = this; boolean foundTheme = false; while (component != null) { for (Behavior behavior : component.getBehaviors()) { if (behavior instanceof ExtThemeBehavior) { foundTheme = true;//from w ww. ja v a2 s . c om break; } } if (foundTheme) { break; } component = component.getParent(); } if (!foundTheme) { add(getThemeBehavior()); } } }
From source file:org.wicketstuff.js.ext.ExtObservable.java
License:Apache License
@Override public void bind(Component component) { this.component = component; for (Map.Entry<String, ExtEventAjaxBehavior> entry : eventHandlers.entrySet()) { ExtEventAjaxBehavior behavior = entry.getValue(); if (!component.getBehaviors().contains(behavior)) { component.add(behavior);//from w w w .j a va2 s. c o m } } }
From source file:org.wicketstuff.js.ext.util.ExtCustomThemeBehavior.java
License:Apache License
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); Component parent = component.getParent(); boolean foundTheme = false; while (parent != null) { for (Behavior behavior : parent.getBehaviors()) { if (behavior instanceof ExtThemeBehavior) { foundTheme = true;// w w w . j av a 2 s .c om break; } } if (foundTheme) { break; } parent = parent.getParent(); } if (!foundTheme) { response.render(CssHeaderItem.forReference(EXT_ALL_NOTHEME_REFERENCE)); } }
From source file:org.wicketstuff.minis.apanel.GridLayout.java
License:Apache License
private GridLayoutConstraint getGridConstraint(final Component component) { for (final Behavior behavior : component.getBehaviors()) if (behavior instanceof GridLayoutConstraint) return (GridLayoutConstraint) behavior; return null;//from w w w .j av a 2 s . c o m }
From source file:org.wicketstuff.push.cometd.CometdPushService.java
License:Apache License
private CometdPushBehavior _findPushBehaviour(final Component component) { for (final Behavior behavior : component.getBehaviors()) if (behavior instanceof CometdPushBehavior) return (CometdPushBehavior) behavior; return null;/*from ww w .j ava2s .c o m*/ }