Search code examples
gwtmgwt

mgwt animation not working


I have created a simple mgwt project .

Its running fine but the Animation isnt working .

I am not able to import

      import com.googlecode.mgwt.mvp.client.Animation;

as mentioned in tutorials ..

It says
"Animation cannot be resolved"

I am using mgwt 2.0.0 GWT 2.6.0

Added this in my gwt.xml class

         <inherits name='com.googlecode.mgwt.MGWT'/>

Here is my code:

            import com.google.gwt.user.client.ui.VerticalPanel;
            import com.googlecode.mgwt.mvp.client.Animation; // this import not resolved
            import com.googlecode.mgwt.ui.client.MGWT;
            import com.googlecode.mgwt.ui.client.MGWTSettings; 
            import com.googlecode.mgwt.ui.client.animation.AnimationHelper;

            import com.googlecode.mgwt.ui.client.widget.panel.Panel;

    public class FirstPage extends VerticalPanel {

public FirstPage(){

    Panel panel = new Panel();
    panel.add(new Label("Intravue Dashboard"));
    final ListBox list = new ListBox();
    list.addItem("name1");
    list.addItem("name2");
    list.addItem("name3");
    panel.add(list);
    add(panel);
    list.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            RootPanel.get().clear();
            String name = list.getItemText(list.getSelectedIndex());
            RootPanel.get().add(new SelectedPanel(name));
        }
    });
      MGWT.applySettings(MGWTSettings.getAppSetting());
     AnimationHelper animationHelper = new AnimationHelper();
    add(animationHelper);
    Panel p = new Panel();

    animationHelper.goTo(p, Animation.SLIDE); // This Animation not getting imported


}

Solution

  • Use:

    import com.googlecode.mgwt.ui.client.widget.animation.Animation;
    import com.googlecode.mgwt.ui.client.widget.animation.Animations;
    

    UPDATE:

    As JPelletier correctly pointed out, Animation.SLIDE should be Animations.SLIDE - this class was renamed. Animation is an interface that all Animations implement.