page.send(page, Broadcast.BREADTH, aEvent);
@Override public void run() { if (pageId != AbstractWebSocketProcessor.NO_PAGE_ID) { Page page = (Page) Session.get().getPageManager().getPage(pageId); page.send(application, Broadcast.BREADTH, payload); } else { ResourceReference reference = new SharedResourceReference(resourceName); IResource resource = reference.getResource(); if (resource instanceof WebSocketResource) { WebSocketResource wsResource = (WebSocketResource) resource; wsResource.onPayload(payload); } else { throw new IllegalStateException( String.format("Shared resource with name '%s' is not a %s but %s", resourceName, WebSocketResource.class.getSimpleName(), Classes.name(resource.getClass()))); } } } };
@Override public void run() { if (pageId != AbstractWebSocketProcessor.NO_PAGE_ID) { Page page = (Page) Session.get().getPageManager().getPage(pageId); page.send(application, Broadcast.BREADTH, payload); } else { ResourceReference reference = new SharedResourceReference(resourceName); IResource resource = reference.getResource(); if (resource instanceof WebSocketResource) { WebSocketResource wsResource = (WebSocketResource) resource; wsResource.onPayload(payload); } else { throw new IllegalStateException( String.format("Shared resource with name '%s' is not a %s but %s", resourceName, WebSocketResource.class.getSimpleName(), Classes.name(resource.getClass()))); } } } };
@Override public void render(JCas aJCas, AnnotatorState aState, VDocument aVDoc) { // We activate new suggestions during rendering. For one, we don't have a push mechanism // at the moment. For another, even if we had it, it would be quite annoying to the user // if the UI kept updating itself without any the user expecting an update. The user does // expect an update when she makes some interaction, so we piggy-back on this expectation. boolean switched = recommendationService.switchPredictions(aState.getUser(), aState.getProject()); // Notify other UI components on the page about the prediction switch such that they can // also update their state to remain in sync with the new predictions if (switched) { RequestCycle.get().find(AjaxRequestTarget.class) .ifPresent(_target -> _target.getPage().send(_target.getPage(), Broadcast.BREADTH, new AjaxPredictionsSwitchedEvent(_target, aJCas, aState, aVDoc))); } // Add the suggestions to the visual document RecommendationRenderer.render(aVDoc, aState, aJCas, annotationService, recommendationService, learningRecordService, fsRegistry, documentService); } }
@Override public void respond(Attributes attributes) { try { PageParameters parameters = attributes.getParameters(); int pageId = parameters.get("pageId").toInt(); Page page = (Page)WebSession.get().getPageManager().getPage(pageId); AjaxRequestTarget newAjaxRequestTarget = ((WebApplication)Application.get()).newAjaxRequestTarget(page); RequestCycle.get().scheduleRequestHandlerAfterCurrent(newAjaxRequestTarget); page.send(page, Broadcast.BREADTH, new JEEWebGlobalAjaxEvent( newAjaxRequestTarget, parameters, RequestCycle.get() .getRequest() .getPostParameters())); } catch (Exception e) { LOGGER.error("Error while processing the ajax request", e); } } };
aTarget.getPage().send(aTarget.getPage(), Broadcast.BREADTH, new AjaxRecommendationRejectedEvent(aTarget, aState, aVID));
page.send(app, Broadcast.BREADTH, this);
page.send(app, Broadcast.BREADTH, this);
aTarget.getPage().send(aTarget.getPage(), Broadcast.BREADTH, new AjaxRecommendationAcceptedEvent(aTarget, aState, aVID));