当前位置: 首页>>代码示例>>Java>>正文


Java DomEvent类代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.DomEvent的典型用法代码示例。如果您正苦于以下问题:Java DomEvent类的具体用法?Java DomEvent怎么用?Java DomEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DomEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了DomEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setEventHandler

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
/**
 * Sets an event handler for an {@code Element}. All previous event handlers of this type of event are removed.
 * @param element The element to bind the event handler for
 * @param eventType The event type (e.g. {@code ClickEvent.getType()})
 * @param handler The handler that handler the event
 */
public static <H extends EventHandler> void setEventHandler(final Element element, DomEvent.Type<H> eventType, H handler) {
  if (element == null) {
    return;
  }
  HandlerManager hm = handlerManagers.get(element);
  if (hm == null) {
    handlerManagers.put(element, hm = new HandlerManager(element));
    DOM.setEventListener(element, new EventListener() {
      @Override
      public void onBrowserEvent(Event event) {
        DomEvent.fireNativeEvent(event, handlerManagers.get(element), element);
      }
    });
  }
  DOM.sinkBitlessEvent(element, eventType.getName());
  while (hm.getHandlerCount(eventType) > 0) {
    hm.removeHandler(eventType, hm.getHandler(eventType, 0));
  }
  hm.addHandler(eventType, handler);
}
 
开发者ID:turnsk,项目名称:gwtmvp,代码行数:27,代码来源:EventManager.java

示例2: onPaletteChooserMouseWheel

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@UiHandler("paletteChooser")
void onPaletteChooserMouseWheel(MouseWheelEvent event) {
	// determine new index based on scroll direction
	int newIndex = paletteChooser.getSelectedIndex();
	if (event.getDeltaY() < 0) {
		newIndex--;
	}
	else {
		newIndex++;
	}

	// set new index (if it's valid) and trigger change event (is not automatically triggered)
	if (newIndex >= 0 && newIndex < paletteChooser.getItemCount()) {
		paletteChooser.setSelectedIndex(newIndex);
		DomEvent.fireNativeEvent(Document.get().createChangeEvent(), paletteChooser);
	}
}
 
开发者ID:umlet,项目名称:umlet,代码行数:18,代码来源:MainView.java

示例3: finishEdit

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
private void finishEdit(DomEvent<?> event, boolean save) {
  int index = getItemIndexFromEvent(event);
  Task task = getItem(index, true);
  TaskAdapterView view = getItemView(index);
  if (save) {
    if (view.getNameInput().getValue().trim().length() == 0) {
      removeTask(index);
    } else {
      task.setName(view.getNameInput().getValue());
      view.getName().setInnerText(task.getName());
      Dao.onTasksChanged();
    }
  }
  view.getEditButton().removeClassName("hidden");
  view.getRemoveButton().removeClassName("hidden");
  view.getName().removeClassName("hidden");
  view.getNameInput().addClassName("hidden");
}
 
开发者ID:turnsk,项目名称:gwtmvp,代码行数:19,代码来源:TaskAdapter.java

示例4: setValue

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void setValue(final AdministratedApplicationConfig value, final boolean fireEvents) {
  for (int i = 0; i < connectorListBox.getItemCount(); i++) {
    if(connectorListBox.getValue(i).equals(value.getBlockchainSource().name())) {
      connectorListBox.setSelectedIndex(i);
      DomEvent.fireNativeEvent(Document.get().createChangeEvent(), connectorListBox);
      break;
    }
  }

  currentEditor.setValue(value);

  applicationTitle.setText(value.getApplicationTitle());
  applicationSubtitle.setText(value.getApplicationSubTitle());
  donationAddress.setText(value.getHostDonationAddress());
}
 
开发者ID:JornC,项目名称:bitcoin-transaction-explorer,代码行数:18,代码来源:ConfigViewImpl.java

示例5: prepare

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
public void prepare() {
	canvas = new GWTCanvas(width, height);
	popupPanel.setWidget(canvas);
	for (Entry<EventHandler, DomEvent.Type<EventHandler>> entry : eventHandlers.entrySet()) {
		canvas.addDomHandler(entry.getKey(), entry.getValue());
	}
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:8,代码来源:PopupCanvas.java

示例6: testTextBox

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@Test
public void testTextBox() throws Exception {
    TextBox tb = new TextBox();
    RootPanel.get().add(tb);
    final List events = new ArrayList();
    tb.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            events.add(event);
        }
    });

    DomEvent.fireNativeEvent(Document.get().createChangeEvent(), tb);

    assertEquals(1, events.size());
}
 
开发者ID:salk31,项目名称:RedQueryBuilder,代码行数:17,代码来源:GwtTestDom.java

示例7: broadcastBlurEvent

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
protected void broadcastBlurEvent() {
    final NativeEvent blur = Document.get().createBlurEvent();
    for (int i = 0; i < RootPanel.get().getWidgetCount(); i++) {
        final Widget w = RootPanel.get().getWidget(i);
        DomEvent.fireNativeEvent(blur,
                                 w);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:FocusableLienzoPanelView.java

示例8: onMouseOrTouchUp

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
private void onMouseOrTouchUp(DomEvent event, int x, int y, boolean isTouch)
{
	s_logger.log(Level.INFO, "up");

	if( !m_isMouseDown )
	{
		return;
	}
	
	m_wasMouseJustDown = m_isMouseDown; // should always be the case;
	m_isMouseDown = false;

	this.setMousePoint(x, y, m_mouseEvent.getPoint());
	m_mouseEvent.set(E_MouseEventType.MOUSE_UP, 0, Element.as(event.getNativeEvent().getEventTarget()), isTouch);
	
	dispatchEvent(m_mouseEvent);
	
	Event.releaseCapture(m_container.getElement());
	event.preventDefault();
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:21,代码来源:Mouse.java

示例9: onMouseOrTouchDown

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
private void onMouseOrTouchDown(DomEvent event, int x, int y, boolean isTouch)
{
	m_isTouching = isTouch;
	
	s_logger.log(Level.INFO, "down");
	
	m_isMouseDown = true;
	m_hasMouseStrayedWhileDown = false;
	
	setMousePoint(x, y, m_mouseDownPoint);
	
	m_mouseEvent.getPoint().copy(m_mouseDownPoint);
	m_mouseEvent.set(E_MouseEventType.MOUSE_DOWN, 0, Element.as(event.getNativeEvent().getEventTarget()), isTouch);
	dispatchEvent(m_mouseEvent);

	Event.setCapture(m_container.getElement());
	event.preventDefault();
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:19,代码来源:Mouse.java

示例10: broadcastBlurEvent

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
protected void broadcastBlurEvent() {
    final NativeEvent blur = Document.get().createBlurEvent();
    for ( int i = 0; i < RootPanel.get().getWidgetCount(); i++ ) {
        final Widget w = RootPanel.get().getWidget( i );
        DomEvent.fireNativeEvent( blur,
                                  w );
    }
}
 
开发者ID:Salaboy,项目名称:wires,代码行数:9,代码来源:FocusableLienzoPanel.java

示例11: call

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@Override
public void call(String moduleName, AsyncCallback<Void> callback) {
	LOG.info("ModuleReadyFeatureProvider.call: moduleName=" + moduleName);
	for (ModuleBean moduleBean : moduleUnreadyList)
		if (Utils.equals(moduleName, moduleBean.getName())) {
			moduleReadyList.add(moduleBean);
			moduleUnreadyList.remove(moduleBean);
			if (moduleUnreadyList.isEmpty()) {
				timeoutTimer.cancel();
				DomEvent.fireNativeEvent(Document.get().createLoadEvent(), this);
			}
			return;
		}
	throw new IllegalArgumentException("Module with name '" + moduleName + "' isn't expected");
}
 
开发者ID:domax,项目名称:gwt-dynamic-plugins,代码行数:16,代码来源:ModuleReadyFeatureProvider.java

示例12: processNewPackage

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
private void processNewPackage(String newPackageName) {
    if (newPackageName != null && !"".equals(newPackageName.trim())) {
        boolean exists = false;
        newPackageName = newPackageName.trim();
        int count = packageList.getItemCount();
        if (count > 0) {
            for (int i = 0; i < count; i++) {
                if ((exists = newPackageName.equals(packageList.getValue(i)))) break;
            }
        }
        if (exists) {
            packageList.setSelectedValue(newPackageName);
        } else {
            packageList.addItem(newPackageName, newPackageName);
            packageList.setSelectedValue(newPackageName);
            DomEvent.fireNativeEvent(Document.get().createChangeEvent(), packageList);
        }
    }
}
 
开发者ID:kiegroup,项目名称:jbpm-data-modeler,代码行数:20,代码来源:PackageSelector.java

示例13: onBrowserEvent

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
	
	// If we're not yet dragging, only trigger mouse events if the event occurs
	// in the caption wrapper
	if (this.resizable) {
		switch (event.getTypeInt()) {
		case Event.ONMOUSEDOWN:
		case Event.ONMOUSEUP:
		case Event.ONMOUSEMOVE:
		case Event.ONMOUSEOVER:
		case Event.ONMOUSEOUT:
			
			if (this.dragMode >= 0 || calcDragMode(event.getClientX(),event.getClientY()) >= 0) {
				// paste'n'copy from Widget.onBrowserEvent
				switch (DOM.eventGetType(event)) {
				case Event.ONMOUSEOVER:
					// Only fire the mouse over event if it's coming from outside this
					// widget.
				case Event.ONMOUSEOUT:
					// Only fire the mouse out event if it's leaving this
					// widget.
					Element related = event.getRelatedEventTarget().cast();
					if (related != null && getElement().isOrHasChild(related)) {
						return;
					}
					break;
				}
				DomEvent.fireNativeEvent(event, this, this.getElement());
				return;
			}
			if (this.dragMode<0)
				this.updateCursor(this.dragMode);
		}
	}
	
	super.onBrowserEvent(event);
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:39,代码来源:WindowBox.java

示例14: init

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    getWidget()._delegate.cellClickListener = new TableCellClickListener() {
        @Override
        public void onClick(String columnKey, int rowKey) {
            getRpcProxy(CubaTableServerRpc.class).onClick(columnKey, String.valueOf(rowKey));
        }
    };
    tooltipHandlerRegistration = Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
        @Override
        public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (event.getTypeInt() != Event.ONMOUSEMOVE
                    || !Element.is(event.getNativeEvent().getEventTarget())) {
                return;
            }

            Element element = Element.as(event.getNativeEvent().getEventTarget());
            if ("div".equalsIgnoreCase(element.getTagName())) {
                String className = element.getClassName();
                if (className != null && (className.contains("v-table-caption-container")
                        || className.contains("v-table-footer-container"))) {
                    DomEvent.fireNativeEvent(event.getNativeEvent(), getWidget());
                }
            }
        }
    });
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:CubaTreeTableConnector.java

示例15: init

import com.google.gwt.event.dom.client.DomEvent; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    getWidget()._delegate.cellClickListener = new TableCellClickListener() {
        @Override
        public void onClick(String columnKey, int rowKey) {
            getRpcProxy(CubaTableServerRpc.class).onClick(columnKey, String.valueOf(rowKey));
        }
    };

    tooltipHandlerRegistration = Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
        @Override
        public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (event.getTypeInt() != Event.ONMOUSEMOVE
                    || !Element.is(event.getNativeEvent().getEventTarget())) {
                return;
            }

            Element element = Element.as(event.getNativeEvent().getEventTarget());
            if ("div".equalsIgnoreCase(element.getTagName())) {
                String className = element.getClassName();
                if (className != null && (className.contains("v-table-caption-container")
                        || className.contains("v-table-footer-container"))) {
                    DomEvent.fireNativeEvent(event.getNativeEvent(), getWidget());
                }
            }
        }
    });
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:CubaScrollTableConnector.java


注:本文中的com.google.gwt.event.dom.client.DomEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。