Codota Logo
IBehavior
Code IndexAdd Codota to your IDE (free)

How to use
IBehavior
in
org.apache.wicket.behavior

Best Java code snippets using org.apache.wicket.behavior.IBehavior (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void onComponentTag(Component aComponent, ComponentTag aTag) {
  for (IBehavior behavior : behaviors) {
    behavior.onComponentTag(aComponent, aTag);
  }
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void afterRender(Component aComponent) {
  for (IBehavior behavior : behaviors) {
    behavior.afterRender(aComponent);
  }
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void beforeRender(Component aComponent) {
  for (IBehavior behavior : behaviors) {
    behavior.beforeRender(aComponent);
  }
}
origin: org.ops4j.pax.wicket/pax-wicket-service

  behavior.onComponentTag(this, tag);
if (behavior.isEnabled(this))
  behavior.onComponentTag(this, tag);
behavior.detach(this);
origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.
 * 
 * Traverses all behaviors and calls detachModel() on them. This is needed to cleanup behavior
 * after render. This method is necessary for {@link AjaxRequestTarget} to be able to cleanup
 * component's behaviors after header contribution has been done (which is separated from
 * component render).
 */
public final void detachBehaviors()
{
  for (IBehavior behavior : getBehaviors())
  {
    // Always detach models, 'accepted' or not. Otherwise, if they
    // are accepted during render, but not here - something can go
    // undetached, and calling isEnabled can also lead to nasty side
    // effects. See for instance Timo's comment on
    // http://issues.apache.org/jira/browse/WICKET-673
    behavior.detach(this);
    if (behavior.isTemporary())
    {
      removeBehavior(behavior);
    }
  }
}
origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Adds an behavior modifier to the component.
 * 
 * <p>
 * Note: this method is override to enable users to do things like discussed in <a
 * href="http://www.nabble.com/Why-add%28IBehavior%29-is-final--tf2598263.html#a7248198">this
 * thread</a>.
 * </p>
 * 
 * @param behavior
 *            The behavior modifier to be added
 * @return this (to allow method call chaining)
 */
public Component add(final IBehavior behavior)
{
  if (behavior == null)
  {
    throw new IllegalArgumentException("Argument may not be null");
  }
  addBehavior(behavior);
  if (!behavior.isTemporary())
  {
    addStateChange(new AddedBehaviorChange(behavior));
  }
  // Give handler the opportunity to bind this component
  behavior.bind(this);
  return this;
}
origin: org.wamblee/wamblee-wicket-components

@Override
public boolean isEnabled(Component aComponent) {
  for (IBehavior behavior : behaviors) {
    if (!behavior.isEnabled(aComponent)) {
      return false;
    }
  }
  return true;
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void exception(Component aComponent, RuntimeException aException) {
  for (IBehavior behavior : behaviors) {
    behavior.exception(aComponent, aException);
  }
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void bind(Component aComponent) {
  for (IBehavior behavior : behaviors) {
    behavior.bind(aComponent);
  }
}
origin: org.wamblee/wamblee-wicket-components

@Override
public void detach(Component aComponent) {
  for (IBehavior behavior : behaviors) {
    behavior.detach(aComponent);
  }
}
origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Returns if the component is stateless or not. It checks the stateless hint if that is false
 * it returns directly false. If that is still true it checks all its behaviors if they can be
 * stateless.
 * 
 * @return whether the component is stateless.
 */
public final boolean isStateless()
{
  if (!getStatelessHint())
  {
    return false;
  }
  final Iterator behaviors = getBehaviors().iterator();
  while (behaviors.hasNext())
  {
    IBehavior behavior = (IBehavior)behaviors.next();
    if (!behavior.getStatelessHint(this))
    {
      return false;
    }
  }
  return true;
}
origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Removes behavior from component
 * 
 * @param behavior
 *            behavior to remove
 * 
 * @return this (to allow method call chaining)
 */
public Component remove(final IBehavior behavior)
{
  if (behavior == null)
  {
    throw new IllegalArgumentException("Argument `behavior` cannot be null");
  }
  if (removeBehavior(behavior))
  {
    if (!behavior.isTemporary())
    {
      addStateChange(new RemovedBehaviorChange(behavior));
    }
  }
  else
  {
    throw new IllegalStateException(
      "Tried to remove a behavior that was not added to the component. Behavior: " +
        behavior.toString());
  }
  return this;
}
origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.
 * 
 * Traverses all behaviors and calls detachModel() on them. This is needed to cleanup behavior
 * after render. This method is necessary for {@link AjaxRequestTarget} to be able to cleanup
 * component's behaviors after header contribution has been done (which is separated from
 * component render).
 */
public final void detachBehaviors()
{
  List behaviors = getBehaviorsImpl();
  if (behaviors != null)
  {
    for (Iterator i = behaviors.iterator(); i.hasNext();)
    {
      IBehavior behavior = (IBehavior)i.next();
      // Always detach models, 'accepted' or not. Otherwise, if they
      // are accepted during render, but not here - something can go
      // undetached, and calling isEnabled can also lead to nasty side
      // effects. See for instance Timo's comment on
      // http://issues.apache.org/jira/browse/WICKET-673
      behavior.detach(this);
      if (behavior.isTemporary())
      {
        removeBehavior(behavior);
      }
    }
  }
}
origin: org.ops4j.pax.wicket/pax-wicket-service

if (!behavior.isTemporary())
behavior.bind(this);
origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Components are allowed to reject behavior modifiers.
 * 
 * @param behavior
 * @return False, if the component should not apply this behavior
 */
protected boolean isBehaviorAccepted(final IBehavior behavior)
{
  // Ignore AttributeModifiers when FLAG_IGNORE_ATTRIBUTE_MODIFIER is set
  if ((behavior instanceof AttributeModifier) &&
    (getFlag(FLAG_IGNORE_ATTRIBUTE_MODIFIER) != false))
  {
    return false;
  }
  return behavior.isEnabled(this);
}
origin: org.ops4j.pax.wicket/pax-wicket-service

behavior.exception(this, ex);
origin: org.wamblee/wamblee-wicket-components

@Override
public void bind(Component aComponent) {
  super.bind(aComponent);
  for (IBehavior behavior: createLocalizedBehaviors(aComponent) ) { 
    behavior.bind(aComponent); 
    add(behavior);
  }
}

origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * Returns if the component is stateless or not. It checks the stateless hint if that is false
 * it returns directly false. If that is still true it checks all its behaviors if they can be
 * stateless.
 * 
 * @return whether the component is stateless.
 */
public final boolean isStateless()
{
  if (!getStatelessHint())
  {
    return false;
  }
  for (IBehavior behavior : getBehaviors())
  {
    if (!behavior.getStatelessHint(this))
    {
      return false;
    }
  }
  return true;
}
origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * Removes behavior from component
 * 
 * @param behavior
 *            behavior to remove
 * 
 * @return this (to allow method call chaining)
 */
public Component remove(final IBehavior behavior)
{
  if (behavior == null)
  {
    throw new IllegalArgumentException("Argument `behavior` cannot be null");
  }
  if (removeBehavior(behavior))
  {
    if (!behavior.isTemporary())
    {
      addStateChange(new RemovedBehaviorChange(behavior));
    }
  }
  else
  {
    throw new IllegalStateException(
      "Tried to remove a behavior that was not added to the component. Behavior: " +
        behavior.toString());
  }
  return this;
}
origin: org.apache.wicket/com.springsource.org.apache.wicket

  behavior.onComponentTag(this, tag);
behavior.onComponentTag(this, tag);
org.apache.wicket.behaviorIBehavior

Javadoc

Behaviors are kind of plug-ins for Components. They allow to be added to a component and get essential events forwarded by the component. they can be bound to a concrete component (using the bind method is called when the behavior is attached), but they don't need to. They can modify the components markup by changing the rendered ComponentTag. Behaviors can have their own models as well, and they are notified when these are to be detached by the component.

It is recommended that you extend from org.apache.wicket.behavior.AbstractBehaviorinstead of directly implementing this interface.

Most used methods

  • onComponentTag
    Called any time a component that has this behavior registered is rendering the component tag.
  • afterRender
    Called when a component that has this behavior coupled was rendered.
  • beforeRender
    Called when a component is about to render.
  • bind
    Bind this handler to the given component. This method is called by the host component immediately af
  • detach
    Allows the behavior to detach any state it has attached during request processing.
  • exception
    In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onExcepti
  • isEnabled
    Called when a components is rendering and wants to render this behavior. If false is returned this b
  • getStatelessHint
    This method returns false if the behavior generates a callback url (for example ajax behaviors)
  • isTemporary
    Specifies whether or not this behavior is temporary. Temporary behaviors are removed at the end of r

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now