Getting Vignette 5.5 tools working on MacOS X

Introduction

You can get the Vignette client tools working on MacOS X; I've done it and use them every day; they work as well as the Windows version and actually look pretty cool too! Just a few hacks are needed to remove Windows specific functionality, and to fix a JDK 2 incompatibility. That's all!

Method

Changing Classes

Four classes in vignette_exports.jar need to be changed:

  1. com.vignette.awt.NativeUtils loads vgn_ui_native.dll, which is used to install MouseWheel handlers, feed key and mouse events into the system (why?), and get the current desktop size.
  2. com.vignette.awt.MouseWheel loads vgn_ui_native.dll, to install a mouse wheel handler.
  3. com.vignette.awt.FileBrowser loads vgn_ui_native.dll to use a Windows file browser (why?); this is used for Submitting files.
  4. com.vignette.awt.ResPopupMenu.java prevents contextual menus from being displayed on MacOS. This is kind of cosmetic, but useful.

You need some intermediate/advanced knowledge of Java to do these hacks!

Quite why Vignette decided to go away from 100% Java and screw everyone who wants to run the tools on another platform is beyond me; the native parts are trivial: the simple changes below make the Vignette tools back into a 100% Java application!

These notes should allow you to get the tools working on any other platform which supports JDK2 (e.g. Linux).

Instructions

The first step is to copy the whole of the PC install directory 'Program Files\Vignette' to your Mac, and un-jar the vignette_exports.jar:


% cd Vignette/Tools/5.5/lib
% mkdir old
% cd old
% jar -xvf ../vignette_exports.jar

You can then decompile the classes (see below), and apply the following modifications:

com.vignette.awt.NativeUtils - delete all native stubs, the import for WDrawingSurfaceInfo and the static code which loads the dll, leaving Java static function stubs, and add a simple implementation for getDesktopWorkArea(). JODE produces some illegal code in one of the functions; you need to replace it with a Class.forName call, and catch the ClassNotFound exception (actually you could probably just comment that bit out too):


% diff -be old/com/vignette/awt/NativeUtils.java new/com/vignette/awt/NativeUtils.java
198d
188,195d
174,182c
    public static void getDesktopWorkArea(Rectangle rectangle) {
        java.awt.GraphicsEnvironment ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
        java.awt.GraphicsDevice gd = ge.getDefaultScreenDevice();
        java.awt.GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle r = gc.getBounds();
        rectangle.setBounds(r);
    }
.
171a
        } catch (java.lang.ClassNotFoundException e) {
                ;
        }
.
165c
                    = Class.forName("java.awt.event.ComponentListener"))
.
159a
        try {
.
157d
134,155d
124,129d
119,120d
113,114d
63,90d
23d

com.vignette.awt.MouseWheel - delete the static call to load the dll and the code which references HWndInfo etc, leaving the stubs:


% diff -be old/com/vignette/awt/MouseWheel.java new/com/vignette/awt/MouseWheel.java
207d
136,142d
52,58d
34,45d

com.vignette.awt.FileBrowser - remove the static call to load the dll, and the native stub, add a 100% Java replacement within inner class BrowserThread.run():


% diff -be old/com/vignette/awt/FileBrowser.java new/com/vignette/awt/FileBrowser.java
121d
56,60d
47,50c
            javax.swing.JFileChooser jFileChooser = new javax.swing.JFileChooser();
            jFileChooser.setMultiSelectionEnabled(true);
            jFileChooser.setCurrentDirectory(new java.io.File(getDirectory()));
            if(getInitialFilename() != null) {
                jFileChooser.setSelectedFile(new java.io.File(getInitialFilename()));
            }
            setDirectory("");
            int returnVal = jFileChooser.showOpenDialog(parent);
            if(returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
                for(int i = 0; i < jFileChooser.getSelectedFiles().length; i++) {
                    System.out.println(jFileChooser.getSelectedFiles()[i].getPath());
                    addFile(jFileChooser.getSelectedFiles()[i].getPath());
                }
            }

com.vignette.awt.ResPopupMenu.java - remove the exclusion for isMac on ResPopUpMenu.show:


% diff -be old/com/vignette/awt/ResPopupMenu.java new/com/vignette/awt/ResPopupMenu.java
51d

I used JODE to decompile the classes, and simply recompiled them with javac:


% java -classpath /Users/me/Projects/Jode/jode-1.1.1.jar:/Users/me/Vignette/Tools/5.5/lib/old jode.decompiler.Main --dest /Users/me/Vignette/Tools/5.5/lib/old com.vignette.awt.FileBrowser

(do edits)


% javac com.vignette.awt.NativeUtils

etc.

Apart from the diff output above, which contains no copyrighted code, I can't legally tell you any more, so get JODE, decompile the classes above, look at them and it will be obvious; most of the work is simply deleting stuff, and the rest adding some very simple Java code. Work at it until it compiles and it might just work...

You can then JAR up the files again:


% jar -cvf vignette_exports_macosx.jar com/vignette/*

Note that if you decide to modify anything in any of the tools directory jars (admin.jar devctr.jar prodctr.jar), make sure you re-jar them with the correct META-INF/MANIFEST.MF; there is a custom header in there to indicate to the application framework the primary class of the jar, and what order its module should appear in the production center button bar; e.g. devctr.jar has the manifest:


Manifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)
VgnPkg: com.vignette.devctr.DevCtr 3

Failure to do this will result some of the options not being available in the production center button-bar.

Oromatcher

The Vignette supplied oromatcher-1.0.7.jar won't work with JDK2 due to broken obfusation used in the library, you get the following error:


java.lang.ClassFormatError: com/oroinc/text/regex/MalformedPatternException (Local variable name has bad constant pool index)

Download the latest version from http://www.savarese.org/oro/; version 1.0.7 is supplied with 5.5 and only works with JDK 1.1, OROMatcher 1.1 works with JDK 1.2+, so will do for our purposes.

Running

Run the Production Center using com.vignette.app.StoryServer as the main class with:


% cd /Users/me/Vignette/Tools/5.5/lib
% java -classpath /Users/me/Vignette/Tools/5.5/lib/vignette_exports_macosx.jar:/Users/me/Vignette/Tools/5.5/lib/oromatcher-1.1.jar:/Users/me/Vignette/Tools/5.5/lib/fixes.jar:/Users/me/Vignette/Tools/5.5/lib/jsafeSSL.jar:/Users/me/Vignette/Tools/5.5/lib/jsafe.jar:/Users/me/Vignette/Tools/5.5/lib/images.jar:/Users/me/Vignette/Tools/5.5/lib/gqb.jar:/Users/me/Vignette/Tools/5.5/lib/xml4j.jar:/Users/me/Vignette/Tools/5.5/lib/tools/prodctr.jar:/Users/me/Vignette/Tools/5.5/lib/tools/devctr.jar:/Users/me/Vignette/Tools/5.5/lib/tools/admin.jar com.vignette.app.StoryServer

replacing the /Users/me with the appropriate path to the Vignette install dir! Note that I've left off dde.jar (printing) which needs another native support dll. I've also put the new OROMatcher (which comes unjarred) and the hacked contents of vignette_exports.jar into oromatcher-1.1.jar and vignette_exports_macosx.jar respectively.

There's one caveat here; the tools look for the modules in the lib/tools directory which it finds relative to the working directory; you'll get an error e.g.


No packages found in /Users/me/tools

and no buttons will come up in the Production Center window (making it rather useless), if you run java when in any directory other than the lib directory containing the jars. Therefore you should run the Production Center from the lib directory.

Alternatively, you can run just the DevCenter by using com.vignette.devctr.DevCtrApp as the main class.

Making a double-clickable application

Make a double-clickable Java application using MRJAppBuilder; just put in the main class as com.vignette.app.StoryServer, and put in the same class-path as above (just cut and paste it!), or use the Merge Files option and drop all the jars above in (they'll end up in the Contents/Resources/Java directory).

To get around the 'relative path to tools' problem outlined above, add the following to the generated Contents/Resources/MRJApp.properties file embedded in the application package:


com.apple.mrj.application.workingdirectory=$APP_PACKAGE/Contents/Resources/Java

If you are planning to run just the Dev Center instead, put the main class as com.vignette.devctr.DevCtrApp.

Customize the application icon using IconComposer and vlogo32.ico if you feel froody.

I've provided a skeleton application which has no jars in it; add your own legally obtained and slightly-hacked jars to the Contents/Resources/Java directory!

Note once more that the application contains no Vignette code and will not do anything without your own jar files, which you must obtain legally!

What Doesn't Work

What Works

Contributions

I'd be interested if anyone can be bothered to get any missing features working or add any enhancements...

I've also successfully converted the V/5.6 tools using the same methods as above (commenting out or replacing native code).