예제 #1
0
  public void stopControlRemoteDesktop(String remoteUserName) throws Exception {
    log.info("stopControlRemoteDesktop " + remoteUserName);
    VncViewer viewer = viewerMap.get("vncview_" + remoteUserName);
    if (viewer != null) {
      viewer.setViewOnly(true);

      MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class);
      if (component.isVisible()) {
        VncViewPanel viewPanel = component.getVncViewPanel();
        viewPanel.getAskforControlButton().setEnabled(true);
        viewPanel.getStopControlButton().setEnabled(false);
      } else {
        DockingLayoutMeetingPanel dockingLayoutMeetingPanel =
            ViewManager.getComponent(DockingLayoutMeetingPanel.class);
        View findInViewMap = dockingLayoutMeetingPanel.findInViewMap("vncview_" + remoteUserName);
        if (findInViewMap != null) {
          VncViewPanel viewPanel = (VncViewPanel) findInViewMap.getComponent();
          viewPanel.getAskforControlButton().setEnabled(true);
          viewPanel.getStopControlButton().setEnabled(false);
        }
      }
      ShareFileServerUtil.getInstance()
          .startScreenShareToOneClientCallBack(
              DataUtil.getLoginInfo().getConfno(),
              remoteUserName,
              DataUtil.getLoginInfo().getUsername(),
              "DESKTOP_NOTCONTROL",
              "-1");
    }
  }
예제 #2
0
 // 主动关闭,或被远端主动关闭
 public void closeDesktopView(String remoteUserName) throws Exception {
   log.info("closeDesktopView");
   VncViewer viewer = viewerMap.get("vncview_" + remoteUserName);
   if (viewer != null) {
     viewer.setCustomProperty("IsDestroy", "true");
     viewer.setEnabled(false);
     viewer.disconnect();
     viewer.destroy(); // dispose!
   }
   DockingLayoutMeetingPanel dockingLayoutMeetingPanel =
       ViewManager.getComponent(DockingLayoutMeetingPanel.class);
   View findInViewMap = dockingLayoutMeetingPanel.findInViewMap("vncview_" + remoteUserName);
   if (findInViewMap != null) {
     //        	dockingLayoutMeetingPanel.removePanel("vncview_"+remoteUserName);
   }
   dockingLayoutMeetingPanel.removePanel("vncview_" + remoteUserName);
   MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class);
   component.setVncViewPanel(null);
   component.dispose();
   viewerMap.put("vncview_" + remoteUserName, null);
   ShareFileServerUtil.getInstance()
       .startScreenShareToOneClientCallBack(
           DataUtil.getLoginInfo().getConfno(),
           remoteUserName,
           DataUtil.getLoginInfo().getUsername(),
           "DESKTOP_STOPVIWE",
           "-1");
 }
예제 #3
0
 public void startScreenShareToOneClientCallBack(
     String sharerUserName, String userName, String status, String repeaterid) throws Exception {
   log.info(
       "startScreenShareToOneClientCallBack "
           + sharerUserName
           + ","
           + userName
           + ","
           + status
           + ","
           + repeaterid);
   if (status.equals("ERROR")) {
     //    		DockingLayoutMeetingPanel panel =
     // DataUtil.getValue(DataUtil.Key.DockingLayoutMeetingPanel);
     if (screenshareflag) {
       addToWaitList(userName, repeaterid, false);
     }
     //			if (panel.getStopScreenShareMI().isEnabled()) {
     ////				Thread.sleep(2000);
     //				addToWaitList(userName, repeaterid,false);
     //			}
     MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class);
     MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName);
     if (memberListItemByName != null) {
       memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_FREE);
       memberPanel.repaint();
     }
   } else if (status.equals("SUCCESS")) {
     MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class);
     MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName);
     if (memberListItemByName != null) {
       memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_VIEW);
       //        		memberListItemByName.repaint();
       memberPanel.repaint();
     }
   } else if (status.equals("DESKTOP_CONTROL")) {
     MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class);
     MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName);
     if (memberListItemByName != null) {
       memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_CONTROL);
       memberPanel.repaint();
     }
   } else if (status.equals("DESKTOP_NOTCONTROL")) {
     MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class);
     MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName);
     if (memberListItemByName != null) {
       memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_VIEW);
       memberPanel.repaint();
     }
   } else if (status.equals("DESKTOP_STOPVIWE")) {
     MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class);
     MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName);
     if (memberListItemByName != null) {
       memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_FREE);
       //        		memberListItemByName.repaint();
       memberPanel.repaint();
     }
   }
 }
예제 #4
0
 public void revertVncViewPanel(VncViewPanel panel) throws Exception {
   log.info("revertVncViewPanel");
   DockingLayoutMeetingPanel dockingLayoutMeetingPanel =
       ViewManager.getComponent(DockingLayoutMeetingPanel.class);
   dockingLayoutMeetingPanel.updatePanel(panel, "vncview_" + panel.getUsername());
   MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class);
   component.setVncViewPanel(null);
   component.dispose();
   panel.getDesktopScrollPane().getComponent(0).repaint();
   panel.getMaxViewButton().setVisible(true);
   panel.getRevertViewButton().setVisible(false);
 }
예제 #5
0
  public void getRepeaterIDCallBack(Map<String, Integer> repeaterids) throws Exception {
    log.info("getRepeaterIDCallBack");
    if (screenshareflag) {

      if (!looThread.isAlive()) {
        looThread.start();
      }

      Iterator<Entry<String, Integer>> iterator = repeaterids.entrySet().iterator();
      while (iterator.hasNext()) {
        Map.Entry<java.lang.String, java.lang.Integer> entry =
            (Map.Entry<java.lang.String, java.lang.Integer>) iterator.next();
        String remoteUserName = entry.getKey().substring(entry.getKey().indexOf("-") + 1);
        if (!remoteUserName.equals(DataUtil.getLoginInfo().getUsername())) {
          addToWaitList(remoteUserName, entry.getValue() + "", true);
        }
      }

      //			DockingLayoutMeetingPanel panel =
      // DataUtil.getValue(DataUtil.Key.DockingLayoutMeetingPanel);
      //			panel.getStartScreenShareMI().setEnabled(false);
      //			panel.getStopScreenShareMI().setEnabled(true);
      MainFrame mainFrame = ViewManager.getComponent(MainFrame.class);
      mainFrame
          .getShareDesktopButton()
          .setText(StringUtil.getUIString("DockingLayoutMeetingPanel.stopScreenShareMI.text"));
      mainFrame.getShareDesktopButton().setEnabled(true);

      //    		screenshareflag = false;
    }
  }
예제 #6
0
 public void stopScreenShare() throws Exception {
   log.info("取消共享桌面");
   try {
     waitlist.clear();
     services.getScreenShareService().stopScreenShare();
     // 同一时间只有一个被共享者,可以kill
     services.getScreenShareService().stopScreenShareProcess();
     MainFrame mainFrame = ViewManager.getComponent(MainFrame.class);
     mainFrame
         .getShareDesktopButton()
         .setText(StringUtil.getUIString("DockingLayoutMeetingPanel.screenShareMenu.text"));
     //			mainFrame.getShareDesktopButton().setEnabled(false);
     screenshareflag = false;
   } catch (Exception ex) {
     log.error("stopScreenShare", ex);
   }
 }
예제 #7
0
  public void maxVncViewPanel(VncViewPanel panel) throws Exception {
    log.info("maxVncViewPanel");
    MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class);
    component.setAlwaysOnTop(true);

    Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    component.setSize(screenSize);
    component.setLocation(0, 0);
    component.getCenterPanel().removeAll();
    Dimension topPanelSize = panel.getTopPanel().getSize();
    panel
        .getDesktopScrollPane()
        .setSize(screenSize.width + 1, screenSize.height - topPanelSize.height - 4);

    component.getCenterPanel().add(panel, BorderLayout.CENTER);
    component.setVncViewPanel(panel);
    component.setVisible(true);
    panel.getDesktopScrollPane().getComponent(0).repaint();

    panel.getMaxViewButton().setVisible(false);
    panel.getRevertViewButton().setVisible(true);
  }
예제 #8
0
  public void startScreenShare() throws Exception {
    log.info("启动共享桌面");
    try {
      List<MemberDto> members =
          (List<MemberDto>) ControllerFacade.execute("mainController", "getOpenfireMemberList");
      String[] targetusers = new String[members.size()];
      for (int i = 0; i < members.size(); i++) {
        MemberDto memberDto = members.get(i);
        targetusers[i] = memberDto.getName();
      }

      MainFrame mainFrame = ViewManager.getComponent(MainFrame.class);
      mainFrame
          .getShareDesktopButton()
          .setText(StringUtil.getUIString("DockingLayoutMeetingPanel.stopScreenShareMI.text"));
      mainFrame.getShareDesktopButton().setEnabled(false);

      boolean processExists =
          com.lorent.common.util.ProcessUtil.getInstance().processExists("winvnc.exe");
      if (!processExists) {
        /*
        Double osVersion = PlatformUtil.getOSVersion();
        if ( osVersion >= 6.0f) {
        	Process startScreenShareProcess = services.getScreenShareService().startScreenShareProcess();
        	DataUtil.setValue(DataUtil.Key.ScreenShareProcess, startScreenShareProcess);
        }
        else{
        	services.getScreenShareService().installScreenShareService();
        }
        */
        Process startScreenShareProcess =
            services.getScreenShareService().startScreenShareProcess();
        DataUtil.setValue(DataUtil.Key.ScreenShareProcess, startScreenShareProcess);
      }

      screenshareflag = true;
      services.getScreenShareService().getRepeaterIDsFromServer(targetusers);

      new Thread() {

        @Override
        public void run() {
          try {

            Thread.sleep(10000);
            MainFrame mainFrame = ViewManager.getComponent(MainFrame.class);
            if (screenshareflag && !mainFrame.getShareDesktopButton().isEnabled()) {
              log.info("启动共享桌面超时");
              mainFrame
                  .getShareDesktopButton()
                  .setText(
                      StringUtil.getUIString("DockingLayoutMeetingPanel.screenShareMenu.text"));
              mainFrame.getShareDesktopButton().setEnabled(true);
              screenshareflag = false;
            }

          } catch (Exception e) {
            e.printStackTrace();
            log.error("startScreenShare", e);
          }
        }
      }.start();
    } catch (Exception ex) {
      log.error("startScreenShare", ex);
    }
  }
예제 #9
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);
    }
  }
예제 #10
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");
  }