Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    smartgwt.mobile 1.0 pre beta hello world

    smartgwt.mobile 1.0 pre beta

    The Helloworld.java example has incorrect imports and does not work correctly.

    The codes uses these imports
    import com.google.gwt.event.dom.client.ClickEvent;
    import com.google.gwt.event.dom.client.ClickHandler;

    And it should use these

    import com.smartgwt.mobile.client.widgets.events.ClickEvent;
    import com.smartgwt.mobile.client.widgets.events.ClickHandler;


    The sample does not work. When you press the buttons, the onClick is not triggered.

    I think there is a problem with the backButton, but I have not figured out how it should work.


    Also when viewing the showcase with a kindle fire, the <back button is truncated. To see, point your kindle fire browser to the showcase. It works correctly on my android phone's browser.

    #2
    Please re-download smartgwt-mobile.1.0.zip, I've corrected the HelloWorld.java example and have updated release_notes.html. I may update this example again since the ToolbarButtons should really be within Toolbar's. Will also see if I can find a Kindle fire emulator. Thanks.

    Comment


      #3
      I'm also noting that the ScrollablePanel is truncated in HelloWorld which I'll correct later this evening. Please post any additional problems you are seeing.
      Thanks
      Kam

      Comment


        #4
        The Hello World in the zip does not compile for me as well.

        This is the error in Eclipse / HelloWorld.java - Around Line 45

        The method addHandler(H, GwtEvent.Type<H>) from the type Widget is not visible


        Any help would be appreciated.

        Comment


          #5
          Both the original and new HelloWorld have no compilation problems, the original HelloWorld just had a functional issue. You most likely have a faulty install of the GWT SDK.

          Comment


            #6
            I've updated HelloWorld to address several problems:
            1. addHandler is now addClickHandler. Note: the example was compiled using GWT 2.4
            2. The Color panel is no longer truncated.
            3. The ToolbarButtons in the Sports panel are now in Toolbars.

            Note that in the helloworld example resize (and orientationchange) events are not being handled. These are normally handled within the framework's TabSet.
            Since there is no TabSet within the helloworld example, it exposes something we probably want to address within the framework. I'll speak with Charles about this.

            Comment


              #7
              Just to be complete, I've included the new source below. This may be quicker than redownloading...


              HelloWorld.java:


              package com.mycompany.client;

              import com.google.gwt.core.client.EntryPoint;
              import com.google.gwt.user.client.ui.RootLayoutPanel;
              import com.smartgwt.mobile.client.widgets.Button;
              import com.smartgwt.mobile.client.widgets.Dialog;
              import com.smartgwt.mobile.client.widgets.Panel;
              import com.smartgwt.mobile.client.widgets.ScrollablePanel;
              import com.smartgwt.mobile.client.widgets.ToolbarButton;
              import com.smartgwt.mobile.client.widgets.events.ClickEvent;
              import com.smartgwt.mobile.client.widgets.events.ClickHandler;
              import com.smartgwt.mobile.client.widgets.layout.NavStack;
              import com.smartgwt.mobile.client.widgets.layout.Toolbar;

              /**
              * Entry point classes define <code>onModuleLoad()</code>.
              */
              public class HelloWorld implements EntryPoint {
              // handles application pages history and transitions
              private NavStack navigationStack;

              /**
              * This is the entry point method.
              */
              public void onModuleLoad() {
              navigationStack = new NavStack(46, 0, getColorsView());
              RootLayoutPanel.get().add(navigationStack);
              }

              public Panel getColorsView() {
              Panel panel = new ScrollablePanel("Colors");
              String[] colors = new String[]{ "blue", "red", "yellow", "green", "gray", "white", "black", "pink", "brown" };
              for (int i = 0; i < 50; i++) {
              String color = colors[(int) (Math.random() * colors.length)];
              Button button = new Button(color);
              button.setTintColor(color);
              button.addClickHandler(new ClickHandler() {
              public void onClick(ClickEvent event) {
              navigationStack.push(getSportsView(((Button)event.getSource()).getTitle()));
              }
              });
              panel.addMember(button);
              }
              return panel;
              }

              public Panel getSportsView(String color) {
              Panel panel = new ScrollablePanel("Sports");
              String[] sports = new String[]{ "Baseball", "Basketball", "Football", "Hockey", "Volleyball" };
              for (int i = 0; i < 20; i++) {
              String sport = sports[(int) (Math.random() * sports.length)];
              ToolbarButton button = new ToolbarButton(sport);
              button.setInheritTint(true);
              button.addClickHandler(new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
              String sportName = ((ToolbarButton)event.getSource()).getTitle();
              Dialog dialog = new Dialog(navigationStack, "Do you like " + sportName + "?");
              dialog.setButtons(Dialog.YES, Dialog.NO);
              dialog.show();
              }
              });
              Toolbar toolbar = new Toolbar();
              toolbar.setTintColor(color);
              toolbar.addMember(button);
              panel.addMember(toolbar);
              }
              return panel;
              }
              }

              Comment


                #8
                Originally posted by Isomorphic
                Both the original and new HelloWorld have no compilation problems, the original HelloWorld just had a functional issue. You most likely have a faulty install of the GWT SDK.
                My environment had GWT 2.0.2 - and the code had compilation issue with it.

                I upgraded to GWT 2.4 and it works very well.

                Comment


                  #9
                  hi,

                  where did you download smartgwt.mobile? can you post a link?
                  regard,
                  timo

                  Comment


                    #10
                    The posted hello world works for me now. There are differences between the browsers I am testing it with. I am not sure if this is of interest or if I should just send issues that are on mobile devices. ( I still need to setup a good mobile test environment). Once I get my test environment setup I will be able to test a itouch, android galaxy skyrocket and kindle fire.

                    The the following browser versions I have found diferences. See attached.

                    FF 5.01

                    Safari 5.1.2
                    Everything worked OK.

                    Chrome 17.0.963.66
                    Attached Files

                    Comment


                      #11
                      See the user_guide.txt for expectations on what should and shouldn't work when testing with desktop browsers (and which ones).

                      Comment


                        #12
                        Please download the latest smartgwt-mobile-1.0.zip.
                        HelloWorld now resizes on resize, orientationchange events.
                        Last edited by kkasravi; 8 Mar 2012, 15:13.

                        Comment


                          #13
                          Tmoes,

                          Here's a link to the page with the download to the smartgwt.mobile sdk (beta):
                          http://forums.smartclient.com/showthread.php?t=21490

                          Comment

                          Working...
                          X