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


Java EventBus.fireEvent方法代碼示例

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


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

示例1: PartStackPresenter

import com.google.web.bindery.event.shared.EventBus; //導入方法依賴的package包/類
@Inject
public PartStackPresenter(
    final EventBus eventBus,
    final PartMenu partMenu,
    PartStackEventHandler partStackEventHandler,
    TabItemFactory tabItemFactory,
    PartsComparator partsComparator,
    @Assisted final PartStackView view,
    @Assisted @NotNull WorkBenchPartController workBenchPartController) {
  this.view = view;
  this.view.setDelegate(this);

  this.eventBus = eventBus;
  this.partMenu = partMenu;
  this.partStackHandler = partStackEventHandler;
  this.workBenchPartController = workBenchPartController;
  this.tabItemFactory = tabItemFactory;
  this.partsComparator = partsComparator;

  this.parts = new HashMap<>();
  this.constraints = new LinkedHashMap<>();

  this.propertyListener =
      new PropertyListener() {
        @Override
        public void propertyChanged(PartPresenter source, int propId) {
          if (PartPresenter.TITLE_PROPERTY == propId) {
            updatePartTab(source);
          } else if (EditorPartPresenter.PROP_DIRTY == propId) {
            eventBus.fireEvent(new EditorDirtyStateChangedEvent((EditorPartPresenter) source));
          }
        }
      };

  if (workBenchPartController != null) {
    this.workBenchPartController.setSize(DEFAULT_PART_SIZE);
  }

  currentSize = DEFAULT_PART_SIZE;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:41,代碼來源:PartStackPresenter.java

示例2: fire

import com.google.web.bindery.event.shared.EventBus; //導入方法依賴的package包/類
public static <D> void fire(EventBus source, Class<D> clazz, D old, D data) {
    source.fireEvent(new ModelEvent(clazz, old, data));
}
 
開發者ID:spirylics,項目名稱:x-gwt,代碼行數:4,代碼來源:ModelEvent.java

示例3: MachineStatusEventHandler

import com.google.web.bindery.event.shared.EventBus; //導入方法依賴的package包/類
@Inject
MachineStatusEventHandler(
    RequestHandlerConfigurator configurator,
    EventBus eventBus,
    AppContext appContext,
    WorkspaceServiceClient workspaceServiceClient) {
  this.appContext = appContext;

  BiConsumer<String, MachineStatusEvent> operation =
      (String endpointId, MachineStatusEvent event) -> {
        Log.debug(getClass(), "Received notification from endpoint: " + endpointId);

        final String machineName = event.getMachineName();
        final String workspaceId = event.getIdentity().getWorkspaceId();

        eventBus.fireEvent(new MachineStatusChangedEvent(machineName, event.getEventType()));

        workspaceServiceClient
            .getWorkspace(workspaceId)
            .then(
                workspace -> {
                  RuntimeImpl workspaceRuntime = workspace.getRuntime();
                  if (workspaceRuntime == null) {
                    return;
                  }

                  // Update workspace model in AppContext before firing an event.
                  // Because AppContext always must return an actual workspace model.
                  ((AppContextImpl) appContext).setWorkspace(workspace);

                  switch (event.getEventType()) {
                    case STARTING:
                      getMachineByName(machineName)
                          .ifPresent(m -> eventBus.fireEvent(new MachineStartingEvent(m)));
                      break;
                    case RUNNING:
                      getMachineByName(machineName)
                          .ifPresent(m -> eventBus.fireEvent(new MachineRunningEvent(m)));
                      break;
                    case STOPPED:
                      getMachineByName(machineName)
                          .ifPresent(m -> eventBus.fireEvent(new MachineStoppedEvent(m)));
                      break;
                    case FAILED:
                      getMachineByName(machineName)
                          .ifPresent(
                              m ->
                                  eventBus.fireEvent(
                                      new MachineFailedEvent(m, event.getError())));
                      break;
                  }
                });
      };

  configurator
      .newConfiguration()
      .methodName(MACHINE_STATUS_CHANGED_METHOD)
      .paramsAsDto(MachineStatusEvent.class)
      .noResult()
      .withBiConsumer(operation);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:62,代碼來源:MachineStatusEventHandler.java


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