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


Java HandlerManager.addHandler方法代碼示例

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


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

示例1: setEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的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: injectEvents

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * To handle events.
 * 
 * @param eventBus HandlerManager
 */
@Override
public void injectEvents(HandlerManager eventBus) {
	eventBus.addHandler(BatchListKeyDownEvent.TYPE, new BatchListKeyDownEventHandler() {

		@Override
		public void onKeyDown(BatchListKeyDownEvent event) {
			if (event.getEvent().isControlKeyDown()) {
				switch (event.getEvent().getNativeEvent().getKeyCode()) {
					case 'j':
					case 'J':
						event.getEvent().getNativeEvent().preventDefault();
						view.setReviewTableSelected();
						break;
					case 'k':
					case 'K':
						event.getEvent().getNativeEvent().preventDefault();
						view.setValidateTableSeleted();
						break;
					default:
						break;
				}
			}
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:31,代碼來源:LandingPresenter.java

示例3: addTreeRefreshEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addTreeRefreshEventHandler(HandlerManager eventBus) {
	eventBus.addHandler(TreeRefreshEvent.type, new TreeRefreshEventHandler() {

		@Override
		public void refresh(TreeRefreshEvent treeRefreshEvent) {
			// If any of the following entities is null... this means there is no page or document left in the batch.
			// Set the validate panel visibility to false.
			Batch batch = presenter.batchDTO.getBatch();
			if (batch == null || batch.getDocuments() == null || batch.getDocuments().getDocument() == null
					|| batch.getDocuments().getDocument().size() < 1) {
				documentTypes.clear();
				documentList.setEnabled(Boolean.FALSE);
				documentTypes.setEnabled(Boolean.FALSE);
				return;
			}
			setFocus();
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:23,代碼來源:ReviewPanel.java

示例4: injectEvents

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
@Override
public void injectEvents(HandlerManager eventBus) {
	// TODO Auto-generated method stub
	eventBus.addHandler(RVKeyDownEvent.type, new RVKeyDownEventHandler() {

		@Override
		public void onKeyDown(RVKeyDownEvent event) {

			KeyDownEvent keyDownEvent = event.getEvent();
			if (keyDownEvent.isControlKeyDown() && keyDownEvent.isShiftKeyDown()
					&& keyDownEvent.getNativeEvent().getKeyCode() == 39) {
				// Ctrl + Shift + ->
				keyDownEvent.getNativeEvent().preventDefault();
				nextBatchPage();
			}
		}
	});

}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:20,代碼來源:TopPanel.java

示例5: addRVKeyDownEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addRVKeyDownEventHandler(HandlerManager eventBus) {
	eventBus.addHandler(RVKeyDownEvent.type, new RVKeyDownEventHandler() {

		@Override
		public void onKeyDown(RVKeyDownEvent event) {
			if (!presenter.isTableView() && event.getEvent().isControlKeyDown()) {
				switch (event.getEvent().getNativeKeyCode()) {
					case 52:
					case 100:
					case 55:
					case 103:
					case 56:
					case 104:
					case 57:
					case 105:
						event.getEvent().preventDefault();
						break;
					default:
						break;
				}
			}
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:28,代碼來源:ReviewValidatePanel.java

示例6: addDocExpandEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addDocExpandEventHandler(HandlerManager eventBus) {
	eventBus.addHandler(DocExpandEvent.type, new DocExpandEventHandler() {

		@Override
		public void onExpand(DocExpandEvent event) {
			presenter.document = event.getDocument();
			setErrorTextForDocument();
			presenter.setCustomizedShortcutPanels();
			if (event.isFireReviewPanelDefaultEvent()) {
				setReviewPanelState();
			}
		}

	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:19,代碼來源:ReviewValidatePanel.java

示例7: addRVKeyUpEvent

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addRVKeyUpEvent(HandlerManager eventBus) {
	eventBus.addHandler(RVKeyUpEvent.type, new RVKeyUpEventHandler() {

		@Override
		public void onKeyUp(RVKeyUpEvent event) {
			KeyUpEvent keyEvent = event.getEvent();
			if (keyEvent.isControlKeyDown()) {
				int keyCode = keyEvent.getNativeEvent().getKeyCode();
				switch (keyCode) {
					case 'n':
					case 'N':
						keyNUpEvent(keyEvent);
						break;
					case 'p':
					case 'P':
						keyPUpEvent(keyEvent);
						break;
					default:
						break;
				}
			}
		}

	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:29,代碼來源:DocumentTree.java

示例8: addRVKeyDownEvent

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addRVKeyDownEvent(HandlerManager eventBus) {
	eventBus.addHandler(RVKeyDownEvent.type, new RVKeyDownEventHandler() {

		@Override
		public void onKeyDown(RVKeyDownEvent event) {
			if (event.getEvent().isControlKeyDown()) {
				switch (event.getEvent().getNativeEvent().getKeyCode()) {
					case 'n':
					case 'N':
						event.getEvent().getNativeEvent().preventDefault();
						break;
					case 'p':
					case 'P':
						event.getEvent().getNativeEvent().preventDefault();
						break;
					default:
						break;
				}
			}

		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:27,代碼來源:DocumentTree.java

示例9: addPageChangeHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addPageChangeHandler(HandlerManager eventBus) {
	eventBus.addHandler(PageChangeEvent.type, new PageChangeEventHandler() {

		@Override
		public void onPageChange(PageChangeEvent event) {
			PageImage pageImage = getPageImageById(event.getPage().getIdentifier());
			if (!event.getPage().isIsRotated()) {
				pageImage.image.setUrl(presenter.batchDTO.getAbsoluteURLFor(event.getPage().getThumbnailFileName()), event
						.getPage().getDirection());
			} else {
				pageImage.image.setUrl(presenter.batchDTO.getAbsoluteURLForRotatedImage(event.getPage().getThumbnailFileName(),
						event.getPage().getDirection().toString()), event.getPage().getDirection());
			}
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:20,代碼來源:DocumentTree.java

示例10: registerHandlers

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
private void registerHandlers() {
	HandlerManager eventBus = ConsoleUnitEventManager.getInstance().getEventBus();
	eventBus.addHandler(RotationEvent.getType(), this);
	eventBus.addHandler(WindowResizeEvent.getType(), this);
	eventBus.addHandler(SwipeEvent.getType(), this);
	eventBus.addHandler(HoldEvent.getType(), this);
	eventBus.addHandler(NavigateEvent.getType(), this);
	eventBus.addHandler(CommandSendEvent.getType(), this);
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:10,代碼來源:ConsoleUnit.java

示例11: injectEvents

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * To handle events.
 * 
 * @param eventBus HandlerManager
 */
@Override
public void injectEvents(HandlerManager eventBus) {
	eventBus.addHandler(ModuleItemsAddedEvent.type, new ModuleItemsAddedEventHandler() {

		@Override
		public void onItemsAdded(ModuleItemsAddedEvent event) {
			addSelectedModule();
		}
	});

}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:17,代碼來源:ConfigureModulePresenter.java

示例12: addRVKeyUpEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addRVKeyUpEventHandler(final HandlerManager eventBus) {
	eventBus.addHandler(RVKeyUpEvent.type, new RVKeyUpEventHandler() {

		@Override
		public void onKeyUp(final RVKeyUpEvent event) {
			shiftKeyPressed = false;
			ctrlKeyPressed = false;
			clickCount = 0;
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:15,代碼來源:ImageOverlayPanel.java

示例13: addDocTypeChangeHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addDocTypeChangeHandler(HandlerManager eventBus) {
	eventBus.addHandler(DocTypeChangeEvent.type, new DocTypeChangeEventHandler() {

		@Override
		public void onDocumentTypeChange(DocTypeChangeEvent event) {
			presenter.document = event.getDocumentType();
			presenter.setCustomizedShortcutPanels();
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:14,代碼來源:ReviewValidatePanel.java

示例14: addDocTypeChangeHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addDocTypeChangeHandler(HandlerManager eventBus) {
	eventBus.addHandler(DocTypeChangeEvent.type, new DocTypeChangeEventHandler() {

		@Override
		public void onDocumentTypeChange(DocTypeChangeEvent event) {
			handleRefreshEvent(event.getBatchDTO(), event.getDocumentType(), event.getDocumentType().getPages().getPage().get(0));
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:13,代碼來源:DocumentTree.java

示例15: addTreeRefreshHandler

import com.google.gwt.event.shared.HandlerManager; //導入方法依賴的package包/類
/**
 * @param eventBus
 */
private void addTreeRefreshHandler(HandlerManager eventBus) {
	eventBus.addHandler(TreeRefreshEvent.type, new TreeRefreshEventHandler() {

		@Override
		public void refresh(TreeRefreshEvent event) {
			handleRefreshEvent(event.getBatchDTO(), event.getDocument(), event.getPage());
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:13,代碼來源:DocumentTree.java


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