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


Java HandlerManager類代碼示例

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


HandlerManager類屬於com.google.gwt.event.shared包,在下文中一共展示了HandlerManager類的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包/類
@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

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

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

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

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

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

示例8: MonitorPresenter

import com.google.gwt.event.shared.HandlerManager; //導入依賴的package包/類
public MonitorPresenter(HandlerManager eventBus, View view, String bdaJobId, String oozieJobId) {
	this.eventBus = eventBus;
	this.view = view;
	this.headerLoader = new HeaderLoader(eventBus, view.getHeaderView(),
			MonitorPresenter.this);
	this.bdaJobMonitor = new BdaJobMonitor(this);
	this.diagramBuilder = new DiagramBuilder(this);
	this.currentJob = new BdaJob();
	this.currentJob.setJobId(bdaJobId);
	this.currentJob.setAccount(AppController.email);

	this.currentOozieJob = new OozieJob();
	this.currentOozieJob.setId(oozieJobId);
	this.currentOozieJob.setAccount(AppController.email);
	instanceFlag = true;
	this.arr = AppController.power.split("");
}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:18,代碼來源:MonitorPresenter.java

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

示例10: setData

import com.google.gwt.event.shared.HandlerManager; //導入依賴的package包/類
private void setData(String dataName, String data) {
	String oldData = getObjectString(dataName);
	if (oldData == null || !data.equals(oldData)) {
		String dataNamePath = buildPathString(dataName);
		try {
			if (dataStore != null) {
				dataStore.removeItem(dataNamePath);
				dataStore.setItem(dataNamePath, data);
			} else {
				Cookies.setCookie(dataNamePath, data, new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 365 * 100)));
			}
		} catch (Exception e) {}
		HandlerManager eventBus = ConsoleUnitEventManager.getInstance().getEventBus();
		BindingDataChangeEvent event = new BindingDataChangeEvent(dataName);
		eventBus.fireEvent(event);
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:18,代碼來源:LocalDataServiceImpl.java

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

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

示例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) {
			presenter.document = event.getDocumentType();
			presenter.setCustomizedShortcutPanels();
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:14,代碼來源:ReviewValidatePanel.java

示例15: addTableViewDisplayEventHandler

import com.google.gwt.event.shared.HandlerManager; //導入依賴的package包/類
/**
 * @param eventBus
 */
private void addTableViewDisplayEventHandler(HandlerManager eventBus) {
	eventBus.addHandler(TableViewDisplayEvent.type, new TableViewDisplayEventHandler() {

		@Override
		public void onResult(TableViewDisplayEvent event) {
			showTableViewBtn.setVisible(false);
			if (event.getTablesCount() > 0) {
				showTableViewBtn.setVisible(true);
			}
		}
	});
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:16,代碼來源:ValidatePanel.java


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