The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov's Blog

February 2006 Archives


Substance 2.2 official release

Posted by kirillcool on February 27, 2006 at 01:57 AM | Permalink | Comments (2)

Substance look-and-feel has reached the 2.2 release, with a lot of new features and a lot of bugs fixed. The list of new features includes:
  • Zero memory leaks on switching themes / watermarks / ... and switching between Substance and core LAFs
  • Full interoperability with core LAFs
  • Animation on rollover (fade-in / fade-out).
  • Localization and internationalization.
  • Vertical tabs in tabbed panes.
  • Strength checking on password fields.
  • Specular gradient painter.
  • Focus ring kinds.
  • Watermark bleeding.
  • Watermark ignore.
  • Configurable base and extra font size.
  • Flat toolbar buttons.
  • Support for Matisse baseline alignment.
  • Gradient background on menus.
  • Marking non-editable text components.
  • Auto-completion on editable comboboxes.
  • Translucency animation on title pane buttons.
  • Rollover effects on Xoetrope color wheel.
  • Configurable size of tab close buttons.
  • Animating close buttons of modified tabs.
  • RTL menu support.
In addition, the following documents were updated / added:
  • FAQ
  • API for applications
  • List of available VM flags and client properties.
Here's a handful of Substance screenshots:

















Multi-colored buttons

Posted by kirillcool on February 22, 2006 at 01:41 PM | Permalink | Comments (9)

With the release of version 2.2 of Substance look-and-feel scheduled for this Monday, i have started to work on the next version (2.3 code-named Firenze). One of the things i wanted to improve are color themes, and a lot of work has already been done in this area. For now, i want to introduce the concept of "mixed" themes.

Substance comes with eighteen core and twenty one plugin themes. The total is thirty-nine. By the end of the article you will see how after a few hours of coding this has been increased by 630 additional themes. Here is a sample screenshot of mixed themes and how they look like on buttons:



The mixed theme is composed of two base themes. When some mixed theme is used, the resulting image is composed from these two based themes. The first 30% is the first theme, the last 30% is the second theme and the middle 40% is the blending between the two. Now, Chet has mentioned the concept of color distance. In the simplest computation, it's the Euclidean distance between the color components (red, green, blue). For the human perception, it's better to use hue-saturation-value scale or assign different coefficients to red-green-blue (as when RGB is translated to gray-scale). The examples above showcase some of the best matches distance-wise. They are not too close (so the two distinct themes are visible) and not too far (so the themes are not dissonant). The entries above are:
  • Aqua and Light Aqua
  • Aqua and Bottle Green
  • Barby Pink and Raspberry
  • Bottle Green and Lime Green
  • Brown and Sun Glare
  • Sunset and Orange
Here is a screenshot of all available mixed themes (generated in the Substance test application) - 122 themes. This screenshot is ordered by the first theme (all entries in a row have the same first base theme):



Here is a screenshot of the same themes ordered by simple Eucledian distance (shown as the button text):



Once you drop the theme-pack plugin in the classpath, the number of mixed themes increases from 122 to 630. Here is the screenshot of all available mixed themes ordered by distance (click to see all 630) - as you can see two themes that are two close do not produce the desired multicolor effects:



This is one of the reasons i prefer Java2D over image-based drawing (such as Synth-based LAFs). You need to invest a little bit more in the programming, but the outcome is much more generic - once a new theme is added to Substance, 20+ new mixed themes are available at no cost. In addition, once a mixed theme is set as Substance current theme, it is used for all controls (buttons, checkboxes, tabs, spinners, sliders, scroll bars etc). Think about the amount of work needed to be done for each Synth-based theme...

The world of ferret hunters is really thriving lately. Sort of

Posted by kirillcool on February 20, 2006 at 01:56 AM | Permalink | Comments (23)

Every time i read one of Bruce Tate interviews (the latest one is right here), i can't help but think that the ferret-hunters think that everybody else is hunting ferrets. I guess that's how the world looks like when you run a consultancy shop for mom'n'dad joints that can't afford their own ferret hunters. I mean, you have a shop that sells ferret-hunting equipment and a guy walks in. Chances are, he'll ask for the latest in ferret-hunting, right?

Now, you know that there are other animals out there, and you have even spent a few years on a big ranch full of them. But the "man" didn't let you hunt other animals, he just gave you this big bazooka and told you to take those ferrets down. It took you four months to read the bazooka manual, to setup the launch pad and figure out that if you aim too close the ferrets just disintegrate and if you aim too far they just get brushed. Your friend hooks you up with a ferret-trap and in four days you have more ferrets than you have in your entire life. You then start writing a book.

This book is full of examples. Every time you need an example from the hunting world, you randomly pick up an animal. Randomly, each time it's a ferret. After a few such picks, your readers are really intrigued - perhaps there are no other animals around? You seem to be so sure of that (at least it doesn't hurt the book sales too much). The random selection can't be wrong after all. You then present a wonderful choice of these great ferret-hunting tools and say that all the hunter enthusiasts are already using them to hunt ferrets all over the world. I guess they are, since the ferret-hunting frameworks are springing all over the place. All other animals must seem extinct by now. Somehow it is implied that these enthusiasts are hunting other animals with these tools too. Oh no, wait - there are no other animals around, haven't i said it already?

A few months back Greg had took the words out of my mouth with his review of ferret-hunting beyondness. Now even Hani joins in against the ferret-hunting consultancy shops.

Aligning menu items in Swing applications - welcome to the real world

Posted by kirillcool on February 18, 2006 at 12:53 PM | Permalink | Comments (8)

When i have written the previous entry on aligning menu items in Swing applications, i was blissfully ignorant and thought that the life was good. Thankfully, one of the users of Substance has opened this defect with the following summary - "Menu texts are invisible in RTL orientation".

Why, say you. What's that RTL has to do with my application? Turns out that there are four locales that define the right-to-left orientation (who should know better than me...), Arabic (ar), Hebrew (iw), Persian (fa) and Urdu (ur). Under these locales, the users expect their applications to be layed-out correspondingly. Swing core look-and-feels provide quite a good support for this:

These two screenshots of Metal in Tiger and Metal in Mustang (you can see that Mustang properly aligns the texts, but fails quite miserably at aligning the accelerators):



The same problem with the accelerator alignment on RTL menus under Mustang is with the Windows LAF:



And what happens with the third-party LAFs you ask? Well, it depends. Here's a short chart of nine third-party open-source and commercial LAFs sorted by the degree of current RTL support in the menus (both under Tiger and Mustang):

  • The first place - JGoodies' Looks. The only problem is with the accelerator alignment (both on Tiger and on Mustang). The first place doesn't come easy though - JGoodies provides its own layout and painting mechanism and as such, it uses the SwingUtilities2 class which is unsupported. Hence, this ungodly creature in the codebase of 2.0beta:
        private static final String SWING_UTILITIES2_NAME =
            LookUtils.IS_JAVA_6_OR_LATER
                 ? "sun.swing.SwingUtilities2"
                 : "com.sun.java.swing.SwingUtilities2";
    
    The screenshots for Tiger and Mustang (note the accelerator alignment problem which is better in Mustang but still slightly off - this has been fixed for Beta2 coming in the next few days):

  • The second place - Substance (would have been sixth and the last place yesterday). Both under Tiger and Mustang properly aligned texts, but the accelerators are off. The main hindrance to getting this to work (not only in Substance but also in all other Metal-extending LAFs below) is that the UI delegates for menu items do not provide hooks for painting the accelerators. The only available way is JGoodies way - do it yourself (and be bound to use SwingUtilities2). The screenshots for Tiger and Mustang (note the accelerator alignment problem present in both):

  • Third place - Pagosoft, Squareness and Napkin. In addition to the accelerator alignment as above, the texts aren't aligned under Tiger (core fix in Mustang). The screenshots of Pagosoft for Tiger and Mustang (note the text alignment under Tiger):



    The screenshots of Squareness for Tiger and Mustang (note the text alignment under Tiger):



    The screenshots of Napkin for Tiger and Mustang (including Tiger workaround for this bug fixed in Mustang):



  • Fourth place - Synthetica (commercial) and Trendy (commercial). In addition to the accelerator alignment and text alignment under Tiger, the arrow points to the right and not to the left. The screenshots of Synthetica for Tiger and Mustang (note the arrow direction):



    The screenshots of Trendy for Tiger and Mustang (note the arrow direction):

  • Fifth place - Liquid and Tiny. The RTL menus are completely messed up both under Tiger and Mustang. Screenshots of Liquid and Tiny under Mustang:

  • Sixth place - Office (and Substance yesterday). No support at all for RTL menus - the menus are layed out left-to-right. Screenshot under Mustang:

The above support for RTL menus in Substance is available in the release candidate of version 2.2. In addition, the version 2.3 will provide full support for RTL features (including additional UI elements that Substance adds). Great thanks to the reporter that made me finally think of this and let's hope that the accelerator alignment issue will be addressed in the final release of Mustang.

Teach a man how to fish and you'll sell him your fishing equipment for the next five years

Posted by kirillcool on February 15, 2006 at 12:24 AM | Permalink | Comments (6)

Yesterday BEA has announced that the recently purchased SolarMetric's Kodo persistence engine will be open-source and available under Apache license. Hurray, you think, especially in view of statements such as "Right now, the focus is on supporting the JDO 2 specification and the EJB 3 Persistence specification and offering customers interoperability between the two specs. Both of these specifications are very close to being submitted to the JCP for final approval, and we would very much like to be right on the heels of the approvals with GA versions of Kodo and Open JPA." The one sentence shouldn't escape you, though - "We are not open sourcing the code related to JDO and JDO 2 as this will continue to be available for purchase from BEA Systems." (the bold is by me).

And that has been the recent trend lately (I talked about Eclipse being the milk cow for board members about half a year ago) - give something basic for free (like JRockit VM) and charge for the tools. In BEA's marketing lingo it's called "blended" development (part open-source, part "give your top dollar to us now") - i wonder what happened to "liquid" (it hasn't been a year since it was announced at JavaOne 2005). And it's not only the big companies such as BEA or IBM. You can go from JBoss to JGraph and from JGoodies to Synthetica.

Don't get me wrong - everybody has to eat, and everybody wants to make an extra on top of that. It's just that the marketing shows you only one side of the deal before you get hooked too deep. Karl Marx once said - "Sell a man a fish, he eats for a day, teach a man how to fish, you ruin a wonderful business opportunity". I guess we are seeing an emergence of a new business model in IT world - "Try to sell a man a fish, he goes Googling for free fish, teach a man how to fish, you'll sell him your fishing equipment for the next five years".

The NetBeans look-and-feel competition winners are...

Posted by kirillcool on February 14, 2006 at 12:06 PM | Permalink | Comments (6)

Winners of NetBeans look-and-feel competition have been announced. Needless to say that I have been pleasantly surprised to see that 31 out of 33 winners have used the Substance module for NetBeans to create their entries (I really liked the entry of Cicero Zandona that used the same watermark as the desktop):



All of these have used image-based watermark despite the fact that quite a few other watermarks are available. This makes me wonder - was it only for the competition, or do people really use image-based watermark in day-to-day work?

Thanks to all that have used the Substance module - now i know it works under Linux, Mac and Vista :) Now it's time to give back - help test the release candidate of Substance LAF and all its plugins (including the NetBeans module). In addition, it would be nice to get additional translations for Substance.

An unorthodox approach to logging in application server

Posted by kirillcool on February 09, 2006 at 02:52 PM | Permalink | Comments (3)

A colleague of mine entered our room a couple of days ago and asked me this: can he open a Swing frame from the application server in order to view the request that he got (a pretty big XML string)? Sounds strange, right? So many reasons not do this:
  • What happens with this code in production?
  • Why not use Eclipse debugger, copy the request to XMLSpy and view it there?
  • Why not configure the log level of the specific class to WARNING, copy the message from the app server console (WebLogic 8.1 in this case) and do the above (with XMLSpy)?
And that's not all - after working with application server and writing the back-end functionality, you come to think in certain terms of what is right and what is wrong. You work with the database through the db layer, you don't start threads on your own, you think in XML and web services, you send a message to your dog via JMS (OK, went a little too far :) Of course you expect the full power of J2SE available to you in addition to J2EE stack, you just view the application server as this really powerful cluster with a terminal window attached to it.

After thinking half a minute about this, me and our GUI expert have started to think - perhaps the application server is not allowed to open Swing frames? But why not - it runs on the local machine, it has full access to the file system, it has full access to the DB. Most certainly you need much less permissions to open a frame. Surely if you leave this code in production it will open a few thousand frames (one per each request) and let the machine die happily, but that's not the point. The point is that this technique was suited very well to the particular problem, but it was so unorthodox that it took us quite a few minutes to agree that it should be possible to do.

Eventually it turned out that there was no problem in opening a JFrame from inside an EJB implementation class. A little something to think about... Perhaps a look-and-feel for the EJB 3.0 :)

Breadcrumb bar - from closed source to open source

Posted by kirillcool on February 08, 2006 at 12:43 PM | Permalink | Comments (6)

As mentioned in my previous blog entry, one of the reasons i have started the Flamingo project (release candidate February 13, release February 27, version 1.0 code-named Aoife) was the rather unexpected contribution from the commercial vendor (Rick Jeliffe of Topologi). On one hand, he paid money to his developers to make this component happen (back in 2003, way before Windows Vista integrated this component into Windows Explorer), on the other hand maintaining the code base and coping with look-and-feel issues must have been seen as an additional and unwelcome burden. By deciding to "offshore" it to the open-source community he not only serves his own interests (code maintenance, proper documentation, support for third-party look-and-feels, community coming up with ideas), but also allows the Swing developers to take this ready-to-use component and play with it in their own applications.

So, without further ado, you are welcome to :
  • Go to Flamingo homepage and download the binaries and the source.
  • Go to Substance Flamingo plugin homepage and download the Substance plugin that provides the UI delegates for the breadcrumb bar. You most certainly don't have to because the component looks great (to my taste) under Ocean as well.
  • See the complete documentation along with API walk-through and code samples.
  • Run the WebStart version of Basic look and feel and Substance look and feel. You will have to grant full permissions since it's a file-system explorer (don't worry, it needs a read-only access, that's a promise).
Here's a small introduction to the breadcrumb bar from the Flamingo project. Rick - I hope this is the beginning of the collaboration between your company and the Swing community:)


The BreadcrumbBar in the org.jvnet.flamingo.bcb is a Swing component that provides the breadcrumb bar functionality. The breadcrumb bar is a path of components. Each component has a selector with a popup menu. The breadcrumb bar allows easy navigation in tree-like structures (file system, XML stream) in a limited screen space. The following screenshot illustrates a sample application built with the breadcrumb bar. The application is a Windows Vista-like file explorer.

Breadcrumb Bar parts and functionality overview

The above screenshots illustrates the following parts of the breadcrumb bar:
  • Main icon (optional) - appears in the left part of the bar.
  • Root selector - appears after the main icon.
  • A path of particles with associated selectors.
A particle represents a portion of the currently selected path. For file system, it can be the name of the current directory. For XML file, it can be the name of the current node. A particle has an associated selector. When the selector is selected (using mouse or keyboard), the popup menu containing all possible child particles is shown. When a child particle is selected, it is added to the bar.

In addition, the breadcrumb bar allows easy backwards navigation in the path - use the mouse or the keyboard to select some particle. The path will be updated (the rest of the path is disposed of). A particle can have an associated icon that is shown in both the bar and the popup menu.

The breadcrumb bar provides memory functionality, allowing adding the current path to the memory, going back and forth through the memory paths (the selection is updated automatically), saving the memory to a stream using XML-based format, loading the memory from XML-based stream and clearing the memory.

The breadcrumb bar uses application-supplied callback to retrieve a list of root particles and child particles. In addition, it allows registering a listener on the following events:
  • Path change
  • Memory change
  • Item load




Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds