Example usage for org.apache.wicket AttributeModifier getAttribute

List of usage examples for org.apache.wicket AttributeModifier getAttribute

Introduction

In this page you can find the example usage for org.apache.wicket AttributeModifier getAttribute.

Prototype

public final String getAttribute() 

Source Link

Usage

From source file:com.pushinginertia.wicket.core.util.ComponentUtils.java

License:Open Source License

/**
 * Identifies if a component has had the given {@link AttributeModifier} added to it.
 * @param callingComponent component making the call
 * @param modifier modifier to search for
 * @return true if the modifier has been added to the component
 *//*  w  w w  . ja  v a2 s.  c om*/
public static boolean isAttributeModifierAdded(final Component callingComponent,
        final AttributeModifier modifier) {
    ValidateAs.notNull(callingComponent, "callingComponent");
    ValidateAs.notNull(modifier, "modifier");

    final List<AttributeModifier> behaviorList = callingComponent.getBehaviors(AttributeModifier.class);
    final String attribute = modifier.getAttribute();

    for (final AttributeModifier behavior : behaviorList) {
        if (attribute.equals(behavior.getAttribute())) {
            return modifier.equals(behavior);
        }
    }
    return false;
}