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"); } }
// 主动关闭,或被远端主动关闭 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"); }
// 被动关闭 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"); }