This is the entry point method. @param eventBus the event bus @param profiles the profiles @param tokenMatcher the token matcher @param kuneSession the kune session @param waveUnsavedIndicator the wave unsaved indicator @param contentService the content service @param colorPicker the color picker
(final EventBus eventBus, final KuneWaveProfileManager profiles,
final cc.kune.core.client.state.Session kuneSession, StateManager stateManager,
final CustomSavedStateIndicator waveUnsavedIndicator, final ContentServiceAsync contentService,
final Provider<AurorisColorPicker> colorPicker, SearchPanelView searchPanel,
CustomEditToolbar customEditToolbar)
| 373 | * @param colorPicker the color picker |
| 374 | */ |
| 375 | @Inject |
| 376 | public WebClient(final EventBus eventBus, final KuneWaveProfileManager profiles, |
| 377 | final cc.kune.core.client.state.Session kuneSession, StateManager stateManager, |
| 378 | final CustomSavedStateIndicator waveUnsavedIndicator, final ContentServiceAsync contentService, |
| 379 | final Provider<AurorisColorPicker> colorPicker, SearchPanelView searchPanel, |
| 380 | CustomEditToolbar customEditToolbar) { |
| 381 | this.eventBus = eventBus; |
| 382 | this.profiles = profiles; |
| 383 | this.kuneSession = kuneSession; |
| 384 | this.stateManager = stateManager; |
| 385 | this.waveUnsavedIndicator = waveUnsavedIndicator; |
| 386 | this.contentService = contentService; |
| 387 | this.colorPicker = colorPicker; |
| 388 | this.customEditToolbar = customEditToolbar; |
| 389 | this.searchPanel = searchPanel; |
| 390 | ErrorHandler.install(); |
| 391 | eventBus.addHandler(StackErrorEvent.getType(), new StackErrorEvent.StackErrorHandler() { |
| 392 | @Override |
| 393 | public void onStackError(final StackErrorEvent event) { |
| 394 | getStackTraceAsync(event.getException(), new Accessor<SafeHtml>() { |
| 395 | @Override |
| 396 | public void use(final SafeHtml stack) { |
| 397 | final String stackAsString = stack.asString().replace("<br>", "\n"); |
| 398 | NotifyUser.logError(stackAsString); |
| 399 | cc.kune.common.client.log.Log.error("Stack: " + stackAsString); |
| 400 | } |
| 401 | }); |
| 402 | } |
| 403 | }); |
| 404 | |
| 405 | ClientEvents.get().addWaveCreationEventHandler( |
| 406 | new WaveCreationEventHandler() { |
| 407 | |
| 408 | @Override |
| 409 | public void onCreateRequest(final WaveCreationEvent event, final Set<ParticipantId> participantSet) { |
| 410 | LOG.info("WaveCreationEvent received"); |
| 411 | if (channel == null) { |
| 412 | throw new DefaultException("Spaghetti attack. Create occured before login"); |
| 413 | } |
| 414 | openWave(WaveRef.of(idGenerator.newWaveId()), true, participantSet); |
| 415 | } |
| 416 | }); |
| 417 | |
| 418 | //setupConnectionIndicator(); |
| 419 | |
| 420 | // Done in StateManager |
| 421 | HistorySupport.init(new HistoryProvider() { |
| 422 | @Override |
| 423 | public String getToken() { |
| 424 | final String currentToken = History.getToken(); |
| 425 | String waveToken = currentToken; |
| 426 | // FIXME what about preview? |
| 427 | if (TokenMatcher.isGroupToken(currentToken) || TokenMatcher.isHomeToken(currentToken)) { |
| 428 | waveToken = kuneSession.getContentState().getWaveRef(); |
| 429 | LOG.info("Kune URL: " + currentToken + " = " + waveToken); |
| 430 | } |
| 431 | return waveToken; |
| 432 | } |