How to use DeckLayoutPanel?

713 views
Skip to first unread message

AgitoM

unread,
Aug 22, 2012, 9:13:21 AM8/22/12
to google-we...@googlegroups.com
Been trying to implement a iPhone like transition between widgets for a mobile project I'm working on
Basically I need transition from left to right, and from right to left.
Read online that this can be accomplished using a DeckLayoutPanel.

Been trying to get an example to work, but not matter what I try, I I can't get any of the DeckLayoutPanel contents to display.
Of the many things I have tried, this is a example:

public class AnimationMainView extends Composite {
private DeckLayoutPanel aPanel = new DeckLayoutPanel();
public AnimationMainView() {
initWidget(this.aPanel);
this.setSize("100%", "100%");
this.aPanel.setAnimationDuration(5000);
this.aPanel.setAnimationVertical(false);
Widget1 w1 = new Widget1(this);
this.aPanel.add(w1);
Widget2 w2 = new Widget2(this);
this.aPanel.add(w2);
this.openWidget1();
}
public void openWidget1() {
this.aPanel.showWidget(0);
}
public void openWidget2() {
this.aPanel.showWidget(1);
}
}

Does anyone have a working example of a DeckLayoutPanel being used, or can someone explain what I am doing wrong?

Thanks in advance.

Jens

unread,
Aug 22, 2012, 9:52:45 AM8/22/12
to google-we...@googlegroups.com
DeckLayoutPanel implements RequiresResize so you should use ResizeComposite to wrap the DeckLayoutPanel. If possible put your custom widget inside another layout panel (parent widget). If thats not possible you have to set the height of your widget to 100%. If you do so, you have to make sure that the parent widget/parent DOM element also has a height defined otherwise a height of 100% won't work for your widget.

Maybe you want to take a look at MGWT and GWT-PhoneGap if you are building a mobile app.

-- J.
Reply all
Reply to author
Forward
0 new messages