Beispiel #1
0
  public void showConfirmControlDesktopDialog(final String remoteUserName, String remoteNickName)
      throws Exception {

    Object object = confirmDialogMap.get(remoteUserName);
    if (object == null) {
      final JDialog jDialog = new JDialog(ViewManager.getComponent(MainFrame.class), false);
      jDialog.addWindowListener(
          new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
              jDialog.dispose();
              confirmDialogMap.remove(remoteUserName);
            }
          });

      final JOptionPane jOptionPane =
          new JOptionPane(
              remoteNickName + "(" + remoteUserName + ")" + "  申请控制,是否允许?",
              JOptionPane.QUESTION_MESSAGE,
              JOptionPane.YES_NO_OPTION);
      jDialog.setContentPane(jOptionPane);
      jDialog.setTitle("信息提示");
      jOptionPane.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              String propertyName = evt.getPropertyName();
              if (jDialog.isVisible()
                  && evt.getSource() == jOptionPane
                  && propertyName.equals(JOptionPane.VALUE_PROPERTY)) {
                if (evt.getNewValue().equals(JOptionPane.YES_OPTION)) {
                  try {
                    // 找出正在控制的控制端
                    MemberListPanel memberListPanel =
                        ViewManager.getComponent(MemberListPanel.class);
                    DefaultListModel model =
                        (DefaultListModel) memberListPanel.getMemberList().getModel();
                    for (int i = 0; i < model.size(); i++) {
                      MemberListItem item = (MemberListItem) model.get(i);
                      if (item.getShareDesktopState()
                          == Constants.MEMBER_STATUS_SHAREDESKTOP_CONTROL) {
                        services
                            .getScreenShareService()
                            .notAgreeControlDesktop(item.getData().getName());
                      }
                    }
                    services.getScreenShareService().agreeControlDesktop(remoteUserName);
                  } catch (Exception e1) {
                    log.error("showConfirmControlDesktopDialog", e1);
                  }
                  confirmDialogMap.remove(remoteUserName);
                  jDialog.dispose();
                } else if (evt.getNewValue().equals(JOptionPane.NO_OPTION)) {
                  confirmDialogMap.remove(remoteUserName);
                  jDialog.dispose();
                }
              }
            }
          });
      jDialog.pack();
      FadeWindow fadeWindow = new FadeWindow(jDialog);
      //        	fadeWindow.startRuning();
      fadeWindow.setPosistionInRightBottom();
      fadeWindow.setWindowOpacity(1.0f);
      fadeWindow.setVisible(true);
      //        	fadeWindow.startFadeIn();
      confirmDialogMap.put(remoteUserName, remoteUserName);
    }
  }
Beispiel #2
0
  // 被动关闭
  public void stopDesktopView(String remoteUserName) throws Exception {
    log.info("stopDesktopView");
    VncViewer viewer = viewerMap.get("vncview_" + remoteUserName);
    if (viewer == null) {
      return;
    }
    viewer.setCustomProperty("IsDestroy", "true");
    viewer.setEnabled(false);
    viewer.disconnect();
    viewer.destroy(); // dispose!

    VncViewPanel viewPanel = null;
    MaxVncPanelWindow maxVncPanelWindow = ViewManager.getComponent(MaxVncPanelWindow.class);
    DockingLayoutMeetingPanel dockingLayoutMeetingPanel =
        ViewManager.getComponent(DockingLayoutMeetingPanel.class);
    View findInViewMap = dockingLayoutMeetingPanel.findInViewMap("vncview_" + remoteUserName);
    if (maxVncPanelWindow.isVisible()) {
      viewPanel = maxVncPanelWindow.getVncViewPanel();
    } else {
      if (findInViewMap != null) {
        viewPanel = (VncViewPanel) findInViewMap.getComponent();
      }
    }

    if (viewPanel != null && viewPanel.isConnected()) {
      final JDialog jDialog = new JDialog(ViewManager.getComponent(MainFrame.class), false);
      jDialog.addWindowListener(
          new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
              jDialog.dispose();
            }
          });

      final JOptionPane jOptionPane =
          new JOptionPane("远程桌面 " + remoteUserName + " 的连接已经断开", JOptionPane.INFORMATION_MESSAGE);
      jDialog.setContentPane(jOptionPane);
      jDialog.setTitle("信息提示");
      jOptionPane.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              String propertyName = evt.getPropertyName();
              //    				System.out.println(propertyName+" , "+evt.getSource());
              if (jDialog.isVisible()
                  && evt.getSource() == jOptionPane
                  && propertyName.equals(JOptionPane.VALUE_PROPERTY)) {
                //    					jDialog.setVisible(false);
                jDialog.dispose();
              }
            }
          });
      jDialog.pack();
      FadeWindow fadeWindow = new FadeWindow(jDialog);
      fadeWindow.setVisible(true);
      fadeWindow.setPosistionInRightBottom();
      fadeWindow.startFadeIn();
    }
    maxVncPanelWindow.setVncViewPanel(null);
    maxVncPanelWindow.dispose();
    dockingLayoutMeetingPanel.removePanel("vncview_" + remoteUserName);
    viewerMap.put("vncview_" + remoteUserName, null);
    ShareFileServerUtil.getInstance()
        .startScreenShareToOneClientCallBack(
            DataUtil.getLoginInfo().getConfno(),
            remoteUserName,
            DataUtil.getLoginInfo().getUsername(),
            "DESKTOP_STOPVIWE",
            "-1");
    log.debug("stopDesktopView End");
  }