gr.zeus.ui.typesafe
Class SwingConfigurationManager

java.lang.Object
  extended by gr.zeus.ui.typesafe.SwingConfigurationManager

public final class SwingConfigurationManager
extends java.lang.Object

This class is the central point of execution for all the classes inside gr.zeus.ui.typesafe package. Although each class can be used as standalone, the SwingConfigurationManager provides an easy way to configure multiple swing components within many forms via a property file. You can have as many instances of this class as you need, just keep in mind that each instance is attached to a single property file. The property file can also exist inside a ResourceBundle. Aside the constructors the main methods are: applyFocus(), initializes the focus for a container and configComponent(), that configures all the swing components. Property file format example:
customfocustraversalpolicy=true/false
(tagname).(param)=(value)

Note: Due to the internal design of the JFormattedTextField, the TypeSafeTextDocumentFilter is not applied (see Sun's javadocs). Only the Verifier's functionality is applied.

Since:
1.20
Author:
Gregory Kotsaftis

Constructor Summary
SwingConfigurationManager(java.util.ResourceBundle res)
          Constructor, creates the properties from the specified ResourceBundle.
SwingConfigurationManager(java.lang.String propertyFile)
          Constructor, loads the property file from the specified pathname.
 
Method Summary
 void applyFocus(java.awt.Container c, java.awt.Component[] all)
          Apply focus policy to all the components in the array, depending on the component's placement within this array.
 void configComponent(java.lang.String name, javax.swing.text.JTextComponent... all)
          Apply a configuration to one or more components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingConfigurationManager

public SwingConfigurationManager(java.lang.String propertyFile)
Constructor, loads the property file from the specified pathname.

Parameters:
propertyFile - The pathname to the property file.

SwingConfigurationManager

public SwingConfigurationManager(java.util.ResourceBundle res)
Constructor, creates the properties from the specified ResourceBundle.

Parameters:
res - The resource bundle to load the properties from.
Method Detail

applyFocus

public void applyFocus(java.awt.Container c,
                       java.awt.Component[] all)
Apply focus policy to all the components in the array, depending on the component's placement within this array. Also changes the traversal keys for all JTextArea, JTextPane and JEditorPane within this array if the appropriate properties are set in the configuration file.

Parameters:
c - The swing container, e.g. a JFrame.
all - The array with the components.

configComponent

public void configComponent(java.lang.String name,
                            javax.swing.text.JTextComponent... all)
                     throws java.lang.Exception
Apply a configuration to one or more components.

Parameters:
name - The tagname within the property file.
all - One or more components to apply the configuration rule.
Throws:
java.lang.Exception