本文整理匯總了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;
}
示例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));
}
示例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);
}