コード例 #1
0
 public void onAddedStar(Star s) {
   mState = State.Default;
   setLeftButton(true, "add", DrifMaps.Words.Add());
   setRightButton(false, "save", DrifMaps.Words.Save());
   setStarButton(true, "star", DrifMaps.Words.Star());
   mMapController.addStar(s);
   mMapController.onChangeCursor(null);
 }
コード例 #2
0
 /**
  * Event called on start editing
  *
  * @param mi
  */
 public void onStartEditing(MapItem mi) {
   // map handler call this method => witch handler to edit state made before this call
   mState = State.Editing;
   showMapItemEdit(mi);
   mDisplay.setContextButtonsVisible(true);
   setRightButton(true, "cancel", DrifMaps.Words.Cancel());
   setLeftButton(true, "save", DrifMaps.Words.Save());
   mMapController.startEditing(mi);
 }
コード例 #3
0
  /** Changes states of objects during @value {@link State#Adding} */
  public void onStartAddingItem() {
    mState = State.Adding;

    mDisplay.getMenuContent().setOpen(true);
    mDisplay.setContextButtonsVisible(true);
    mDisplay.setMapItem(new MapItem());
    setLeftButton(true, "save", DrifMaps.Words.Save());
    setRightButton(true, "cancel", DrifMaps.Words.Cancel());
    setStarButton(false);
    mMapController.startAdding();
  }
コード例 #4
0
 public void onAddingStar(String type) {
   mStarType = type;
   mState = State.AddingStar;
   mMapController.onChangeCursor(Cursor.CROSSHAIR.toString());
   mDisplay.getMenuContent().setOpen(false);
   setStarButton(true, "cancel", DrifMaps.Words.Cancel());
   setLeftButton(false);
   setRightButton(false);
 }
コード例 #5
0
  protected void showMapItemEdit(MapItem mi) {
    mDisplay.setMapItem(mi);
    mDisplay.getMenuContent().setOpen(true);
    mDisplay.getContextItemsContainer().clear();
    if (mi.getPros() != null) {
      for (String s : mi.getPros()) onAddPro(s, false);
    }

    if (mi.getCons() != null) {
      for (String s : mi.getCons()) onAddCon(s, false);
    }

    if (mi.getDetails() != null) {
      for (Detail d : mi.getDetails()) onAddDetail(d, false);
    }

    setLeftButton(true, "edit", DrifMaps.Words.Edit());
    setRightButton(true, "cancel", DrifMaps.Words.Hide());
  }
コード例 #6
0
  private void handleRemoveDetail(final DetailItem<Detail> di) {
    if (mState == State.Default) return;
    QuestionDialog.show(
        DrifMaps.Words.ReallyQstn(),
        new QuestionDialog.OnQuestionDialogButtonClick() {
          @Override
          public void onYesClick() {
            onRemoveDetail(di);
          }

          @Override
          public void onNoClick() {}

          @Override
          public void onCancelClick() {}
        });
  }
コード例 #7
0
  private void handleRemoveCon(final ContextItem<String> ci) {
    if (mState == State.Default) return;
    QuestionDialog.show(
        DrifMaps.Words.ReallyQstn(),
        new QuestionDialog.OnQuestionDialogButtonClick() {
          @Override
          public void onYesClick() {
            onRemoveCon(ci);
          }

          @Override
          public void onNoClick() {}

          @Override
          public void onCancelClick() {}
        });
  }
コード例 #8
0
  /**
   * Called only if data model is valid
   *
   * @throws ValidationException
   */
  public void onSavingItem() throws ValidationException {
    if (!mDisplay.validate()) throw new ValidationException("Map Item validation");

    MapItem item = mDisplay.getDataModel().getValue();
    setLeftButton(false, "save", DrifMaps.Words.Saving());
    int operation = (item.getId() == 0) ? DataService.ADD : DataService.UPDATE;

    mDataService.processMapItem(
        item,
        operation,
        new AsyncCallback<MapItem>() {
          @Override
          public void onSuccess(MapItem result) {
            onSavedItem(result);
          }

          @Override
          public void onFailure(Throwable caught) {
            setLeftButton(true, "save", DrifMaps.Words.Save());
            NotificationDialog.show(caught);
          }
        });
  }
コード例 #9
0
 private void resetButtons() {
   setLeftButton(true, "add", DrifMaps.Words.Add());
   setRightButton(false, "cancel", DrifMaps.Words.Cancel());
   setStarButton(true, "star", DrifMaps.Words.Star());
 }