Exemplo n.º 1
0
  public void onModuleLoad() {

    /*
     * Layout Stuff
     */

    routineSessionEditor.setVisible(false);
    RootPanel.get("fr-widgetLstRoutineSelector").add(lstRoutineSelector);
    RootPanel.get("fr-widgetTxtNewRoutine").add(txtNewRoutine);
    RootPanel.get("fr-widgetRoutineEditor").add(routineSessionEditor);
    /*
     * Register Listeners
     */

    lstRoutineSelector.addChangeListener(this);
    txtNewRoutine.addKeyboardListener(this);
    routineSessionEditor.addRoutineEditorListener(this);
    routineSessionEditor.getSessionExerciseEditor().addRoutineSessionEditorListener(this);

    routineSessionData.addDataListener(routineSessionEditor);

    sessionExerciseData.addDataListener(routineSessionEditor.getSessionExerciseEditor());

    /*
     * RPC's
     */

    exerciseService.getService().getUOMS(new CallbackScreener(callbackGetExerciseUOMS()));

    exerciseService
        .getService()
        .getUserExercises(
            User.instance().getToken(), new CallbackScreener(callbackGetUserExercises()));

    routineService
        .getService()
        .getUserRoutines(
            User.instance().getToken(), new CallbackScreener(callbackGetUserRoutines()));
  }
Exemplo n.º 2
0
  public void onChange(Widget sender) {
    if (sender == lstRoutineSelector) {
      if (lstRoutineSelector.getSelectedIndex() > 0) {
        long routineID =
            ((UserRoutine) userRoutineData.getDataObject(lstRoutineSelector.getSelectedIndex() - 1))
                .getUserRoutineID();

        if (routineID != currentRoutineID) {
          currentRoutineID = routineID;
          routineService
              .getService()
              .getRoutineSessions(
                  User.instance().getToken(),
                  routineID,
                  new CallbackScreener(callbackGetRoutineSessions()));
          if (!routineSessionEditor.isVisible()) {
            routineSessionEditor.setVisible(true);
          }
        }
      }
    }
  }