Esempio n. 1
0
        @Override
        public void run() {
          WaitViewParamBean poll;
          while (true) {
            try {
              poll = waitlist.poll(1000, TimeUnit.MILLISECONDS);
              if (poll != null) {

                String[] args = poll.getArgs();
                String remoteUserName = poll.getRemoteUserName();
                String repeaterid = poll.getRepeaterid();

                services
                    .getScreenShareService()
                    .addRepeaterID(
                        (String) DataUtil.getValue(DataUtil.Key.RepeaterHost),
                        Integer.parseInt(repeaterid));
                //						Thread.sleep(2000);
                ShareFileServerUtil.getInstance()
                    .startScreenShareToOneClient(
                        DataUtil.getLoginInfo().getConfno(), remoteUserName, repeaterid, args);
              }
            } catch (Exception e) {
              log.error("looThread.run", e);
            }
          }
        }
Esempio n. 2
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");
    }
  }
Esempio n. 3
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");
 }
Esempio n. 4
0
  private void addToWaitList(String remoteUserName, String repeaterid, boolean immediately)
      throws Exception {
    log.info("addToWaitList " + remoteUserName + "," + repeaterid);
    WaitViewParamBean bean = new WaitViewParamBean();
    bean.setRemoteUserName(remoteUserName);
    bean.setRepeaterid(repeaterid);

    String vnccolor = ConfigUtil.getProperty("VncColors", "Full");
    Integer nport = ConfigUtil.getIntProperty("repeaterport");

    String[] parameters =
        new String[] {
          "HOST",
          "ID",
          "PORT",
          repeaterid,
          "PASSWORD",
          ConfigUtil.getProperty("screenSharePasswd"),
          "View only",
          "Yes",
          "Restricted colors",
          vnccolor,
          "REPEATERHOST",
          DataUtil.getValue(DataUtil.Key.RepeaterHost),
          "REPEATERPORT",
          nport.toString()
        };

    bean.setArgs(parameters);

    //
    //	services.getScreenShareService().addRepeaterID((String)DataUtil.getValue(DataUtil.Key.RepeaterHost), Integer.parseInt(repeaterid));
    //		Thread.sleep(3000);
    waitlist.offer(bean);
  }
Esempio n. 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;
    }
  }
Esempio n. 6
0
 public void startScreenShareToOneClientFromSharer(
     String shareUserName, String repeaterid, Object args) throws Exception {
   log.info(
       "startScreenShareToOneClientFromSharer " + shareUserName + "," + repeaterid + "," + args);
   String[] sargs = (String[]) args;
   if (!shareUserName.equals(DataUtil.getLoginInfo().getUsername())) {
     createDesktopViewFromParameters(sargs, shareUserName, repeaterid);
   }
 }
Esempio n. 7
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);
    }
  }
Esempio n. 8
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");
  }
Esempio n. 9
0
  public void createDesktopView(
      String ip, int port, String password, String remoteUserName, Map<String, Integer> repeaterids)
      throws Exception {
    Integer nport = port;
    String innat = ConfigUtil.getProperty("IsInNat", "true");
    String[] parameters =
        new String[] {
          "HOST",
          ip,
          "PORT",
          nport.toString(),
          "PASSWORD",
          password,
          "View only",
          "Yes",
          "Restricted colors",
          "Full"
        };
    if (!innat.equals("true")) {
      if (repeaterids != null && repeaterids.size() != 0) {

        Integer id = repeaterids.get(remoteUserName + "-" + DataUtil.getLoginInfo().getUsername());
        Collection<Integer> values = repeaterids.values();

        Set<String> keySet = repeaterids.keySet();
        for (String string : keySet) {
          log.info("repeaterids key:" + string + " value:" + repeaterids.get(string));
        }
        String vnccolor = ConfigUtil.getProperty("VncColors", "Full");
        if (id != null) {

          nport = ConfigUtil.getIntProperty("repeaterport");
          parameters =
              new String[] {
                "HOST",
                "ID",
                "PORT",
                id.toString(),
                "PASSWORD",
                password,
                "View only",
                "Yes",
                "Restricted colors",
                vnccolor,
                "REPEATERHOST",
                DataUtil.getValue(DataUtil.Key.RepeaterHost),
                "REPEATERPORT",
                nport.toString()
              };
          createDesktopViewFromParameters(parameters, remoteUserName, id.toString());
        }
        log.info(
            "createDesktopView "
                + remoteUserName
                + "-"
                + DataUtil.getLoginInfo().getUsername()
                + " id:"
                + id);
      }
    } else {
      createDesktopViewFromParameters(parameters, remoteUserName, "");
      log.info(
          "createDesktopView "
              + remoteUserName
              + "-"
              + DataUtil.getLoginInfo().getUsername()
              + " noid");
    }
  }