com.accountingenhancements.layouttools
Class ConvertStringToJComponent

java.lang.Object
  extended by com.accountingenhancements.layouttools.ConvertStringToJComponent

public abstract class ConvertStringToJComponent
extends java.lang.Object

Convert the description of a component into a JComponent.
Used by some of the LayoutFactory methods.
Field names could be database name such as tblEmp.firstName and supportParameters could contain a database connection as well as a HashMap of field settings so that this function could create an appropriate field to support the database field. Used to allow the layout factory to convert a description of a component into the component itself.


Constructor Summary
ConvertStringToJComponent()
          Creates a new instance of ConvertStringToJComponent
 
Method Summary
abstract  javax.swing.JComponent[] getComponentAndLabel(java.lang.String componentName, java.util.ArrayList supportParameters, java.util.ArrayList<javax.swing.JComponent[]> objectList)
          Convert the description of a component into a JComponent.
Note: supportParameters is handed through, untouched, from the GroupLayoutPanelFactory.
 javax.swing.JComponent[] getComponentAndLabelSimple(java.lang.String componentName, java.util.ArrayList<javax.swing.JComponent[]> supportParameters, java.util.ArrayList<javax.swing.JComponent[]> objectList)
          Convert index reference to a component.
This routine returns the JComponents referenced by index numbers that are between the curly brackets.
This is functional code and also is intended as a simple example of what can be done with the above function.
All {x} (where x is a number) references are passed here instead of to the getComponentAndLabel(String, ArrayList) method.
This routine can also limit the size of the JComponent if the component supports setColumns() and parentheses are used after the greater than symbol to indicate field size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertStringToJComponent

public ConvertStringToJComponent()
Creates a new instance of ConvertStringToJComponent

Method Detail

getComponentAndLabel

public abstract javax.swing.JComponent[] getComponentAndLabel(java.lang.String componentName,
                                                              java.util.ArrayList supportParameters,
                                                              java.util.ArrayList<javax.swing.JComponent[]> objectList)
Convert the description of a component into a JComponent.
Note: supportParameters is handed through, untouched, from the GroupLayoutPanelFactory. The GroupLayoutPanelFactory doesn't care what is in this ArrayList. see getComponentAndLabelSimple(String componentName, ArrayList supportParameters) for a simple example.

Parameters:
componentName - the name of the component that the LayoutFactory found in the string
supportParameters - other parameters you passed to the factory so that you have sufficient information to create the components.
Returns:
JComponent[] a JComponent array, size=2, where JComponent[0]=component, and JComponent[1]=JLabel(Description) of component. Set null if not applicable.

getComponentAndLabelSimple

public javax.swing.JComponent[] getComponentAndLabelSimple(java.lang.String componentName,
                                                           java.util.ArrayList<javax.swing.JComponent[]> supportParameters,
                                                           java.util.ArrayList<javax.swing.JComponent[]> objectList)
Convert index reference to a component.
This routine returns the JComponents referenced by index numbers that are between the curly brackets.
This is functional code and also is intended as a simple example of what can be done with the above function.
All {x} (where x is a number) references are passed here instead of to the getComponentAndLabel(String, ArrayList) method.
This routine can also limit the size of the JComponent if the component supports setColumns() and parentheses are used after the greater than symbol to indicate field size. Ex: {1}(15) for field 1 -> setColumns(15)
Example: componentName = "{0}" supportParameters(0)={new JTextField(),new JLabel("TextField)}; will return the array in supportParameters.get(0) Note: Remember that you are handing the JComponent array into the support parameters so code such as:
component[0]=Field_1; component[1]=Label_1; supportParameters.add(component);
component[0]=Field_2; component[1]=Label_2; supportParameters.add(component);
This will cause both entries in supportParameters to be Field_2, Label_2 since supportParameters actually has the object represented by component.
Instead do the following:
component=new JComponent[2]; component[0]=Field_1; component[1]=Label_1; supportParameters.add(component);
component=new JComponent[2]; component[0]=Field_2; component[1]=Label_2; supportParameters.add(component);
Now component has a fresh object for each entry.

Parameters:
componentName - the index of the component array to be returned, surrounded by curly bracket symbols, optionally followed by a field size surrounded by parentheses.
supportParameters - an ArrayList of components and their labels. Component array in index 0, label array in index 1. The labels can be null if not applicable.
Returns:
JComponent[] an array, size=2, where JComponent[0] = the component and JComponent[1] = a label or null