public class FormBuilder
extends java.lang.Object
| Constructor and Description |
|---|
FormBuilder(java.lang.String xmlFile)
Create new instance of the formBuilder class.
|
FormBuilder(java.lang.String xmlFile,
DataAccess da)
Create new instance of the formBuilder class.
|
| Modifier and Type | Method and Description |
|---|---|
int |
buildForm(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int pY,
int wkspcId)
Build form on a specified panel.
|
int |
buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
int w_id)
Builds a form from a query into the DATADICTIONARY table.
|
int |
buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
int posY,
int w_id)
Builds a form from a query into the DATADICTIONARY table.
|
int |
buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int w_id)
Builds a form from a query into the DATADICTIONARY table.
|
int |
buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int posY,
int w_id)
Builds a form from a query into the DATADICTIONARY table.
|
int |
buildFormFromXml(javax.swing.JPanel container)
Builds a form based on the parameters found in the loaded XML file.
|
void |
clearForm(javax.swing.JPanel panel)
Clears all the generated text input fields by setting their value to an empty string.
|
java.lang.String |
generateSqlInsert(java.sql.ResultSet data,
javax.swing.JPanel container)
Calls generateSqlInsert without any specified Workspace id.
|
java.lang.String |
generateSqlInsert(java.sql.ResultSet data,
javax.swing.JPanel container,
java.lang.String workspaces_id)
Generates an SQL insert statement from the information provided in the given JPanel container.
|
java.lang.String |
generateSqlUpdate(java.sql.ResultSet data,
javax.swing.JPanel container,
java.lang.String id)
Generates an SQL update statement from the information provided in the given JPanel container.
|
DataAccess |
getDataAccess()
Data access getter.
|
java.lang.String[] |
getTagNames()
Returns the tag names for all children off the root XML node.
|
org.w3c.dom.NodeList |
getXmlData(java.lang.String key)
Requires that the XML file be loaded and the root element set.
|
java.lang.String[] |
getXmlData(java.lang.String[] keys)
Get values from XmlDocument for a set of given keys.
|
java.lang.String[] |
getXmlData(java.lang.String[] keys,
java.lang.String xmlFile)
Get values from an XmlDocument for a set of given keys.
|
org.w3c.dom.NodeList |
getXmlData(java.lang.String key,
java.lang.String xmlFile)
Returns a NodeList of all the entries in the XML file that match the given key.
|
static java.lang.String[] |
getXmlDataStatic(java.lang.String[] keys,
java.lang.String xmlFile)
Get values from an XmlDocument for a set of given keys.
|
static org.w3c.dom.NodeList |
getXmlDataStatic(java.lang.String key,
java.lang.String xmlFile)
Returns a NodeList of all the entries in the XML file that match the given key.
|
static void |
increasePanelHeight(javax.swing.JPanel container,
int posY)
Increases panel height based on position of last control.
|
static void |
increasePanelWidth(javax.swing.JPanel container,
int posX,
int width)
Increases panel width based on size and position of a control.
|
void |
setDataAccess(DataAccess da)
Data access setter.
|
java.lang.String |
validateFormSql(java.sql.ResultSet data,
javax.swing.JPanel container)
Check the fields of a form against validation
specifications in the Data Dictionary.
|
boolean |
writeSettings(javax.swing.JPanel panel)
Writes the values in the given JPanel container to the XML structure loaded
from the configuration file.
|
boolean |
writeSettings(javax.swing.JPanel panel,
java.lang.String xmlFile)
Writes the setting contents of the given JPanel to the specified XML configuration file.
|
public FormBuilder(java.lang.String xmlFile,
DataAccess da)
xmlFile - XmlDocument File path. Create fields for the Document and the root Element.da - dataAccess class for database queries.DataAccesspublic FormBuilder(java.lang.String xmlFile)
xmlFile - XmlDocument File path. Create fields for the Document and the root Element.DataAccesspublic DataAccess getDataAccess()
DataAccesspublic void setDataAccess(DataAccess da)
da - Sets the dataAccess class used by this form builder.DataAccesspublic org.w3c.dom.NodeList getXmlData(java.lang.String key,
java.lang.String xmlFile)
key - An XML key to find data for.xmlFile - An XML file to parse for the specified key.public static org.w3c.dom.NodeList getXmlDataStatic(java.lang.String key,
java.lang.String xmlFile)
key - An XML key to find data for.xmlFile - An XML file to parse for the specified key.public org.w3c.dom.NodeList getXmlData(java.lang.String key)
key - An XML key to find data for.public void clearForm(javax.swing.JPanel panel)
panel - The panel to clear.public boolean writeSettings(javax.swing.JPanel panel,
java.lang.String xmlFile)
panel - The JPanel that has all the XML configuration settings. JPanel should be auto generated from a buildForm method call.xmlFile - The target XML configuration file used to save the configuration info, defaults to config.xml.public boolean writeSettings(javax.swing.JPanel panel)
panel - A JPanel container that has text fields and text areas with the data to be saved in the XML configuration file.public java.lang.String[] getXmlData(java.lang.String[] keys,
java.lang.String xmlFile)
keys - Array of keys to look up.xmlFile - XmlDocument File path.public static java.lang.String[] getXmlDataStatic(java.lang.String[] keys,
java.lang.String xmlFile)
keys - Array of keys to look up.xmlFile - XmlDocument File path.public java.lang.String[] getTagNames()
public java.lang.String[] getXmlData(java.lang.String[] keys)
keys - Array of keys to look up.public java.lang.String generateSqlInsert(java.sql.ResultSet data,
javax.swing.JPanel container)
data - The original data result set that was used to populate the JPanel form.container - The JPanel that contains information to generate SQL insert for.public java.lang.String generateSqlInsert(java.sql.ResultSet data,
javax.swing.JPanel container,
java.lang.String workspaces_id)
throws java.lang.Exception
data - Dataset containing table schema for target table.container - Form containing fields to add as new DB row.workspaces_id - Workspace id to use as SELECT filter.java.lang.Exception - Throws generic exception.public java.lang.String generateSqlUpdate(java.sql.ResultSet data,
javax.swing.JPanel container,
java.lang.String id)
throws java.lang.Exception
data - Dataset containing table schema for target table.container - Form containing fields to add as new DB row.id - Row ID used to specify which row to update.java.lang.Exception - Throws generic exception.public java.lang.String validateFormSql(java.sql.ResultSet data,
javax.swing.JPanel container)
data - SQL query results containing validation data from DataDictionary.container - Form to validate.public int buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
int w_id)
data - A result set from the database, specifically from the DATADICTIONARY table.container - The JPanel container that will store the generated form.w_id - The current workspace id.public int buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int w_id)
data - A result set from the database, specifically from the DATADICTIONARY table.container - The JPanel container that will store the generated form.vals - A set of values used to populate the generate form fields.w_id - The current workspace id.public int buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int posY,
int w_id)
data - A result set from the database, specifically from the DATADICTIONARY table.container - The JPanel container that will store the generated form.vals - A set of values used to populate the generate form fields.posY - Y position, relative to container top, of first form field.w_id - The current workspace id.public int buildFormFromSql(java.sql.ResultSet data,
javax.swing.JPanel container,
int posY,
int w_id)
data - A result set from the database, specifically from the DATADICTIONARY table.container - The JPanel container that will store the generated form.posY - Y position, relative to container top, of first form field.w_id - The current workspace id.public static void increasePanelWidth(javax.swing.JPanel container,
int posX,
int width)
container - Panel to resize.posX - X position of control.width - Width of control.public static void increasePanelHeight(javax.swing.JPanel container,
int posY)
container - Panel to resize.posY - Y position of last control.public int buildForm(java.sql.ResultSet data,
javax.swing.JPanel container,
java.sql.ResultSet vals,
int pY,
int wkspcId)
throws java.lang.Exception
data - Set of input fields and field attributes for the form.container - Places form fields inside this panel.vals - Set of strings to populate any text fields that already have existing values.pY - Y position, relative to container top, of first form field.wkspcId - The current workspace id.java.lang.Exception - Throws generic exception.public int buildFormFromXml(javax.swing.JPanel container)
container - Places form fields inside this panel.