@Override
  public void onValueChange(ValueChangeEvent<String> event) {

    if (event.getValue().equals("page1")) {
      goToPage1();
    }

    if (event.getValue().equals("page2")) {
      goToPage2();
    }
  }
Ejemplo n.º 2
0
    /**
     * @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(ValueChangeEvent
     *     event)
     */
    public void onValueChange(ValueChangeEvent<String> event) {

      setGhostMode(false);
      if ((m_ghostValue != null) && "".equals(m_textbox.getValue())) {
        m_ghostMode = true;
        setGhostStyleEnabled(true);
        m_textbox.setValue(m_ghostValue);
      }
      if (!event.getValue().equals(m_currentValue)) {
        m_currentValue = event.getValue();
        fireValueChangedEvent();
      }
    }
Ejemplo n.º 3
0
  /**
   * This is called either when the user loads the page for the first time or when the user switches
   * places.
   *
   * <p>It is not meant to be called directly, but implicit via {@link #go(Class)}
   */
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    Map<String, String> tokens = parseToken(event.getValue());
    if (!tokens.containsKey(null)) {
      GWT.log("History Token has no location - returning to home page");
      goHome();
    } else {
      Class<? extends Activity> mainActivity = getActityFromLocation(tokens);
      if (mainActivity != null) {
        injector.create(
            mainActivity,
            new AsyncCallback<Activity>() {
              @Override
              public void onFailure(Throwable caught) {
                GWT.log("Unable to start requested Presenter", caught);
              }

              @Override
              public void onSuccess(Activity result) {
                display.displayActivity(result);
              }
            });
      } else {
        GWT.log("Unknown location - returning to home page");
        goHome();
        return;
      }
    }
  }
 /** Handles change events from {@link History}. */
 @Override
 public void onValueChange(final ValueChangeEvent<String> event) {
   if (locked) {
     defferedNavigation =
         new Command() {
           @Override
           public void execute() {
             onValueChange(event);
           }
         };
     return;
   }
   if (!getLock()) {
     return;
   }
   String historyToken = event.getValue();
   try {
     if (historyToken.trim().equals("")) {
       unlock();
       revealDefaultPlace();
     } else {
       historyToken = modifyNameToken(historyToken);
       placeHierarchy = tokenFormatter.toPlaceRequestHierarchy(historyToken);
       setPreviousRequestUrl(getCurrentPlaceRequest());
       doRevealPlace(getCurrentPlaceRequest(), true);
     }
   } catch (TokenFormatException e) {
     unlock();
     error(historyToken);
     NavigationEvent.fire(this, null);
   }
 }
  @Override
  public final void onValueChange(ValueChangeEvent<S> valueChangeEvent) {
    S s = valueChangeEvent.getValue();
    setValue(s);
    validate();

    if (getState() != State.Initial) {
      setState(validate() ? State.Valid : State.Invalid);
    }
  }
 /**
  * This will return immediately if the token passed in the event object isn't the token currently
  * on the History stack, or if the static back variable is true. If those aren't the case it calls
  * stateHandler.validateToken(token) and checks for equality with the token passed in. If they are
  * unequal it calls back() and adds a new item immediately after, then returns. If everything
  * checks out then the method cycles through the list of ClientWidget's and adds those which are
  * related to the page, by calling addWidget().
  */
 public void onValueChange(ValueChangeEvent<String> event) {
   String token = event.getValue();
   if (back || !token.equals(History.getToken())) return;
   String validatedToken = stateHandler.validateToken(token);
   if (!stateHandler.compareTokens(token, validatedToken)) {
     // back(); /* Actually works in Chrome, so I can't use this trick
     History.newItem(validatedToken);
     return;
   }
   for (ClientWidget w : list) if (w.isTokenRelated(validatedToken)) w.addWidgetToRootPanel();
 }
Ejemplo n.º 7
0
  @UiHandler("switchBuild")
  void onSwitch(ValueChangeEvent<String> event) {
    if ("MAVEN".equals(event.getValue())) {
      this.buildGradlePanel.setVisible(false);
      this.buildMavenPanel.setVisible(true);

    } else {
      this.buildGradlePanel.setVisible(true);
      this.buildMavenPanel.setVisible(false);
    }
  }
Ejemplo n.º 8
0
  /**
   * Processes the hyperlink clicks
   *
   * @param event The event of the hyperlink click
   */
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    ViewEnum view = ViewEnum.HOME;
    try {
      view = ViewEnum.valueOf(event.getValue());

    } catch (IllegalArgumentException e) {
      return;
    }
    setBody(view);
  }
Ejemplo n.º 9
0
  @Override
  public final Presenter onValueChange(ValueChangeEvent<String> event) {
    final String token = event.getValue();

    if (token != null) {
      if (token.equals(getListAction())) {
        return createListPresenter();
      } else if (token.equals(getAddAction())) {
        return createAddPresenter();
      } else if (token.equals(getEditAction())) {
        return createEditPresenter(null);
      }
    }
    return null;
  }
Ejemplo n.º 10
0
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    String hash = event.getValue();

    recordAnalyticsHit(Window.Location.getPath() + Window.Location.getHash());

    String[] parts = hash.split(",");

    if (parts.length == 12) {
      String code = parts[0];
      Integer year = Integer.decode(parts[1]);
      try {
        Integer timeLineDataType = Integer.decode(parts[2]);
        Integer timeLineChartSelect0 = Integer.decode(parts[3]);
        Integer timeLineChartSelect1 = Integer.decode(parts[4]);
        Integer timeLineChartSelect2 = Integer.decode(parts[5]);
        Integer timeLineChartSelect3 = Integer.decode(parts[6]);
        Integer timeLineChartSelect4 = Integer.decode(parts[7]);
        Integer timeLineChartSelect5 = Integer.decode(parts[8]);
        Integer pieChartDataType = Integer.decode(parts[9]);
        Integer pieChartNet = Integer.decode(parts[10]);
        Integer resultsGridNet = Integer.decode(parts[11]);
        selectBudgetCode(code, year);
        mTimeLineCharter.setState(
            timeLineDataType,
            timeLineChartSelect0,
            timeLineChartSelect1,
            timeLineChartSelect2,
            timeLineChartSelect3,
            timeLineChartSelect4,
            timeLineChartSelect5);
        mPieCharter.setState(pieChartDataType, pieChartNet);
        mResultsGrid.setState(resultsGridNet);
      } catch (Exception e) {
        Log.error("Application::onValueChange: Error while parsing url", e);
        newCodeAndYear("00", 2012);
      }
    } else {
      Log.error("Application::onValueChange: Error while parsing url");
      newCodeAndYear("00", 2012);
    }
  }
Ejemplo n.º 11
0
  /** {@inheritDoc} */
  @Override
  public void onValueChange(final ValueChangeEvent<String> event) {
    try {

      final PageRequest pageRequest = PageRequest.fromString(event.getValue(), pages);

      // A popup page cannot be accessed directly by URL modification (such as <a> elements).
      if (isPopupView(pageRequest.getPage())) {
        if (Log.isInfoEnabled()) {
          Log.info("Popup page '" + pageRequest + "' cannot be accessed directly by URL.");
        }
        eventBus.navigate(null);
      } else {
        eventBus.fireEvent(new PageRequestEvent(pageRequest, true));
      }

    } catch (final PageParsingException e) {
      eventBus.navigate(null);
    }
  }
Ejemplo n.º 12
0
  public void onValueChange(ValueChangeEvent<String> event) {
    String token = event.getValue();
    if (token != null) {
      String page = BLCLaunch.getSelectedPage(token);
      String moduleName = BLCLaunch.getSelectedModule(token);

      LinkedHashMap<String, String[]> pages = modules.get(moduleName).getPages();
      if (SecurityManager.getInstance().isUserAuthorizedToViewModule(moduleName)
          && SecurityManager.getInstance().isUserAuthorizedToViewSection(pages.get(page)[0])) {

        if (moduleName != null && !moduleName.equals(BLCMain.currentModuleKey)) {
          BLCMain.setCurrentModuleKey(moduleName);
          selectPrimaryMenu(moduleName);
          buildSecondaryMenu(page, moduleName);
          AppController.getInstance().clearCurrentView();
        } else {
          AppController.getInstance().clearCurrentView();
          buildSecondaryMenu(page, moduleName);
        }
      }
    }
  }
Ejemplo n.º 13
0
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          String newFragment = event.getValue();

          // Send the location to the server if the fragment has changed
          // and flush active connectors in UI.
          if (!newFragment.equals(currentFragment) && connection != null) {
            /*
             * Ensure the fragment is properly encoded in all browsers
             * (#10769)
             *
             * createUrlBuilder does not properly pass an empty fragment to
             * UrlBuilder on Webkit browsers so do it manually (#11686)
             */
            String location =
                Window.Location.createUrlBuilder()
                    .setHash(URL.decodeQueryString(Window.Location.getHash()))
                    .buildString();

            currentFragment = newFragment;
            connection.flushActiveConnector();
            connection.updateVariable(id, UIConstants.LOCATION_VARIABLE, location, true);
          }
        }
Ejemplo n.º 14
0
 @Override
 public void onValueChange(ValueChangeEvent<Object> event) {
   checkChanges(event.getValue());
 }
 @Override
 public void onValueChange(ValueChangeEvent<String> event) {
   System.out.println(event.getValue());
   onHistoryChange(event.getValue());
 }
Ejemplo n.º 16
0
 @Override
 public void onValueChange(ValueChangeEvent<String> event) {
   String token = event.getValue();
   switchSection(token);
 }
Ejemplo n.º 17
0
 /** {@code ValueChangeHandler} */
 @Override
 public void onValueChange(ValueChangeEvent<String> event) {
   String value = event.getValue();
   processHistoryChange(value);
 }
Ejemplo n.º 18
0
 public void onValueChange(ValueChangeEvent<Date> event) {
   setValue(parseDate(false), event.getValue(), true, true);
   hideDatePicker();
   preventDatePickerPopup();
   box.setFocus(true);
 }
Ejemplo n.º 19
0
 @UiHandler("scrollerX")
 public void onScrollX(ValueChangeEvent<GenomeRange> event) {
   contents.rangeX.pixelLength = contents.getElement().getClientWidth();
   contents.rangeX.update(event.getValue());
 }
 /**
  * test if the value change event's value is null.
  *
  * @param event the event to test.
  * @return true if the event or event's value is null, false overise.
  */
 public static boolean isValueNull(ValueChangeEvent<?> event) {
   return event == null || event.getValue() == null;
 }
Ejemplo n.º 21
0
    /**
     * @see
     *     com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)
     */
    public void onValueChange(ValueChangeEvent<String> event) {

      m_entity.setAttributeValue(m_attributeName, event.getValue(), m_valueIndex);
    }
 public void onValueChange(ValueChangeEvent<T> event) {
   onValueChange(event.getValue());
   view.refreshBudgetInfo(budget);
 }
Ejemplo n.º 23
0
 @UiHandler("contents")
 public void onScroll2D(ValueChangeEvent<Integer[]> event) {
   final Integer[] off = event.getValue();
   if (off[0] != 0) scrollerX.scrollRelative(off[0]);
   if (off[1] != 0) scrollerY.scrollRelative(off[1]);
 }
Ejemplo n.º 24
0
 @UiHandler("scrollerY")
 public void onScrollY(ValueChangeEvent<GenomeRange> event) {
   contents.rangeY.pixelLength = contents.getElement().getClientHeight();
   contents.rangeY.update(event.getValue());
 }
 @UiHandler("defaultValueEditor")
 void onDefaultValueChange(ValueChangeEvent<Splittable> event) {
   // Forward defaultValue onto value.
   model.setValue(event.getValue());
 }
Ejemplo n.º 26
0
 public void onValueChange(ValueChangeEvent<GWTCSimpleDatePicker> event) {
   setSelectedDate(event.getValue().getSelectedDate());
 }
Ejemplo n.º 27
0
  // from interface ValueChangeHandler<String>
  public void onValueChange(ValueChangeEvent<String> event) {
    Args args = new Args(event.getValue());

    // if we have showing popups, clear them out
    _pstack.clear();

    // these are OK to view as a guest
    switch (args.page) {
      case ATTRACTOR:
        setContent(LandingPage.attractor(this, args.get(0, 0), args.get(1, 0)));
        return;
      case LANDING:
        setContent(LandingPage.news(this, _news));
        return;
      case CARD:
        setContent(LandingPage.card(this, args.get(0, 0), args.get(1, 0), args.get(2, 0L)));
        return;
      case CREDITS:
        setContent(new CreditsPage(this));
        return;
      case BROWSE:
        if (args.get(0, getMe().userId) != 0) {
          if (!(_content instanceof BrowsePage)) {
            setContent(new BrowsePage(this));
          }
          ((BrowsePage) _content)
              .setArgs(args.get(0, getMe().userId), args.get(1, 0), args.get(1, ""));
          return;
        }
        break;
      default:
        break; // keep going
    }

    // otherwise guests see the "add this app to play" button
    if (getMe().isGuest()) {
      setContent(LandingPage.news(this, _news));
      return;
    }

    // these are OK as a regular player
    switch (args.page) {
      case FLIP:
        setContent(new FlipPage(this));
        return;
      case SHOP:
        setContent(new ShopPage(this));
        return;
      case GET_COINS:
        setContent(new BuyCoinsPage(this, args.get(0, "")));
        return;
      case FRIENDS:
        if (!(_content instanceof FriendsPage)) {
          setContent(new FriendsPage(this));
        }
        ((FriendsPage) _content).setMode(args.get(0, ""));
        return;
      case EDIT_INTRO:
        setContent(new EditIntroPage(this));
        return;
      default:
        break; // keep going
    }

    // these are OK for editors
    if (isEditor()) {
      switch (args.page) {
        case EDIT_CATS:
          if (!(_content instanceof EditCatsPage)) {
            setContent(new EditCatsPage(this));
          }
          ((EditCatsPage) _content).setArgs(args);
          return;
        case EDIT_PENDING:
          setContent(new EditPendingPage(this));
          return;
        case EDIT_INDEV:
          if (!(_content instanceof InDevPage)) {
            setContent(new InDevPage(this));
          }
          ((InDevPage) _content).setMode(args.get(0, ""));
          return;
        case EDIT_FAQ:
          setContent(new EditFAQPage(this));
          return;
        case EDIT_SERIES:
          setContent(new EditSeriesPage(this, args.get(0, 0)));
          return;
        default:
          break; // keep going
      }
    }

    // these are OK for admins
    if (isAdmin()) {
      switch (args.page) {
        case ADMIN_STATS:
          setContent(new StatsPage(this));
          return;
        case ADMIN_NEWS:
          setContent(new EditNewsPage(this, _news));
          return;
        default:
          break; // keep going
      }
    }

    // otherwise default to displaying the landing panel
    setContent(LandingPage.news(this, _news));
  }
 /**
  * test if the value change event's value is not null.
  *
  * @param event the event to test.
  * @return true if the event or event's value is not null, false overise.
  */
 public static boolean isValueNotNull(ValueChangeEvent<?> event) {
   return event != null && event.getValue() != null;
 }
Ejemplo n.º 29
0
 @UiHandler("offline")
 protected void onOfflineChanged(ValueChangeEvent<Boolean> event) {
   this.presenter.setOffline(event.getValue());
 }