/** * Creates a search presenter. * * @param model model to present * @param view view to render into * @param actionHandler handler for actions * @param profileEventsDispatcher the dispatcher of profile events. */ public static SearchPresenter create( Search model, SearchPanelView view, WaveActionHandler actionHandler, SourcesEvents<ProfileListener> profileEventsDispatcher) { SearchPresenterResources.Css css = SearchPresenterResources.Loader.res.css(); SearchPresenter presenter = new SearchPresenter( css, SchedulerInstance.getHighPriorityTimer(), model, view, actionHandler, profileEventsDispatcher); presenter.init(); return presenter; }
/** @return the renderer of intrinsic blip state. Subclasses may override. */ protected BlipQueueRenderer createBlipQueueRenderer() { DomAsViewProvider domAsView = stageOne.getDomAsViewProvider(); ReplyManager replyManager = new ReplyManager(getModelAsViewProvider()); // Add all doodads here. DocumentRegistries doodads = installDoodads(DocumentRegistries.builder()) // \u2620 .use(InlineAnchorLiveRenderer.installer(getViewIdMapper(), replyManager, domAsView)) .use(Gadget.install(getProfileManager(), getSupplement(), getSignedInUser())) .build(); LiveConversationViewRenderer live = LiveConversationViewRenderer.create( SchedulerInstance.getLowPriorityTimer(), getConversations(), getModelAsViewProvider(), getBlipDetailer(), replyManager, getThreadReadStateMonitor(), getProfileManager(), getSupplement()); live.init(); BlipPager pager = BlipPager.create( getDocumentRegistry(), doodads, domAsView, getModelAsViewProvider(), getBlipDetailer(), stageOne.getWavePanel().getGwtPanel()); // Collect various components required for paging blips in/out. PagingHandlerProxy pagingHandler = PagingHandlerProxy.create( // \u2620 // Enables and disables the document rendering, as well blip metadata. pager, // Registers and deregisters profile listeners for name changes. live); return BlipQueueRenderer.create(pagingHandler); }
private void loadStageTwo(final StageOne one) { final Timer timer = Timing.start("Stage Two"); SchedulerInstance.getHighPriorityTimer() .schedule( new Scheduler.Task() { @Override public void execute() { createStageTwoLoader(one) .call( new Accessor<StageTwo>() { @Override public void use(StageTwo x) { Timing.stop(timer); loadStageThree(x); } }); } }); }
private void loadStageThree(final StageTwo two) { final Timer timer = Timing.start("Stage Tree"); SchedulerInstance.getHighPriorityTimer() .schedule( new Scheduler.Task() { @Override public void execute() { createStageThreeLoader(two) .call( new Accessor<StageThree>() { @Override public void use(StageThree x) { Timing.stop(timer); finish(); } }); } }); }
/** Creates the second stage. */ @Override protected void create(final Accessor<StageTwo> whenReady) { onStageInit(); final CountdownLatch synchronizer = CountdownLatch.create( 2, new Command() { @Override public void execute() { install(); onStageLoaded(); whenReady.use(DefaultProvider.this); } }); fetchWave( new Accessor<WaveViewData>() { @Override public void use(WaveViewData x) { waveData = x; synchronizer.tick(); } }); // Defer everything else, to let the RPC go out. SchedulerInstance.getMediumPriorityTimer() .scheduleDelayed( new Task() { @Override public void execute() { installStatics(); synchronizer.tick(); } }, 20); }
/** @return the scheduler to use for RPCs. Subclasses may override. */ protected CollectiveScheduler createRpcScheduler() { // Use a scheduler that runs closely-timed tasks at the same time. return new OptimalGroupingScheduler(SchedulerInstance.getLowPriorityTimer()); }