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


Java MouseDownEvent類代碼示例

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


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

示例1: checkDOMElementCreationMouseDownHandler

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
@Test
public void checkDOMElementCreationMouseDownHandler() {
    factory.createDomElement(gridLayer,
                             gridWidget,
                             cellRenderContext);

    final ArgumentCaptor<MouseDownHandler> mouseDownHandlerCaptor = ArgumentCaptor.forClass(MouseDownHandler.class);

    verify(listBox).addMouseDownHandler(mouseDownHandlerCaptor.capture());

    final MouseDownEvent e = mock(MouseDownEvent.class);
    final MouseDownHandler mouseDownHandler = mouseDownHandlerCaptor.getValue();
    mouseDownHandler.onMouseDown(e);

    verify(e).stopPropagation();
}
 
開發者ID:kiegroup,項目名稱:drools-wb,代碼行數:17,代碼來源:ListBoxSingletonDOMElementFactoryTest.java

示例2: 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

示例3: 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

示例4: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
	this.onMouseUp(null);

	Icon dragIcon = (Icon) event.getSource();
	this.selectedRow = (TableRow<T>) dragIcon.getParent().getParent();
	this.body = (TableEditorBody<T>) this.selectedRow.getParent();

	this.overRegistration = new HandlerRegistrationCollection();
	this.upRegistration = RootPanel.get().addDomHandler(this, MouseUpEvent.getType());
	this.rows = Lists.newArrayList(this.body.getRows());
	for (TableRow<T> row : this.rows) {
		this.overRegistration.add(row.addDomHandler(this, MouseOverEvent.getType()));
	}
	TableOrder.this.disableTextSelection(true);
	RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.MOVE);
	StyleUtils.addStyle(this.selectedRow, TableOrder.STYLE_ROW_DRAGING);
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:19,代碼來源:TableOrder.java

示例5: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
@Override
public void onMouseDown(MouseDownEvent event) {
    GWT.log("onMouseDown(MouseDownEvent)");
    if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
        GanttWidget.this.onTouchOrMouseDown(event.getNativeEvent());
    } else {
        secondaryClickOnNextMouseUp = true;
        new Timer() {

            @Override
            public void run() {
                secondaryClickOnNextMouseUp = false;
            }
        }.schedule(CLICK_INTERVAL);
        event.stopPropagation();
    }
}
 
開發者ID:tltv,項目名稱:gantt,代碼行數:18,代碼來源:GanttWidget.java

示例6: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
public void onMouseDown(MouseDownEvent event) {
	FeatureTransaction featureTransaction = getFeatureTransaction();
	if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE
			&& event.getNativeButton() != Event.BUTTON_RIGHT) {
		String targetId = getTargetId(event);
		if (TransactionGeomIndexUtil.isVertex(targetId)) {
			dragTargetId = targetId;
			if (dragTransaction == null) {
				dragTransaction = (FeatureTransaction) featureTransaction.clone();
			}
			mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
			mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
			createTempLine(featureTransaction, event);
		}
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:17,代碼來源:LineStringEditController.java

示例7: onMouseDown

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
public void onMouseDown(MouseDownEvent event) {
	FeatureTransaction featureTransaction = getFeatureTransaction();
	if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE
			&& event.getNativeButton() != Event.BUTTON_RIGHT) {
		String targetId = getTargetId(event);
		if (TransactionGeomIndexUtil.isVertex(targetId)) {
			dragTargetId = targetId;
			if (dragTransaction == null) {
				dragTransaction = (FeatureTransaction) featureTransaction.clone();
			}
			mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
			mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
			createTempLines(featureTransaction, event);
		}
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:17,代碼來源:PolygonEditController.java

示例8: 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

示例9: showContextualMenu

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
/**
 * Show the context menu of the mouse position.(Position from mouse down event)
 * 
 * @param event  mouse down event.
 */
public void showContextualMenu(MouseDownEvent event){
	final int X = event.getRelativeX(widgetPanel.getElement());
	final int Y = event.getRelativeY(widgetPanel.getElement());
	getMousePoint().setLeft(X);
	getMousePoint().setTop(Y);

	final int offsetX = event.getClientX();
	final int offsetY = event.getClientY();
	mouseOffsetPoint.setLeft(offsetX);
	mouseOffsetPoint.setTop(offsetY);

	cmenu.hide();
	cmenu = new ContextMenu();
	Command command = new Command() {
		@Override
		public void execute() {
			cmenu.hide();
		}
	};
}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:26,代碼來源:DiagramController.java

示例10: Leaf

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
/**
 * Create a leaf node for the Tree
 *
 * @param name   name of the TreeItem
 * @param module Attached moduleId for the TreeItem
 */
public Leaf(String name,
		T module,
		String style) {
	// add context menu
	this.menu = new ContextMenu();
	label = new Label(name);
	this.setWidget(label);

	label.addMouseDownHandler(new MouseDownHandler() {
		@Override
		public void onMouseDown(MouseDownEvent event) {
			// display the context menu when right click
			if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
				menu.setPopupPosition(event.getClientX(), event.getClientY());
				menu.show();
			}
		}
	});

	// set moduleId
	this.module = module;
	this.addStyleName("bda-treeleaf");
	if (!style.equals(""))
		this.addStyleName(style);
}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:32,代碼來源:Leaf.java

示例11: Cell

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
Cell(int day, int slot) {
	super("cell", "item", isEditable(day, slot) ? "clickable" : null);
	iDay = day; iSlot = slot;
	RoomSharingOption option = iModel.getOption(day, slot);
	if (option == null) {
		getElement().getStyle().clearBackgroundColor();
		setHTML("");
		setTitle("");
	} else {
		getElement().getStyle().setBackgroundColor(option.getColor());
		setHTML(option.getCode() == null ? "" : option.getCode());
		setTitle(CONSTANTS.longDays()[day] + " " + slot2short(slot) + " - " + slot2short(slot + iMode.getStep()) + ": " + option.getName());
	}
	if (isEditable(day, slot))
		addMouseDownHandler(new MouseDownHandler() {
			@Override
			public void onMouseDown(MouseDownEvent event) {
				setOption(iOption);
			}
		});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:22,代碼來源:RoomSharingWidget.java

示例12: Cell

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
Cell(int day, int slot, Date date, PeriodInterface period) {
	super("cell", "item", isEditable() && period != null ? "clickable" : null, period == null ? "disabled" : null, period != null && iModel.isAssigned(period) ? "highlight" : null);
	iDay = day;
	iSlot = slot;
	iDate = date;
	iPeriod = period;
	if (period != null) {
		PreferenceInterface preference = iModel.getPreference(day, slot);
		if (preference == null) {
			getElement().getStyle().clearBackgroundColor();
			setHTML("");
			setTitle("");
		} else {
			getElement().getStyle().setBackgroundColor(preference.getColor());
			setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName());
		}
		if (isEditable())
			addMouseDownHandler(new MouseDownHandler() {
				@Override
				public void onMouseDown(MouseDownEvent event) {
					setOption(iPreference);
				}
			});				
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:26,代碼來源:PeriodPreferencesWidget.java

示例13: D

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
private D(int day, int slot, Date date, PeriodInterface period) {
	super("cell", "day", isEditable() && period != null ? "clickable" : null, period == null ? "unavailable" : null);
	iDay = day;
	iSlot = slot;
	iDate = date;
	iPeriod = period;
	setText(DateTimeFormat.getFormat("d").format(date));
	if (period != null) {
		PreferenceInterface preference = iModel.getPreference(day, slot);
		if (preference == null) {
			getElement().getStyle().clearBackgroundColor();
			setTitle("");
		} else {
			getElement().getStyle().setBackgroundColor(preference.getColor());
			setTitle(DateTimeFormat.getFormat(CONSTANTS.examPeriodDateFormat()).format(date) + " " + slot2short(slot) + (period == null ? "" : " - " + slot2short(slot + period.getLength())) + ": " + preference.getName());
		}
		if (isEditable())
			addMouseDownHandler(new MouseDownHandler() {
				@Override
				public void onMouseDown(MouseDownEvent event) {
					setOption(iPreference);
				}
			});				
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:26,代碼來源:PeriodPreferencesWidget.java

示例14: SelectionPanel

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
public SelectionPanel(boolean fixed) {
	setStyleName(fixed ? "selection" : "active-selection");
	if (fixed) {
		iRemove = new P("x"); iRemove.setHTML("&times;");
		iRemove.addMouseDownHandler(new MouseDownHandler() {
			@Override
			public void onMouseDown(MouseDownEvent event) {
				iSelections.remove(SelectionPanel.this);
				if (iSelection != null)
					iAllSelections.remove(iSelection);
			}
		});
		iRemove.getElement().getStyle().setRight(2, Unit.PX);
		iRemove.getElement().getStyle().setTop(2, Unit.PX);
		iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
		add(iRemove);
		iText = new P("text");
		add(iText, 0, 0);
	}
	
	sinkEvents(Event.ONMOUSEDOWN);
	sinkEvents(Event.ONMOUSEUP);
	sinkEvents(Event.ONMOUSEMOVE);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:TimeGrid.java

示例15: addHandlers

import com.google.gwt.event.dom.client.MouseDownEvent; //導入依賴的package包/類
private void addHandlers() {
  addMouseDownHandler(new MouseDownHandler() {
    @Override
    public void onMouseDown(MouseDownEvent arg0) {
      select(getWidget());
    }
  });
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:9,代碼來源:SimplePaletteItem.java


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