Example usage for org.apache.wicket Component getBehaviors

List of usage examples for org.apache.wicket Component getBehaviors

Introduction

In this page you can find the example usage for org.apache.wicket Component getBehaviors.

Prototype

public final List<? extends Behavior> getBehaviors() 

Source Link

Document

Gets the currently coupled Behavior s as a unmodifiable list.

Usage

From source file:org.wicketstuff.push.dojo.TargetRefresherManager.java

License:Apache License

public void onAfterRespond(final Map<String, Component> map, final IJavaScriptResponse response) {
    // we need to find all dojoWidget that should be reParsed
    final Map<String, Component> real = new HashMap<String, Component>();
    String requires = "";

    for (final Component c : dojoComponents.values()) {
        for (final Behavior behavior : c.getBehaviors()) {
            if (behavior instanceof AbstractRequireDojoBehavior) {
                requires += ((AbstractRequireDojoBehavior) behavior).getRequire();
            }/*ww  w.  j  a  va  2  s.c  om*/
        }
    }
    dojoComponents = real;

    if (generateReParseJs() != null) {
        response.addJavaScript(requires + generateReParseJs());
    }
    instance = null;

}

From source file:org.wicketstuff.push.timer.TimerPushService.java

License:Apache License

private TimerPushBehavior _findPushBehaviour(final Component component) {
    for (final Behavior behavior : component.getBehaviors())
        if (behavior instanceof TimerPushBehavior)
            return (TimerPushBehavior) behavior;
    return null;/* w  w  w  .  j a v a2 s.c  om*/
}

From source file:org.wicketstuff.table.column.TimedRender.java

License:Apache License

private ColumnTimingBehavior getColumnTimer(SelectableListItem parent, int column) {
    Component reference = parent.getParent().getParent();
    for (Iterator i = reference.getBehaviors().iterator(); i.hasNext();) {
        IBehavior behavior = (IBehavior) i.next();
        if (ColumnTimingBehavior.class.isAssignableFrom(behavior.getClass())) {
            ColumnTimingBehavior timing = (ColumnTimingBehavior) behavior;
            if (timing.getColumn() == column) {
                return timing;
            }//  w w w .  j  a  v  a 2  s. c  o  m
        }
    }
    ColumnTimingBehavior newTiming = null;
    reference.add(newTiming = new ColumnTimingBehavior(duration, column));
    return newTiming;
}

From source file:org.wicketstuff.table.TableUtil.java

License:Apache License

public static boolean doComponentHasBehavior(Component component, Class<? extends IBehavior> behavior) {
    for (Iterator i = component.getBehaviors().iterator(); i.hasNext();) {
        IBehavior b = (IBehavior) i.next();
        if (behavior.isAssignableFrom(b.getClass())) {
            return true;
        }/* w w  w.  j a v  a  2 s .  co  m*/
    }
    return false;
}

From source file:org.wicketstuff.table.TableUtil.java

License:Apache License

public static <T extends IBehavior> T getBehavior(Component component, Class<T> behavior) {
    for (Iterator i = component.getBehaviors().iterator(); i.hasNext();) {
        IBehavior b = (IBehavior) i.next();
        if (behavior.isAssignableFrom(b.getClass())) {
            return (T) b;
        }//from  www .  j  a  va  2s . c o m
    }
    return null;
}