當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseDownEvent.preventDefault方法代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.MouseDownEvent.preventDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseDownEvent.preventDefault方法的具體用法?Java MouseDownEvent.preventDefault怎麽用?Java MouseDownEvent.preventDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.event.dom.client.MouseDownEvent的用法示例。


在下文中一共展示了MouseDownEvent.preventDefault方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
	debug("VComboBoxMultiselect.onMouseDown(): blocking mouseDown event to avoid blur");

	event.preventDefault();
	event.stopPropagation();

	/*
	 * In IE the above wont work, the blur event will still trigger. So, we
	 * set a flag here to prevent the next blur event from happening. This
	 * is not needed if do not already have focus, in that case there will
	 * not be any blur event and we should not cancel the next blur.
	 */
	if (BrowserInfo.get()
		.isIE() && this.focused) {
		this.preventNextBlurEventInIE = true;
		debug("VComboBoxMultiselect: Going to prevent next blur event on IE");
	}
}
 
開發者ID:bonprix,項目名稱:vaadin-combobox-multiselect,代碼行數:20,代碼來源:VComboBoxMultiselect.java

示例2: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown( MouseDownEvent event )
{
	direction = getDirection( event.getNativeEvent().getEventTarget() );
	if( direction == 0 )
		return;

	startX = event.getScreenX();
	startY = event.getScreenY();

	startLeft = ResizablePanelBad.this.getAbsoluteLeft();
	startTop = ResizablePanelBad.this.getAbsoluteTop();
	startWidth = ResizablePanelBad.this.getOffsetWidth();
	startHeight = ResizablePanelBad.this.getOffsetHeight();

	DOM.setCapture( getElement() );

	fResizing = true;

	event.stopPropagation();
	event.preventDefault();
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:23,代碼來源:ResizablePanelBad.java

示例3: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
/**
 * Trigger action when mouse down event fired
 * 
 * @param event
 */
public void onMouseDown(MouseDownEvent event) {
	logger.info("diagram left mouse down");
	this.getWidgetPanel().getElement().focus();
	if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
		NodeShape shape = (NodeShape) getShapeUnderMouse();
		if (shape instanceof OutNodeShape) {
			OutNodeShape outShape = (OutNodeShape)shape;
			int x = outShape.getOffsetLeft() + 2*outShape.getRadius();
			int y = outShape.getOffsetTop() + 2*outShape.getRadius();
			outShape.getContextMenu().setPopupPosition(x,y);
			outShape.getContextMenu().show();
		}
		if(isvacancy){
			event.stopPropagation();
			event.preventDefault();
			//Popup connection menu
			if( !this.inShapeArea ){
				final Connection c = getConnectionNearMouse();
				if (c != null) {
					showMenu(c);
				}else{
					showContextualMenu(event);
				}
			}

		}

		return;
	}

	if (!lockDrawConnection && inEditionToDrawConnection) {
		logger.info( "draw connection lock: " +  lockDrawConnection );
		inDragBuildConnection = true;
		inEditionToDrawConnection = false;
		((NodeShape) startShape).onConnectionStart();
		drawBuildArrow(startShape, getMousePoint());
	}
	if(!isvacancy){
		event.stopPropagation();
		event.preventDefault();
		focusTimer.scheduleRepeating(50);
	}
	else {
		this.clearSelectedWidgets();
		selectedWidget = null;
		focusTimer.scheduleRepeating(50);
	}
	this.setIsVacancy(true);
}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:55,代碼來源:DiagramController.java

示例4: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public boolean onMouseDown(MouseDownEvent event, Element context) {
  if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
    return false;
  }

  ReplyBoxView indicatorView = panel.asReplyBox(context);
  ThreadView threadView = indicatorView.getParent();
  ConversationThread thread = modelAsViewProvider.getThread(threadView);
  actions.addBlipToThread(thread);
  event.preventDefault();
  return true;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:14,代碼來源:ReplyIndicatorController.java

示例5: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown( MouseDownEvent event )
{
	if( event.getNativeEvent().getEventTarget().<Element>cast() == title )
	{
		isMoving = true;
		movingMouseOffsetX = event.getClientX();
		movingMouseOffsetY = event.getClientY();

		DOM.setCapture( title );
		event.preventDefault();
		event.stopPropagation();
	}
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:15,代碼來源:DialogBoxForNormalWidget.java

示例6: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent event) {
	dragging = true;
	stretchLayout();
	event.stopPropagation();
	event.preventDefault();
	handleY = handleDragStartY;
	currentY = handleY + event.getY();
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt2,代碼行數:9,代碼來源:ZoomStepControl.java

示例7: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public boolean onMouseDown(MouseDownEvent event, Element context) {
  if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
    return false;
  }
  BlipMenuItemView item = panel.asBlipMenuItem(context);
  switch (item.getOption()) {
    case EDIT:
      actions.startEditing(item.getParent().getParent());
      break;
    case EDIT_DONE:
      actions.stopEditing();
      break;
    case REPLY:
      actions.reply(item.getParent().getParent());
      break;
    case DELETE:
      // We delete the blip without confirmation if shift key is pressed
      if (event.getNativeEvent().getShiftKey() || Window.confirm(messages.confirmDeletion())) {
        actions.delete(item.getParent().getParent());
      }
      break;
    case LINK:
      actions.popupLink(item.getParent().getParent());
      break;
    default:
      throw new AssertionError();
  }
  event.preventDefault();
  return true;
}
 
開發者ID:apache,項目名稱:incubator-wave,代碼行數:32,代碼來源:MenuController.java

示例8: handleMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@UiHandler("content")
void handleMouseDown(MouseDownEvent e) {
  // Prevent the editor from losing selection focus.
  e.preventDefault();
  e.stopPropagation();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:7,代碼來源:VerticalToolbarButtonWidget.java

示例9: handleMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@UiHandler("self")
void handleMouseDown(MouseDownEvent e) {
  // Prevent the editor from losing selection focus.
  e.preventDefault();
  e.stopPropagation();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:7,代碼來源:HorizontalToolbarButtonWidget.java

示例10: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
  event.preventDefault();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:5,代碼來源:PopupMenu.java

示例11: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent e) {
//    public void mousePressed(MouseEvent e) {
    	e.preventDefault();
    	menuX = e.getX();
    	menuY = e.getY();
    	mouseDownTime = System.currentTimeMillis();
    	
    	// maybe someone did copy in another window?  should really do this when
    	// window receives focus
    	enablePaste();
    	
    	// IES - hack to only handle left button events in the web version.
    	if (e.getNativeButton() != NativeEvent.BUTTON_LEFT)
    		return;
    	
    	// set mouseElm in case we are on mobile
    	mouseSelect(e);
    	
    	mouseDragging=true;
    	didSwitch = false;
	
    	if (mouseWasOverSplitter) {
    		tempMouseMode = MODE_DRAG_SPLITTER;
    		return;
    	}
	if (e.getNativeButton() == NativeEvent.BUTTON_LEFT) {
//	    // left mouse
	    tempMouseMode = mouseMode;
	    if (e.isAltKeyDown() && e.isMetaKeyDown())
		tempMouseMode = MODE_DRAG_COLUMN;
	    else if (e.isAltKeyDown() && e.isShiftKeyDown())
		tempMouseMode = MODE_DRAG_ROW;
	    else if (e.isShiftKeyDown())
		tempMouseMode = MODE_SELECT;
	    else if (e.isAltKeyDown())
		tempMouseMode = MODE_DRAG_ALL;
	    else if (e.isControlKeyDown() || e.isMetaKeyDown())
		tempMouseMode = MODE_DRAG_POST;
	}

	int gx = inverseTransformX(e.getX());
	int gy = inverseTransformY(e.getY());
	if (doSwitch(gx, gy)) {
	    // do this BEFORE we change the mouse mode to MODE_DRAG_POST!  Or else logic inputs
	    // will add dots to the whole circuit when we click on them!
            didSwitch = true;
	    return;
	}
	
	// IES - Grab resize handles in select mode if they are far enough apart and you are on top of them
	if (tempMouseMode == MODE_SELECT && mouseElm!=null && 
			mouseElm.getHandleGrabbedClose(gx, gy, POSTGRABSQ, MINPOSTGRABSIZE) >=0 &&
		    !anySelectedButMouse() )
		tempMouseMode = MODE_DRAG_POST;


	
	if (tempMouseMode != MODE_SELECT && tempMouseMode != MODE_DRAG_SELECTED)
	    clearSelection();

	pushUndo();
	initDragGridX = gx;
	initDragGridY = gy;
	dragging = true;
	if (tempMouseMode !=MODE_ADD_ELM)
		return;
//	
	int x0 = snapGrid(gx);
	int y0 = snapGrid(gy);
	if (!circuitArea.contains(e.getX(), e.getY()))
	    return;

	dragElm = constructElement(mouseModeStr, x0, y0);
    }
 
開發者ID:sharpie7,項目名稱:circuitjs1,代碼行數:75,代碼來源:CirSim.java

示例12: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
public void onMouseDown(MouseDownEvent e){
//		GWT.log("Down");
		dragging=false;
		e.preventDefault();
		doMouseDown(e.getX(), true);
	}
 
開發者ID:sharpie7,項目名稱:circuitjs1,代碼行數:7,代碼來源:Scrollbar.java

示例13: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
	int button = event.getNativeButton();
	if ((button == NativeEvent.BUTTON_LEFT || button == NativeEvent.BUTTON_MIDDLE) && touchId == null) {
		isMouseDown = true;
		x = event.getX();
		y = event.getY();
		event.preventDefault();
		Event.setCapture(widget.getElement());
	}
}
 
開發者ID:mateusz-matela,項目名稱:djvu-html5,代碼行數:12,代碼來源:PanListener.java

示例14: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent p_event)
{
  p_event.preventDefault();
}
 
開發者ID:kroc702,項目名稱:fullmetalgalaxy,代碼行數:6,代碼來源:WgtBoardBase.java

示例15: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入方法依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent p_event)
{
  p_event.preventDefault();
  onDown(Element.as(p_event.getNativeEvent().getEventTarget()), p_event.getClientX(), p_event.getClientY());
}
 
開發者ID:kroc702,項目名稱:fullmetalgalaxy,代碼行數:7,代碼來源:WgtScroll.java


注:本文中的com.google.gwt.event.dom.client.MouseDownEvent.preventDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。