com.metamatrix.console.ui.util.property
Class GuiComponentFactory

java.lang.Object
  extended by com.metamatrix.console.ui.util.property.GuiComponentFactory

public class GuiComponentFactory
extends java.lang.Object

The GuiComponentFactory creates JComponents and sets their properties. All JavaBean properties can be set using this class. For example, to create a JButton, the properties file entries could look like this:

     btn=javax.swing.JButton.class
     btn.background=Color.red
     btn.text="Red Button"
     btn.mnemonic='R'
     btn.toolTipText="This is a red button"
 
After the component identifier, in the above example "btn", and after the period separator, the property name is identified starting with a lowercase letter. A PropertyProvider identifies which properties files are searched.

Version:
1.0
Author:
Dan Florian

Field Summary
static java.lang.String SEPARATOR
          The separator used between component ID and property when composing a properties file key.
static java.lang.String TYPE_DEFS_PROP
          The default properties file used in the createTextField(String) method.
static java.lang.String TYPE_PREFIX
          The prefix used to denote data types in property files.
 
Method Summary
static TextFieldWidget createTextField(java.lang.String theType)
          Creates a TextFieldWidget and initializes it by using the given type.
static TextFieldWidget createTextField(java.lang.String theType, PropertyProvider thePropProvider)
          Creates a TextFieldWidget and initializes by using the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

public static final java.lang.String SEPARATOR
The separator used between component ID and property when composing a properties file key. Currently only a period is used.

See Also:
Constant Field Values

TYPE_DEFS_PROP

public static final java.lang.String TYPE_DEFS_PROP
The default properties file used in the createTextField(String) method.

See Also:
Constant Field Values

TYPE_PREFIX

public static final java.lang.String TYPE_PREFIX
The prefix used to denote data types in property files.

See Also:
Constant Field Values
Method Detail

createTextField

public static TextFieldWidget createTextField(java.lang.String theType)
Creates a TextFieldWidget and initializes it by using the given type. If the type is not found by the provider, a default textfield is returned. The default provider is used.

Parameters:
theType - the data type key
Returns:
the newly created TextFieldWidget
Throws:
java.lang.IllegalArgumentException - if input parameter is null
See Also:
createTextField(String, PropertyProvider)

createTextField

public static TextFieldWidget createTextField(java.lang.String theType,
                                              PropertyProvider thePropProvider)
Creates a TextFieldWidget and initializes by using the given type. If the type is not found by the provider, a default textfield is returned. A typical type entry in a properties file would like like this:
     type.heapsize.length.min="1"
     type.heapsize.length.max="4"
     type.heapsize.cols=get("type.heapsize.length.max")
     type.heapsize.required="true"
     type.heapsize.validchars="0-9"
     #type.heapsize.invalidchars=""
 

Parameters:
theType - the data type key
thePropProvider - the provider that determines the file(s) to look at for properties
Returns:
the newly created TextFieldWidget
Throws:
java.lang.IllegalArgumentException - if either input parameter is null


Copyright © 2009. All Rights Reserved.