Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/mitre/cvw/CVWWhiteboard.java


1   /*
2    * Copyright (c) 1996-2000. The MITRE Corporation (http://www.mitre.org/).
3    * All rights reserved.
4    * CVW comes with ABSOLUTELY NO WARRANTY. See license for details.
5    */
6   
7   package org.mitre.cvw;
8   
9   import java.util.*;
10  import java.net.*;
11  import java.io.File;
12  
13  import org.mitre.cvw.docserv.DocServException;
14   
15  /**
16   * CLASS DESCRIPTION
17   * @version  1.0
18   * @author Rich Taylor
19   */
20  public class CVWWhiteboard extends CVWObject {
21  
22    String docId = null;
23    String path = null;
24    transient WBThreadReader wbThreadReader = null;
25    transient WBThreadWriter wbThreadWriter = null;
26    static boolean clientServerProtocolSync = true;
27    static Float currentClientServerStartVersion = new Float(1.0);
28    static Float currentClientServerEndVersion   = new Float(1.0);
29    static Float currentClientWBVersion          = new Float(1.1);
30  
31  /**
32   *  Constructor
33   */
34    CVWWhiteboard() {
35      super(CVWObject.WHITEBOARD);
36    }
37  
38  /**
39   *  Constructor
40   *
41   * @param type
42   * @param docId
43   * @param path
44   */
45    CVWWhiteboard(int type, String docId, String path) {
46      super(type);
47      this.docId = docId;
48      this.path = path;
49      if (this.docId != null && !this.docId.equals("none") && Integer.parseInt(this.docId) != 0)
50        this.path = getPathFromID(docId);
51    }
52  
53  /**
54   *  Constructor
55   *
56   * @param docId
57   * @param path
58   */
59    CVWWhiteboard(String docId, String path) {
60      super(CVWObject.WHITEBOARD);
61      this.docId = docId;
62      this.path = path;
63      if (this.docId != null && !this.docId.equals("none") && Integer.parseInt(this.docId) != 0)
64        this.path = getPathFromID(docId);
65    }
66  
67    public String getDocID() {
68         return docId;
69      }
70  
71    // perm will be either 0 or 1 ... 0 is not editable
72  /**
73   * FUNCTION DESCRIPTION
74   * @param docServer The document server where the image resides
75   * @param path
76   * @param docId
77   * @param perms
78   */
79    public void open(String docServer, String path, String docId, String perms) {
80  
81      // only supported on Windows(95/NT)
82      //String os = System.getProperty("os.name");
83      //if (!os.startsWith("Windows")) {
84      //  errorMsg("Unable to open whiteboard on this platform.  Currently, only Win95/NT supported ");
85      //  return;
86      //} 
87  
88      if (!clientServerProtocolSync) {
89        errorMsg("Unable to open whiteboard. JCVW Client/MOO Server protocol out of sync.");
90        return; 
91      }
92  
93  
94      this.docId = docId;
95      this.path = path;
96      if (this.docId != null && !this.docId.equals("none") && Integer.parseInt(this.docId) != 0) {
97    // new changes for secure server!!!
98    // since tcl whiteboard won't be able to connect to secure docserver, let's 
99    // download the file to the cache dir, then pass along a filename
100   // that starts with "file:"
101 
102   String filepath = NPDocServer.getInstance().getUserCheckoutDir() + System.getProperty("file.separator")
103       + "mwb" + docId;
104   // now download the document. use Export!
105   DSIParms outdsip, indsip = new DSIParms();
106   indsip.path = filepath;
107   try {
108       indsip.docID = Integer.valueOf(docId);
109       DSIController dsi;
110       if (docServer != null) {
111     dsi = DocumentServerList.getDocumentServerList().getDocServer(docServer);
112       } else {
113     dsi = DocumentServerList.getDocumentServerList().getLocalDocServer();
114       }
115             if (dsi != null) {
116     outdsip = dsi.startDSSyncOp(ObjectValues.DOCEXPORT, indsip);
117     if (outdsip.exc != null)
118         throw outdsip.exc;
119       } else {
120     displayError("This whiteboard could not be opened because the backdrop image is located on the Document Server which is currently not available.", "Error");
121     return;
122       }
123   } 
124   catch (NumberFormatException nfe) {
125       CVWCoordinator.getInstance().displayError("Illegal document ID");
126       return;
127   }
128   catch (NoSuchElementException nsee) {
129       CVWCoordinator.getInstance().displayError("Bad document server");
130       return;
131   }
132   catch (DocInUseException diue) {
133       CVWCoordinator.getInstance().displayError("Document server in use");
134       return;
135   }
136   catch (DocServException dse) {
137       CVWCoordinator.getInstance().displayError("Error retrieving image for whiteboard from the Document server");
138       return;
139   }
140 
141   // we should have the wb now. just update the file path.
142   // do this for windows...
143   String wfilepath = filepath.replace('\\', '/');
144   this.path = "file:" + wfilepath;
145   //  this.path = getPathFromID(this.docId);
146     }
147 
148     /* We need to check if window/wb is currently open, if so return, otherwise
149        open the window and register it with the window manager
150     */
151 
152     WindowMgr winMgr = WindowMgr.getWindowMgr();
153     if (winMgr.whiteboardWindowExists(this))
154       return;
155 
156     // Check to ensure directory exists
157     String wbRoot = NPDocServer.getSystemDir();
158     String sep = System.getProperty("file.separator");
159     String wbPath = new String(wbRoot + sep + "modules" + sep + "mwb");
160     File wbDir = new File(wbPath);
161 
162     if (!wbDir.isDirectory()) {
163       errorMsg("Whiteboard directory: " + wbPath 
164                 + " not found.  Unable to start whiteboard");
165       return;
166     }
167 
168     winMgr.addWBWindow(this);
169 
170     // Need WB owner, objId, localHost, port, name
171     String[] cmd; 
172     cmd = getStartCmd();
173     new WBProc(this, cmd).start();  
174   }
175 
176 /* 10/29/98 dage - change so that mwb.proxySet is not the indicator of
177  *    using proxy port but just the existance of mwb.proxyHost and mwb.proxyPort
178  */
179 /**
180  * FUNCTION DESCRIPTION
181  * @return 
182  */
183   public String[] getStartCmd() {
184     String[] cmd = new String[4];
185     //String mwb_proxySet = "false";
186     String proxyHost = System.getProperty("cvw.mwb.proxyHost", "none");;
187     String proxyPort = System.getProperty("cvw.mwb.proxyPort", "none");
188     int port;
189 
190     String os = System.getProperty("os.name");
191     //mwb_proxySet = System.getProperty("cvw.mwb.proxySet", "false");
192     //if (mwb_proxySet.equals("true")) {
193       //proxyHost = System.getProperty("proxyHost", "none");
194       //proxyPort = System.getProperty("proxyPort", "none");
195     //}
196     
197 
198     String wbRoot = NPDocServer.getSystemDir();
199     String sep = System.getProperty("file.separator");
200     String wbPath = new String(wbRoot + sep + "modules" + sep + "mwb" 
201                 + sep + "bin"); 
202     String wbPath2 = wbPath.replace('\\', '/');
203     String wbInterp = new String(wbRoot + sep + "modules" + sep + "mwb" 
204                                + sep + "bin" + sep + "wish80.exe");
205     String wbFile = new String(wbRoot + sep + "modules" + sep + "mwb" 
206                                + sep + "bin" + sep + "mwb.mwb");
207 
208     WBMgr wbMgr = WBMgr.getWBMgr();
209     port = wbMgr.getPort();
210 
211     cmd[0] = new String(wbInterp);
212     cmd[1] = new String(wbFile);
213     cmd[2] = new String(wbPath2 );
214     cmd[3] = new String("JAVA_CLIENT" + " " +
215                         jcvw.currentUser.objNum.strValue() + " " +
216                         new Integer(objNum.intValue()).toString() + " " +
217                         jcvw.getParameter("wbLocalHost") + " " +
218                         new Integer(port).toString() + " " +
219                         currentClientWBVersion.toString() + " " +
220                         proxyHost + " " + proxyPort + " " + name);
221 
222     return cmd;
223   }
224 
225 
226 /**
227  * FUNCTION DESCRIPTION
228  * @param userId
229  * @param userName
230  */
231   public void addListener(String userId, String userName) {
232     String cmd = new String("WB_ADD_LISTENER " + userId + " " + userName); 
233     sendMsg(cmd);
234   }
235 
236 
237 /**
238  * FUNCTION DESCRIPTION
239  * @param userId
240  * @param userName
241  */
242   public void rmListener(String userId, String userName) {
243     String cmd = new String("WB_RM_LISTENER " + userId + " " + userName); 
244     sendMsg(cmd);
245   }
246 
247 
248   public void add(String id, String ownerId, String ownerName, String perm, 
249                                  String type, String color, String linelist) {
250     String cmd = new String("WB_ADD " + id + " " + ownerId + " " + ownerName +
251                             " " + perm + " " + type + " " + color + " " +
252                             linelist);
253     sendMsg(cmd); 
254   }
255 
256 
257   public void revert(String id, String ownerId, String ownerName, String perm, 
258                    String oldId, String type, String color, String linelist) {
259     String cmd = new String("WB_REVERT " + id + " " + ownerId + " " + 
260                             ownerName + " " + perm + " " + oldId + " " + 
261                             type + " " + color + " " + linelist);
262     sendMsg(cmd); 
263   }
264 
265 
266 /**
267  * FUNCTION DESCRIPTION
268  * @param id
269  * @param error
270  */
271   public void remove(String id, String error) {
272     String status;
273 
274     if (error.equals("none"))
275       status = "0";
276     else
277       status = "1";
278       
279 
280     String cmd = new String("WB_REMOVE " + id + " " + status);
281     sendMsg(cmd); 
282   }
283 
284 
285 /**
286  * FUNCTION DESCRIPTION
287  * @param diag
288  * @param perms
289  * @return 
290  */
291   public ObjectPanel getObjectPanel(FolderDialog diag, String perms) {
292      return new WhiteboardObjectPanel(this, diag, perms);
293   }
294 
295 /* 7/22/98 dage - used when creating an object
296  */
297 /**
298  * FUNCTION DESCRIPTION
299  * @param diag
300  * @return 
301  */
302   public ObjectPanel getObjectPanel(FolderDialog diag) {
303      return new WhiteboardObjectPanel(this, diag);
304    }
305 
306 /**
307  * FUNCTION DESCRIPTION
308  * @param desc
309  * @param perms
310  * @param owners
311  * @param path
312  */
313   public void getInfo(String desc, String perms, String owners, String path) {
314       
315     this.path = path;
316 
317     if (typeValue == WHITEBOARD_SC) {
318       perms = "0";       // not editable regardless of what is sent in
319     }
320     super.getInfo(desc, perms, owners);
321   }
322 
323 
324 /**
325  * FUNCTION DESCRIPTION
326  * @param name
327  * @param sessile
328  * @param desc
329  * @param path
330  * @return 
331  */
332   public Integer createDocBackground(String name, boolean sessile, String desc, String path) {
333     DSIParms outdsip;
334     DSIParms indsip = new DSIParms();
335 
336     DSIController dsi = DocumentServerList.getDocumentServerList().getLocalDocServer(); 
337     if (dsi == null) return null;
338 
339     indsip.name = name;
340     indsip.mimeType = "unknown/unknown";  // overridden if there is a file 
341                                           // extension
342     indsip.desc = desc;
343     indsip.path = path;
344     indsip.sessile = sessile;
345 
346     try {
347       outdsip = dsi.startDSSyncOp(ObjectValues.DOCCREATEBACKGROUND,indsip);
348       if (outdsip.exc != null) 
349         throw outdsip.exc;
350       Integer docID = outdsip.integerResult;
351       return(docID);
352     } catch (DocInUseException e) {
353       CVWCoordinator.getInstance().displayDocServInUseError();
354       return(new Integer(0));
355     } catch (DocServException d) {
356       System.err.println(d.toString());
357       return(new Integer(0));
358     }
359   }
360 
361 
362   public void objectCreate(String name, boolean sessile, 
363                                                     String desc, String path) {
364 
365     String cmd = getObjectCreateMCP(name, sessile, desc);
366 
367     // Is it a URL or a File to be stored on the DocServer
368       if (path.length() == 0) {
369         // no background
370         cmd = cmd + " path: " + prepTextForServer("");
371       } else {
372 
373       if (path.startsWith("http") && (path.indexOf("://") > 0)) {
374   String docServerPrefix = getDocServerPrefix();
375           if (CVWCoordinator.DEBUG) System.err.println("CVWWb::docServerPrefix(): " + docServerPrefix);
376 
377         // maybe new WB with a copied image as background
378         if (path.indexOf(docServerPrefix) == 0) {
379           if (CVWCoordinator.DEBUG) System.err.println("CVWWb::objectCreate() path: " + path);
380  
381             // new WB with a copied image as background confirmed
382             String newDocIdStr = path.substring(docServerPrefix.length(), 
383                                              path.length()); 
384             Integer newDocId = new Integer(newDocIdStr);
385             cmd = cmd + " docId: " + newDocId;
386           }
387         // background is URL
388         cmd = cmd + " path: " + prepTextForServer(path);
389         //cmd = cmd + " description: " + prepTextForServer(desc) +
390               //" path: " + prepTextForServer(path);
391       } else {
392         // background is file... need to save on DocServer
393         Integer newDocId = createDocBackground(name, sessile, desc, path);
394         if (newDocId.intValue() == 0)
395           return;
396 
397    String newPath = getPathFromID(newDocId.intValue());
398         cmd = cmd + " path: " + prepTextForServer(newPath) +
399               " docId: " + newDocId;
400       }
401     } 
402     objectCreate(cmd);
403   }
404 
405 /**
406  * Updates the path of the document on the doc server given the doc id.
407  * @param the document id as a String
408  */
409   public void updatePath(String id) {
410      path = getDocServerPrefix() + id;
411     }
412 
413 /**
414  * Returns the path of the document on the doc server given the doc id.
415  * @param the document id as a String
416  */
417   public String getPathFromID(String id) {
418      return (getDocServerPrefix() + id);
419     }
420 
421 /**
422  * Returns the path of the document on the doc server given the doc id.
423  * @param the document id as a int
424  */
425   public String getPathFromID(int id) {
426      return (getDocServerPrefix() + id);
427     }
428 
429 /**
430  * Returns the doc server prefix path of a document on the doc server.
431  */
432   public String getDocServerPrefix() {
433         return "http://" + CVWCoordinator.getInstance().DSserver 
434                                   + ":" + CVWCoordinator.getInstance().DSport + 
435                                   CVWCoordinator.getInstance().DSurl + "/";
436     }
437 
438 /**
439  * When the user requests a whiteboard with a background on the document 
440  * server to be copied, the CVWServer sends an
441  * object number of a new CVW document object with the doc id to be copied.  
442  * The doc id of the document is sent to the document server. 
443  * If the copy was successful, the document server returns a new doc id of 
444  * the copy of the original document.  Either the new doc id is sent to the 
445  * CVW server along with the new path to the document or a message noting 
446  * that there was an error on the document server.
447  * <br> MCP receive cvw-document-copy
448  * <br> MCP send cvw-document-copy-result
449  *
450  * @param docid the document id of the document to be copied
451  * @param docid the document id of the document to be copied
452  * @param newObjNum the object number of the new document to be created
453  *
454  * @see DSIController#getNewDocID
455  */
456   public void doDocBkgCopy(String newObjNum) {
457     if(CVWCoordinator.DEBUG) System.err.println("Copy DOCID: " + docId);
458 
459     int newID = 0;
460     DSIController dsic = (DSIController)DocumentServerList.getDocumentServerList().getLocalDocServer();
461 
462     if (dsic == null) {
463   newID = 0;
464     } else {
465   newID = dsic.getNewDocID(docId);
466     }
467 
468     if(CVWCoordinator.DEBUG) System.err.println("THE NEW DOCID IS: " + newID);
469 
470     if (newID == 0)   //error
471       CVWServerComm.sendMCPCmdToServer("#$#cvw-document-copy-result ",
472                                 " new_object: " +  newObjNum +
473                                 " error_msg: DocServer error occurred.");
474     else
475       CVWServerComm.sendMCPCmdToServer("#$#cvw-document-copy-result ",
476                                 " new_object: " +  newObjNum +
477                                 " new_path: " +  prepTextForServer(getPathFromID(newID)) +
478                                 " new_docid: " + newID);
479   }
480 
481 /**
482  * FUNCTION DESCRIPTION
483  * @param message
484  */
485   public void errorMsg(String message) {
486     jcvw.displayError(message);
487   }
488 
489 
490 /**
491  * FUNCTION DESCRIPTION
492  * @param message
493  */
494   public synchronized void msg(String message) {
495     processMsg(message);
496   }
497 
498 
499   void sendMsg(String msg) {
500     if (wbThreadWriter != null)
501       wbThreadWriter.putMsg(msg);
502   }
503 
504 
505   void setThreadReader(WBThreadReader wbThreadReader) {
506     this.wbThreadReader = wbThreadReader;
507   } 
508 
509   void setThreadWriter(WBThreadWriter wbThreadWriter) {
510     this.wbThreadWriter = wbThreadWriter;
511   } 
512 
513 
514   void processMsg(String msg) {
515 
516     int tokenNum = 0;
517     String reply = null;
518     String cmd = new String();
519     String type = null;
520     String color = null;
521     String ownerId = null;
522     String ownerName = null;
523     String id = null;
524     String prevId = null;
525     String exitStatus = null;
526     StringBuffer linelist = new StringBuffer();
527     
528 
529     StringTokenizer parser = new StringTokenizer(msg);
530     int tokenCount = parser.countTokens();
531 
532     if (tokenCount > 0) {
533       try {
534         while (tokenNum < 1 && parser.hasMoreTokens()) {
535           if (tokenNum == 0) {
536             cmd = parser.nextToken();
537             tokenNum++;
538           } else {
539             errorMsg("CVWWhiteboard::processMsg() handling tokens");
540           }
541         }
542 
543         if (cmd.equals("WB_STARTED")) {
544           reply = new String("RCV_WB_STARTED");
545           sendMsg(reply);
546         } else if (cmd.equals("SEND_BACKDROP")) {
547           if (path == null || path.trim().equals("")) {
548             reply = new String("RCV_BACKDROP");
549           } else {
550             reply = new String("RCV_BACKDROP {" + path + "}");
551           } 
552           sendMsg(reply);
553         } else if (cmd.equals("RCV_BACKDROP")) {
554           // Notify MOO Server to send listener and item info
555           CVWServerComm.sendMCPCmdToServer("#$#cvw-whiteboard-started", "object: " + objNum.strValue());
556         } else if (cmd.equals("RCV_WB_ADD_LISTENER")) {
557 
558         } else if (cmd.equals("RCV_WB_RM_LISTENER")) {
559 
560         } else if (cmd.equals("RCV_WB_ADD")) {
561 
562         } else if (cmd.equals("RCV_WB_REVERT")) {
563 
564         } else if (cmd.equals("RCV_WB_REMOVE")) {
565 
566         } else if (cmd.equals("SEND_WB_ADD")) {
567           if (tokenCount > 3) {
568             try {
569               while (parser.hasMoreTokens()) {
570                 if (tokenNum == 1) {
571                   type = parser.nextToken();
572                 } else if (tokenNum == 2) {
573                   color = parser.nextToken();
574                 } else if (tokenNum == 3) {
575                   linelist.insert(0, parser.nextToken());
576                 } else if (tokenNum > 3) {
577                   linelist.append(" ").append(parser.nextToken());
578                 }
579                 tokenNum++; 
580               }
581             } catch (NoSuchElementException e) {
582               errorMsg("CVWWhiteboard::processMsg() SEND_WB_ADD " 
583                                                             + e.getMessage());
584               return;
585             }
586 
587             CVWServerComm.sendMCPCmdToServer("#$#cvw-whiteboard-add-request", "object: " 
588                                      + objNum.strValue() + " item_type: " + type 
589                                      + " item_color: " + color + " linelist: " 
590                                      + "\""+linelist.toString()+"\""); 
591           } else {  
592             errorMsg(
593                   "CVWWhiteboard::processMsg() SEND_WB_ADD invalid arg count");
594           }
595 
596         } else if (cmd.equals("SEND_WB_REVERT")) {
597           if (tokenCount > 6) {
598             try {
599               while (parser.hasMoreTokens()) {
600                 if (tokenNum == 1) {
601                   ownerId = parser.nextToken();
602                 } else if (tokenNum == 2) {
603                   ownerName = parser.nextToken();
604                 } else if (tokenNum == 3) {
605                   prevId = parser.nextToken();
606                 } else if (tokenNum == 4) {
607                   type = parser.nextToken();
608                 } else if (tokenNum == 5) {
609                   color = parser.nextToken();
610                 } else if (tokenNum == 6) {
611                   linelist.insert(0, parser.nextToken());
612                 } else if (tokenNum > 7) {
613                   linelist.append(" ").append(parser.nextToken());
614                 }
615                 tokenNum++; 
616               }
617             } catch (NoSuchElementException e) {
618               errorMsg(
619                   "CVWWhiteboard::processMsg() SEND_WB_REVERT " 
620                                                             + e.getMessage());
621               return;
622             }
623 
624             CVWServerComm.sendMCPCmdToServer("#$#cvw-whiteboard-revert-request", 
625                                      "object: " + objNum.strValue() 
626                                      + " item_owner: " + ownerId + " owner-name: " + ownerName
627                                      + " old_item_id: " + prevId  + " item_type: " + type 
628                                      + " item_color: " + color + " linelist: " 
629                                      + "\""+linelist.toString()+"\""); 
630           } else {  
631             errorMsg(
632                "CVWWhiteboard::processMsg() SEND_WB_REVERT invalid arg count");
633           }
634         } else if (cmd.equals("RAISED")) {
635 
636         } else if (cmd.equals("SEND_WB_REMOVE")) {
637           if (tokenCount > 1) {
638             try {
639               while (parser.hasMoreTokens()) {
640                 if (tokenNum == 1) {
641                   id = parser.nextToken();
642                 } 
643                 tokenNum++; 
644               }
645             } catch (NoSuchElementException e) {
646               errorMsg(
647                   "CVWWhiteboard::processMsg() SEND_WB_REMOVE " 
648                                                              + e.getMessage());
649               return;
650             }
651 
652             CVWServerComm.sendMCPCmdToServer("#$#cvw-whiteboard-remove-request", 
653                                      "object: " + objNum.strValue() + " item_id: " 
654                                      + id);
655           } else {  
656             errorMsg(
657                "CVWWhiteboard::processMsg() SEND_WB_REMOVE invalid arg count");
658           }
659         } else if (cmd.equals("WB_STOPPED")) {
660           closeWindow();
661         } else if (cmd.equals("TERMINATED")) {
662           if (wbThreadReader != null) { 
663             wbThreadReader.stopThread();
664             wbThreadReader = null;
665           }
666           if (wbThreadWriter != null) { 
667             wbThreadWriter.stopThread();
668             wbThreadWriter = null;
669           }
670           WindowMgr winMgr = WindowMgr.getWindowMgr();
671           winMgr.removeWhiteboardWindow(this); 
672 
673         } else if (cmd.equals("EXITED")) {
674           if (tokenCount > 1) {
675             try {
676               while (parser.hasMoreTokens()) {
677                 if (tokenNum == 1) {
678                   exitStatus = parser.nextToken();
679                 }
680                 tokenNum++; 
681               }
682 
683               if (exitStatus.equals("2")) {
684                 errorMsg("Client/Whiteboard protocol version out of sync.  Unable to open Whiteboard.");
685         } else if (!exitStatus.equals("0")) {
686       errorMsg("Whiteboard aborted with exit status: "+exitStatus);
687               }
688 
689             } catch (NoSuchElementException e) {
690               errorMsg("CVWWhiteboard::processMsg() EXITED " + e.getMessage());
691               return;
692             }
693           } 
694 
695           WindowMgr winMgr = WindowMgr.getWindowMgr();
696           winMgr.removeWhiteboardWindow(this); 
697           CVWServerComm.sendMCPCmdToServer("#$#cvw-object-close", 
698                                    "object: " + objNum.strValue()); 
699         } else if (cmd.equals("APPLICATION_DISPLAY")) {
700       if (tokenCount > 1) {
701     String message = new String("APPLICATION_DISPLAY: ");
702     try {
703         while (parser.hasMoreTokens()) {
704       message += (parser.nextToken() + " ");
705         }
706     } catch (NoSuchElementException e) {
707         errorMsg("CVWWhiteboard::processMsg APP_DISPLAY " + e.getMessage());
708         return;
709     }
710     errorMsg(message);
711       }
712   }
713     
714       } catch (NoSuchElementException e) {
715         errorMsg("CVWWhiteboard::processMsg() " + e.getMessage());
716       }
717     }
718   }
719 
720 
721   void showWindow() {
722     String cmd = new String("RAISE");
723     sendMsg(cmd);
724   }
725 
726 
727   void closeWindow() {
728     String cmd = new String("TERMINATE");
729     sendMsg(cmd);
730   }
731 
732 
733 /**
734  * FUNCTION DESCRIPTION
735  * @param fromVersion
736  * @param toVersion
737  */
738   public static void setClientServerProtocolVersion(String fromVersion, String toVersion) {
739     // These version numbers need to be consistent with those in 
740     // CVWCoordinator's startProtocolExchange() method
741     Float startVersion, endVersion;
742 
743     if ((fromVersion != null) && (toVersion != null)) {
744       startVersion = Float.valueOf(fromVersion);
745       endVersion = Float.valueOf(toVersion);
746     } else {
747       CVWCoordinator.getInstance().displayError("Unable to determine JCVW Client/MOO Server whiteboard protocol version.");
748       CVWCoordinator.getInstance().displayError("Whiteboards are unavailable.");
749       clientServerProtocolSync = false;
750       return;
751     }
752       
753 
754     if ((startVersion.floatValue() >= 
755          currentClientServerStartVersion.floatValue()) && 
756         (endVersion.floatValue() <= 
757          currentClientServerEndVersion.floatValue()))
758       clientServerProtocolSync = true;
759     else
760       clientServerProtocolSync = false;
761   }
762 
763 /**
764  * Returns a string representing the state of this component.
765  * @return  a string representation of this component's state.
766  */
767   public String paramString() {
768      return ("path=" + path + ",docid=" + docId + "," +  super.paramString());
769    }
770 
771 
772 }