/** * Called to indicate that delivery of a WhiteboardObject sent earlier has failed. Reason code and * phrase are contained by the <tt>WhiteboardObjectDeliveryFailedEvent</tt> * * @param evt the <tt>WhiteboardObjectDeliveryFailedEvent</tt> containing the ID of the * WhiteboardObject whose delivery has failed. */ public void whiteboardObjectDeliveryFailed(WhiteboardObjectDeliveryFailedEvent evt) { String errorMessage = null; if (evt.getErrorCode() == WhiteboardObjectDeliveryFailedEvent.NETWORK_FAILURE) { errorMessage = "Network failure."; } else if (evt.getErrorCode() == WhiteboardObjectDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED) { errorMessage = "Offline messages aren't supported."; } else if (evt.getErrorCode() == WhiteboardObjectDeliveryFailedEvent.PROVIDER_NOT_REGISTERED) { errorMessage = "Protocol provider is not registered."; } else if (evt.getErrorCode() == WhiteboardObjectDeliveryFailedEvent.INTERNAL_ERROR) { errorMessage = "An internal error occured."; } else if (evt.getErrorCode() == WhiteboardObjectDeliveryFailedEvent.UNKNOWN_ERROR) { errorMessage = "An unknown error occured."; } String debugErrorMessage = "WBObjectDeliveryFailedEvent: The following object: " + evt.getSourceWhiteboardObject() + " has NOT been delivered to " + evt.getDestinationContact().getDisplayName() + " because of the following error: " + errorMessage; logger.debug(debugErrorMessage); WhiteboardActivator.getUiService() .getPopupDialog() .showMessagePopupDialog(errorMessage, "Error", PopupDialog.ERROR_MESSAGE); }
/** * Called to accept an incoming invitation. Adds the invitation chat room to the list of chat * rooms and joins it. * * @param invitation the invitation to accept. */ public void acceptInvitation(WhiteboardInvitation invitation) { WhiteboardSession whiteboard = invitation.getTargetWhiteboard(); byte[] password = invitation.getWhiteboardPassword(); try { if (password == null) whiteboard.join(); else whiteboard.join(password); } catch (OperationFailedException e) { WhiteboardActivator.getUiService() .getPopupDialog() .showMessagePopupDialog( Resources.getString( "failedToJoinWhiteboard", new String[] {whiteboard.getWhiteboardID()}), Resources.getString("error"), PopupDialog.ERROR_MESSAGE); logger.error("Failed to join whiteboard: " + whiteboard.getWhiteboardID(), e); } }
/** * Implements the <tt>WhiteboardSessionPresenceListener .whiteboardSessionPresenceChanged</tt> * method. */ public void whiteboardSessionPresenceChanged(WhiteboardSessionPresenceChangeEvent evt) { WhiteboardSession whiteboardSession = evt.getWhiteboardSession(); if (evt.getEventType().equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_JOINED)) { whiteboardSession.addWhiteboardObjectListener(WhiteboardSessionManager.this); WhiteboardFrame frame = getWhiteboardFrame(evt.getWhiteboardSession()); if (frame == null) { frame = new WhiteboardFrame(WhiteboardSessionManager.this, whiteboardSession); frame.setVisible(true); wbFrames.add(frame); } } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_JOIN_FAILED)) { WhiteboardActivator.getUiService() .getPopupDialog() .showMessagePopupDialog( Resources.getString( "failedToJoinWhiteboard", new String[] {whiteboardSession.getWhiteboardID()}) + evt.getReason(), Resources.getString("error"), PopupDialog.ERROR_MESSAGE); } else if (evt.getEventType().equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_LEFT)) { WhiteboardFrame frame = getWhiteboardFrame(whiteboardSession); if (frame == null) return; wbFrames.remove(frame); frame.dispose(); whiteboardSession.removeWhiteboardObjectListener(WhiteboardSessionManager.this); } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_KICKED)) { } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_DROPPED)) { } }