コード例 #1
0
        @Override
        public boolean activate() {

            if (this.getMap() != null) {

                if (this.clickHandler == null) {
                    
                    ClickHandlerOptions clickHandlerOptions = new ClickHandlerOptions();
                    clickHandlerOptions.setClickListener(new ClickListener() {
                        
                        @Override
                        public void onDoubleClick(ClickEvent eventObject) {
                            checkEvent(eventObject);
                        }
                        
                        @Override
                        public void onClick(ClickEvent eventObject) {
                            checkEvent(eventObject);
                        }
                    });
                    
                    this.clickHandler = new ClickHandler(this, clickHandlerOptions);
                    
                }

                this.clickHandler.activate();

            }

            return super.activate();
        }
コード例 #2
0
  private ClickHandlerOptions createClickHandlerOptions(
      boolean singleClick,
      boolean doubleClick,
      boolean stopSingle,
      boolean stopDouble,
      int pixelTolerance,
      final String mode) {

    ClickHandlerOptions clickHandlerOptions =
        new ClickHandlerOptions(
            new ClickListener() {

              @Override
              public void onClick(ClickEvent eventObject) {

                writeOutput(
                    mode
                        + " - single click x="
                        + String.valueOf((int) eventObject.getX())
                        + " y="
                        + String.valueOf((int) eventObject.getY()));
              }

              @Override
              public void onDoubleClick(ClickEvent eventObject) {

                writeOutput(
                    mode
                        + " - double click x="
                        + String.valueOf((int) eventObject.getX())
                        + " y="
                        + String.valueOf((int) eventObject.getY()));
              }
            });

    clickHandlerOptions.setStopSingle(stopSingle);
    clickHandlerOptions.setStopDouble(stopDouble);
    clickHandlerOptions.setSingleClick(singleClick);
    clickHandlerOptions.setDoubleClick(doubleClick);
    clickHandlerOptions.setPixelTolerance(pixelTolerance);

    return clickHandlerOptions;
  }