* Reflects an image
*/
@Override
public void reflectImage(final NEffectPanel thePanel, final int height,
final double opacity, final int gap, boolean setUp) {
final DockPanel container = new DockPanel();
final Image v = new Image();
SimplePanel gapPanel;
Widget w = thePanel.getPanelWidget();
if (!(w instanceof Image)) {
w = ((VerticalPanel) w).getWidget(0);
}
// For some reason when reloading a page in IE a complete refresh is not
// made
// and so this effect is not fired; by adding this load listener overcomes
// this problem
// go figure......
if (!loaded) {
((Image) w).addLoadHandler(theIEFix);
loaded = true;
} else {
// ((Image) w).removeLoadHandler(theIEFix);
}
gapPanel = new SimplePanel();
gapPanel.setWidth("100%");
gapPanel.add(new HTML(" "));
gapPanel.setHeight(gap + "px");
int imgWidth = w.getOffsetWidth();
int imgHeight = w.getOffsetHeight();
int canvasHeight = new Double(imgHeight * height / 100).intValue();
v.setUrl(((Image) w).getUrl());
v.getElement().getStyle().setProperty("filter",
"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="
+ (opacity * 100)
+ ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="
+ (height * 100) + ")");
v.setHeight(canvasHeight + "px");
v.setWidth(imgWidth + "px");
thePanel.remove(w);
container.add(w, DockPanel.NORTH);
container.add(v, DockPanel.SOUTH);
container.add(gapPanel, DockPanel.CENTER);
thePanel.add(container);
}