Package com.google.gwt.user.client

Examples of com.google.gwt.user.client.Command


      add(focusPanel);
    }

    protected void _processEnter() {
     
      DeferredCommand.addCommand(new Command() {
        public void execute() {
          final TextArea ta = new TextArea();
          String text = contents.getText();
          ta.setText(text.trim());
         
View Full Code Here


  private void sortByColumn(String colName, boolean down) {
    sortFactor = down ? -1 : 1;
    sortColumn = colName;

    showProgress();
    DeferredCommand.addCommand(new Command() {
      public void execute() {
        Collections.sort(ontologyInfos, cmp);
        update();
      }
    });
View Full Code Here

   */
  public void setOntologyInfos(final List<RegisteredOntologyInfo> ontologyInfos, LoginResult loginResult) {
    this.ontologyInfos = ontologyInfos;
    this.isAdmin = loginResult != null && loginResult.isAdministrator();
   
    DeferredCommand.addCommand(new Command() {
      public void execute() {
        Collections.sort(ontologyInfos, cmp);
        update();
      }
    });
View Full Code Here

        MenuBar menu = new MenuBar(true);
//        menu.setStylePrimaryName("PopupMenu");
        final PopupPanel menuPopup = new PopupPanel(true);
       
        menu.addItem(new MenuItem("Sort up", new Command() {
        public void execute() {
          sortByColumn(colName, false);
          menuPopup.hide();
        }
        }));
        menu.addItem(new MenuItem("Sort down", new Command() {
        public void execute() {
          sortByColumn(colName, true);
          menuPopup.hide();
        }
        }));
View Full Code Here

    initWidget(uiBinder.createAndBindUi(this));

    currentYear.setInnerText(Integer.toString(new Date().getYear() + 1900));

    aboutMenuItem.setCommand(new Command() {
      @Override
      public void execute() {
        GWT.runAsync(new RunAsyncCallback() {

          @Override
          public void onFailure(Throwable reason) {
            // TODO Auto-generated method stub
          }

          @Override
          public void onSuccess() {
            AboutDialog aboutDialog = new AboutDialog();
            aboutDialog.center();
            aboutDialog.show();
          }
        });
      }
    });

    // Check to see if we have an user logged in, if so, let's build logout
    // menus and stuff. Otherwise, we'll show login link.
    if (userInfo != null) {
      settingsMenuItem.setCommand(new Command() {
        @Override
        public void execute() {
          placeController.goTo(new SettingsPlace());
        }

      });
      settingsMenuItem.setVisible(true);

      logoutMenuItem.setCommand(new Command() {
        @Override
        public void execute() {
          StringBuilder forwardUrl = new StringBuilder(Window.Location
              .getPath());

          String queryString = Window.Location.getQueryString();
          if (queryString != null) {
            forwardUrl.append(queryString);
          }

          String hash = Window.Location.getHash();
          if (hash != null) {
            forwardUrl.append(hash);
          }

          Window.Location.assign("/logout.php?f="
              + URL.encodeQueryString(forwardUrl.toString()));
        }
      });
      logoutMenuItem.setVisible(true);
    } else {
      loginMenuItem.setCommand(new Command() {
        @Override
        public void execute() {
          StringBuilder forwardUrl = new StringBuilder(Window.Location
              .getPath());

          String queryString = Window.Location.getQueryString();
          if (queryString != null) {
            forwardUrl.append(queryString);
          }

          String hash = Window.Location.getHash();
          if (hash != null) {
            forwardUrl.append(hash);
          }

          Window.Location.assign("/login.php?f="
              + URL.encodeQueryString(forwardUrl.toString()));
        }
      });
      loginMenuItem.setVisible(true);
    }

    searchKeyword.getTextBox().addFocusHandler(new FocusHandler() {
      @Override
      public void onFocus(FocusEvent event) {
        HotKeysManager.deactivateHotKeys();
      }
    });

    searchKeyword.getTextBox().addBlurHandler(new BlurHandler() {
      @Override
      public void onBlur(BlurEvent event) {
        HotKeysManager.activateHotKeys();
      }
    });

    HotKeysManager.registerHotKey('?', new Command() {

      @Override
      public void execute() {
        // TODO decide how we do the hot keys display popup.
      }
View Full Code Here

                                            @Override
                                            public String asString() {
                                                    return cell;
                                            }
                                    };
                                    friendList.addItem(friendCell, new Command() {
                                            @Override
                                            public void execute() {
                                                AsyncCallback<MatchInfo> callback = new AsyncCallback<MatchInfo>(){
                                                      @Override
                                                      public void onFailure(Throwable caught) {
                                                      }
                                                      @Override
                                                      public void onSuccess(MatchInfo result) {   //load the game from the server
                                                            presenter.loadGame(result.toString());
                                                     
                                                                     
                                               };
                                               opponentId = userTurnList.get(tmp).getId();
                                               loginService.LoadMatchByOpponentInDropdown(fbUid, opponentId, callback);
                                              
                                       }
                                   });
                               }
                               
                                for (int i = 0; i < opponentTurnList.size(); i++) {
                                    final String cell = "<img src = 'http://graph.facebook.com/" + opponentTurnList.get(i).getId()
                                                    + "/picture' height = '50px' width = '50px'>" + opponentTurnList.get(i).getName() + " / "
                                                    + "["+(opponentTurnList.get(i).getRank()-2*opponentTurnList.get(i).getrd())+" , "+(opponentTurnList.get(i).getRank()+2*opponentTurnList.get(i).getrd())+"]" + " / Opponent Turn";
                                    SafeHtml friendCell = new SafeHtml() {
                                            @Override
                                            public String asString() {
                                                    return cell;
                                            }
                                    };
                                    final int tmp = i;
                                    friendList.addItem(friendCell, new Command() {
                                            @Override
                                            public void execute() {
                                                    AsyncCallback<MatchInfo> callback = new AsyncCallback<MatchInfo>(){
                                                                  @Override
                                                                  public void onFailure(Throwable caught) {
                                                                  }
                                                                  @Override
                                                                  public void onSuccess(MatchInfo result) {   //load the game from the server
                                                                    presenter.loadGame(result.toString());
                                                                 
                                                                         
                                                   };
                                                   opponentId = opponentTurnList.get(tmp).getId();
                                                   loginService.LoadMatchByOpponentInDropdown(fbUid, opponentId, callback);
                                                  
                                           }
                                    });
                                }
                               
                                for (int i = 0; i < noAgainstList.size(); i++) {
                                    final int tmp = i;
                                    final String cell = "<img src = 'http://graph.facebook.com/" + noAgainstList.get(i).getId()
                                                    + "/picture' height = '50px' width = '50px'>" + noAgainstList.get(i).getName() + " / "
                                                    +"["+(noAgainstList.get(i).getRank()-2*noAgainstList.get(i).getrd())+" , "+(noAgainstList.get(i).getRank()+2*noAgainstList.get(i).getrd())+"]";
                                    SafeHtml friendCell = new SafeHtml() {
                                            @Override
                                            public String asString() {
                                                    return cell;
                                            }
                                    };
                                    friendList.addItem(friendCell, new Command() {
                                            @Override
                                            public void execute() {                                           
                                                 opponentId = noAgainstList.get(tmp).getId();
                                                 presenter.startMatch(opponentId);  
                                                 presenter.sendRequest();
View Full Code Here

        map.setSize("300px", "300px");
        RootPanel.get().add(map);
        InfoWindowContent content = new InfoWindowContent("<i>Hello World!</i>");
        InfoWindow info = map.getInfoWindow();
        info.open(center, content);
        DeferredCommand.addCommand(new Command() {
          public void execute() {
            map.closeInfoWindow();
            finishTest();
          }
        });
View Full Code Here

    return getFormat().parse(this, text, reportError);
  }

  private void preventDatePickerPopup() {
    allowDPShow = false;
    DeferredCommand.addCommand(new Command() {
      @Override
    public void execute() {
        allowDPShow = true;
      }
    });
View Full Code Here

    final Label bar = new Label("bar");
    p.add(foo, new Label("foo"));
    p.add(bar, new Label("bar"));

    delayTestFinish(2000);
    DeferredCommand.addCommand(new Command() {
      @Override
    public void execute() {
        assertEquals(128, foo.getOffsetWidth());
        assertEquals(128 - 32, foo.getOffsetHeight());

        p.selectTab(1);
        DeferredCommand.addCommand(new Command() {
          @Override
        public void execute() {
            assertEquals(128, bar.getOffsetWidth());
            assertEquals(128 - 32, bar.getOffsetHeight());
            finishTest();
View Full Code Here

    inner.addSouth(bar, 2);
    inner.add(new Label("center"));
    p.add(inner, new Label("bar"));

    delayTestFinish(2000);
    DeferredCommand.addCommand(new Command() {
      @Override
    public void execute() {
        p.selectTab(1);
        DeferredCommand.addCommand(new Command() {
          @Override
        public void execute() {
            // Assert that the 'bar' label is of non-zero size on both axes.
            // The problem fixed in issue 4694 was causing its height to be
            // zero on IE8, because the EM units weren't being calculated
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.