public void reflectImage(NEffectPanel thePanel, int height, double opacity,
int gap, boolean setUp) {
DockPanel container;
Widget w;
Canvas v;
SimplePanel gapPanel;
if (setUp) {
w = (Image) ((DockPanel) thePanel.getPanelWidget()).getWidget(0);
v = (Canvas) ((DockPanel) thePanel.getPanelWidget()).getWidget(WHERE_IS_REFLECTION);
v.setSize(1, 1);
// v = new Canvas();
container = (DockPanel) thePanel.getPanelWidget();
// Remove from panel now as this may make any animations look much
// smoother
// If not, there is a danger on slow(er) systems that the reflection hangs
// out from image until re-drawn.
container.remove(WHERE_IS_REFLECTION);
} else {
container = new DockPanel();
w = getReflectedImage(thePanel, setUp);
v = new Canvas();
}
gapPanel = new SimplePanel();
gapPanel.setWidth("100%");
gapPanel.add(new HTML(" "));
gapPanel.setHeight(gap + "px");
int imgHeight = w.getOffsetHeight();
int canvasHeight = (int) ((imgHeight * height) / 100);
reflect(v.getElement(), w.getElement(), canvasHeight, opacity);
if (setUp) {
container.add(v, DockPanel.SOUTH);
} else {
container.add(w, DockPanel.NORTH);