Exemplo n.º 1
0
  private void verifyMouseOverEvent() {
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOverCaptor.capture(), eq(MouseOverEvent.getType()));

    mouseOverCaptor.getValue().onMouseOver(mouseOverEvent);

    verify(resources).erase();
    verify(itemWidget).setImage(any(SVGImage.class));
  }
Exemplo n.º 2
0
  @Test
  public void imageShouldNotBeSetWhenStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);

    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOverCaptor.capture(), eq(MouseOverEvent.getType()));

    mouseOverCaptor.getValue().onMouseOver(mouseOverEvent);

    verify(itemWidget, never()).setImage(any(SVGImage.class));
  }
  /**
   * Binds the tool tip to the target widget. Allows a tool tip to switch the target widget.
   *
   * @param target the target widget
   */
  public void initTarget(final Widget target) {
    if (this.target != null) {
      handlerRegistration.removeHandler();
    }

    this.target = target;

    if (target != null) {
      Handler handler = new Handler();
      handlerRegistration = new GroupingHandlerRegistration();
      handlerRegistration.add(target.addDomHandler(handler, MouseOverEvent.getType()));
      handlerRegistration.add(target.addDomHandler(handler, MouseOutEvent.getType()));
      handlerRegistration.add(target.addDomHandler(handler, MouseMoveEvent.getType()));
      handlerRegistration.add(target.addHandler(handler, HideEvent.getType()));
      handlerRegistration.add(target.addHandler(handler, AttachEvent.getType()));
    }
  }
 private void createButtom() {
   itemButton.setIcon(getIcon());
   itemButton.setIconFixedWidth(true);
   itemButton.setSize(ButtonSize.SMALL);
   itemButton.setType(ButtonType.LINK);
   mouseEventHandler = new MouseEventHandler();
   itemButton.addDomHandler(mouseEventHandler, MouseOverEvent.getType());
   itemButton.addStyleName(CSS.CSS().sideDockItem());
   itemButton.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           if (!isSelected()) {
             selectAndExecuteExpandCommand();
           } else {
             deselectAndExecuteCommand();
           }
         }
       });
 }
Exemplo n.º 5
0
 private UserPopupPanel createPopupPanel(AccountInfo account) {
   UserPopupPanel popup = new UserPopupPanel(account, false, false);
   popup.addDomHandler(
       new MouseOverHandler() {
         @Override
         public void onMouseOver(MouseOverEvent event) {
           scheduleShow();
         }
       },
       MouseOverEvent.getType());
   popup.addDomHandler(
       new MouseOutHandler() {
         @Override
         public void onMouseOut(MouseOutEvent event) {
           scheduleHide();
         }
       },
       MouseOutEvent.getType());
   return popup;
 }
Exemplo n.º 6
0
 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
   return addDomHandler(handler, MouseOverEvent.getType());
 }
Exemplo n.º 7
0
 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
   // TODO Auto-generated method stub
   return addDomHandler(handler, MouseOverEvent.getType());
 }
  public PlaceBookItemPopupFrame(final DragController controller) {
    super();
    rootPanel = widgetPanel;
    widgetPanel.setStyleName(Resources.STYLES.style().widgetPanel());
    createFrame();
    this.controller = controller;
    widgetPanel.addDomHandler(highlightOn, MouseOverEvent.getType());
    widgetPanel.addDomHandler(highlightOff, MouseOutEvent.getType());

    frame.addDomHandler(highlightOn, MouseOverEvent.getType());
    frame.addDomHandler(highlightOff, MouseOutEvent.getType());

    menuButton.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            final int x =
                menuButton.getElement().getAbsoluteLeft()
                    + menuButton.getElement().getClientWidth();
            final int y =
                menuButton.getElement().getAbsoluteTop()
                    + menuButton.getElement().getClientHeight();
            controller.setSelected(PlaceBookItemPopupFrame.this);
            controller.showMenu(menuItems, x, y, true);
            event.stopPropagation();
          }
        },
        ClickEvent.getType());

    dragSection.addDomHandler(
        new MouseDownHandler() {
          @Override
          public void onMouseDown(final MouseDownEvent event) {
            controller.setupDrag(event, getItemWidget(), PlaceBookItemPopupFrame.this);
          }
        },
        MouseDownEvent.getType());

    resizeSection.addDomHandler(
        new MouseDownHandler() {
          @Override
          public void onMouseDown(final MouseDownEvent event) {
            controller.setupResize(event, PlaceBookItemPopupFrame.this);
          }
        },
        MouseDownEvent.getType());

    menuItems.add(new EditMapMenuItem(controller, this));
    menuItems.add(new DeleteItemMenuItem(controller.getSaveItem(), this));
    menuItems.add(new FitToContentMenuItem(controller, this));
    menuItems.add(new HideTrailMenuItem(controller, this));
    menuItems.add(new EditTitleMenuItem(controller, this));
    // menuItems.add(new SetSourceURLMenuItem(controller, this));
    menuItems.add(new ShowTrailMenuItem(controller, this));
    menuItems.add(new UploadMenuItem(controller.getSaveItem(), this));

    frame.getElement().getStyle().setProperty("left", "0px");
    frame.getElement().getStyle().setProperty("width", "100%");

    markerImage.getElement().getStyle().setPosition(Position.ABSOLUTE);
    markerImage.getElement().getStyle().setZIndex(2);
    markerImage.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            controller.goToPage(getItem().getParameter("mapPage"));
          }
        });
  }
Exemplo n.º 9
0
 @Override
 public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
   return handlers.addHandler(MouseOverEvent.getType(), handler);
 }
Exemplo n.º 10
0
  /**
   * @see
   *     com.google.gwt.event.dom.client.HasMouseOverHandlers#addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
   */
  public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {

    HandlerRegistration req = addDomHandler(handler, MouseOverEvent.getType());
    m_handlerRegistrations.add(req);
    return req;
  }
Exemplo n.º 11
0
  public AnnotationWidget(Annotation a, Labels labels) {
    this.annotation = a;

    // Construct annotation panel
    annotationPanel = new FlowPanel();
    annotationPanel.setStyleName("yuma-annotation-content");

    // Username will be undefined in server-less mode!
    InlineHTML username = null;
    if (annotation.getUserRealName() != null) {
      username = new InlineHTML(annotation.getUserRealName());
    } else if (annotation.getUsername() != null) {
      username = new InlineHTML(annotation.getUsername());
    }

    if (username != null) {
      username.setStyleName("yuma-annotation-username");
      annotationPanel.add(username);
    }

    // Timestamps will be -1 in server-less mode!
    InlineHTML timestamp = new InlineHTML();
    long modified = annotation.getModified();
    if (modified > 0) {
      timestamp.setHTML(DateTimeFormat.getFormat(DATE_FORMAT).format(new Date(modified)));
      timestamp.setStyleName("yuma-annotation-modified");
    }

    annotationPanel.add(new InlineHTML(annotation.getText() + "<br/>"));
    annotationPanel.add(timestamp);

    annotationPanel.addDomHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            btnEdit.removeStyleName(CSS_HIDDEN);
            btnDelete.removeStyleName(CSS_HIDDEN);
          }
        },
        MouseOverEvent.getType());

    // Construct button panel
    buttonPanel = new FlowPanel();
    buttonPanel.setStyleName("yuma-annotation-buttons");

    btnDelete = new PushButton();
    btnDelete.setStyleName("yuma-button");
    btnDelete.addStyleName("yuma-button-delete");
    btnDelete.addStyleName(CSS_HIDDEN);
    btnDelete.getElement().getStyle().setFloat(Float.RIGHT);
    btnDelete.getElement().getStyle().setCursor(Cursor.POINTER);

    btnEdit = new PushButton();
    btnEdit.setStyleName("yuma-button");
    btnEdit.addStyleName("yuma-button-edit");
    btnEdit.addStyleName(CSS_HIDDEN);
    btnEdit.getElement().getStyle().setFloat(Float.RIGHT);
    btnEdit.getElement().getStyle().setCursor(Cursor.POINTER);

    if (labels == null) {
      btnDelete.setTitle("Delete this Comment");
      btnEdit.setTitle("Edit this Comment");
    } else {
      btnDelete.setTitle(labels.deleteTooltip());
      btnEdit.setTitle(labels.editTooltip());
    }
    buttonPanel.add(btnDelete);
    buttonPanel.add(btnEdit);

    // Wrap everything into the container panel
    container = new FlowPanel();
    container.setStyleName("yuma-annotation");
    container.add(annotationPanel);
    container.add(buttonPanel);

    container.addDomHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            btnEdit.addStyleName(CSS_HIDDEN);
            btnDelete.addStyleName(CSS_HIDDEN);
          }
        },
        MouseOutEvent.getType());

    initWidget(container);
  }