Adding package protected roll down animation from gwt-incubator, initial work done by Jason Essington
Review by:jlabanca
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@4448 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index bbf4de4..707fc0b 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -100,7 +100,7 @@
* </ul>
*/
static enum AnimationType {
- CENTER, ONE_WAY_CORNER
+ CENTER, ONE_WAY_CORNER, ROLL_DOWN
}
/**
@@ -144,7 +144,7 @@
// Determine if we need to animate
boolean animate = curPanel.isAnimationEnabled;
- if (curPanel.animType == AnimationType.ONE_WAY_CORNER && !showing) {
+ if (curPanel.animType != AnimationType.CENTER && !showing) {
animate = false;
}
@@ -210,17 +210,25 @@
int bottom = 0;
int height = (int) (progress * offsetHeight);
int width = (int) (progress * offsetWidth);
- if (curPanel.animType == AnimationType.CENTER) {
- top = (offsetHeight - height) >> 1;
- left = (offsetWidth - width) >> 1;
- } else if (curPanel.animType == AnimationType.ONE_WAY_CORNER) {
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- left = offsetWidth - width;
- }
+ switch (curPanel.animType) {
+ case ROLL_DOWN:
+ right = offsetWidth;
+ bottom = height;
+ break;
+ case CENTER:
+ top = (offsetHeight - height) >> 1;
+ left = (offsetWidth - width) >> 1;
+ right = left + width;
+ bottom = top + height;
+ break;
+ case ONE_WAY_CORNER:
+ if (LocaleInfo.getCurrentLocale().isRTL()) {
+ left = offsetWidth - width;
+ }
+ right = left + width;
+ bottom = top + height;
+ break;
}
- right = left + width;
- bottom = top + height;
-
// Set the rect clipping
impl.setClip(curPanel.getElement(), getRectString(top, right, bottom,
left));