List of usage examples for com.google.gwt.event.shared EventBus addHandler
public abstract <H extends EventHandler> HandlerRegistration addHandler(GwtEvent.Type<H> type, H handler);
From source file:com.ephesoft.gxt.admin.client.presenter.regexbuilder.RegexBuilderMainPresenter.java
License:Open Source License
@Override public void injectEvents(final EventBus eventBus) { eventBinder.bindEventHandlers(this, controller.getEventBus()); eventBus.addHandler(RegexEvent.type, new RegexEventHandler() { @Override//from www . ja v a2s . co m public void generateRegex(final RegexEvent regexEvent) { generateRegexPattern(); } }); }
From source file:com.eucalyptus.webui.client.ExPlaceHistoryHandler.java
License:Open Source License
/** * Initialize this place history handler. * /*from ww w .j a v a2 s.c o m*/ * @return a registration object to de-register the handler */ public HandlerRegistration register(PlaceController placeController, EventBus eventBus, Place defaultPlace, Place errorPlace) { this.placeController = placeController; this.defaultPlace = defaultPlace; this.errorPlace = errorPlace; final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { public void onPlaceChange(PlaceChangeEvent event) { log().log(Level.INFO, "Place changed"); Place newPlace = event.getNewPlace(); historian.newItem(tokenForPlace(newPlace), false); } }); final HandlerRegistration historyReg = historian.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { String token = event.getValue(); log().log(Level.INFO, "History changed: " + token); handleHistoryToken(token); } }); return new HandlerRegistration() { public void removeHandler() { ExPlaceHistoryHandler.this.defaultPlace = Place.NOWHERE; ExPlaceHistoryHandler.this.placeController = null; placeReg.removeHandler(); historyReg.removeHandler(); } }; }
From source file:com.github.a2g.core.objectmodel.CommandLinePresenter.java
License:Apache License
public CommandLinePresenter(final HostingPanelAPI panel, EventBus bus, CommandLineCallbackAPI api) { this.model = new CommandLine(api); this.api = api; this.view = api.getFactory().createCommandLinePanel(ColorEnum.Purple, ColorEnum.Black, ColorEnum.Red); panel.setThing(view);//w w w .ja v a2 s . c om bus.addHandler(ExecuteCommandEvent.TYPE, this); bus.addHandler(SetRolloverEvent.TYPE, this); }
From source file:com.github.a2g.core.objectmodel.MasterPresenter.java
License:Apache License
public MasterPresenter(final HostingPanelAPI panel, EventBus bus, MasterPresenterHostAPI parent) { this.bus = bus; this.timer = null; this.switchTimer = null; this.parent = parent; this.popupDisplayDuration = .8; this.theObjectMap = new TreeMap<Short, SceneObject>(); this.theAnimationMap = new TreeMap<String, Animation>(); this.doCommandActionRunner = new ActionRunner(this, 1); this.dialogActionRunner = new ActionRunner(this, 2); this.gatePoints = new ArrayList<PointF>(); this.gateIds = new ArrayList<Integer>(); this.theListOfIndexesToInsertAt = new Integer[100]; for (int i = 0; i < 100; i++) theListOfIndexesToInsertAt[i] = new Integer(0); bus.addHandler(SaySpeechCallDialogTreeEvent.TYPE, this); bus.addHandler(PropertyChangeEvent.TYPE, this); this.masterPanel = getFactory().createMasterPanel(320, 240, ColorEnum.Black); panel.setThing(this.masterPanel); this.dialogTreePresenter = new DialogTreePresenter(masterPanel.getHostForDialogTree(), bus, this); this.commandLinePresenter = new CommandLinePresenter(masterPanel.getHostForCommandLine(), bus, this); this.inventoryPresenter = new InventoryPresenter(masterPanel.getHostForInventory(), bus, this); this.scenePresenter = new ScenePresenter(masterPanel.getHostForScene(), this); this.verbsPresenter = new VerbsPresenter(masterPanel.getHostForVerbs(), bus, this); this.loadingPresenter = new LoaderPresenter(masterPanel.getHostForLoading(), bus, this, this, parent); this.titleCardPresenter = new TitleCardPresenter(masterPanel.getHostForTitleCard(), bus, this, parent); this.speechPopup = getFactory().createPopupPanel(this, scenePresenter.getWidth(), scenePresenter.getHeight()); this.masterPanel.setActiveState(MasterPanelAPI.GuiStateEnum.Loading); }
From source file:com.google.gwt.sample.dynatablerf.client.events.FilterChangeEvent.java
License:Apache License
public static HandlerRegistration register(EventBus eventBus, Handler handler) { return eventBus.addHandler(TYPE, handler); }
From source file:com.google.gwt.sample.dynatablerf.client.PersonEditorWorkflow.java
License:Apache License
static void register(EventBus eventBus, final DynaTableRequestFactory requestFactory, final FavoritesManager manager) { eventBus.addHandler(EditPersonEvent.TYPE, new EditPersonEvent.Handler() { public void startEdit(PersonProxy person, RequestContext requestContext) { new PersonEditorWorkflow(requestFactory, manager, person).edit(requestContext); }/*from www .j a v a 2s . c o m*/ }); }
From source file:com.google.gwt.sample.expenses.client.place.AbstractProxyListActivity.java
License:Apache License
public void start(AcceptsOneWidget display, EventBus eventBus) { view.setDelegate(this); EntityProxyChange.registerForProxyType(eventBus, proxyClass, new EntityProxyChange.Handler<P>() { public void onProxyChange(EntityProxyChange<P> event) { update(event.getWriteOperation(), event.getProxyId()); }/*w w w. ja va2 s . co m*/ }); eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { public void onPlaceChange(PlaceChangeEvent event) { updateSelection(event.getNewPlace()); } }); this.display = display; init(); updateSelection(placeController.getWhere()); }
From source file:com.google.gwt.sample.expenses.client.place.ProxyListPlacePicker.java
License:Apache License
public HandlerRegistration register(EventBus eventBus, HasConstrainedValue<ProxyListPlace> view) { this.view = view; final HandlerRegistration placeRegistration = eventBus.addHandler(PlaceChangeEvent.TYPE, this); final HandlerRegistration viewRegistration = view.addValueChangeHandler(this); return new HandlerRegistration() { public void removeHandler() { placeRegistration.removeHandler(); viewRegistration.removeHandler(); ProxyListPlacePicker.this.view = null; }/*from w ww . j a va 2 s .co m*/ }; }
From source file:com.google.gwt.sample.mobilewebapp.client.activity.TaskActivity.java
License:Apache License
public void start(final AcceptsOneWidget container, com.google.gwt.event.shared.EventBus eventBus) { this.childEventBus = new ResettableEventBus(eventBus); eventBus.addHandler(TaskEditEvent.TYPE, new TaskEditEvent.Handler() { @Override/*from ww w. j ava 2 s.co m*/ public void onTaskEdit(TaskEditEvent event) { // Stop the read presenter onStop(); presenter = startEdit(event.getReadOnlyTask()); container.setWidget(presenter); } }); if (place.getTaskId() == null) { presenter = startCreate(); } else { presenter = startDisplay(place); } container.setWidget(presenter); }
From source file:com.kk_electronic.kkportal.core.activity.ActivityManager.java
License:Open Source License
@Inject public ActivityManager(ApplicationLayout layout, FlexInjector injector, ActivityMap activityMap, LocationInfo locationInfo, EventBus eventBus, Stats stats, LocationManager locationManager, SideBar sideBar) {//from w w w .j a v a 2s . c o m this.injector = injector; this.activityMap = activityMap; this.display = layout; this.locationInfo = locationInfo; this.stats = stats; this.locationManager = locationManager; this.secondaryDisplay = sideBar; /* * We create the initial GUI elements needed for displaying activities. */ layout.go(); /* * Start Listening to LocationChange events. */ eventBus.addHandler(LocationChangedEvent.TYPE, this); /* * Do first location check */ onLocationChanged(null); }