Symantec Visual Café Database Development
Edition
Last updated 1998 June 16 Roedy Green ©
1997 Canadian Mind Products.
Here are some hints on using Visual Café Database Development
Edition. The online help documentation is out of date and downright erroneous.
Much of this material will also apply to Visual Café, Visual Café
Pro edition, and Visual Café 1.0.
Preparing JavaBeans
I suggest you read the BeanInfo, BeanBox, Jar File, Manifest, and JavaBean
entries in the Java glossary. Symantec just crashes if you try to add a
bean with anything in the least the matter with it. You must test them
first with the Sun BeanBox. The Symantec Jar file create is hopeless. I
suggest you prepare a manifest file manually, and use Sun's Jar.exe to
create your jar file. It is quite easy to whip up a BeanInfo class for
each bean, even if your only intent is to provide an icon. You can then
add the entire jar at once to the component library. Make sure the jar
file in on the CLASSPATH in SC.INI.
Installing a JavaBean Component In the Library
Visual Cafe has a two step process to get a bean ready for use on the component
toolbar:
-
You must add it from a class file to the library.
-
You must add it to the toolbar from the library.
Both the library and the toolbar have groups. They need not have the same
naming structure. Not all components in the library need be on the toolbar.
The tools for adding and deleting components and groups from the library
and toolbar are chaotic. I am being charitable. But worse, they are improperly
documented. Here is how you actually do these procedures.
-
To add a group to the library, according to help, you are supposed
to click Insert Group. This is always grayed out so I don't think this
is possible. (That button gives the impression it means adding a whole
group of components to the project so this menu item shoud properly be
labeled Insert Group in Library). However, I discovered that you
could add a group in the Library by clicking Window, Component Library,
right click, add group. Then you left click twice slowly! -- not double
click, on the new "folder" group created, and rename it.Intuitive
user interface eh?
-
To remove a group from the library, click Window, Component library.
Click on the offending group. Hit DEL. This will rename it to nothing.
Click away from the group. Click back and hit DEL again. This will finally
kill it. There is no right click delete/rename support.I bet it would take
you more than 5 minutes to discover that by trial and error!
-
If your component as any inner or anonymous classes, you will need to put
your component and its dependent files in a JAR file first, then add the
entire JAR file. I still can't get this to work. The components you add
refused to be deleted because they are "default". I know this sounds totally
nuts, but just add the jar file again, then delete them, and they will
all come out if you try to delete even one of them.
-
To add a component to the library you click Insert Component into
library, and select the class file, then select the group. Oddly,
you can't do this from the component library window. Further seems to work
best if you have the component libary window closed. It refuses to add
some components sometimes. It just whirrs away for about 10 seconds, then
acts as if I had never given the add component command. I have not yet
figured out the circumstance. It gives no error message. This may be pigeon
superstition, but I can sometimes get it to work by adding the component
and anything it uses to the current project, rebuilding the project and
restarting VCP.
-
To remove a component from the library, you must click Window, Component
library, then select the component, then hit DEL. Unfortunately, clicking
the right mouse button does not offer a delete.
When you add a new bean, VCP (Visual Cafe Pro) will create an object of
that bean type and exercise its methods. If they are not up to snuff, you
will get a blanket rejection, no explanation of the precise problem, or
if you less lucky, VCP will crash. It will continue crashing every time
you bring it up. To get out of this, you must start VCP by clicking on
some *.java file to invoke VCP, so it won't start the last project it was
working on. This seems to clear its little brain. Sometimes you can clear
problems when the bean implementation code has changed by clicking on an
OBJECT of that type in the project window.
Installing a JavaBean Component On The Toolbar
First you must install your JavaBean components by the process above. Then
you can add them to the toolbar:
-
Click Tools, Environment Options, Component Palette.
-
To add a component to the toolbar, select a component in the library
on the left to add to the toolbar, click a palette group on the
right to add it to and then click ADD.
-
To remove a component from the toolbar, select a component to remove
from the toolbar on the right, and click REMOVE.
-
To add a new group to the toolbar, click New Group.
-
To remove a group from the toolbar, highlight the group name on
the right, and click REMOVE.
-
Unfortunately, you can't add or remove groups or components from the library
using this screen. You can only affect the toolbar.
-
You can drag and drop groups and components of the toolbar to reorder them.
-
Be careful. It is very easy to highlight on the left and click REMOVE and
then something on the right will disappear.
These clickings are far from obvious. You can spend a long time searching
those menus until you stumble on these magic combinations.
How JavaBean Installs Should Work
How should this work? If I were in charge at Symantec, I would simplify
the whole business like this:
Your component library and toolbar are more integrated. Each component
can be marked visible or invisible -- which determines whether it shows
up on the toolbar. If a group contains nothing but invisible components,
that group does not show up on the toolbar.
You start the process off by clicking on the Window Component Library,
or right clicking on the component toolbar and selecting edit palette..
You see the component library with groups that can be +/- expanded/-collapsed
to see the components. Components are colour coded to indicate visible-invisible.
You right click on any component:
-
add component
-
delete component
-
v on toolbar (the v represents a check toggling check mark)
-
browse component (if available)
-
view source (if available)
You right click on any group:
-
add group
-
delete group
-
rename group
-
add component
When you add a bean, it would be nice if you could select a toolbar icon
for your Bean without having to manually write a BeanInfo class. Alternatively,
it would nice if there were a wizard for generating a simple BeanInfo class
-- e.g. that selected an icon, and perhaps let you hide some of the methods,
giving you effectively a public and published scope.
Attempting to Create A Jar file With the IDE
The create JAR file function has numerous problems:
-
The waiting cursor stays on indefinitely when you click JAR.
-
You can't just accept the offered filename or type your own name for the
created JAR file, you must click the ... and select the filename that way.
-
After you select the file, you must wait fifteen seconds or so while it
looks for files likely to go in your jar. It gives you no indication it
is busy other than the more icon is grayed out.
-
When you add a dependency, the display does not change to reflect that
change. You have to select an unrelated item.
-
Every time you add a file it forgets the directory you last picked up a
file from.
-
It will not let you add more than one dependency. (What do you do with
a bean with two inner anonymous classes?)
-
I'm not totally sure of this, but it seems that once you remove a file,
you can't add it back. Under some conditions, add refuses to do
anything.
-
It is not clear from the documentation that dependent classes are also
supposed to be represented at the outer level. You can't select a dependent
class that is not already added as a class in its own right at the top
level.
-
I would like a bit more explanation of just what dependencies are. I would
think it means that class A uses the dependent classes B and C, or gifs
d and e. Then a class B might be a dependent of several classes. Since
this information is already encoded in the class files themselves, what
is this FOR?
Fortunately Symantec has recognized the problem, and has totally rewritten
the Jar create function. The new code will be in the next update.
Creating A Jar file with JAR.EXE
Be in the directory one closer to the root than your source files (which
might be the root if your package name is the same as the base directory)
in a DOS box and type:
D:\vcp\java\bin\jar.exe cfvm myjar.jar manifest.mf
myDir
Where myjar.jar is the desired name of the jar file, myDir
is where your class files are, and manifest.mf is the name of your
manually prepared manifest file. See manifest
in the Java Glossary for more details about its format. Jar.exe will recurse
directories, and embed the myDir directory name in the archive.
Don't for get the f option, and don't put any spaces between the option
letters or your screen will receive the unintelligible binary output.
Then use WinZip to prune the junk out you don't want. Unfortunately
it won't clean up the manifest.mf file for you. Jar.exe does not seem to
understand wildcards. WinZip tends to put too much directory information
in the jar file if you try to build it with WinZip directly.
You can then add more files like this:
D:\vcp\java\bin\jar.exe fv myjar.jar myDir\myDir2\myClass1.class
Bugs
Here are some bugs I have found in Visual Café that are giving me
grief:
-
If you accidentally leave off the trailing } on a method when you edit
using the class browser, Visual Cafe Pro will crash when you leave editing
that method.
-
Always put each project in a separate directory. Otherwise, there are bound
to be name conflicts and you will overwrite your old source.The application
generator wizards are quite happy to write over existing projects without
even a warning message.
-
After you manually edit source generated by the forms designer or property
editor, don't use the forms designer or property editor again. The only
source code changes that appear to be safe are property values. Don't manually
add components, or change their type. Make sure any component types you
are editing are in the library. The tool does not seem to work at all well
if you make any changes to the library components, e.g. add, remove, or
rename properties. Make sure you have a backup before using the forms designer.
It can make some very severe unwanted changes to your code like converting
all your custom components back into TextFields and throwing out all calls
to set the properties of your custom components.
-
Sometimes you add a method or constructor to a class, then the compiler
complains when you try to use it in some other class. REBUILD ALL seems
to clear its pea brain.
-
When you create a jar file, you should create it in the same directory
where the components you are adding to it live. The jar create command
in VCP is very primitive. Once you create a jar it is sealed, from the
point of view of VCP. You have to manually edit the manifest.mf file, add,
freshen, etc. thereafter. Run time cannot see a jar file unless it is mentioned,
fully qualified in the CLASSPATH (sc.ini).
-
One the ways to crash Visual Café is to rename a *.java file in
the current project and then fire VCP up again. VCP will go looking for
that file, and will offer you a file open dialog to go find it. Since the
file does not exist anymore, you click cancel. Down goes VCP. However,
if you humour it, and give it the "wrong file", e.g. the renamed
file, which it will reject, then later hit cancel, you are able to recover
and remove the file from the project and replace it with the new name.
-
If you change the code for a component. You must delete the component from
the library, reinstall it into the component library. Delete the old components
from your frames. Exit and restart Visual Cafe. Insert the new components
back into your frames.
Symantec has a bug site where you can search for bugs and fixes:
http://service.symantec.com.