Collecting some notes re JHotDraw (and the command line version of
TWikiDraw -- is there such a thing?) focused on finding a way to edit
TWikiDrawPlugin drawings offline to do things like copy and paste between drawings.
See
AboutThesePages.
Contents
Installation
Windows or Linux -- from
Become a programming Picasso with JHotDraw
:
- download the zip,
- extract the files (consider doing it on the path sometime),
- from a dos prompt in the directory where the files were extracted, run:
java CH.ifa.draw.samples.javadraw.JavaDrawApp
Comments
Linux and Windows
Both versions seem to have some bugs -- see the next two sections.
Neither version displays wrapped text properly, in both cases it is displayed as one long unwrapped line (not sure what will happen if I have a superlong block of text). Windows shows a square block seemingly representing the <cr><lf> characters (so the line breaks are visible), Linux does not. In neither case could I find a way to enter line breaks. When returned to TWiki, line wrapping was displayed properly (as long as I had not destroyed it while editing in Windows or Linux).
Windows
The Windows version seems to have memory leaks -- my resource usage climbed steadily as I worked on a drawing in Windows.
Don't recall whether I successfully stretched the canvas or not -- perhaps horizontally.
Update: Yesterday, JHotDraw 5.1 worked, today it doesn't. Had a windows crash, and deleted a few files (don't know if this is related or not). Today, on running
java CH.ifa.draw.samples.javadraw.JavaDrawApp, I get the message (can't copy and paste): "Exception in thread "main" java.lang.NoClassDefFoundError: Ch/ifa/draw/samples/javadraw/JavaDrawApp"
If anybody knows why (and how to fix) write to me (or add the information here -- this is a wiki, after all) -- in the meantime I'll try to do my editing in Linux.
Linux
The Linux version (tried a few hours later) seemed even buggier than Windows. Not sure about memory leaks, but odd behavior when I tried to stretch the text -- would stretch so far, then collapse to the original size after which I could not stretch it again.
In Linux I did make a second drawing by opening a new window, then copying and pasting stuff from the other window to it, then saving the new window with a different name. Presume I can do the same thing in Windows (if I don't mind rebooting when the memory is used up).
In a different trial, I downloaded the test.draw file from
EmailServerSketches. I modified it offline and tried to re-upload it. The changes didn't seem to be recognized. I finally uploaded it to
EditingATWikiDrawSketch with a different file name (test9.draw) and it displayed with the modifications, but I had to use Windows to open the sketch for editing because in konqueror under Linux (without Java installed), there was no visible "box" that I could click in to begin the editing process (and without Java, it would not have worked anyway).
In the course of trying to upload it and get it to display in Linux I did things like check the owner and file permissions -- they were the same for test.draw and test9.draw -- dad,dad and 664. I also tried opening test.draw in Windows to see if that made a difference, but it did not (the changes on test still did not show up). I had added a comment to the uploaded file, something like "Modified offline -- will captions wrap?" and that appeared in the attachment list, and the date and time of the saved file had changed and seemed appropriate, but the changes never did appear.
I don't know if it will make a difference, but next time I'll try editing and re-uploading a file of the same name from Windows instead.
Installation
Windows or Linux -- from
Become a programming Picasso with JHotDraw
:
- download the zip,
- extract the files (consider doing it on the path sometime),
- from a dos prompt in the directory where the files were extracted, run:
java CH.ifa.draw.samples.javadraw.JavaDrawApp
Comments
5.2 (on Windows -- haven't tried Linux) didn't work for me the first time I tried it -- haven't tried again so far. IIRC, the .draw file did not open at all.
<later -- does it exist?>
Resources
From
http://www.c2.com/cgi/wiki?HotDraw
:
Other:
First Round Trip Test
Done in Windows, and uploaded with a new file name, so should not have been a victim of the problem described above, where offline changes were not recognized when a modified file with the same name was reuploaded to TWiki (in Linux).
Unmodified file. (Version 1.26 of test.draw from
EmailServerSketches (IIRC))
IIRC, all I did was open test.draw version 1.26 in
JHotDraw 5.1 and saved. In
JHotDraw 5.1 the background was gray and the text was not wrapped. Looks all OK now (2 bytes dropped from file somewhere). In
JHotDraw I tried to copy and paste the square boxes that presumably represented the <cr><lf> characters but could not. I can presumably find their value with a hex editor or similar and perhaps edit them via the <alt>nnn method (windows). (Or enter those characters after returning the drawing to TWiki.)
Update: Hex editor on .draw file shows the characters as "\n" (05 C6), obviously not the little checkbox being displayed in
JHotDraw. Not sure how I can look at the value of that, and don't plan to do massive trial and error.
- Q: Is there an easy way to copy portions of a drawing and paste them to another drawing? (I guess I could download the files to my machine, view the text file (.draw), copy and paste the appropriate lines of text between the files -- any better suggestions?)
- A: Unfortunately from the applet you are restricted to the Java clipboard. It's a major security hole to allow access to the system clipboard for a browser application so Java doesn't allow it. The Java clipboard is shared by all open applets on the same site, and is saved between editing sessions, so you should be able to edit drawings (on the same site) and copy & paste between them. Another way would be to download the .draw file and edit it using the command-line version of TWikiDraw which I think allows multiple files or a more recent JHotDraw which I know does. -- CrawfordCurrie -- SH
- Follow Up: What / where is the command-line version of TWikiDraw? (I downloaded twikidraw.zip from TWikiDrawApplet, but, from what I can tell, still works in a browser -- maybe the files are stored locally (which would help) -- I haven't installed it yet, the installation looks a little confusing.
I have downloaded and installed JHotDraw 5.1 and 5.2 and will start a Wikilearn.JHotDraw page to record my experiences. I'm not sure 5.2 will work with the TWikiDrawPlugin .draw files. 5.1 seems to work reasonably well for local editing with a few obvious differences -- word wrapping doesn't work within a label, and the background is gray which confused me a little at first.
There may be other differences, I haven't done much testing so far. I haven't yet tried a round trip (that is, editing locally and viewing on twiki.org) -- I'm hoping that if I don't disturb the word wrapping locally it will reappear when viewed on twiki.org.
If there is a command line TWikiDraw I'm hoping it may preserve the word wrapping in labels.
Contributors
- RandyKramer - 12 Apr 2002
- <If you edit this page, add your name here, move this to the next line>
Page Ratings and Attachments