Exemple #1
0
  /** Run the query and load the map */
  public void runQuery() {
    String query = queryTextBox.getValue();
    if (isValidQuery(query)) {
      LatLng latlng = parseLatLng(query);
      if (latlng == null) {
        queryTextBox.setValue("");
      } else {
        Geocoder geocoder = new Geocoder();
        latlng = parseLatLng(latlng.toUrlValue(6));
        if (latlng != null) initMap(map.getElement(), latlng);
        else initMap(map.getElement(), LatLng.newInstance(0.0, 0.0));
        geocoder.getLocations(
            query,
            new LocationCallback() {
              @Override
              public void onFailure(int statusCode) {
                // Window.alert("failed");
                Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE);
                Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE);
              }

              @Override
              public void onSuccess(JsArray<Placemark> locations) {
                responseGeocode(locations, true);
              }
            });
      }
    } else {
      initMap(map.getElement(), LatLng.newInstance(0.0, 0.0));
      Geocoder geocoder = new Geocoder();
      // map.setUIToDefault();
      geocoder.getLocations(
          query,
          new LocationCallback() {
            @Override
            public void onFailure(int statusCode) {
              // Window.alert("failed");
              Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE);
              Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE);
            }

            @Override
            public void onSuccess(JsArray<Placemark> locations) {
              responseGeocode(locations, false);
            }
          });
    }
  }
Exemple #2
0
  /**
   * Initialize widget components and layout elements.
   *
   * @param type file input to use
   * @param form An existing form panel to use
   */
  public Uploader(FileInputType type, FormPanel form) {
    thisInstance = this;
    this.fileInputType = type;

    if (form == null) {
      form = new FormFlowPanel();
    }
    uploadForm = form;
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadForm.addSubmitHandler(onSubmitFormHandler);
    uploadForm.addSubmitCompleteHandler(onSubmitCompleteHandler);
    // Issue #206
    FormElement.as(uploadForm.getElement()).setAcceptCharset("UTF-8");

    uploaderPanel = getUploaderPanel();
    uploaderPanel.add(uploadForm);
    uploaderPanel.setStyleName(STYLE_MAIN);

    setFileInput(fileInputType.getInstance());

    setStatusWidget(statusWidget);

    super.initWidget(uploaderPanel);
  }
 @Inject
 public ModuleWindow(ModuleInfo module) {
   this.module = module;
   masked = binder.createAndBindUi(this);
   super.initWidget(masked);
   title.setTargetHistoryToken("SingleRender$" + module.getId());
 }
 @Override
 protected void onLoad() {
   super.onLoad();
   // panel.addStyleName("notificationShowed");
   //
   // usernameTextBox.setFocus(true);
 }
  @Override
  protected void onAttach() {
    super.onAttach();
    Image img =
        new Image(
            getBaseImageUrl()
                + "?merchant_id="
                + getMerchantId()
                + "&w="
                + getWidth()
                + "&h="
                + getHeight()
                + "&style="
                + getStyle()
                + "&variant="
                + getVariant()
                + "&loc="
                + getLoc());
    img.setTitle("Fast checkout through Google");

    PushButton pb = new PushButton(img);
    pb.addClickHandler(this);
    vpanel.clear();
    vpanel.add(pb);
  }
Exemple #6
0
 /**
  * This method is called when a widget is attached to the browser's document. To receive
  * notification after a Widget has been added to the document, override the Widget.onLoad()
  * method.
  *
  * <p>Subclasses that override this method must call <tt>super.onAttach()</tt> before doing
  * anything else to ensure that the Widget has been properly attached to its underlying Element.
  */
 @Override
 public void onAttach() {
   // Called when we are shown (from being hidden)
   super.onAttach();
   colorMode = -1;
   updateSliders();
 }
 protected void onDetach() {
   super.onDetach();
   Window.removeWindowResizeListener(this.windowListener);
   this.lowerTarget.removeMouseListener(this.getLowerListener());
   this.higherTarget.removeMouseListener(this.getHigherListener());
   this.barTarget.removeMouseListener(this.getBarListener());
   target.removeScrollListener(this.scrollListener);
 }
 @Override
 protected void onAttach() {
   super.onAttach();
   String name = String.valueOf(hashCode());
   navMenu.addStyleName(sideNav);
   navMenu.getElement().setAttribute("data-activates", name);
   mobileNav.getElement().setId(name);
   initNavBar(Integer.parseInt(getSideBarWidth()), sideNav);
 }
  @Override
  public void setVisible(boolean visible) {
    boolean wasVisible = visible_;
    visible_ = visible;
    super.setVisible(visible);

    // if becoming visible, repopulate the list of deployments if we haven't
    // already
    if (!wasVisible && visible) populateDeployments(false);
  }
 @Override
 protected void onDetach() {
   if (messageEventListeners != null) {
     for (final PostMessageEventListener messageEventListener : messageEventListeners) {
       final JavaScriptObject postMessageListenerFunction =
           postMessageListenerFunctions.remove(messageEventListener.getActionToWatch());
       removeFrameNotificationListener(postMessageListenerFunction);
     }
   }
   super.onDetach();
 }
 /** Ensure the wrapped DecoratedGridWidget's size is set too */
 @Override
 public void setPixelSize(int width, int height) {
   if (width < 0) {
     throw new IllegalArgumentException("width cannot be less than zero");
   }
   if (height < 0) {
     throw new IllegalArgumentException("height cannot be less than zero");
   }
   super.setPixelSize(width, height);
   widget.setPixelSize(width, height);
 }
Exemple #12
0
  /**
   * @see com.google.gwt.user.client.ui.Composite#onBrowserEvent(com.google.gwt.user.client.Event)
   */
  @Override
  public void onBrowserEvent(Event event) {

    super.onBrowserEvent(event);
    /*
     * In IE8, the change event is not fired if we switch to another application window after having
     * pasted some text into the text box, so we need to turn off ghost mode manually
     */
    if (event.getTypeInt() == Event.ONPASTE) {
      setGhostMode(false);
    }
  }
 @Override
 protected void onAttach() {
   if (messageEventListeners != null) {
     for (final PostMessageEventListener messageEventListener : messageEventListeners) {
       if (!postMessageListenerFunctions.containsKey(messageEventListener.getActionToWatch())) {
         postMessageListenerFunctions.put(
             messageEventListener.getActionToWatch(),
             addFrameNotificationListener(messageEventListener));
       }
     }
   }
   super.onAttach();
 }
Exemple #14
0
 /**
  * This function intercepts the user click on the map and call the method named
  * getCenterMapstraction
  *
  * @see com.google.gwt.user.client.ui.Composite#onBrowserEvent(com.google.gwt.user.client.Event)
  */
 @Override
 public void onBrowserEvent(Event event) {
   super.onBrowserEvent(event);
   Element targetElement = Element.as(((NativeEvent) event).getEventTarget());
   String targetTagName = targetElement.getTagName();
   if (targetTagName.equalsIgnoreCase("svg") || targetTagName.equalsIgnoreCase("path"))
     getCenterMapstraction(
         EUOSMEGWT.apiMapstraction,
         geoBoundsObj.newTextBoxNorth.getElement(),
         geoBoundsObj.newTextBoxEast.getElement(),
         geoBoundsObj.newTextBoxSouth.getElement(),
         geoBoundsObj.newTextBoxWest.getElement());
 }
 @Override
 protected void onAttach() {
   super.onAttach();
   // gwt sets openSearcButton's tabindex to 0 at onAttach (see
   // FocusWidget.onAttach())
   // but we don't want to select openSearchButton with tab, so tabindex will
   // be set back to -1 after attach all time.
   if (this.openSearchButton != null) {
     this.openSearchButton.setTabIndex(-1);
   }
   if (this.openMenuButton != null) {
     this.openMenuButton.setTabIndex(-1);
   }
 }
Exemple #16
0
 @Override
 protected void onLoad() {
   super.onLoad();
   if (!initialized_) {
     initialized_ = true;
     Scheduler.get()
         .scheduleDeferred(
             new ScheduledCommand() {
               public void execute() {
                 doOnLoad();
                 scrollPanel_.scrollToBottom();
               }
             });
   }
 }
 @Override
 protected void onLoad() {
   super.onLoad();
   if (histogram != null) {
     histogramPanel.clear();
     histogramPanel.add(histogram.createChart(translations.histogram(), translations.density()));
   }
   if (qqPlot != null) {
     normalProbability.clear();
     normalProbability.add(
         qqPlot.createChart(
             translations.normalProbability(),
             translations.theoreticalQuantiles(),
             translations.sampleQuantiles()));
   }
 }
  @Override
  public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    switch (DOM.eventGetType(event)) {
      case Event.ONCONTEXTMENU:
        EventTarget target = event.getEventTarget();

        Element svg = this.getElement().getElementsByTagName("svg").getItem(0);

        if (target.equals(svg)) {
          m_client.getContextMenu().showAt(this, event.getClientX(), event.getClientY());
          event.preventDefault();
          event.stopPropagation();
        }
        break;

      case Event.ONMOUSEDOWN:
        break;

      case Event.ONMOUSEWHEEL:
        double delta = event.getMouseWheelVelocityY() / 30.0;
        double oldScale = m_scale;
        final double newScale = oldScale + delta;
        final int clientX = event.getClientX();
        final int clientY = event.getClientY();
        // broken now need to fix it
        //    	    Command cmd = new Command() {
        //
        //                public void execute() {
        //                    m_client.updateVariable(m_paintableId, "mapScale", newScale, false);
        //                    m_client.updateVariable(m_paintableId, "clientX", clientX, false);
        //                    m_client.updateVariable(m_paintableId, "clientY", clientY, false);
        //
        //                    m_client.sendPendingVariableChanges();
        //                }
        //            };
        //
        //            if(BrowserInfo.get().isWebkit()) {
        //                Scheduler.get().scheduleDeferred(cmd);
        //            }else {
        //                cmd.execute();
        //            }

        break;
    }
  }
  @Override
  protected void onLoad() {
    super.onLoad();

    sinkEvents(Event.ONCONTEXTMENU | VTooltip.TOOLTIP_EVENTS | Event.ONMOUSEWHEEL);

    setupPanningBehavior(m_svg);

    D3Behavior dragBehavior =
        new D3Behavior() {

          @Override
          public D3 run(D3 selection) {
            D3Drag drag = D3.getDragBehavior();
            drag.on(D3Events.DRAG_START.event(), vertexDragStartHandler());
            drag.on(D3Events.DRAG.event(), vertexDragHandler());
            drag.on(D3Events.DRAG_END.event(), vertexDragEndHandler());

            selection.call(drag);
            return selection;
          }
        };

    m_graphDrawer =
        new GraphDrawer(
            m_graph,
            m_vertexGroup,
            m_edgeGroup,
            dragBehavior,
            vertexClickHandler(),
            vertexContextMenuHandler(),
            vertexTooltipHandler(),
            edgeContextHandler(),
            edgeToolTipHandler());
    m_graphDrawerNoTransition =
        new GraphDrawerNoTransition(
            m_graph,
            m_vertexGroup,
            m_edgeGroup,
            dragBehavior,
            vertexClickHandler(),
            vertexContextMenuHandler(),
            vertexTooltipHandler(),
            edgeContextHandler(),
            edgeToolTipHandler());
  }
  protected void onAttach() {
    super.onAttach();
    target.addScrollListener(this.scrollListener);
    Window.addWindowResizeListener(this.windowListener);
    this.lowerTarget.addMouseListener(this.getLowerListener());
    this.higherTarget.addMouseListener(this.getHigherListener());
    this.barTarget.addMouseListener(this.getBarListener());

    Timer t =
        new Timer() {
          public void run() {
            target.setScrollPosition(target.getScrollPosition());
            refresh();
          }
        };

    t.schedule(10);
  }
 @Override
 public void onBrowserEvent(Event event) {
   switch (DOM.eventGetType(event)) {
     case Event.ONCLICK:
       {
         // tabs can be closed by (a) middle mouse (anywhere), or (b)
         // left click on close element
         if (event.getButton() == Event.BUTTON_MIDDLE
             || (Element.as(event.getEventTarget()) == closeElement_
                 && event.getButton() == Event.BUTTON_LEFT)) {
           closeHandler_.onTabClose();
           event.stopPropagation();
           event.preventDefault();
         }
         break;
       }
   }
   super.onBrowserEvent(event);
 }
  /** Creates a new instance of SoftVerticalScroll */
  public SoftHorizontalScrollbar(SoftScrollArea target) {
    this.target = target;
    this.base = new SimplePanel();

    Panel horizontal = new HorizontalPanel();
    this.base.setWidget(horizontal);
    super.initWidget(this.base);
    this.higherTarget.setWidget(this.higher);
    this.barTarget.setWidget(this.bar);
    this.lowerTarget.setWidget(this.lower);

    horizontal.add(lowerTarget);
    horizontal.add(barTarget);
    horizontal.add(higherTarget);
    this.setStyleName("gwittir-SoftHorizontalScrollbar");
    this.bar.setStyleName("bar");
    this.lower.setStyleName("lower");
    this.higher.setStyleName("higher");
    DOM.setStyleAttribute(this.lower.getElement(), "overflow", "hidden");
    DOM.setStyleAttribute(this.bar.getElement(), "overflow", "hidden");
    DOM.setStyleAttribute(this.higher.getElement(), "overflow", "hidden");
    DOM.setStyleAttribute(this.getElement(), "overflow", "hidden");
  }
 @Override
 protected void onUnload() {
   super.onUnload(); // To change body of overridden methods use File | Settings | File Templates.
   PushClient.instance().unsubscribe(pushNotify);
 }
 @Override
 protected void onLoad() {
   setButtonHandlers();
   super.onLoad();
 }
 @Override
 protected void onUnload() {
   for (HandlerRegistration r : registrations) r.removeHandler();
   registrations.clear();
   super.onUnload();
 }
  /** @see com.alkacon.acacia.client.widgets.I_EditWidget#onAttachWidget() */
  public void onAttachWidget() {

    super.onAttach();
  }
 /** default method. */
 public void onLoad() {
   super.onLoad();
 }
  public AbstractSourceButton(String source) {
    this.button = new Button(ShowcaseSearchPanel.I18N.viewSource(source), this);

    super.initWidget(button);
  }
  @Override
  protected void onAttach() {
    super.onAttach();

    updateHeaderWidth(title);
  }
 @Override
 public void onLoad() {
   super.onLoad();
   prepareHorizontalScroll(id);
 }