Class ReflectionBehavior

  • All Implemented Interfaces:
    Serializable, IComponentAwareEventSink, IComponentAwareHeaderContributor, IClusterable

    public class ReflectionBehavior
    extends Behavior
    Behavior for adding reflections to an image. Uses reflection.js (v1.6), licensed under a MIT license.

    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/

    Author:
    Martijn Dashorst
    See Also:
    Serialized Form
    • Field Detail

      • REFLECTION_JS

        public static final ResourceReference REFLECTION_JS
        The resource reference to the reflection.js file.
    • Method Detail

      • setReflectionHeight

        public void setReflectionHeight​(Integer height)
        Sets the reflection height. This is a percentage of the original image. A height of 50 means that the reflection will be half the size of the original image, increasing the image size to 150%. Set the value to null to reset to the default value.
        Parameters:
        height - the height of the reflection as a percentage of the original image, valid values range from 0 to 100.
      • setReflectionOpacity

        public void setReflectionOpacity​(Integer opacity)
        Sets the opacity of the reflection.
        Parameters:
        opacity - the opacity. Valid values range from 0 to 100.