public abstract class AbstractJqueryUiEffect extends JQueryHeaderContributor
Panel myPanel = new Panel("myPanel"); EffectExplode explode = new EffectExplode(); // create effect explode.setSpeed(1000); // set options explode.setPieces(3); add(explode); // add effect to page just for header contribution explode.fire(target, myPanel); // execute effect on componentIt is not possible to fire multiple effects just by calling
fire
multiple times like this:
Panel myPanel = new Panel("myPanel"); EffectExplode explode = new EffectExplode(); // create effect explode.setSpeed(1000); // set options explode.setPieces(3); add(explode); // add effect to page just for header contribution explode.fire(target, myPanel); // execute effect on component EffectBlind blind = new EffectBlind(); // create next effect add(blind); // add effect to page just for header contribution blind.fire(target, myPanel); // execute next effect on comonentThis will lead to surprising results because jQuery does not wait for completion of the explode effect before starting the blind effect. Instead you must build a chain of post effects for a main effect like this:
Panel myPanel = new Panel("myPanel"); EffectExplode explode = new EffectExplode(); // create effect explode.setSpeed(1000); // set options explode.setPieces(3); add(explode); // add effect to page just for header contribution ListIt is important to add the effects during Page/Panel creation to ensure that the needed js libraries are added to header.postEffects = new ArrayList (); EffectBlind blind = new EffectBlind(); // create first post effect add(blind); // add effect to page just for header contribution postEffects.add(blind); // add effect to chain of post effects EffectBounce bounce = new EffectBounce(); // create next post effect add(bounce); // add effect to page just for header contribution postEffects.add(bounce); // add effect to chain of post effects explode.fire(target, postEffects, myPanel); // execute main effect and post effects on component
final EffectBlind blind = new EffectBlind(); // create first post effect add(blind); // add effect to page just for header contribution add(new AjaxLink("id") { @Override public void onClick(AjaxRequestTarget target) { blind.fire(target, component); // fire effect } } );
add(new AjaxLink("id") { @Override public void onClick(AjaxRequestTarget target) { final EffectBlind blind = new EffectBlind(); // create first post effect add(blind); // add effect to page just for header contribution blind.fire(target, component); // fire effect } } );
Modifier and Type | Field and Description |
---|---|
protected String |
effectClass |
protected String |
fadeInAfter |
static JQueryResourceReference |
jQueryUiEffectsCoreJs |
protected boolean |
restoreStyleAfterEffect |
protected String |
speed |
jQueryCoreJs
Constructor and Description |
---|
AbstractJqueryUiEffect(JQueryResourceReference... requiredLibraries) |
Modifier and Type | Method and Description |
---|---|
void |
fire(org.apache.wicket.ajax.AjaxRequestTarget target,
AbstractJqueryUiEffect postEffect,
org.apache.wicket.Component... components)
Let's go! Execute the effect for a bunch of components and after the effect
was completed execute another effect for all components
|
void |
fire(org.apache.wicket.ajax.AjaxRequestTarget target,
org.apache.wicket.Component... components)
Let's go! Execute the effect for a bunch of components
|
void |
fire(org.apache.wicket.ajax.AjaxRequestTarget target,
List<AbstractJqueryUiEffect> postEffects,
org.apache.wicket.Component... components)
Let's go! Execute the effect for a bunch of components and after the effect
was completed execute some other effects for all components
|
String |
getEffectClass() |
void |
setEffectClass(String value)
jQuery applies a specific CSS class during effect processing; e.g.
|
AbstractJqueryUiEffect |
setFadeInAfter(int speed)
After the execution of an effect, the affected element sometimes is
no more visible.
|
AbstractJqueryUiEffect |
setFadeInAfter(JQuerySpeed speed) |
AbstractJqueryUiEffect |
setRestoreStyleAfterEffect(boolean value)
Some effects leave the effected component in a mixed up styling.
|
AbstractJqueryUiEffect |
setSpeed(int ms)
The effect speed may also be specified in milliseconds
|
AbstractJqueryUiEffect |
setSpeed(JQuerySpeed value)
A common parameter for all effects is the speed.
|
addJavascriptReference, addUserProvidedResourceReferences, getUserProvidedResourceReferences, renderHead
public static final JQueryResourceReference jQueryUiEffectsCoreJs
protected boolean restoreStyleAfterEffect
protected String speed
protected String effectClass
protected String fadeInAfter
public AbstractJqueryUiEffect(JQueryResourceReference... requiredLibraries)
public AbstractJqueryUiEffect setRestoreStyleAfterEffect(boolean value)
false
as parameter value to turn it off.value
- switch the preservation on or off.public AbstractJqueryUiEffect setSpeed(JQuerySpeed value)
JQuerySpeed
steps with this methodvalue
- the desired speed or null
to reset the speed to the default value.public AbstractJqueryUiEffect setSpeed(int ms)
the
- speed in milliseconds or a value <= 0 to reset the speed to the default value.public void setEffectClass(String value)
"ui-effects-explode"
for Explode
. This is done
by surrounding the original component by a <div>
tag. The
component keeps it's CSS class.
This method defines a CSS class that replaces the compontnt's
CSS class during effect. The surrounding <div>
tag and it's
effect specific class is not touched by this setting. It applies only
to the component.value
- the CSS class or null
to reset to the default CSS class.public String getEffectClass()
public AbstractJqueryUiEffect setFadeInAfter(int speed)
EffectMode.HIDE
or the effect itself {@link Explode) ore
some other circumstances.
By setting the fade in property, the original element is faded in
after the effect.value
- the speed for the fadeIn action.public AbstractJqueryUiEffect setFadeInAfter(JQuerySpeed speed)
public void fire(org.apache.wicket.ajax.AjaxRequestTarget target, org.apache.wicket.Component... components)
target
- components
- fire the effect on this componentpublic void fire(org.apache.wicket.ajax.AjaxRequestTarget target, AbstractJqueryUiEffect postEffect, org.apache.wicket.Component... components)
target
- postEffect
- this effect is executed after completion of this effectcomponents
- fire the effect on this componentpublic void fire(org.apache.wicket.ajax.AjaxRequestTarget target, List<AbstractJqueryUiEffect> postEffects, org.apache.wicket.Component... components)
target
- postEffects
- these effects are executed after completion of this effectcomponents
- fire the effect on this componentCopyright © 2015. All rights reserved.