com.google.gwt.event.dom.client.MouseUpHandler Java Examples

The following examples show how to use com.google.gwt.event.dom.client.MouseUpHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopupMenu.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a {@PopupMenuItem}
 *
 * @param text The text label for the item.
 * @param cmd The command to run when the item is clicked.
 * @param isEnabled True if this menu item is enabled.
 * @param hide True if clicking this menu item should hide the popup.
 */
public PopupMenuItem(String text, Command cmd, boolean isEnabled, boolean hide) {
  super(text);
  setStyleName(RESOURCES.css().item());
  setEnabled(isEnabled);
  defaultEnabled = isEnabled;
  command = cmd;
  this.hide = hide;
  if (isPreClicked) {
    // If this menu is pre-clicked it doesn't require a full click to select
    // an item, just a mouseup over the item.  If the user then does click the
    // item then that will also give a mouseup so this handler will deal with
    // that case as well.
    addMouseUpHandler(new MouseUpHandler() {
      @Override
      public void onMouseUp(MouseUpEvent event) {
        onClicked();
      }
    });
  } else {
    addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent e) {
        onClicked();
      }
    });
  }
  // Ensure that clicking this menu item doesn't affect the current selection.
  addMouseDownHandler(PREVENT_DEFAULT_HANDLER);
}
 
Example #2
Source File: PopupMenu.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a {@PopupMenuItem}
 *
 * @param text The text label for the item.
 * @param cmd The command to run when the item is clicked.
 * @param isEnabled True if this menu item is enabled.
 * @param hide True if clicking this menu item should hide the popup.
 */
public PopupMenuItem(String text, Command cmd, boolean isEnabled, boolean hide) {
  super(text);
  setStyleName(RESOURCES.css().item());
  setEnabled(isEnabled);
  defaultEnabled = isEnabled;
  command = cmd;
  this.hide = hide;
  if (isPreClicked) {
    // If this menu is pre-clicked it doesn't require a full click to select
    // an item, just a mouseup over the item.  If the user then does click the
    // item then that will also give a mouseup so this handler will deal with
    // that case as well.
    addMouseUpHandler(new MouseUpHandler() {
      @Override
      public void onMouseUp(MouseUpEvent event) {
        onClicked();
      }
    });
  } else {
    addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent e) {
        onClicked();
      }
    });
  }
  // Ensure that clicking this menu item doesn't affect the current selection.
  addMouseDownHandler(PREVENT_DEFAULT_HANDLER);
}
 
Example #3
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Add a widget on the diagram
 * 
 * @param w the widget to add
 * @param left left margin with the absolute panel
 * @param top top margin with the absolute panel
 * 
 * @return the shape
 */
public FunctionShape addWidget(final Widget w, int left, int top) {

	w.getElement().getStyle().setZIndex(3);
	final FunctionShape shape = new FunctionShape(this, w);

	shapes.add(shape);
	widgetShapeMap.put(w, shape);
	functionsMap.put(w, new HashMap<Widget, Connection>());

	if (w instanceof HasContextMenu) {
		w.addDomHandler(new MouseUpHandler() {
			@Override
			public void onMouseUp(MouseUpEvent event) {
				if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
					showMenu((HasContextMenu) w, event.getClientX(), event.getClientY());
				}
			}
		}, MouseUpEvent.getType());
	}
	widgetPanel.add(w, left, top);

	// Register the drag handler
	if (dragController != null) {
		registerDragHandler(shape);
	}

	// If the is mouse is over the widget, clear the topCanvas
	w.addDomHandler(new MouseOverHandler() {
		@Override
		public void onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent arg0) {
			topCanvas.clear();
			mousePoint.setLeft(-30);
			mousePoint.setTop(-30);
		}
	}, com.google.gwt.event.dom.client.MouseOverEvent.getType());
	shape.draw();

	// Send event
	handlerManager.fireEvent(new NewFunctionEvent(w));
	return shape;
}
 
Example #4
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
  return addDomHandler(handler, MouseUpEvent.getType());
}
 
Example #5
Source File: P.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
	return addHandler(handler, MouseUpEvent.getType());
}
 
Example #6
Source File: ClickableDivPanel.java    From swellrt with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
  return addDomHandler(handler, MouseUpEvent.getType());
}
 
Example #7
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
	return this.addDomHandler(handler, MouseUpEvent.getType());
}
 
Example #8
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
	return this.addDomHandler(handler, MouseUpEvent.getType());
}
 
Example #9
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
	return this.addDomHandler(handler, MouseUpEvent.getType());
}
 
Example #10
Source File: ContentAssistAspect.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void showSuggestions(Oracle.Request request, final IsWidget textInput,
	Collection<? extends Suggestion<T>> suggestions, final SuggestionCallback<T> callback) {

	boolean anySuggestions = suggestions != null && !suggestions.isEmpty();
	if (!anySuggestions && this.hideWhenEmpty) {
		this.hideSuggestions();
		return;
	}

	if (this.suggestionPopup.isAttached()) {
		this.suggestionPopup.hide();
	}

	this.suggestionsContainer.clear();

	SuggestionItem<T> selected = null;
	for (final Oracle.Suggestion<T> currentSuggestion : suggestions) {
		String display = highlighter.highlight(currentSuggestion.getValue(), request.getQuery());
		final SuggestionItem<T> suggestionItem = new SuggestionItem<T>(currentSuggestion, display);
		if (selected == null) {
			selected = suggestionItem;
		}
		if (this.selectedItem != null && currentSuggestion.equals(this.selectedItem.suggestion)) {
			selected = suggestionItem;
		}

		suggestionItem.addDomHandler(new MouseUpHandler() {
			@Override
			public void onMouseUp(MouseUpEvent event) {
				if (textInput instanceof Focusable) {
					((Focusable) textInput).setFocus(true);
				}
				SuggestionDisplayImpl.this.setSuggestionItemSelected(suggestionItem);
				callback.onSuggestionSelected(suggestionItem.suggestion);
			}
		}, MouseUpEvent.getType());

		this.suggestionsContainer.append(suggestionItem);
	}

	this.setSuggestionItemSelected(selected);

	if (this.lastTextInput != textInput) {
		if (this.lastTextInput != null) {
			this.suggestionPopup.removeAutoHidePartner(this.lastTextInput.asWidget().getElement());
		}
		this.lastTextInput = textInput;
		this.suggestionPopup.addAutoHidePartner(this.lastTextInput.asWidget().getElement());
	}

	this.suggestionPopup.showRelativeTo(this.lastTextInput.asWidget());
	this.scrollToSelected();
}
 
Example #11
Source File: ClickableDivPanel.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
  return addDomHandler(handler, MouseUpEvent.getType());
}