private void connectHandlers() { EventBus eventBus = playerServices.getEventBus(); eventBus.addHandler(ShowErrorsEvent.TYPE, new ShowErrorsEvent.Handler() { public void onShowErrors(ShowErrorsEvent event) { setShowErrorsMode(); } }); eventBus.addHandler(WorkModeEvent.TYPE, new WorkModeEvent.Handler() { public void onWorkMode(WorkModeEvent event) { setWorkMode(); } }); eventBus.addHandler(ResetPageEvent.TYPE, new ResetPageEvent.Handler() { public void onResetPage(ResetPageEvent event) { setWorkMode(); } }); eventBus.addHandler(CustomEvent.TYPE, new CustomEvent.Handler() { @Override public void onCustomEventOccurred(CustomEvent event) { if (event.eventName.equals("ShowAnswers")) { if (view.isShowErrorsMode()) { view.setShowErrorsMode(false); } } } }); }
public TreePresenter(TreeView treeView) { this.view = treeView; bus.addHandler( FormItemRemovedEvent.TYPE, new FormItemRemovedHandler() { @Override public void onEvent(FormItemRemovedEvent event) { FBFormItem item = event.getFormItem(); view.removeFormItem(item); } }); bus.addHandler( FormItemAddedEvent.TYPE, new FormItemAddedHandler() { @Override public void onEvent(FormItemAddedEvent event) { FBFormItem item = event.getFormItem(); Widget parent = event.getFormItemHolder(); FBCompositeItem parentItem = null; while (parent != null && parentItem == null) { if (parent instanceof FBCompositeItem) { parentItem = (FBCompositeItem) parent; } else { parent = parent.getParent(); } } view.addFormItem(item, parentItem); } }); }
public FormBuilderModel(String contextPath) { this.contextPath = contextPath; // registered to save the menu items bus.addHandler( MenuItemAddedEvent.TYPE, new MenuItemAddedHandler() { public void onEvent(MenuItemAddedEvent event) { FBMenuItem item = event.getMenuItem(); saveMenuItem(event.getGroupName(), item); if (item instanceof CustomMenuItem) { CustomMenuItem customItem = (CustomMenuItem) item; String formItemName = customItem.getOptionName(); FormItemRepresentation formItem = customItem.getRepresentation(); saveFormItem(formItem, formItemName); } } }); // registered to delete the menu items bus.addHandler( MenuItemRemoveEvent.TYPE, new MenuItemRemoveHandler() { public void onEvent(MenuItemRemoveEvent event) { FBMenuItem item = event.getMenuItem(); deleteMenuItem(event.getGroupName(), item); if (item instanceof CustomMenuItem) { CustomMenuItem customItem = (CustomMenuItem) item; String formItemName = customItem.getOptionName(); FormItemRepresentation formItem = customItem.getRepresentation(); deleteFormItem(formItemName, formItem); } } }); }
public FormExporter() { bus.addHandler( UndoableEvent.TYPE, new UndoableHandler() { @Override public void onEvent(UndoableEvent event) { bus.fireEvent(new GetFormRepresentationEvent(EXPORT_TYPE)); } @Override public void doAction(UndoableEvent event) {} @Override public void undoAction(UndoableEvent event) {} }); bus.addHandler( GetFormRepresentationResponseEvent.TYPE, new GetFormRepresentationResponseHandler() { @Override public void onEvent(GetFormRepresentationResponseEvent event) { if (EXPORT_TYPE.equals(event.getSaveType())) { exportForm(event.getRepresentation()); } } }); }
@Override public void start( AcceptsOneWidget containerWidget, com.google.gwt.event.shared.EventBus eventBus) { containerWidget.setWidget(navigationView.asWidget()); registrations.add( navigationView .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { TreePlace place = navigationView.getSelectionModel().getSelectedObject(); if (place != null) { goTo(place); } } })); registrations.add( eventBus.addHandler( DataEvent.getType(), new DataEventHandler() { @Override public void onDataChanged(DataEvent event) { if (event.refreshTree()) { refreshTree(); if (pendingPlace != null) { selectPlace(pendingPlace); } } } })); }
private void registerHandlers() { eventBus.addHandler( UpdateDBOptionsEvent.TYPE, new UpdateDBOptionsEventHandler() { public void onUpdateDBOptions(UpdateDBOptionsEvent event) { setAllowedAuthApps(event.getDBOptionsData().getAllowedAuthApps()); } }); }
/** Construct a "sidebar" for a vertical Template Data editor */ public VerticalTemplateDataSidebarWidget( ResourcesProvider<TemplateDataColumn> resources, boolean isReadOnly, EventBus eventBus) { // Argument validation performed in the superclass constructor super(resources, isReadOnly, eventBus); contextMenu = new CopyPasteContextMenu(eventBus); // Wire-up event handlers eventBus.addHandler(SetInternalTemplateDataModelEvent.TYPE, this); }
private void bind(EventBus eventBus) { eventBus.addHandler( TreeVisEvent.TYPE, new TreeVisEventHandler() { @Override public void onViewData(TreeVisEvent e) { addVisTab(e.getData().getDataKey(), e.getData().getModelKey(), e.getIndex()); } }); eventBus.addHandler( RFGenerateEvent.TYPE, new RFGenerateEventHandler() { @Override public void onStart(RFGenerateEvent e) { logger.log(Level.INFO, "Adding confusion matrix..."); addConfusionMatrixTab(e.getData(), e.getBuilder()); } }); }
private void registerHandlers() { eventBus.addHandler( PanelTransitionEvent.TYPE, new PanelTransitionEventHandler() { public void onPanelTransition(PanelTransitionEvent event) { if (event.getTransitionType() == PanelTransitionEvent.TransitionTypes.PROJECTS) { setupBreadCrumbs(); } } }); }
private void bind() { eventBus.addHandler( UserInfoUpdatedEvent.TYPE, new UserInfoUpdatedEventHandler() { @Override public void onUserInfoChanged(UserInfoUpdatedEvent event) { // makes sure userInfo is up to date b/c class list view uses it userInfo = event.getUserInfo(); } }); }
public SettingsCommand() { super(); bus.addHandler( LoadSettingsResponseEvent.TYPE, new LoadSettingsResponseHandler() { public void onEvent(LoadSettingsResponseEvent event) { showSettingsPanel(event.getSettings()); } }); }
@Before public void setup() { eventBus.addHandler( SearchFieldChangedEvent.TYPE, new SearchFieldChangedHandler() { public void onSearchFieldChanged(SearchFieldChangedEvent event) { trace.add("search"); } }); trace.clear(); }
public void start(AcceptsOneWidget container, EventBus eventBus) { // Подписка activity-презентера на события EventBus. eventBus.addHandler(DeleteEvent.TYPE, this); eventBus.addHandler(DoDeleteEvent.TYPE, this); eventBus.addHandler(DoGetRecordEvent.TYPE, this); eventBus.addHandler(DoSearchEvent.TYPE, this); eventBus.addHandler(ListEvent.TYPE, this); eventBus.addHandler(SearchEvent.TYPE, this); eventBus.addHandler(SetCurrentRecordEvent.TYPE, this); eventBus.addHandler(SetListUIDEvent.TYPE, this); eventBus.addHandler(SaveEvent.TYPE, this); // "Привязка" элементов представления к функционалу презентера. bind(); // Переведем презентер модуля в заданный режим. changeWorkstate(place); }
@Override public void start(AcceptsOneWidget panel, EventBus eventBus) { this.container = panel; this.eventBus = eventBus; handlers.add(eventBus.addHandler(FlashStatusChangeEvent.TYPE, this)); if (useFlash) { fsiActivity.start(panel, eventBus); } else { jsActivity.start(panel, eventBus); } }
private void registerHandlers() { eventBus.addHandler( PanelTransitionEvent.TYPE, new PanelTransitionEventHandler() { public void onPanelTransition(PanelTransitionEvent event) { if (event.getTransitionType() == PanelTransitionEvent.TransitionTypes.NEXT) { currentPanelIndex++; Widget panel = event.getPanel(); deployerDeckPanel.showWidget(currentPanelIndex); eventBus.fireEvent( new BreadCrumbEvent( BreadCrumbEvent.Action.SET_ACTIVE, deployerDeckPanel .getWidget(deployerDeckPanel.getVisibleWidget()) .getTitle())); setFocus(panel); } else if (event.getTransitionType() == PanelTransitionEvent.TransitionTypes.PREVIOUS) { currentPanelIndex--; deployerDeckPanel.showWidget(currentPanelIndex); eventBus.fireEvent( new BreadCrumbEvent( BreadCrumbEvent.Action.SET_ACTIVE, deployerDeckPanel .getWidget(deployerDeckPanel.getVisibleWidget()) .getTitle())); } if (event.getTransitionType() == PanelTransitionEvent.TransitionTypes.DEPLOY) { reset(); } } }); eventBus.addHandler( DeployProjectEvent.TYPE, new DeployProjectEventHandler() { public void onDeployProject(DeployProjectEvent event) { deployProject(); } }); }
@Override public void start(AcceptsOneWidget panel, EventBus eventBus) { this.loggedPerson = null; this.eventBus = eventBus; this.view.setPresenter(this); this.view.clear(); updateMailsFromPerson(); panel.setWidget(view); hr = eventBus.addHandler(MailChangeModifiedEvent.TYPE, handler); }
private void connectHandlers() { EventBus eventBus = playerServices.getEventBus(); eventBus.addHandler(ShowErrorsEvent.TYPE, new ShowErrorsEvent.Handler() { @Override public void onShowErrors(ShowErrorsEvent event) { setShowErrorsMode(); } }); eventBus.addHandler(WorkModeEvent.TYPE, new WorkModeEvent.Handler() { @Override public void onWorkMode(WorkModeEvent event) { setWorkMode(); } }); eventBus.addHandler(ResetPageEvent.TYPE, new ResetPageEvent.Handler() { @Override public void onResetPage(ResetPageEvent event) { reset(); } }); eventBus.addHandler(ItemSelectedEvent.TYPE, new ItemSelectedEvent.Handler() { @Override public void onItemSelected(ItemSelectedEvent event) { if (event.getItem() instanceof DraggableImage) { if (event.getItem().getId() == null) { readyToDraggableItem = null; } else { readyToDraggableItem = event.getItem(); } } } }); eventBus.addHandler(ItemConsumedEvent.TYPE, new ItemConsumedEvent.Handler() { @Override public void onItemConsumed(ItemConsumedEvent event) { readyToDraggableItem = null; } }); eventBus.addHandler(CustomEvent.TYPE, new CustomEvent.Handler() { @Override public void onCustomEventOccurred(CustomEvent event) { if (event.eventName.equals("ShowAnswers")) { showAnswers(); } else if (event.eventName.equals("HideAnswers")) { hideAnswers(); } } }); }
/** * Instantiates a new user notifier popup. * * @param eventBus the event bus * @param msgs the msgs * @param msgWidget the msg widget */ @Inject public SimpleUserNotifierPopup( final EventBus eventBus, final UserMessagesPresenter msgs, final SimpleUserMessage msgWidget) { this.msgWidget = msgWidget; eventBus.addHandler( UserNotifyEvent.getType(), new UserNotifyEvent.UserNotifyHandler() { @Override public void onUserNotify(final UserNotifyEvent event) { if (event.getLevel() != NotifyLevel.log) { SimpleUserNotifierPopup.this.onNotify(event); } } }); }
/** The activity has started */ @Override public void start(AcceptsOneWidget panel, EventBus eventBus) { Log.info("SystemStartActivity.start()"); AnamnesisCheckView systemStartView = new AnamnesisCheckViewImpl(); innerSystemStartView = systemStartView; // AnamnesisCheckView systemStartView = getAnamnesisCheckView(); systemStartView.setPresenter(this); this.widget = panel; this.view = systemStartView; MenuClickEvent.register(requests.getEventBus(), (AnamnesisCheckViewImpl) view); widget.setWidget(systemStartView.asWidget()); init(); activityManger.setDisplay(view.getDetailsPanel()); placeChangeHandlerRegistration = eventBus.addHandler( PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { @Override public void onPlaceChange(PlaceChangeEvent event) { if (event.getNewPlace() instanceof AnamnesisCheckDetailsPlace) { requests.getEventBus().fireEvent(new ApplicationLoadingScreenEvent(true)); view.setDetailPanel(true); requests.getEventBus().fireEvent(new ApplicationLoadingScreenEvent(false)); AnamnesisCheckDetailsPlace place = (AnamnesisCheckDetailsPlace) event.getNewPlace(); if (place.getOperation() == Operation.NEW) { requests.getEventBus().fireEvent(new ApplicationLoadingScreenEvent(false)); getSearchStringByEntityProxyId( (EntityProxyId<AnamnesisCheckProxy>) place.getProxyId()); } } else if (event.getNewPlace() instanceof AnamnesisCheckPlace) { view.setDetailPanel(false); AnamnesisCheckPlace place = (AnamnesisCheckPlace) event.getNewPlace(); if (place.getToken().contains("!DELETED")) { // initSearch(); } } } }); }
@Test public void testCloseTabCallsOnStopAndRemovesWrappersHandlers() throws Exception { Place place = mock(Place.class); multiActivityManager.setTabbedPanel(tabbedPanel); ArgumentCaptor<ResettableEventBus> resettableEventBusArgumentCaptor = ArgumentCaptor.forClass(ResettableEventBus.class); HandlerRegistration handlerRegistration = mock(HandlerRegistration.class); ClosePlaceEvent.Handler handler = mock(ClosePlaceEvent.Handler.class); when(eventBus.addHandler(ClosePlaceEvent.TYPE, handler)).thenReturn(handlerRegistration); Activity activity = goTo(place); when(activity.mayStop()).thenReturn(true); verify(activity).start(any(AcceptTabItem.class), resettableEventBusArgumentCaptor.capture()); resettableEventBusArgumentCaptor.getValue().addHandler(ClosePlaceEvent.TYPE, handler); multiActivityManager.onCloseTab(new ClosePlaceEvent(place)); verify(activity).onStop(); verify(handlerRegistration).removeHandler(); }
public AbstractDecoratedTemplateDataGridWidget( ResourcesProvider<TemplateDataColumn> resources, TemplateDataCellFactory cellFactory, TemplateDataCellValueFactory cellValueFactory, EventBus eventBus, Panel mainPanel, Panel bodyPanel, AbstractMergableGridWidget<TemplateModel, TemplateDataColumn> gridWidget, AbstractDecoratedGridHeaderWidget<TemplateModel, TemplateDataColumn> headerWidget, AbstractDecoratedGridSidebarWidget<TemplateModel, TemplateDataColumn> sidebarWidget) { super(resources, eventBus, mainPanel, bodyPanel, gridWidget, headerWidget, sidebarWidget); if (cellFactory == null) { throw new IllegalArgumentException("cellFactory cannot be null"); } if (cellValueFactory == null) { throw new IllegalArgumentException("cellValueFactory cannot be null"); } this.cellFactory = cellFactory; this.cellValueFactory = cellValueFactory; // Wire-up event handlers eventBus.addHandler(SetTemplateDataEvent.TYPE, this); }
public ModelBoundTab( final ModelBoundTabData tabData, AbstractTabPanel tabPanel, EventBus eventBus) { super(tabData, tabPanel); setAlign(tabData.getAlign()); // Update tab accessibility setAccessible(tabData.getModelProvider().getModel().getIsAvailable()); // Tab widgets are created as part of the corresponding TabView, // at this point CommonModelChangeEvent has already been fired registerModelEventListeners(tabData.getModelProvider()); // Add handler to be notified when UiCommon models are (re)initialized eventBus.addHandler( UiCommonInitEvent.getType(), new UiCommonInitHandler() { @Override public void onUiCommonInit(UiCommonInitEvent event) { setAccessible(tabData.getModelProvider().getModel().getIsAvailable()); registerModelEventListeners(tabData.getModelProvider()); } }); }
/** * Initialize this place history handler. * * @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(); } }; }
/** * Add a {@link GeometrySplitStopHandler}. * * @param handler to be added * @return {@link HandlerRegistration} for the given handler */ public HandlerRegistration addGeometrySplitStopHandler(GeometrySplitStopHandler handler) { return eventBus.addHandler(GeometrySplitStopHandler.TYPE, handler); }
@Override public void start2(AcceptsOneWidget panel, EventBus eventBus) { questionDetailsView = new QuestionDetailsViewImpl(); questionDetailsView.setName("hallo"); questionDetailsView.setPresenter(this); this.widget = panel; this.view = questionDetailsView; widget.setWidget(questionDetailsView.asWidget()); // setTable(view.getTable()); eventBus.addHandler( PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { public void onPlaceChange(PlaceChangeEvent event) { // updateSelection(event.getNewPlace()); // TODO implement } }); // init(); view.setDelegate(this); this.answerListView = view.getAnswerListViewImpl(); answerListView.setDelegate(this); this.answerTable = answerListView.getTable(); requests .personRequestNonRoo() .myGetLoggedPerson() .fire( new Receiver<PersonProxy>() { @Override public void onSuccess(PersonProxy response) { loggedUser = response; start2(); } public void onFailure(ServerFailure error) { ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(error.getMessage()); Log.error(error.getMessage()); onStop(); } @Override public void onViolation(Set<Violation> errors) { Iterator<Violation> iter = errors.iterator(); String message = ""; while (iter.hasNext()) { message += iter.next().getMessage() + "<br>"; } Log.warn( McAppConstant.ERROR_WHILE_DELETE_VIOLATION + " in Antwort löschen -" + message); ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(message); onStop(); } }); }
@Override public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<E> handler) { // don't add to peer, since its changed value is the entire item list return bus.addHandler(ValueChangeEvent.getType(), handler); }
public static HandlerRegistration register(EventBus eventBus, RecordChangeHandler handler) { return eventBus.addHandler(TYPE, handler); }
@Override public void start(final AcceptsOneWidget panel, final EventBus eventBus) { if (StringUtils.isEmpty(documentID)) { goTo(new DocumentSelectionPlace()); } // register this class as the presenter listView.setPresenter(this); checkAuthentication(eventBus); // set the change handler for the table selection widget eventBus.addHandler( TableChangeEvent.TYPE, new TableChangeEventHandler() { @Override public void onTableChange(final TableChangeEvent event) { goTo(new ListPlace(documentID, event.getNewTableName(), "")); } }); // populate the cell table with data final AsyncCallback<LayoutGroup> callback = new AsyncCallback<LayoutGroup>() { @Override public void onFailure(final Throwable caught) { // TODO: create a way to notify users of asynchronous callback failures GWT.log( "AsyncCallback Failed: OnlineGlomService.getListViewLayout(): " + caught.getMessage()); } @Override public void onSuccess(final LayoutGroup result) { // TODO check if result.getTableName() is the same as the tableName field. Update it if // it's not the // same. listView.setCellTable(documentID, tableName, result, quickFind); } }; final String localeID = Utils.getCurrentLocaleID(); OnlineGlomServiceAsync.Util.getInstance() .getListViewLayout(documentID, tableName, localeID, callback); // TODO: Avoid the code duplication with DetailsActivity. // set the change handler for the quickfind text widget eventBus.addHandler( QuickFindChangeEvent.TYPE, new QuickFindChangeEventHandler() { @Override public void onQuickFindChange(final QuickFindChangeEvent event) { // We switch to the List view, to show search results. // TODO: Show the details view if there is only one result. goTo(new ListPlace(documentID, tableName, event.getNewQuickFindText())); } }); // Set the change handler for the table selection widget eventBus.addHandler( LocaleChangeEvent.TYPE, new LocaleChangeEventHandler() { @Override public void onLocaleChange(final LocaleChangeEvent event) { // note the empty primary key item goTo(new ListPlace(documentID, tableName, quickFind)); } }); // indicate that the view is ready to be displayed panel.setWidget(listView.asWidget()); }
public DatasetWidget() { super(); eventBus.addHandler(ESGFDatasetAddedEvent.TYPE, esgfDatasetAddedHandler); }
/** * Register a {@link RequestEvent.Handler} on an {@link EventBus}. * * @param eventBus the {@link EventBus} * @param handler a {@link RequestEvent.Handler} * @return a {@link HandlerRegistration} instance */ public static HandlerRegistration register(EventBus eventBus, RequestEvent.Handler handler) { return eventBus.addHandler(TYPE, handler); }