Example usage for org.apache.wicket Component add

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

Introduction

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

Prototype

public Component add(final Behavior... behaviors) 

Source Link

Document

Adds a behavior modifier to the component.

Usage

From source file:eu.uqasar.web.components.Effects.java

License:Apache License

/**
 * Replaces the given {@code component} in HTML using a fade out fade in
 * effect.//w w  w. java2s.  c  o  m
 * 
 * @param target
 * @param component
 */
public static void replaceWithFading(AjaxRequestTarget target, Component component) {
    component.add(new DisplayNoneBehavior());
    target.prependJavaScript(String.format(JSTemplates.FADE_OUT_ELEM_TEMPLATE, component.getMarkupId()));
    target.add(component);
    target.appendJavaScript(String.format(JSTemplates.FADE_IN_ELEM_TEMPLATE, component.getMarkupId()));
}

From source file:eu.uqasar.web.components.Effects.java

License:Apache License

/**
 * Replaces the given {@code component} in HTML using a slide up slide down
 * effect.//from w  w w . j  a  v a 2 s  .  c o m
 * 
 * @param target
 * @param component
 */
public static void replaceWithSliding(AjaxRequestTarget target, Component component) {
    component.add(new DisplayNoneBehavior());
    target.prependJavaScript(String.format(JSTemplates.SLIDE_UP_ELEM_TEMPLATE, component.getMarkupId()));
    target.add(component);
    target.appendJavaScript(String.format(JSTemplates.SLIDE_DOWN_ELEM_TEMPLATE, component.getMarkupId()));
}

From source file:gr.interamerican.wicket.bo2.utils.SelfDrawnUtils.java

License:Open Source License

/**
 * Adds a behavior on a self drawn panel component that is executed on the "onchange" javascript event.
 * /*from   w w w  .j a v  a  2  s . c  o  m*/
 * 
 * @param selfDrawnPanel
 *        Self drawn panel.
 * @param wicketId
 *        The wicketId of the repeater that has this component.
 * @param callbackAction 
 *         The {@link CallbackAction} that is executed "onchange".
 */
public static void addUpdatingBehavior(MarkupContainer selfDrawnPanel, String wicketId,
        CallbackAction callbackAction) {
    Component component = getComponentFromSelfDrawnPanel(selfDrawnPanel, wicketId);
    component.add(new CallbackActionBehavior("onchange", callbackAction)); //$NON-NLS-1$
}

From source file:guru.mmp.application.web.template.util.FeedbackUtil.java

License:Apache License

/**
 * Applies the appropriate CSS class to a component based on the type of feedback message
 * associated with the component using a Wicket <code>AttributeModifier</code>.
 *
 * @param component the component to apply the CSS class to based on the type of feedback message
 *                  associated with the component
 *///  ww  w .ja  v  a  2 s .c  o m
public static void applyFeedbackCssClassModifier(Component component) {
    List<? extends Behavior> behaviors = component.getBehaviors();

    if (component.hasErrorMessage()) {
        if (!behaviors.contains(HAS_ERROR_CSS_CLASS_MODIFIER)) {
            component.add(HAS_ERROR_CSS_CLASS_MODIFIER);
        }
    } else {
        if (behaviors.contains(HAS_ERROR_CSS_CLASS_MODIFIER)) {
            component.remove(HAS_ERROR_CSS_CLASS_MODIFIER);
        }
    }
}

From source file:net.dontdrinkandroot.wicket.bootstrap.behavior.BadgeBehavior.java

License:Apache License

@Override
public void bind(Component component) {

    super.bind(component);

    component.add(new CssClassAppender(BootstrapCssClass.BADGE));
    component.add(new CssClassAppender(this.getBadgeStyleModel()));
}

From source file:net.dontdrinkandroot.wicket.bootstrap.behavior.ButtonBehavior.java

License:Apache License

@Override
public void bind(Component component) {

    super.bind(component);

    component.add(new CssClassAppender(BootstrapCssClass.BTN));
    component.add(new CssClassAppender(this.getButtonStyleModel()));
    component.add(new CssClassAppender(this.getButtonSizeModel()));
}

From source file:net.dontdrinkandroot.wicket.bootstrap.behavior.LabelBehavior.java

License:Apache License

@Override
public void bind(Component component) {

    super.bind(component);

    component.add(new CssClassAppender(BootstrapCssClass.LABEL));
    component.add(new CssClassAppender(this.getLabelStyleModel()));
}

From source file:net.dontdrinkandroot.wicket.bootstrap.behavior.ToolTipBehavior.java

License:Apache License

@Override
public void bind(Component component) {

    super.bind(component);

    component.add(new AttributeModifier("title", this.textModel));
    component.add(new CssClassAppender("has-tooltip"));
    component.add(new AttributeModifier("data-placement", new EnumLowerCaseNameModel(this.getPositionModel())));
    component.add(new AttributeModifier("data-delay", this.getDelayModel()));
}

From source file:net.dontdrinkandroot.wicket.bootstrap.component.item.AbstractLinkItem.java

License:Apache License

@Override
protected void onInitialize() {

    super.onInitialize();

    Component link = this.createLink("link");
    link.add(new IconBehavior() {

        @Override/*from w  ww  .jav  a  2s  .com*/
        public IModel<CssClass> getPrependIconModel() {

            return AbstractLinkItem.this.getBeforeIconModel();
        };

        @Override
        public IModel<CssClass> getAppendIconModel() {

            return AbstractLinkItem.this.getAfterIconModel();
        };
    });
    this.add(link);
}

From source file:net.dontdrinkandroot.wicket.bootstrap.component.list.ListGroup.java

License:Apache License

@Override
protected void processListComponent(Component listComponent) {

    super.processListComponent(listComponent);
    listComponent.add(new CssClassAppender(BootstrapCssClass.LIST_GROUP_ITEM));
}