public class ReflectionBehavior
extends org.apache.wicket.behavior.Behavior
Add this behavior to your image to generate a reflection. You can change the height and opacity of the reflection using the provided setters.
Ultimately the markup you attach this behavior to must be an image, but it need not be a Wicket
Image component, a markup container will suffice, provided the tag is an img-tag.
You can also use this class to generate add and remove reflection scriptlets for use in Ajax
request targets or any other place you want. All you need to do is ensure the reflection.js is
added to the head of the document. You can use the REFLECTION_JS resource reference for
that.
The reflection.js library and more documentation can be found here http://cow.neondragon.net/stuff/reflection/
| Modifier and Type | Class and Description |
|---|---|
static class |
ReflectionBehavior.Javascript
Container for javascript calls this behavior enables
|
| Modifier and Type | Field and Description |
|---|---|
static org.apache.wicket.request.resource.ResourceReference |
REFLECTION_JS
The resource reference to the reflection.js file.
|
| Constructor and Description |
|---|
ReflectionBehavior()
Default constructor, creates a reflection using the default settings from reflection.js.
|
ReflectionBehavior(Integer height,
Integer opacity)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind(org.apache.wicket.Component component)
Binds the component to this behavior.
|
void |
renderHead(org.apache.wicket.Component c,
org.apache.wicket.markup.head.IHeaderResponse response)
Adds the reflection.js javascript to the page.
|
void |
setReflectionHeight(Integer height)
Sets the reflection height.
|
void |
setReflectionOpacity(Integer opacity)
Sets the opacity of the reflection.
|
public static final org.apache.wicket.request.resource.ResourceReference REFLECTION_JS
public ReflectionBehavior()
public ReflectionBehavior(Integer height, Integer opacity)
height - see setReflectionHeight(Integer)opacity - see setReflectionOpacity(Integer)public void bind(org.apache.wicket.Component component)
bind in class org.apache.wicket.behavior.BehaviorBehavior.bind(Component)public void renderHead(org.apache.wicket.Component c,
org.apache.wicket.markup.head.IHeaderResponse response)
renderHead in interface org.apache.wicket.markup.html.IComponentAwareHeaderContributorrenderHead in class org.apache.wicket.behavior.BehaviorBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse)public void setReflectionHeight(Integer height)
height - the height of the reflection as a percentage of the original image, valid values
range from 0 to 100.public void setReflectionOpacity(Integer opacity)
opacity - the opacity. Valid values range from 0 to 100.Copyright © 2017. All rights reserved.