GUI Commands 2.0 has arrived! Find out what's new and improved.

GUI Commands 2.0 Has Arrived!

GUI Commands 2.0 is a major improvement on this version. Some of improvements are:

  • No more XML - All properties are loaded using standard Java ResourceBundles. This has greatly simplifying internationalization and made the configuration files far less verbose.
  • CommandContainers - In the original version the CommandManager had too many responsibilities. This has now been spit into separate configuration loading, command container and settings components.
  • Binding - the new version supports dynamic binding between commands and their containers. Whereas previously you needed to provide the command manager (in its container role) on construction, they are now found at runtime based on the component hierarchy. There is now no difference between developing a single or multiple frame application.
  • New Group Implementation - CommandGroups have been re implemented and now provide builder interfaces for runtime construction and modification. The new builder APIs make dynamic menu and toolbar generation extremely easy.
  • Delegates - Delegating commands have been completely revamped, are simpler to use, and have many bug fixes.
  • Glasspane Integration - The new command container architecture has allowed for very simple integration of swing workers and glasspane functionality.
Where to now?
This project provides a generic command pattern for Swing GUIs. This project came about after reading the following JavaOne presentations (JDC registration required for viewing).

Features

  • Commands are decoupled from Swing in that they implement a standard public void execute() that can be called without the need of an ActionEvent. This facilitates the use of commands in macros and scripts.
  • The CommandListener interface allows interested parties to be notified when a command is fired (both before and after).
  • Commands are factories for the creation of buttons and menus. Eg myCommand.createButton()
  • All attributes for buttons/menus are configured using xml.
  • The same command can have a different appearance (face) depending on the context in which it is used, ie the button icon can be different from menu icon etc.
  • Standard faces are provided for button, menu, toolbar and html. Other faces can be defined at will.
  • All buttons/menus etc are produced using Factories allowing the easy use of custom button implementations.
  • CommandGroups allow the creation of menu items, popup menus, toolbars, toggle buttons (with drop down menus) consisting of other commands (and/or groups).
  • Groups can add other groups either as sub menus, or as 'inline' members. Inline members are added at the current group level and not as a sub menu.
  • Groups can be programatically modified at runtime with all buttons/menus being updated appropriately. Any changes made to the group can reset back to the default. This is useful for having dynamic menus build on top of a standard base menu.
  • It is possible to specify the "expansion point" for groups. Any new groups members added at runtime will be added at the position of the expansion point.
  • The expansion point intelligently includes separators as required.
  • Toggle commands and toggle groups are implemented.
  • Toggle commands produce JCheckboxMenuItems when used alone and JRadioButtonMenuItems when part of an exclusive group.
  • Toggle commands can veto a selection/deselection request when standalone or part of an exclusive group.
  • A hint mechanism is provided to allow "once off" parameters to be passed to a command on execution. All hints are automatically cleared after execution.
  • Commands are highly customizable and can control any aspect of the buttons it produces (for example commands have a visible property, setting it to false hides all buttons that the command creates).
  • Command loading is a callback scheme with a default implementation, subclasses can override to implement custom features.
  • A simple CommandHyperlinkListener allows commands to be embeded in HTML (JEditorPane) and executed when clicked. The listener provides static method for producing the URL and allows for hints to be specified.
  • Faces can extend another face. Eg <face name='button' extends='my-command[button]'>
  • Faces can be defined in a global <face-defs> section and shared by multiple commands.
  • Supports Undoable/Redoable Commands.
  • Supports Delegating Commands, also often called targetable commands.

GUI Commands now provides built-in support for the Mac.  This includes the following: