I just added some more keywords to my Firefox API keywords, which means that Java 1.4.2, Servlet 2.3, and Google Web Toolkit 1.0.21 are also accessible using keywords. Juse bookmark these urls:
http://keyword.contix.dk/key/java1.4.2?q=%s
http://keyword.contix.dk/key/gwt1.0.21?q=%s
http://keyword.contix.dk/key/servlet2.3?q=%s
Fnally, I added a union of all the Java-related keywords, which can be accessed using this address:
http://keyword.contix.dk/key/java?q=%s
Using this search, all supported Java APIs are searched.
You know the feature in Firefox where it’s possible to give a bookmark a keyword and an argument. When you type in the keyword and an argument in the address field, the bookmarked url is accessed with the argument inserted.
This feature is ideal for bookmarking Google searches and others made for it. However, some reference APIs are not exactly created with that in mind, for example the Java API.
So, I created my own index, which can be used for keyword searching. It can be found at http://keyword.contix.dk, and it makes it possible to enter something like ‘j String’ and get the API for java.lang.String. Other valuable APIs are HTML and CSS.
Suggestions for more APIs are welcome.
Mostly so that I’ll remember it myself: If you have an OpenSSL certificate for Apache mod_ssl or something like that, and would like to use it in Java (e.g. for Tomcat), here’s the way to convert it:
keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts \
-file $rootCert
openssl pkcs12 -export -in ssl.domain.com.crt \
-inkey ssl.domain.com.key -out java.keystore \
-name newcert -caname root -chain -CAfile $rootCert
For standalone, the new keystore can be used by setting the following properties:
javax.net.ssl.keyStorePassword=changeit
javax.net.ssl.keyStore=java.keystore
javax.net.ssl.keyStoreType=pkcs12
Yesterday, we ran into a small issue with JComboBox. It seems that actionEvents are fired both when you scroll over an item with the keyboard and when you press enter on it. The normal OS behaviour is to fire only when an item is actually selected, either by clicking on it with the mouse or by pressing enter on the item.
Because we're opening a new window based on the selection, it doesn't relly work very well when the action is fired just because the item gets focus. After messing around with addActionListener, addItemListener, and addPopupMenuListener,
we concluded that there's relly no support for getting only an event when an item is selected.
Adding a PopupMenuListener gets very close, but if you open a new window inside that event, a NullPointerException will occur later because of some issues with MenuManager being a singleton.
In the end, we made a hack:
JAVA:
-
public class TestComboBox
extends JComboBox {
-
-
-
boolean cancelled;
-
-
-
cancelled = true;
-
}
-
-
if (!cancelled) {
-
-
public void run() {
-
while (true) {
-
if (!isPopupVisible()) {
-
-
break;
-
}
-
try {
-
wait(50);
-
-
-
}
-
}
-
}
-
});
-
}
-
}
-
-
cancelled = false;
-
}
-
});
-
}
-
}
In other words, a listener gets an event just before the popup is closed. The listener then spawns a new thread which checks if the popup has been closed. When the popup is closed, the actionListener is notified.
This can only be classified as a hack, so if anybody has a better solution, then please tell me...
I got a suggestion about optimizing the GWT compiler so that it only compiles when files have actually changed. That makes sense, as the compilation is pretty slow. So, I've made a new version of the ant-gwt task, which analyzes the Java files before it starts compiling.
If none of the client files have changed since last time, the GWT compiler won't be started.
Also, I've added some options for style and log level - here is a complete example:
<gwtcompile destdir="www" optimize="true" logLevel="all"
style="pretty">
<fileset dir="src">
<include name="/*.gwt.xml"/>
</fileset>
</gwtcompile>
The new version is at the same url: Download.
The generated shell launcher script for GWT has an irritating feature: The classpath is fixed, and if your project includes 3rd party libs, which is often the case, you have to modify the script.
Instead, I use something like this:
#!/bin/sh
APPDIR=`dirname $0`
CLASSPATH="$APPDIR/src:$APPDIR/classes"
CLASSPATH="$CLASSPATH:$GWT_HOME/gwt-user.jar"
CLASSPATH="$GWT_HOME/gwt-dev-linux.jar"
for i in `find . -name '*.jar'`; do
CLASSPATH="$CLASSPATH:$i"
done
export CLASSPATH
MODULE=$1
shift
C="com.google.gwt.dev.GWTShell"
java $C -out "$APPDIR/www" "$@" $MODULE/${MODULE/*./}.html
Using this launcher, you can launch the module dk.contix.gwt.Test/Test.html with this command:
launcher dk.contix.gwt.Test
I've been working on a small project using Google Web Toolkit, which is a pretty nice framework. However, it's not exactly easy to integrate into a normal build environment with ant, as it's based on command line utilities.
After a while, I got tired of it and wrote an Ant task which can compile GWT modules into javascript. I know that others have attempted the same, but as far as I could tell, they all required you to hardcode module names in build.xml, which is not very nice.
So, using the task I wrote, it's possible to generate javascript for a set of modules using a single task. Plus, it's a little faster when compiling more modules, as it doesn't have to restart the compiler completely every time.
Try it out. It's released under a GPL license.
Documentation
Update: I got a notice that the task doesn't work under Windows - that should be fixed now.
Update 2: Version 1.1.0 of GWT requires an new compiler. Get it here.
Update 3: The project is now hosted at Google Code, and new releases can be downloaded there.