public class DBUIUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_FIELDS |
static java.lang.String |
NO_NAME |
Constructor and Description |
---|
DBUIUtils() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Document |
convertXMLStr2DOM(java.lang.String aXMLStr)
Convert/Parses an XML string into a DOM tree
|
static void |
fillFieldCombobox(DSSchemaIFace aSchema,
java.lang.String aTableName,
javax.swing.JComboBox aCBX,
boolean aInclAstrick)
Helper method to fill combobox with the list of field names from a
"named" table schema
|
static void |
fillTableCombobox(DSSchemaIFace aSchema,
javax.swing.JComboBox aCBX)
Helper method to fill combobox with the list of table names from the
schema
|
static java.lang.String |
findAttrValue(org.w3c.dom.Node aNode,
java.lang.String aAttr)
------------------------------------------------------------ Gets an
attribute value for the node.
|
static java.lang.String |
findAttrValueForNode(org.w3c.dom.Node aNode,
java.lang.String aName,
java.lang.String aAttr)
------------------------------------------------------------ Gets an
attribute value for the named node.
|
static org.w3c.dom.Node |
findNode(org.w3c.dom.Node aNode,
java.lang.String aName)
------------------------------------------------------------ Finds the
first node of a given type
|
static java.lang.String |
findNodeValue(org.w3c.dom.Node aNode,
java.lang.String aName)
------------------------------------------------------------ Gets the
value of the named node
|
static java.lang.String |
fixNameWithSpaces(java.lang.String aName)
Add brackets around names with spaces
|
static DSTableFieldIFace |
getFieldByName(DSSchemaIFace aSchema,
java.lang.String aTableName,
java.lang.String aFieldName)
Returns a DBTableField object by name
|
static DSTableFieldIFace |
getFieldByName(DSTableIFace aTable,
java.lang.String aName)
Returns a DBTableField object by name
|
static java.lang.String |
getFullFieldName(DBTableField aField)
Returns the full table name/field name concatenated
|
static java.lang.String |
getFullFieldName(java.lang.String aTblName,
java.lang.String aFieldName)
Returns the full table name/field name concatenated
|
static int |
getIntAttrId(org.w3c.dom.Node aNode,
java.lang.String aAttrName)
Looks up the attr and returns the int of it or returns -1
|
static java.lang.String |
getNodeValue(org.w3c.dom.Node aNode)
------------------------------------------------------------ Gets the
String value of a node.
|
static java.lang.String |
getSpaces(int aDepth)
Returns the desired number of spaces for the depth (usually *2)
|
protected static DSTableIFace |
getTableByName(DSSchemaIFace aSchema,
java.lang.String aName)
Returns a table by name
|
static DSTableFieldIFace |
isTableFieldName(DSSchemaIFace aSchema,
java.lang.String aName,
java.lang.StringBuffer aTableName)
Returns true if the name is of format "table name"."
|
static void |
printNode(org.w3c.dom.Node aNode,
int aLevel)
Prints a DOM Tree (recursive)
|
static org.w3c.dom.Document |
readXMLFile2DOM(java.lang.String aFileName)
Reads in an XML document and returns the Document node of the DOM tree
|
static java.lang.String |
readXMLFile2Str(java.lang.String aFileName)
Reads in an XML document and returns a String of the file's contents
|
public static final java.lang.String ALL_FIELDS
public static final java.lang.String NO_NAME
public DBUIUtils()
public static void fillFieldCombobox(DSSchemaIFace aSchema, java.lang.String aTableName, javax.swing.JComboBox aCBX, boolean aInclAstrick)
aSchema
- the schemaaTableName
- the table name in the schemaaCBX
- the comboxboxaInclAstrick
- if the table schema includes a field with an astrick "*" then
include it alsopublic static void fillTableCombobox(DSSchemaIFace aSchema, javax.swing.JComboBox aCBX)
aSchema
- the schemaaCBX
- the comboxboxpublic static java.lang.String fixNameWithSpaces(java.lang.String aName)
aName
- the name to be changedpublic static java.lang.String getFullFieldName(DBTableField aField)
aField
- object for which to get the namespublic static java.lang.String getFullFieldName(java.lang.String aTblName, java.lang.String aFieldName)
aTblName
- the table nameaFieldName
- the field nameprotected static DSTableIFace getTableByName(DSSchemaIFace aSchema, java.lang.String aName)
aName
- name of table to be foundpublic static DSTableFieldIFace getFieldByName(DSTableIFace aTable, java.lang.String aName)
aTable
- table to look intoaName
- name of field to be foundpublic static DSTableFieldIFace getFieldByName(DSSchemaIFace aSchema, java.lang.String aTableName, java.lang.String aFieldName)
aSchema
- schemaaTableName
- table name to look intoaFieldName
- name of field to be foundpublic static DSTableFieldIFace isTableFieldName(DSSchemaIFace aSchema, java.lang.String aName, java.lang.StringBuffer aTableName)
aSchema
- schemaaName
- the full nameaTableName
- can be null, or a stringbuffer that will return the name of
the tablepublic static java.lang.String getSpaces(int aDepth)
aDepth
- the depthpublic static java.lang.String getNodeValue(org.w3c.dom.Node aNode)
aNode
- Parent to search (should be the document root)public static org.w3c.dom.Node findNode(org.w3c.dom.Node aNode, java.lang.String aName)
aNode
- Parent to search (should be the document root)aName
- Name of node to findpublic static java.lang.String findNodeValue(org.w3c.dom.Node aNode, java.lang.String aName)
aNode
- Parent to search (should be the document root)aName
- Name of node to findpublic static java.lang.String findAttrValueForNode(org.w3c.dom.Node aNode, java.lang.String aName, java.lang.String aAttr)
aNode
- Parent to search (should be the document root)aName
- Name of node to findaAttr
- Name of attribute to returnpublic static java.lang.String findAttrValue(org.w3c.dom.Node aNode, java.lang.String aAttr)
aNode
- Parent to search (should be the document root)aAttr
- Name of attribute to returnpublic static int getIntAttrId(org.w3c.dom.Node aNode, java.lang.String aAttrName)
aNode
- the node with the attrpublic static void printNode(org.w3c.dom.Node aNode, int aLevel)
aNode
- parent node of tree to be printedaLevel
- indicates the current indentation levelpublic static java.lang.String readXMLFile2Str(java.lang.String aFileName)
aFileName
- file name of XML file to be readpublic static org.w3c.dom.Document readXMLFile2DOM(java.lang.String aFileName)
aFileName
- file name of XML file to be readpublic static org.w3c.dom.Document convertXMLStr2DOM(java.lang.String aXMLStr)
aXMLStr
- XML string (document)