/**
  * Called by the JabberListener to indicate that a user has accepted or declined an invitation to
  * share a map.
  *
  * @param isAccepted
  */
 public void setMapShareRequestAccepted(String userName, boolean isAccepted) {
   if (state == STATE_SENT_SHARE_REQUEST_PENDING) {
     if (isAccepted) {
       setState(STATE_SHARING_MAP);
       sender.setShareMapUser(userName);
       sender.isMapShared(true);
       // TODO: Send current mind map to share user.
       /*
        * MindMapXMLElement mapElement = new
        * MindMapXMLElement(controller.getFrame()); try { StringWriter
        * sw = new StringWriter();
        *
        * sw.write(" <map version=\"" +
        * controller.getFrame().getFreemindVersion()+"\">\n");
        * MindMapMapModel mindMapNodeModel = (MindMapMapModel)
        * controller.getView().getModel();
        * mindMapNodeModel.saveInternal(sw, true); // save(sw,
        * (MindMapMapModel) controller.getView().getModel().getRoot());
        * sw.write(" </map>\n");
        *
        * sender.sendMap(sw.getBuffer().toString()); } catch(Exception
        * e) { freemind.main.Resources.getInstance().logException(e); }
        */
       jabberConnectionWizardView.showSharingAcceptedMessage(userName);
     } else {
       setState(STATE_CONNECTED);
       sender.isMapShared(false);
       jabberConnectionWizardView.showSharingDeclinedMessage(userName);
     }
   } // endif
 }
 private void addListeners() {
   jabberConnectionWizardView.addCloseButtonMouseListener(new CloseButtonClickListener());
   jabberConnectionWizardView.addNextButtonMouseListener(new NextButtonClickListener());
   jabberConnectionWizardView.addBackButtonMouseListener(new BackButtonClickListener());
   jabberConnectionWizardView.addAcceptButtonMouseListener(new AcceptButtonClickListener());
   jabberConnectionWizardView.addDeclineButtonMouseListener(new DeclineButtonClickListener());
 }
 public void setMapSharingRequested(String username, String mapContent, String mapFileName) {
   setState(STATE_RECEIVED_SHARE_REQUEST_PENDING);
   mapSharingRequestingUser = username;
   this.mapContent = mapContent;
   this.mapFileName = mapFileName;
   jabberConnectionWizardView.showMapShareAcceptDeclineMessage(mapSharingRequestingUser);
 }
 public void showMapSharingDialogue() {
   if (state == STATE_SHARING_MAP || state == STATE_CONNECTED) {
     // TODO: Ask "Are you sure you want to stop sharing?"
     sender.sendMapSharingStopRequest();
     stopSharing();
   } else {
     jabberConnectionWizardView.showConnectToServerDialog();
   }
 }
 /**
  * Called by the JabberListener when the other user no longer shares his/her map.
  *
  * @param username
  */
 public void setSharingStopped(String username) {
   stopSharing();
   jabberConnectionWizardView.showSharingStoppedMessage(username);
 }