コード例 #1
0
 private void setLeftButton(boolean enabled) {
   mDisplay.getLeftButton().setEnabled(enabled);
 }
コード例 #2
0
 private void setLeftButton(boolean enabled, String style, String text) {
   mDisplay.getLeftButton().setEnabled(enabled);
   mDisplay.getLeftButton().setStyleName("button " + style);
   mDisplay.getLeftButton().setText(text);
 }
コード例 #3
0
  /**
   * Bind menu Creates TabPanel and nested objects
   *
   * @param ds
   */
  private void bindMenu(DataServiceAsync ds) {

    mDisplay
        .getLeftButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                if (mState == State.Default) {
                  MapItem mi = mDisplay.getDataModel().getValue();
                  if (mi == null) onStartAddingItem();
                  else onStartEditing(mi);
                } else if (mState == State.Adding || mState == State.Editing) {
                  try {
                    if (mDisplay.validate()) onSavingItem();
                  } catch (ValidationException ve) {
                    // it's not neccassary to catch, its exception for testing, validate will show
                    // it
                  }
                }
              }
            });
    mDisplay
        .getRightButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                onFinishAdding(true);
                //						mDisplay.getAddButton().setEnabled(true);
                //						mDisplay.getAddButton().setText(DrifMaps.Words.Add());
                //						mDisplay.getSaveButton().setEnabled(false);
                //						mDisplay.getSaveButton().setText(DrifMaps.Words.Save());
                //						mDisplay.getDataModel().setValue(null);
                //						mDisplay.getMenuContent().setOpen(false);
                //						mDisplay.getStreetView().hide();

              }
            });
    mDisplay
        .getPlusButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handleClickAddProCons(true);
              }
            });
    mDisplay
        .getMinusButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handleClickAddProCons(false);
              }
            });

    mDisplay
        .getCustomButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handleClickCustomDetail();
              }
            });

    mDisplay
        .getStarButton()
        .addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                if (mState == State.AddingStar) onFinishAdding(true);
                else {
                  StarDialog.show(
                      new StarDialog.OnStarClick() {
                        @Override
                        public void onStarClick(String value) {
                          onAddingStar(value);
                        }
                      });
                }
              }
            });

    mDisplay.addSelectionTabHandler(
        new SelectionHandler<Integer>() {

          @Override
          public void onSelection(SelectionEvent<Integer> event) {

            // when streetview is goint to be display:gone its reseting
            if (event.getSelectedItem() != 0) mDisplay.getStreetView().hide(false);
            else {
              // show it with already set value, show is called in setValue if value is not null
              String value = mDisplay.getDataModel().getStreetViewLink().getValue();
              if (value != null) mDisplay.getStreetView().setValue(value);
              else mDisplay.getStreetView().show();
            }
          }
        });
  }