Link of Swing 2.0? And google collection description …

Just two links:

  • PureSwing Description taken from the homepage: PureSwing is Java GUI library with user API nearly identical to Swing GUI toolkit. It’s based on GNU Classpath’s reimplementation of Java Swing classes.
    Nice:

    • See the homepage for a feature overview! It is more a “removing overview” 😉 e.g.: removed AWT dependency!
    • Joining the project is very easy: just send in the patch and if it’s good it will be commited.
    • License: PureSwing is distributed under GPLv2+ with Classpath exception (allows linking with proprietary programs). This license is effectivelly less restrictive than LGPL, …
    • There is support for NetBeans GUI builder

    Size for version 20091025: 2.1 MB (core); 2.8 MB (dependencies)

  • Google collections overview

    Dependency Injection in Java!

    Now the JSR330 is final! This was really fast (because of JEE 6)!

    From the JSR:

    This JSR will standardize:

    • A set of annotations for use on injectable classes
    • A typesafe, user-friendly injector configuration API that provides an integration point for higher level dependency injection configuration approaches

    The code is located at google.

    VL Docking and other window docking managers for Java

    Maybe you already know it;

    there are several docking managers and since April 2009 (3.0) you can include VL Docking for free even in commercial applications, because its LGPL!

    The good thing about VL Docking is (and of MyDoggy by the way …)  that it is well integrated into the Spring RC project.

    More information about VL Docking

    All Java docking managers

    (look here for an old list)

    Inactive projects

    • SwingDocking seems to me fully functional and fast; Apache license 2
    • XUI will be further developed here?; MPL; 1.6 MB (XUI-jdk15.zip)
    • JDocking CDDL; 1.3 MB (v0.8.zip) the docking part of netbeans
    • FlexDock MIT; only jar’s: 0.5 MB
    • JRichClient GPL; derivation of flexdock

    Please let me know if you know other libraries which support ‘window docking’.

    Java Application Frameworks (not only client side …)

    In an old post I listed all Java libraries,where only two application frameworks were listed.

    Today it is time to list some client side Java application frameworks, because I discovered some new ones while reading the W-JAX announcement. Some of the listed frameworks will make developing application with DB easier. And some of them are real 3 tier architectured frameworks. Some of them even allow you to develop RIA’s and web frameworks at the same time.

    Here is now the list of open source Java application frameworks especially for the desktop. Feel free to add some more (via comment):

    1. NetBeans RC Platform, my IDE is build on this 😉
    2. Eclipse RC Platform, has an interesting ‘subproject’ called Riena
    3. Spring RC, at the moment my favourite used in TimeFinder
    4. AppFramework which won’t be in JDK 7, but has a lot of derivatives
      1. Swing application framework fork
      2. Guice Utilities & Tools Set
      3. Better Swing AppFramework
      4. with OSGi
    5. JVx, looks very nice! Makes fast development of Swing applications possible (with db support)
    6. OpenXDev a framework which could be used as a base for your next Swing project
    7. Genuine is a client framework for Java Swing applications for which it provides basic infrastructure
    8. Genesis with Swing and SWT binding; Easy, transparent remoting; etc
    9. GWT (although only intented for javascript widgets it could theoretically being used as a rich client running in the jvm)
    10. OpenSwing Framework is an open-source suite of advanced graphics components based on Swing toolkit
    11. Leonardi Framework
    12. Jspresso is a framework for building rich internet applications
    13. Viewa framework
    14. XUI is a Java and XML RIA platform
    15. Swing + XUL = SwiXAT looks interesting but dead, the same for the next:
    16. Swing + XML = SwiXml a small GUI generating engine.
    17. buoy built on top of Swing. Xml serialization of UI possible
    18. But why xml if you have groovy: Griffon 😉
      Now, a nice approach would be to send/receive groovy code and build the clients’ GUI on fly… this would be like replacing the browser+html+javascript system with rock solid JVM+Groovy 😉
      Another Comment from AndresAn addtional tidbit about Griffon, it can be seen as a polyglot programming desktop/RIA framework as it supports 5 JVM languages at the moment: Java, Groovy, Scala, Clojure and JavaFX. It also lets you embed JavaFX components on Swing containers.
    19. JMatter is a software framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern.
    20. Metawidget is a ‘User Interface widget’ that populates itself, at runtime, with UI components to match the properties of your business objects.
    21. Pivot a platform for building rich internet applications in Java

    Especially JVx with a webstart demo looks very promising! It even feels better and faster than an ordinary flash application!

    Commercial:

    1. Aviantes-Business-Application-Framework
    2. Jide Desktop Application Framework
    3. Jazz

    I listed only frameworks which help developers to easier build client side desktop application and only if they run in the JVM. So frameworks where the client is browser-based (aka web frameworks) are not listed here.

    For a good list of J2EE frameworks go to java-source.net or to wikipedia. (Or here, or there, or even here)

    Update: For additional comments look at dzone

    Import/Export Code Formatting Settings from NetBeans

    In short: To share settings (e.g. code formatting) from NetBeans with Eclipse a little bit work has to be done.

    For NetBeans you have the following possibilities

    • Either directly use the file
      'home'/.netbeans/6.0/config/Preferences/org/netbeans/modules/java/source/CodeStyle/default.properties
      
    • Use the eclipse importer. Now you can use the project within NetBeans and sync etc.
    • Or  you could load the settings (e.g. the settings from previously imported eclipse project) via “right-clicking the project”->Properties->Formatting->Use project specific options->Load from other projectper-project-settings
    • Other possibilities? Let me know!

    Xvantage – Yet Another Xml Serializer!

    In one of my last posts I listed some xml serializers and binding tools. After trying XStream, JAXB, XmlEncoder, Apache Digester and X2JB I decided to create another one: xvantage!

    Why yet another xml tool?

    To make it clear: At the moment xvantage is in its early stage (one week old) and I hacked it down in some hours of my spare time. So it is not a fully fledged and bugless solution like the other ones should be.

    But it has some new ideas included to make the serialization as easy as XStream and XmlEncoder, but to make the xml checkable through an xsd file. The advantage of a valid xml is first of all: “then you know all is fine” and second “It is nice to read and editable from a person!”. The latter one was very important for me and is really important for xml configuration files.

    Apache Digester was another candidate but the set up was relative complex and the dependencies are to big for me. And last but not least: you need an additional, not further developed library (Betwixt) to make writing working too! So xvantage seems to solve at least these two problems: it is small and it can write xml from your POJOs and read it back.

    How would it look like to write my objects?

    // Create a data pool with all your POJOs you want to serialize
    DataPool pool = new DefaultDataPool();
    Map<Long, SimpleObj> map = pool.getData(SimpleObj.class);
    map.put(0L, new SimpleObj("test"));
    StringWriter writer = new StringWriter();
    xadv.mount("/path/", SimpleObj.class);
    xadv.saveObjects(pool, writer);
    

    The resulting xml looks like

    <?xml version="1.0" encoding="UTF-8"?>
    <path>
    <simpleObj id="0">
    <name>test</name>
    </simpleObj>
    </path>
    

    And reading?

    // get xml from somewhere
    StringReader iStream = new StringReader(
     "<path>" +
     "   <myobject><name>test</name></myobject>" +
     "</path>");
    
    // mount to /path/ with an alternative name 'myobject' instead of the default which would be simpleObj
    // this is the preferred way for mounting, because otherwise class refactoring results in different xml
    xadv.mount("/path/myobject", SimpleObj.class);
    DataPool pool = xadv.readObjects(iStream);
    
    // get the first SimpleObj and check the name
    SimpleObj obj = pool.getData(SimpleObj.class).values().iterator().next();
    assertEquals("test", obj.getName());
    

    Why does xvantage needs the DataPool interface?

    Without it it couldn’t handle references properly. And now with this DataPool interesting use cases arises, e.g. where parts of an object graph should be refreshed through xml (imagine you grab some objects as xmls through HTTP GET …)

    Why do we need to mount classes?

    To mount a class means: xvantage should track every occurance of that class as references and should NOT nest the object within other objects.

    This looks interesting, but does it works for more complex objects?

    Yes, it should. I could successfully embed this in my TimeFinder project, where I tried to persist 4 entities (some of them with hundreds of objects and several references) and read them successfully back. Objects which are not mounted explicitly will be nested within mounted objects like in xstream.

    Look into this for more information.

    Is xvantage an xml binding tool?

    No, it is an xml processor. So serialization and deserialization is easily possible if you start from Java code. At the moment it is nearly impossible to start from xml. Use JAXB or JiBX in that case.

    What is are the disadvantages?

    • As I mentioned earlier: it is may be not so stable like all the others, because it is in early development
    • It is not (yet?) so powerful and configurable like JAXB and all the others. So at the moment you cannot make your dream xml happen (i.e. not suited for binding)
    • may be not so fast
    • not thread save, you have to use multiple instances of xvantage
    • a no-arg constructor (at least private), getter and setters for all classes are required to use xvantage

    And what are the advantages?

    There are several

    1. easy xml (de-)serialization
    2. small library <50KB (without dependencies!)
    3. junit tested
    4. cross references are allowed! So you can reference even between documents and you could read/write from/to multiple files!
    5. the xml could be checked via xsd (but no must)
    6. no deeply nested unreadable xml (the same as 6.)
    7. no checked exceptions
    8. no license issues and free source code (public domain!)

    How can I use it?

    Just clone the git repository:

    git clone git://github.com/karussell/xvantage.git
    cd xvantage
    mvn clean install -Dmaven.test.skip=true
    

    Currently it is a netbeans project and the tests in maven will not pass because some resource files are not available.(?)

    How does it work in theory?

    Writing

    1. Xvantage writes the object to xml (via SAX). The object will be directly converted to xml if it is a primitive type, a collection (list, set), a map, an array, your own implementations of such an interface or a BitSet.
    2. If the values of a collection or a property references to a mounted POJO it will write only the id
    3. If no id was found (in case we have an unmounted POJO) the POJO will be written directly as subtree to the current object.

    Reading

    1. It reads the xml tree via SAX and reads discrete objects according to the mounted classes via DOM
    2. If the object is a mounted POJO it will read the id and try to set the properties from the xml structure. If an object with the given id already exist, this instance will be used to fill in the properties from the xml nodes.
    3. If a setter is one of the mounted classes a new object with the id (from xml) will be created and the properties will be filled later.
    4. If the object is a collection it will fill the collection from the values
    5. If the object is not a mounted POJO it will try to read the nested xml structure to set the properties

    Provide Feedback!

    Be constructive and tell me facts (maybe such a tool already exists :0!). Use comments or peathal at yaahooo dot de.

    Thanks a lot for your attention!