Class SwingConfigurationManager

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

public final class SwingConfigurationManager extends 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 Details

    • SwingConfigurationManager

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

      Parameters:
      propertyFile - The pathname to the property file.
    • SwingConfigurationManager

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

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

    • applyFocus

      public void applyFocus(Container c, 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(String name, JTextComponent... all) throws 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:
      Exception