52
|
1 // Copyright (C) 2010, 2011, 2012, 2013 GlavSoft LLC.
|
|
2 // All rights reserved.
|
|
3 //
|
|
4 //-------------------------------------------------------------------------
|
|
5 // This file is part of the TightVNC software. Please visit our Web site:
|
|
6 //
|
|
7 // http://www.tightvnc.com/
|
|
8 //
|
|
9 // This program is free software; you can redistribute it and/or modify
|
|
10 // it under the terms of the GNU General Public License as published by
|
|
11 // the Free Software Foundation; either version 2 of the License, or
|
|
12 // (at your option) any later version.
|
|
13 //
|
|
14 // This program is distributed in the hope that it will be useful,
|
|
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 // GNU General Public License for more details.
|
|
18 //
|
|
19 // You should have received a copy of the GNU General Public License along
|
|
20 // with this program; if not, write to the Free Software Foundation, Inc.,
|
|
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
22 //-------------------------------------------------------------------------
|
|
23 //
|
|
24
|
|
25 package com.glavsoft.viewer.swing;
|
|
26
|
|
27 import com.glavsoft.viewer.AbstractConnectionWorkerFactory;
|
|
28 import com.glavsoft.viewer.ConnectionPresenter;
|
|
29 import com.glavsoft.viewer.NetworkConnectionWorker;
|
|
30 import com.glavsoft.viewer.RfbConnectionWorker;
|
|
31
|
|
32 import javax.swing.*;
|
|
33
|
|
34 /**
|
|
35 * @author dime at tightvnc.com
|
|
36 */
|
|
37 public class SwingConnectionWorkerFactory extends AbstractConnectionWorkerFactory {
|
|
38
|
|
39 private JFrame parentWindow;
|
|
40 private String predefinedPassword;
|
|
41 private final ConnectionPresenter presenter;
|
|
42 private final SwingViewerWindowFactory viewerWindowFactory;
|
|
43
|
|
44 public SwingConnectionWorkerFactory(JFrame parentWindow, String predefinedPassword, ConnectionPresenter presenter,
|
|
45 SwingViewerWindowFactory viewerWindowFactory) {
|
|
46 this.parentWindow = parentWindow;
|
|
47 this.predefinedPassword = predefinedPassword;
|
|
48 this.presenter = presenter;
|
|
49 this.viewerWindowFactory = viewerWindowFactory;
|
|
50 }
|
|
51
|
|
52 @Override
|
|
53 public NetworkConnectionWorker createNetworkConnectionWorker() {
|
|
54 return new SwingNetworkConnectionWorker(parentWindow);
|
|
55 }
|
|
56
|
|
57 @Override
|
|
58 public RfbConnectionWorker createRfbConnectionWorker() {
|
|
59 return new SwingRfbConnectionWorker(predefinedPassword, presenter, parentWindow, viewerWindowFactory);
|
|
60 }
|
|
61
|
|
62 @Override
|
|
63 public void setPredefinedPassword(String predefinedPassword) {
|
|
64 this.predefinedPassword = predefinedPassword;
|
|
65 }
|
|
66 }
|