Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 224:ccbc3a951961
fix indent, update mm.
author | oc |
---|---|
date | Sun, 06 Jul 2014 17:50:00 +0900 |
parents | 3189e210a7ed |
children | 5e3594021e79 |
files | doc/TreeVNC_structur.mm src/main/java/com/glavsoft/rfb/encoding/decoder/FramebufferUpdateRectangle.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java |
diffstat | 7 files changed, 508 insertions(+), 481 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/TreeVNC_structur.mm Sun Jul 06 12:46:20 2014 +0900 +++ b/doc/TreeVNC_structur.mm Sun Jul 06 17:50:00 2014 +0900 @@ -20,7 +20,11 @@ </node> </node> <node CREATED="1404609496221" ID="ID_1495750438" MODIFIED="1404609511206" POSITION="right" TEXT="RfbProtocol"> -<node CREATED="1404609511207" ID="ID_1928120169" MODIFIED="1404609522121" TEXT="ProtocolDocumentがどこにあるか"/> +<node CREATED="1404609511207" ID="ID_1928120169" MODIFIED="1404609522121" TEXT="ProtocolDocumentがどこにあるか"> +<node CREATED="1404612415064" ID="ID_438378261" MODIFIED="1404612416234" TEXT="http://www.realvnc.com/docs/rfbproto.pdf"> +<node CREATED="1404612672575" ID="ID_274301008" MODIFIED="1404612672575" TEXT=""/> +</node> +</node> <node CREATED="1404609884205" ID="ID_1045564107" MODIFIED="1404609900064" TEXT="最初のnegosiation"> <node CREATED="1404609904949" ID="ID_1830321484" MODIFIED="1404609908840" TEXT="serverToClient"> <node CREATED="1404609919260" ID="ID_1886898319" MODIFIED="1404609942757" TEXT="updateRectangle"/> @@ -42,8 +46,6 @@ </node> <node CREATED="1404609545373" ID="ID_1492358178" MODIFIED="1404609550897" POSITION="right" TEXT="VNCServerとの接続"> <node CREATED="1404610020310" ID="ID_1766453931" MODIFIED="1404610032250" TEXT="tightVncをそのまま使っている感じ"/> -</node> -<node CREATED="1404609553167" ID="ID_1526694970" MODIFIED="1404609570984" POSITION="right" TEXT="updateRectangleRequest"> <node CREATED="1404609584685" ID="ID_1694446143" MODIFIED="1404609609704" TEXT="swingRfbConnectionWorker"> <node CREATED="1404610033550" ID="ID_1859271611" MODIFIED="1404610040330" TEXT="state パターン"/> <node CREATED="1404610042327" ID="ID_14295510" MODIFIED="1404610051130" TEXT="tightVncのstateに入っている"/> @@ -51,17 +53,19 @@ <node CREATED="1404610062567" ID="ID_1504829803" MODIFIED="1404610069896" TEXT="abstract factory"/> </node> </node> -<node CREATED="1404609615213" ID="ID_840244303" MODIFIED="1404609621352" POSITION="right" TEXT="updateRectangle"/> -<node CREATED="1404609623957" ID="ID_1610108993" MODIFIED="1404609631872" POSITION="right" TEXT="Decoder"/> -<node CREATED="1404609636621" ID="ID_862545743" MODIFIED="1404609660368" POSITION="right" TEXT="ZRLEE encoder"> +<node CREATED="1404609553167" ID="ID_1526694970" MODIFIED="1404609570984" POSITION="right" TEXT="updateRectangleRequest"/> +<node CREATED="1404609615213" ID="ID_840244303" MODIFIED="1404609621352" POSITION="right" TEXT="updateRectangle"> +<node CREATED="1404609623957" ID="ID_1610108993" MODIFIED="1404609631872" TEXT="Decoder"/> +<node CREATED="1404609636621" ID="ID_862545743" MODIFIED="1404609660368" TEXT="ZRLEE encoder"> <node CREATED="1404610143717" ID="ID_1514425073" MODIFIED="1404610150218" TEXT="Zlibを使っている"/> <node CREATED="1404610150589" ID="ID_400751491" MODIFIED="1404610157312" TEXT="inflater, deflater"/> </node> +</node> <node CREATED="1404609648845" ID="ID_62035725" MODIFIED="1404609668264" POSITION="right" TEXT="readSendData"> <node CREATED="1404610130318" ID="ID_1259931650" MODIFIED="1404610136160" TEXT="inputStream"/> <node CREATED="1404610137084" ID="ID_1184744992" MODIFIED="1404610140360" TEXT="reset"/> </node> -<node CREATED="1404609671341" ID="ID_383305925" MODIFIED="1404609676816" POSITION="right" TEXT="Multicastqueue"> +<node CREATED="1404609671341" ID="ID_383305925" MODIFIED="1404636529107" POSITION="right" TEXT="Multicastqueue"> <node CREATED="1404610109829" ID="ID_1022779630" MODIFIED="1404610127377" TEXT="latchを使っている"/> </node> <node CREATED="1404609684261" ID="ID_1838600643" MODIFIED="1404609693560" POSITION="left" TEXT="TreeManagement"> @@ -84,5 +88,28 @@ <node CREATED="1404610267367" ID="ID_1704338982" MODIFIED="1404610304696" TEXT="step in, step over, step return, continueをしていく"/> <node CREATED="1404610307692" ID="ID_1044031413" MODIFIED="1404610318258" TEXT="break pointにはconditionをかけられる"/> </node> +<node CREATED="1404610639853" ID="ID_75634055" MODIFIED="1404610650898" POSITION="left" TEXT="eclipseの環境構築"> +<node CREATED="1404610652959" ID="ID_1253239482" MODIFIED="1404610664873" TEXT="マーケットプレイス"> +<node CREATED="1404610665478" ID="ID_1298336252" MODIFIED="1404610669313" TEXT="mercurial"/> +<node CREATED="1404610669724" ID="ID_1128644521" MODIFIED="1404610671296" TEXT="gradle"/> +<node CREATED="1404610675429" ID="ID_1650458137" MODIFIED="1404610685529" TEXT="両方とも一番上を"/> +</node> +<node CREATED="1404610686989" ID="ID_683490273" MODIFIED="1404610718297" TEXT="emacs binding"> +<node CREATED="1404610693877" ID="ID_1577128446" MODIFIED="1404610754296" TEXT="preferense"> +<node CREATED="1404610755061" ID="ID_1583592249" MODIFIED="1404610759112" TEXT="general"> +<node CREATED="1404610759541" ID="ID_875652502" MODIFIED="1404610762320" TEXT="keys"/> +</node> +</node> +<node CREATED="1404610765429" ID="ID_20274641" MODIFIED="1404610775945" TEXT="schemeをemacsに"/> +</node> +<node CREATED="1404610719110" ID="ID_840657770" MODIFIED="1404610723088" TEXT="tabのsetting"> +<node CREATED="1404610723629" ID="ID_524444691" MODIFIED="1404610730898" TEXT="wikiをみたらいいかも!"/> +<node CREATED="1404610733047" ID="ID_301887783" MODIFIED="1404610744426" TEXT="河野研の"/> +<node CREATED="1404610791127" ID="ID_676285074" MODIFIED="1404610792850" TEXT="http://www.cr.ie.u-ryukyu.ac.jp/~game/pukiwiki/index.php?eclipse"/> +</node> +<node CREATED="1404610883239" ID="ID_1697389983" MODIFIED="1404610898610" TEXT="Todoを使おう"> +<node CREATED="1404610917897" ID="ID_98313720" MODIFIED="1404610926017" TEXT="log"/> +</node> +</node> </node> </map>
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/FramebufferUpdateRectangle.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/FramebufferUpdateRectangle.java Sun Jul 06 17:50:00 2014 +0900 @@ -38,40 +38,40 @@ * and then follows the pixel data in the specified encoding */ public class FramebufferUpdateRectangle { - public int x; - public int y; - public int width; - public int height; + public int x; + public int y; + public int width; + public int height; private EncodingType encodingType; - public FramebufferUpdateRectangle() { - // nop - } + public FramebufferUpdateRectangle() { + // nop + } - public FramebufferUpdateRectangle(int x, int y, int w, int h) { - this.x = x; this.y = y; - width = w; height = h; - } + public FramebufferUpdateRectangle(int x, int y, int w, int h) { + this.x = x; this.y = y; + width = w; height = h; + } - public void fill(Reader reader) throws TransportException { - x = reader.readUInt16(); + public void fill(Reader reader) throws TransportException { + x = reader.readUInt16(); y = reader.readUInt16(); width = reader.readUInt16(); height = reader.readUInt16(); int encoding = reader.readInt32(); - encodingType = EncodingType.byId(encoding); + encodingType = EncodingType.byId(encoding); + } + + public EncodingType getEncodingType() { + return encodingType; } - public EncodingType getEncodingType() { - return encodingType; - } - - @Override - public String toString() { - return "FramebufferUpdateRect: [x: " + x + ", y: " + y + - ", width: " + width + ", height: " + height + - ", encodingType: " + encodingType + - "]"; - } + @Override + public String toString() { + return "FramebufferUpdateRect: [x: " + x + ", y: " + y + + ", width: " + width + ", height: " + height + + ", encodingType: " + encodingType + + "]"; + } }
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Jul 06 17:50:00 2014 +0900 @@ -50,143 +50,143 @@ import jp.ac.u_ryukyu.treevnc.TreeVncProtocol; public class ReceiverTask implements Runnable { - private static final byte FRAMEBUFFER_UPDATE = 0; - private static final byte SET_COLOR_MAP_ENTRIES = 1; - private static final byte BELL = 2; - private static final byte SERVER_CUT_TEXT = 3; - private static final byte Check_Delay = 11; + private static final byte FRAMEBUFFER_UPDATE = 0; + private static final byte SET_COLOR_MAP_ENTRIES = 1; + private static final byte BELL = 2; + private static final byte SERVER_CUT_TEXT = 3; + private static final byte Check_Delay = 11; - private static Logger logger = Logger.getLogger("com.glavsoft.rfb.protocol.ReceiverTask"); - private final Reader reader; - private volatile boolean isRunning = false; - private Renderer renderer; - private final IRepaintController repaintController; - private final ClipboardController clipboardController; - protected final DecodersContainer decoders; - protected FramebufferUpdateRequestMessage fullscreenFbUpdateIncrementalRequest; - protected final ProtocolContext context; - protected PixelFormat pixelFormat; - protected boolean needSendPixelFormat; - private TreeRFBProto rfb; - private long checkCounter = 0; - - public ReceiverTask(Reader reader, + private static Logger logger = Logger.getLogger("com.glavsoft.rfb.protocol.ReceiverTask"); + private final Reader reader; + private volatile boolean isRunning = false; + private Renderer renderer; + private final IRepaintController repaintController; + private final ClipboardController clipboardController; + protected final DecodersContainer decoders; + protected FramebufferUpdateRequestMessage fullscreenFbUpdateIncrementalRequest; + protected final ProtocolContext context; + protected PixelFormat pixelFormat; + protected boolean needSendPixelFormat; + private TreeRFBProto rfb; + private long checkCounter = 0; + + public ReceiverTask(Reader reader, IRepaintController repaintController, ClipboardController clipboardController, DecodersContainer decoders, ProtocolContext context, TreeRFBProto _rfb) { - rfb = _rfb; - this.reader = reader; - this.repaintController = repaintController; - this.clipboardController = clipboardController; - this.context = context; - this.decoders = decoders; + rfb = _rfb; + this.reader = reader; + this.repaintController = repaintController; + this.clipboardController = clipboardController; + this.context = context; + this.decoders = decoders; - Decoder decoder = new ZRLEESender(rfb); - decoders.setDecoderByType(EncodingType.ZLIB, decoder); - decoders.setDecoderByType(EncodingType.ZRLE, decoder); - decoders.setDecoderByType(EncodingType.ZRLEE, decoder); + Decoder decoder = new ZRLEESender(rfb); + decoders.setDecoderByType(EncodingType.ZLIB, decoder); + decoders.setDecoderByType(EncodingType.ZRLE, decoder); + decoders.setDecoderByType(EncodingType.ZRLEE, decoder); + + if(!rfb.getCuiVersion()) + renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); + fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); + if(rfb.isTreeManager()) { + fullscreenFbUpdateIncrementalRequest.sendFullScreenRequest(); + connectionFinished(); + } + } - if(!rfb.getCuiVersion()) - renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); - fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); - if(rfb.isTreeManager()) { - fullscreenFbUpdateIncrementalRequest.sendFullScreenRequest(); - connectionFinished(); - } - } - - @Override - public void run() { - isRunning = true; - while (isRunning) { - try { - if(! rfb.isTreeManager()) { - // client has 8byte packet sequence number - reader.mark(28); - getLost(reader); //check seq consistency - } else { - reader.mark(20); - } - byte messageId = reader.readByte(); - switch (messageId) { - case FRAMEBUFFER_UPDATE: -// logger.fine("Server message: FramebufferUpdate (0)"); - framebufferUpdateMessage(); - break; - case SET_COLOR_MAP_ENTRIES: - logger.severe("Server message SetColorMapEntries is not implemented. Skip."); - setColorMapEntries(); - break; - case BELL: - logger.fine("Server message: Bell"); -// System.out.print("\0007"); -// System.out.flush(); - break; - case SERVER_CUT_TEXT: - logger.fine("Server message: CutText (3)"); - serverCutText(); - break; - case Check_Delay: - ZRLEESender sender = new ZRLEESender(rfb); - sender.readCheckDelay(reader); - /* + @Override + public void run() { + isRunning = true; + while (isRunning) { + try { + if(! rfb.isTreeManager()) { + // client has 8byte packet sequence number + reader.mark(28); + getLost(reader); //check seq consistency + } else { + reader.mark(20); + } + byte messageId = reader.readByte(); + switch (messageId) { + case FRAMEBUFFER_UPDATE: + // logger.fine("Server message: FramebufferUpdate (0)"); + framebufferUpdateMessage(); + break; + case SET_COLOR_MAP_ENTRIES: + logger.severe("Server message SetColorMapEntries is not implemented. Skip."); + setColorMapEntries(); + break; + case BELL: + logger.fine("Server message: Bell"); + // System.out.print("\0007"); + // System.out.flush(); + break; + case SERVER_CUT_TEXT: + logger.fine("Server message: CutText (3)"); + serverCutText(); + break; + case Check_Delay: + ZRLEESender sender = new ZRLEESender(rfb); + sender.readCheckDelay(reader); + /* reader.readBytes(15); System.out.println("delay_time="+(System.currentTimeMillis() - reader.readInt64())); - */ - break; - default: - logger.severe("Unsupported server message. Id = " + messageId); - } - } catch (TransportException e) { + */ + break; + default: + logger.severe("Unsupported server message. Id = " + messageId); + } + } catch (TransportException e) { logger.severe("Close session: " + e.getMessage()); - if(!rfb.isTreeManager() && !(rfb.getTerminationType())) { - System.out.println("task stop"); - TreeVncProtocol echo = new TreeVncProtocol(rfb.getConnectionParam().getHostName(), rfb.getConnectionParam().getPort()); - int counter = 3; - while(counter-- > 0) { - try { - if (rfb.isLeader()) { - echo.lostParent(rfb.getMyAddress(),rfb.getAcceptPort()); - } + if(!rfb.isTreeManager() && !(rfb.getTerminationType())) { + System.out.println("task stop"); + TreeVncProtocol echo = new TreeVncProtocol(rfb.getConnectionParam().getHostName(), rfb.getConnectionParam().getPort()); + int counter = 3; + while(counter-- > 0) { + try { + if (rfb.isLeader()) { + echo.lostParent(rfb.getMyAddress(),rfb.getAcceptPort()); + } break; } catch (Exception e1) { logger.severe("Cannot send lostHost: " + e1.getMessage()); sleep(3000); } - } - } else if (isRunning) { -// logger.severe("Close proxy: "); -// context.cleanUpSession("Connection closed."); - } - stopTask(); - } catch (ProtocolException e) { - logger.severe(e.getMessage()); - if (isRunning) { - context.cleanUpSession(e.getMessage() + "\nConnection closed."); - } - stopTask(); - } catch (CommonException e) { - logger.severe(e.getMessage()); - if (isRunning) { - context.cleanUpSession("Connection closed.."); - } - stopTask(); - } catch (Throwable te) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - te.printStackTrace(pw); - logger.severe(te.getMessage()); - if (isRunning) { - context.cleanUpSession(te.getMessage() + "\n" + sw.toString()); - } - stopTask(); - } - } - } + } + } else if (isRunning) { + // logger.severe("Close proxy: "); + // context.cleanUpSession("Connection closed."); + } + stopTask(); + } catch (ProtocolException e) { + logger.severe(e.getMessage()); + if (isRunning) { + context.cleanUpSession(e.getMessage() + "\nConnection closed."); + } + stopTask(); + } catch (CommonException e) { + logger.severe(e.getMessage()); + if (isRunning) { + context.cleanUpSession("Connection closed.."); + } + stopTask(); + } catch (Throwable te) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + te.printStackTrace(pw); + logger.severe(te.getMessage()); + if (isRunning) { + context.cleanUpSession(te.getMessage() + "\n" + sw.toString()); + } + stopTask(); + } + } + } - private void sleep(int i) { - try { + private void sleep(int i) { + try { Thread.sleep(i); } catch (InterruptedException e) { // nothing. @@ -195,107 +195,107 @@ private void setColorMapEntries() throws TransportException { - reader.readByte(); // padding - reader.readUInt16(); // first color index - int length = reader.readUInt16(); - while (length-- > 0) { - reader.readUInt16(); // R - reader.readUInt16(); // G - reader.readUInt16(); // B - } - } + reader.readByte(); // padding + reader.readUInt16(); // first color index + int length = reader.readUInt16(); + while (length-- > 0) { + reader.readUInt16(); // R + reader.readUInt16(); // G + reader.readUInt16(); // B + } + } - private void serverCutText() throws TransportException { - reader.readByte(); // padding - reader.readInt16(); // padding - int length = reader.readInt32() & Integer.MAX_VALUE; - clipboardController.updateSystemClipboard(reader.readBytes(length)); - } + private void serverCutText() throws TransportException { + reader.readByte(); // padding + reader.readInt16(); // padding + int length = reader.readInt32() & Integer.MAX_VALUE; + clipboardController.updateSystemClipboard(reader.readBytes(length)); + } - public void framebufferUpdateMessage() throws CommonException, UnsupportedEncodingException { - reader.readByte(); // padding - int numberOfRectangles = reader.readUInt16(); - while (numberOfRectangles-- > 0) { - FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(); - rect.fill(reader); + public void framebufferUpdateMessage() throws CommonException, UnsupportedEncodingException { + reader.readByte(); // padding + int numberOfRectangles = reader.readUInt16(); + while (numberOfRectangles-- > 0) { + FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(); + rect.fill(reader); - Decoder decoder = decoders.getDecoderByType(rect.getEncodingType()); - logger.finest(rect.toString() + (0 == numberOfRectangles ? "\n---" : "")); - if (decoder != null) { - decoder.decode(reader, renderer, rect); // TreeVNC processing here - if(!(rfb.getCuiVersion())) - repaintController.repaintBitmap(rect); - } else if (rect.getEncodingType() == EncodingType.RICH_CURSOR) { - RichCursorDecoder.getInstance().decode(reader, renderer, rect); - if(repaintController!=null) - repaintController.repaintCursor(); - } else if (rect.getEncodingType() == EncodingType.CURSOR_POS) { - renderer.decodeCursorPosition(rect); - repaintController.repaintCursor(); - } else if (rect.getEncodingType() == EncodingType.DESKTOP_SIZE || rect.getEncodingType() == EncodingType.INIT_DATA ) { - fullscreenFbUpdateIncrementalRequest = - new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, true); + Decoder decoder = decoders.getDecoderByType(rect.getEncodingType()); + logger.finest(rect.toString() + (0 == numberOfRectangles ? "\n---" : "")); + if (decoder != null) { + decoder.decode(reader, renderer, rect); // TreeVNC processing here + if(!(rfb.getCuiVersion())) + repaintController.repaintBitmap(rect); + } else if (rect.getEncodingType() == EncodingType.RICH_CURSOR) { + RichCursorDecoder.getInstance().decode(reader, renderer, rect); + if(repaintController!=null) + repaintController.repaintCursor(); + } else if (rect.getEncodingType() == EncodingType.CURSOR_POS) { + renderer.decodeCursorPosition(rect); + repaintController.repaintCursor(); + } else if (rect.getEncodingType() == EncodingType.DESKTOP_SIZE || rect.getEncodingType() == EncodingType.INIT_DATA ) { + fullscreenFbUpdateIncrementalRequest = + new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, true); rfb.setCuiVersion(false); boolean visible = true; if (rect.getEncodingType() == EncodingType.INIT_DATA) { - int length = reader.readInt32(); - byte[] initData = new byte[length]; - reader.read(initData); - String name = new String(initData, 24, length - 24, "UTF-8"); - rfb.getContext().setRemoteDesktopName(name); - rfb.getContext().setInitData(initData); - repaintController.updateRemoteDesktopName(rfb.getContext()); - reader.reset(); - rfb.readSendData(length + 20, reader, null ); // size of UpdateRectangleMessage with initData. - short id = (short) rect.x; - visible = (id != rfb.getId()); + int length = reader.readInt32(); + byte[] initData = new byte[length]; + reader.read(initData); + String name = new String(initData, 24, length - 24, "UTF-8"); + rfb.getContext().setRemoteDesktopName(name); + rfb.getContext().setInitData(initData); + repaintController.updateRemoteDesktopName(rfb.getContext()); + reader.reset(); + rfb.readSendData(length + 20, reader, null ); // size of UpdateRectangleMessage with initData. + short id = (short) rect.x; + visible = (id != rfb.getId()); } synchronized (renderer.getLock()) { - if(!(rfb.getCuiVersion())) - renderer = repaintController.createRenderer(reader, rect.width, rect.height,context.getPixelFormat()); + if(!(rfb.getCuiVersion())) + renderer = repaintController.createRenderer(reader, rect.width, rect.height,context.getPixelFormat()); } if (rect.getEncodingType() == EncodingType.INIT_DATA) { - repaintController.setVisible(visible); + repaintController.setVisible(visible); } context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, false)); - // repaintController.repaintCursor(); - } else - throw new CommonException("Unprocessed encoding: " + rect.toString()); - } - if (!rfb.isTreeManager()) return; - synchronized (this) { - if (needSendPixelFormat) { - needSendPixelFormat = false; - context.setPixelFormat(pixelFormat); - context.sendMessage(new SetPixelFormatMessage(pixelFormat)); - logger.fine("sent: "+pixelFormat); - context.sendRefreshMessage(); - logger.fine("sent: nonincremental fb update"); - } else { - context.sendMessage(fullscreenFbUpdateIncrementalRequest); - } - } - } + // repaintController.repaintCursor(); + } else + throw new CommonException("Unprocessed encoding: " + rect.toString()); + } + if (!rfb.isTreeManager()) return; + synchronized (this) { + if (needSendPixelFormat) { + needSendPixelFormat = false; + context.setPixelFormat(pixelFormat); + context.sendMessage(new SetPixelFormatMessage(pixelFormat)); + logger.fine("sent: "+pixelFormat); + context.sendRefreshMessage(); + logger.fine("sent: nonincremental fb update"); + } else { + context.sendMessage(fullscreenFbUpdateIncrementalRequest); + } + } + } - public synchronized void queueUpdatePixelFormat(PixelFormat pf) { - pixelFormat = pf; - needSendPixelFormat = true; -// context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1, 1, false)); - } + public synchronized void queueUpdatePixelFormat(PixelFormat pf) { + pixelFormat = pf; + needSendPixelFormat = true; + // context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1, 1, false)); + } + + public void stopTask() { + isRunning = false; + } - public void stopTask() { - isRunning = false; - } - - private void connectionFinished() { - rfb.vncConnected(true); - } - - private void getLost(Reader reader) throws Exception { - long num = reader.readInt64(); - if(num != ++checkCounter) { - System.out.println("LostData" + (num - checkCounter)); - checkCounter = num; - } - } + private void connectionFinished() { + rfb.vncConnected(true); + } + + private void getLost(Reader reader) throws Exception { + long num = reader.readInt64(); + if(num != ++checkCounter) { + System.out.println("LostData" + (num - checkCounter)); + checkCounter = num; + } + } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sun Jul 06 17:50:00 2014 +0900 @@ -64,8 +64,8 @@ private NetworkConnectionWorker networkConnectionWorker; private boolean needReconnection = true; private boolean isTreeVNC = false; - private boolean cuiVersion; - private boolean noConnection = false; + private boolean cuiVersion; + private boolean noConnection = false; public ConnectionPresenter(boolean hasSshSupport, boolean allowInteractive) { this.hasSshSupport = hasSshSupport; @@ -80,24 +80,24 @@ if ( ! isModelRegisteredByName(CONNECTION_PARAMS_MODEL)) { throw new IllegalStateException("No Connection Params model added."); } - + if(!isTreeVNC) { - connectionsHistory = new ConnectionsHistory(); - addModel(CONNECTIONS_HISTORY_MODEL, connectionsHistory); - syncModels(paramSettingsMask); + connectionsHistory = new ConnectionsHistory(); + addModel(CONNECTIONS_HISTORY_MODEL, connectionsHistory); + syncModels(paramSettingsMask); } if (allowInteractive) { show(); populate(); } else { - if (!noConnection) - connect(); + if (!noConnection) + connect(); } } - + public void setNoConnection(boolean c){ - noConnection = c; - needReconnection = false; + noConnection = c; + needReconnection = false; } public void setUseSsh(boolean useSsh) { @@ -134,9 +134,9 @@ private void connect() { final ConnectionParams connectionParams = (ConnectionParams) getModel(CONNECTION_PARAMS_MODEL); if(!cuiVersion) - networkConnectionWorker = connectionWorkerFactory.createNetworkConnectionWorker(); + networkConnectionWorker = connectionWorkerFactory.createNetworkConnectionWorker(); else - networkConnectionWorker = new SwingNetworkConnectionWorker(null); + networkConnectionWorker = new SwingNetworkConnectionWorker(null); networkConnectionWorker.setConnectionParams(connectionParams); networkConnectionWorker.setPresenter(this); networkConnectionWorker.setHasSshSupport(hasSshSupport); @@ -209,7 +209,7 @@ } private void setSshOptions() { - if (hasSshSupport) { + if (hasSshSupport) { try { final boolean useSsh = (Boolean)getViewProperty(PROPERTY_USE_SSH); setModelProperty(PROPERTY_USE_SSH, useSsh, boolean.class); @@ -221,7 +221,7 @@ setModelProperty(PROPERTY_SSH_PORT_NUMBER, getViewPropertyOrNull(PROPERTY_SSH_PORT_NUMBER)); setViewProperty(PROPERTY_SSH_PORT_NUMBER, getModelProperty(PROPERTY_SSH_PORT_NUMBER)); } - } + } private void syncModels(int paramSettingsMask) { final ConnectionParams cp = (ConnectionParams) getModel(CONNECTION_PARAMS_MODEL); @@ -233,8 +233,8 @@ connectionsHistory.reorder(cp, rfbSettings, uiSettings); } -// protocolSettings.addListener(connectionsHistory); -// uiSettings.addListener(connectionsHistory); + // protocolSettings.addListener(connectionsHistory); + // uiSettings.addListener(connectionsHistory); } public void populateFromHistoryItem(ConnectionParams connectionParams) { @@ -303,23 +303,23 @@ public boolean allowInteractive() { return allowInteractive; } - + public void setIsTreeVNC(boolean flag) { - isTreeVNC = flag; + isTreeVNC = flag; + } + + public void setCuiVersion(boolean b) { + cuiVersion = b; } - public void setCuiVersion(boolean b) { - cuiVersion = b; - } + public SwingViewerWindow getViewer() { + if (rfbConnectionWorker != null) { + return rfbConnectionWorker.getViewer(); + } + return null; + } - public SwingViewerWindow getViewer() { - if (rfbConnectionWorker != null) { - return rfbConnectionWorker.getViewer(); - } - return null; - } - - public Socket getSocket() { - return rfbConnectionWorker.getSocket(); - } + public Socket getSocket() { + return rfbConnectionWorker.getSocket(); + } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jul 06 17:50:00 2014 +0900 @@ -52,7 +52,7 @@ @SuppressWarnings("serial") public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface { - private Logger logger; + private Logger logger; private int paramsMask; private boolean allowAppletInteractiveConnections; @@ -66,52 +66,52 @@ private ConnectionPresenter connectionPresenter; boolean isTreeVNC = false; protected TreeRFBProto myRfb; - private boolean noConnection; + private boolean noConnection; public int vncport = ConnectionParams.DEFAULT_RFB_PORT; private int fbWidth; - private boolean showTree = false; + private boolean showTree = false; public static void main(String[] args) { - Parser parser = new Parser(); - ParametersHandler.completeParserOptions(parser); + Parser parser = new Parser(); + ParametersHandler.completeParserOptions(parser); - parser.parse(args); - if (parser.isSet(ParametersHandler.ARG_HELP)) { - printUsage(parser.optionsUsage()); - System.exit(0); - } - Viewer viewer = new Viewer(parser); - SwingUtilities.invokeLater(viewer); - } + parser.parse(args); + if (parser.isSet(ParametersHandler.ARG_HELP)) { + printUsage(parser.optionsUsage()); + System.exit(0); + } + Viewer viewer = new Viewer(parser); + SwingUtilities.invokeLater(viewer); + } public static void printUsage(String additional) { - System.out.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]¥n" + - " or¥n"+ - " java -jar (progfilename) [Options]¥n" + - " or¥n java -jar (progfilename) -help¥n to view this help¥n¥n" + - "Where Options are:¥n" + additional + - "¥nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes¥n" + - "Both option name and option value are case insensitive."); - } + System.out.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]¥n" + + " or¥n"+ + " java -jar (progfilename) [Options]¥n" + + " or¥n java -jar (progfilename) -help¥n to view this help¥n¥n" + + "Where Options are:¥n" + additional + + "¥nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes¥n" + + "Both option name and option value are case insensitive."); + } - public Viewer() { + public Viewer() { logger = Logger.getLogger(getClass().getName()); - connectionParams = new ConnectionParams(); - settings = ProtocolSettings.getDefaultSettings(); - uiSettings = new UiSettings(); - } + connectionParams = new ConnectionParams(); + settings = ProtocolSettings.getDefaultSettings(); + uiSettings = new UiSettings(); + } - private Viewer(Parser parser) { - this(); + private Viewer(Parser parser) { + this(); setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE : - parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER : - Level.INFO); + parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER : + Level.INFO); paramsMask = ParametersHandler.completeSettingsFromCLI(parser, connectionParams, settings, uiSettings); - passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD); - logger.info("TightVNC Viewer version " + ver()); - isApplet = false; - } + passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD); + logger.info("TightVNC Viewer version " + ver()); + isApplet = false; + } private void setLoggingLevel(Level levelToSet) { final Logger appLogger = Logger.getLogger("com.glavsoft"); @@ -127,26 +127,26 @@ ch = new ConsoleHandler(); appLogger.addHandler(ch); } -// ch.setFormatter(new SimpleFormatter()); + // ch.setFormatter(new SimpleFormatter()); ch.setLevel(levelToSet); } @Override - public void windowClosing(WindowEvent e) { - if (e != null && e.getComponent() != null) { + public void windowClosing(WindowEvent e) { + if (e != null && e.getComponent() != null) { final Window w = e.getWindow(); if (w != null) { w.setVisible(false); w.dispose(); } - } - closeApp(); - } + } + closeApp(); + } - /** - * Closes App(lication) or stops App(let). - */ + /** + * Closes App(lication) or stops App(let). + */ public void closeApp() { if (connectionPresenter != null) { connectionPresenter.cancelConnection(); @@ -159,36 +159,36 @@ repaint(); stop(); } - } else { - System.exit(0); - } - } + } else { + System.exit(0); + } + } - @Override - public void paint(Graphics g) { - if ( ! isAppletStopped) { - super.paint(g); - } else { - getContentPane().removeAll(); - g.clearRect(0, 0, getWidth(), getHeight()); - g.drawString("Disconnected", 10, 20); - } - } + @Override + public void paint(Graphics g) { + if ( ! isAppletStopped) { + super.paint(g); + } else { + getContentPane().removeAll(); + g.clearRect(0, 0, getWidth(), getHeight()); + g.drawString("Disconnected", 10, 20); + } + } - @Override - public void destroy() { - closeApp(); - super.destroy(); - } + @Override + public void destroy() { + closeApp(); + super.destroy(); + } - @Override - public void init() { - paramsMask = ParametersHandler.completeSettingsFromApplet(this, connectionParams, settings, uiSettings); - isSeparateFrame = ParametersHandler.isSeparateFrame; - passwordFromParams = getParameter(ParametersHandler.ARG_PASSWORD); - isApplet = true; + @Override + public void init() { + paramsMask = ParametersHandler.completeSettingsFromApplet(this, connectionParams, settings, uiSettings); + isSeparateFrame = ParametersHandler.isSeparateFrame; + passwordFromParams = getParameter(ParametersHandler.ARG_PASSWORD); + isApplet = true; allowAppletInteractiveConnections = ParametersHandler.allowAppletInteractiveConnections; - repaint(); + repaint(); try { SwingUtilities.invokeAndWait(this); @@ -197,10 +197,10 @@ } } - @Override - public void start() { - super.start(); - } + @Override + public void start() { + super.start(); + } private boolean checkJsch() { try { @@ -210,19 +210,19 @@ return false; } } - + public void setNoConnection(boolean c){ - noConnection = c; + noConnection = c; } - + @Override - public void run() { + public void run() { final boolean hasJsch = checkJsch(); final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet; connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); connectionPresenter.setNoConnection(noConnection); connectionPresenter.addModel("ConnectionParamsModel", connectionParams); - final ConnectionView connectionView = new ConnectionView( + ConnectionView connectionView = new ConnectionView( Viewer.this, // appWindowListener connectionPresenter, hasJsch); connectionPresenter.addView(ConnectionPresenter.CONNECTION_VIEW, connectionView); @@ -234,84 +234,84 @@ public void closeView() { /*nop*/ } }); } - + SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(isSeparateFrame, isApplet, this); - + connectionPresenter.setConnectionWorkerFactory( new SwingConnectionWorkerFactory(connectionView.getFrame(), passwordFromParams, connectionPresenter, viewerWindowFactory, myRfb)); connectionPresenter.setNeedReconnection(!noConnection); connectionPresenter.startConnection(settings, uiSettings, paramsMask); - } + } - @Override - public void windowOpened(WindowEvent e) { /* nop */ } - @Override - public void windowClosed(WindowEvent e) { /* nop */ } - @Override - public void windowIconified(WindowEvent e) { /* nop */ } - @Override - public void windowDeiconified(WindowEvent e) { /* nop */ } - @Override - public void windowActivated(WindowEvent e) { /* nop */ } - @Override - public void windowDeactivated(WindowEvent e) { /* nop */ } + @Override + public void windowOpened(WindowEvent e) { /* nop */ } + @Override + public void windowClosed(WindowEvent e) { /* nop */ } + @Override + public void windowIconified(WindowEvent e) { /* nop */ } + @Override + public void windowDeiconified(WindowEvent e) { /* nop */ } + @Override + public void windowActivated(WindowEvent e) { /* nop */ } + @Override + public void windowDeactivated(WindowEvent e) { /* nop */ } - public static String ver() { - final InputStream mfStream = Viewer.class.getClassLoader().getResourceAsStream( - "META-INF/MANIFEST.MF"); - if (null == mfStream) { - System.out.println("No Manifest file found."); - return "-1"; - } - try { - Manifest mf = new Manifest(); - mf.read(mfStream); - Attributes atts = mf.getMainAttributes(); - return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION); - } catch (IOException e) { - return "-2"; - } - } + public static String ver() { + final InputStream mfStream = Viewer.class.getClassLoader().getResourceAsStream( + "META-INF/MANIFEST.MF"); + if (null == mfStream) { + System.out.println("No Manifest file found."); + return "-1"; + } + try { + Manifest mf = new Manifest(); + mf.read(mfStream); + Attributes atts = mf.getMainAttributes(); + return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION); + } catch (IOException e) { + return "-2"; + } + } - public void setSocket(Socket soc) { - connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); - } + public void setSocket(Socket soc) { + connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); + } - public void setOpenPort(int parseInt) { - } + public void setOpenPort(int parseInt) { + } - public void setTeminationType(boolean b) { - myRfb.setTerminationType(b); - } - - /** - * start TreeVNC viewer - */ - public void startTreeViewer(String hostName,boolean cui) { - TreeRFBProto rfb = new TreeRFBProto(false); - rfb.setCuiVersion(cui); - rfb.setHasViewer(true); + public void setTeminationType(boolean b) { + myRfb.setTerminationType(b); + } + + /** + * start TreeVNC viewer + */ + public void startTreeViewer(String hostName,boolean cui) { + TreeRFBProto rfb = new TreeRFBProto(false); + rfb.setCuiVersion(cui); + rfb.setHasViewer(true); rfb.setViewer(this); rfb.createConnectionAndStart(this); - CreateConnectionParam cp = new CreateConnectionParam(rfb); - if (hostName!=null) { - cp.setHostName(hostName); - } else { - try { - cp.findTreeVncRoot(); - } catch (InterruptedException e) { - System.out.println("cannot find TreeVNC Root "+e.getMessage()); - return; - } - } - cp.sendWhereToConnect(this); - isTreeVNC = true; - myRfb = rfb; + CreateConnectionParam cp = new CreateConnectionParam(rfb); + if (hostName!=null) { + cp.setHostName(hostName); + } else { + try { + cp.findTreeVncRoot(); + } catch (InterruptedException e) { + System.out.println("cannot find TreeVNC Root "+e.getMessage()); + return; + } + } + cp.sendWhereToConnect(this); + isTreeVNC = true; + myRfb = rfb; settings.setViewOnly(true); // too avoid unnecessary upward traffic rfb.getAcceptThread().waitForShutdown(); - } - + } + /** * Start client with new parent (including reconnection) @@ -319,29 +319,29 @@ * @param hostname * @throws IOException */ - @Override + @Override public void connectToParenet(int port, String hostname) throws IOException { setTeminationType(false); closeApp(); connectionParams.setConnectionParam(hostname, port); run(); } - - public void setIsTreeVNC(boolean flag) { - isTreeVNC = flag; - } - - public TreeRFBProto getRfb() { - return myRfb; - } + + public void setIsTreeVNC(boolean flag) { + isTreeVNC = flag; + } - public boolean getCuiVersion() { - return myRfb.getCuiVersion(); - } - public void setCuiVersion(boolean flag) { - myRfb.setCuiVersion(flag); - } - + public TreeRFBProto getRfb() { + return myRfb; + } + + public boolean getCuiVersion() { + return myRfb.getCuiVersion(); + } + public void setCuiVersion(boolean flag) { + myRfb.setCuiVersion(flag); + } + /** * start new VNC server receiver with * inherited clients @@ -355,14 +355,14 @@ isApplet = true; this.setNoConnection(false); if (myRfb.isTreeManager()) { - setVisible(false); + setVisible(false); } run(); } public void proxyStart(String[] argv, int width, int height, boolean showTree) { - fbWidth = width; - this.showTree = showTree; + fbWidth = width; + this.showTree = showTree; // input into arguments Decision Parser parser = new Parser(); ParametersHandler.completeParserOptions(parser); @@ -396,18 +396,18 @@ myRfbProto.setReconnecting(true); run(); } - + @Override public void setVisible(boolean b) { - SwingViewerWindow v = connectionPresenter.getViewer(); - if (v != null) - v.setVisible(b); + SwingViewerWindow v = connectionPresenter.getViewer(); + if (v != null) + v.setVisible(b); } - @Override - public Socket getVNCSocket() { - return connectionPresenter.getSocket(); - } + @Override + public Socket getVNCSocket() { + return connectionPresenter.getSocket(); + } @Override public boolean getShowTree() {
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sun Jul 06 17:50:00 2014 +0900 @@ -48,8 +48,8 @@ import jp.ac.u_ryukyu.treevnc.TreeRFBProto; /** -* @author dime at tightvnc.com -*/ + * @author dime at tightvnc.com + */ public class SwingRfbConnectionWorker extends SwingWorker<Void, String> implements RfbConnectionWorker, IRfbSessionListener { private String predefinedPassword; @@ -82,12 +82,12 @@ workingProtocol.handshake(); myRfb.setProtocolContext(workingProtocol); -// tryAgain = false; + // tryAgain = false; return null; } public SwingRfbConnectionWorker(String predefinedPassword, ConnectionPresenter presenter, JFrame parentWindow, - SwingViewerWindowFactory viewerWindowFactory, TreeRFBProto myRfb) { + SwingViewerWindowFactory viewerWindowFactory, TreeRFBProto myRfb) { this.predefinedPassword = predefinedPassword; this.presenter = presenter; this.parentWindow = parentWindow; @@ -110,22 +110,22 @@ presenter.showMessage("Handshake established"); ClipboardControllerImpl clipboardController; if(!myRfb.getCuiVersion()) - clipboardController = new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName()); + clipboardController = new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName()); else - clipboardController = new ClipboardControllerImpl(workingProtocol, "cui"); + clipboardController = new ClipboardControllerImpl(workingProtocol, "cui"); clipboardController.setEnabled(rfbSettings.isAllowClipboardTransfer()); rfbSettings.addListener(clipboardController); if(!myRfb.getCuiVersion()) - viewerWindow = viewerWindowFactory.createViewerWindow(workingProtocol, rfbSettings, uiSettings, connectionString, presenter); + viewerWindow = viewerWindowFactory.createViewerWindow(workingProtocol, rfbSettings, uiSettings, connectionString, presenter); myRfb.setProtocolContext(workingProtocol); workingProtocol.startNormalHandling(this,viewerWindow.getSurface(), clipboardController, myRfb); presenter.showMessage("Started"); - + // hide VNC server's view to prevent video feed back. if (myRfb.hasViewer() && myRfb.getReconnectingId() != 0) viewerWindow.setVisible(true); if(!myRfb.getCuiVersion()) - presenter.successfulRfbConnection(); + presenter.successfulRfbConnection(); } catch (CancellationException e) { logger.info("Cancelled"); presenter.showMessage("Cancelled"); @@ -153,11 +153,11 @@ logger.severe(errorMessage); presenter.clearPredefinedPassword(); } catch (TransportException e) { -// if ( ! isAppletStopped) { + // if ( ! isAppletStopped) { errorTitle = "Connection Error"; errorMessage = "Connection Error: " + e.getMessage(); logger.severe(errorMessage); -// } + // } } catch (IOException e) { errorTitle = "Connection Error"; errorMessage = "Connection Error: " + e.getMessage(); @@ -178,12 +178,12 @@ } @Override - public void rfbSessionStopped(final String reason) { + public void rfbSessionStopped(final String reason) { if (workingProtocol != null) { - workingProtocol.cleanUpSession(); - } - if (isStoppingProcess) return; - cleanUpUISessionAndConnection(); + workingProtocol.cleanUpSession(); + } + if (isStoppingProcess) return; + cleanUpUISessionAndConnection(); logger.info("Rfb session stopped: " + reason); if (presenter.needReconnection()) { SwingUtilities.invokeLater(new Runnable() { @@ -194,7 +194,7 @@ } }); } - } + } @Override public boolean cancel() { @@ -207,17 +207,17 @@ } private synchronized void cleanUpUISessionAndConnection() { - isStoppingProcess = true; - if (workingSocket != null && workingSocket.isConnected()) { - try { - workingSocket.close(); - } catch (IOException e) { /*nop*/ } - } - if (viewerWindow != null) { + isStoppingProcess = true; + if (workingSocket != null && workingSocket.isConnected()) { + try { + workingSocket.close(); + } catch (IOException e) { /*nop*/ } + } + if (viewerWindow != null) { viewerWindow.close(); - } - isStoppingProcess = false; - } + } + isStoppingProcess = false; + } @Override public void setWorkingSocket(Socket workingSocket) { @@ -258,7 +258,7 @@ public String getPassword() { return Strings.isTrimmedEmpty(predefinedPassword) ? getPasswordFromGUI() : - predefinedPassword; + predefinedPassword; } private String getPasswordFromGUI() { @@ -283,13 +283,13 @@ } } - @Override - public SwingViewerWindow getViewer() { - return viewerWindow; - } + @Override + public SwingViewerWindow getViewer() { + return viewerWindow; + } - @Override - public Socket getSocket() { - return workingSocket; - } + @Override + public Socket getSocket() { + return workingSocket; + } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Sun Jul 06 12:46:20 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Sun Jul 06 17:50:00 2014 +0900 @@ -11,9 +11,9 @@ */ public class SwingViewerWindowFactory { - private final boolean isSeparateFrame; - private final boolean isApplet; - private final ViewerInterface viewer; + private boolean isSeparateFrame; + private boolean isApplet; + private ViewerInterface viewer; public SwingViewerWindowFactory(boolean isSeparateFrame, boolean isApplet, ViewerInterface viewer) { this.isSeparateFrame = isSeparateFrame;