|
NetCharts Pro | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetcharts.pro.util.NFProUtil
public class NFProUtil
Contains a number of utility methods for chart components. These consist of methods to manipulate chart components, convert objects to CDL templates, retrieve and set user objects, perform basic string operations and more.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_DATE_FORMAT
The default data format used when converting Date objects to string. |
static boolean |
dontValidate
Whether or not to verify discrete data when a verification method is called. |
static java.lang.String |
ON
ON. |
Constructor Summary | |
---|---|
NFProUtil()
|
Method Summary | |
---|---|
static java.lang.Object[] |
cdlTuple2ObjectArray(java.lang.String cdl)
Converts an array of string-based input data into an object array. |
static boolean |
checkString(java.lang.String in,
java.lang.String check)
Will check the value of the String against the specified value. |
static boolean |
checkString(java.lang.String in,
java.lang.String check,
boolean ignoreCase)
Will check the value of the String against the specified value. |
static java.util.Date |
convertToDate(java.lang.String[] formats,
java.lang.String value)
Attempt to convert the given string into a Date using the given date formats. |
static java.lang.String |
dataBean2CDL(NFDataBean dataBean)
Produces the CDL representation of the NFDataBean instance. |
static java.lang.String |
dataBean2CDL(NFDataBean dataBean,
java.lang.String param)
Produces the CDL representation of the NFDataBean instance. |
static boolean |
dataBean2KeyValues(NFDataBean dataBean,
java.lang.String param,
java.util.Vector addTo)
Appends to the specified Vector the set of NFKeyValue based parameter definitions that represent the NFDataBean instance. |
static java.lang.String |
dateToCDLString(java.util.Date date,
boolean quote)
Convert the Date to a string suitable for use in CDL. |
static java.lang.Object |
determineValue(java.lang.String value)
This method will return an object of the first available type between Integer, Double and String. |
static void |
enableServerContext()
Sets the rendering engines context to "server-side". |
static java.lang.String |
escapeQuotes(java.lang.String in)
Replaces quotes with the proper html entities. |
static java.lang.String |
escapeQuotes(java.lang.String in,
boolean escapeSingleQuotes)
Replaces quotes with the proper html entities. |
static java.lang.StringBuffer |
filterReader(java.io.Reader r,
java.util.Hashtable filterValues)
|
static java.lang.StringBuffer |
filterStream(java.io.InputStream is,
java.util.Hashtable filterValues)
This method replaces variables in the given input stream with the corresponding variable/value entry in the given hashtable, if one exists. |
static java.lang.StringBuffer |
filterString(java.lang.String s,
java.util.Hashtable filterValues)
|
static java.lang.String |
formatForHtml(java.lang.String in)
HTML encodes the string |
static java.lang.String |
formatForHtml(java.lang.String in,
boolean nltab)
|
static java.lang.String[] |
getAttributeArray(java.lang.String value)
Converts a CDL "tuple" into an array of strings. |
static NFCdf |
getCDLTemplate(java.io.File cdlFile)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile |
static NFCdf |
getCDLTemplate(java.io.File cdlFile,
java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile |
static NFCdf |
getCDLTemplate(java.io.InputStream cdlStream)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream |
static NFCdf |
getCDLTemplate(java.io.InputStream cdlStream,
java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream |
static NFCdf |
getCDLTemplate(java.lang.String cdlString)
Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object. |
static NFCdf |
getCDLTemplate(java.lang.String cdlString,
java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object. |
static NFCdf |
getCDLTemplate(java.net.URL cdlURL)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL |
static NFCdf |
getCDLTemplate(java.net.URL cdlURL,
java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL |
static java.lang.Object |
getDataObject(NFBaseClass base)
Returns the object associated with the NFUserObjectKeys.DATA_KEY key, or null
if there is no associated value. |
static java.lang.Object |
getDataObject(java.lang.String cdl)
Converts the input string into a Double or Date. |
static java.lang.Object |
getDataObject(java.lang.String cdl,
java.lang.String[] dateFormats)
Converts the input string into a Double or Date. |
static java.lang.String |
getQuotedString(java.lang.String string)
This method will return a string with surrounding double quotes. |
static java.lang.Object |
getStyleObject(NFBaseClass base)
Returns the object associated with the NFUserObjectKeys.STYLE_KEY key, or null
if there is no associated value. |
static java.lang.Object |
getStyleObjectData(NFBaseClass base)
Returns the style data of the style object associated with the NFUserObjectKeys.STYLE_KEY key, or null
if there is no associated value. |
static java.lang.String[] |
getTupleArray(java.lang.String value)
Converts a CDL "tuple vectors" into an array of tuple elements. |
static java.lang.Object |
getUserObject(NFBaseClass base)
Returns the user object associated with NFBaseClass instance. |
static java.lang.Object |
getUserObject(NFBaseClass base,
java.lang.String key)
Returns the user object associated with NFBaseClass instance. |
static FillBorder |
makeFillBorder(IFillBorder fb)
Make a FillBorder from a IFillBorder. |
static boolean |
notANull(java.lang.String cdl)
Determines if the CDL element represents a "null" value. |
static java.lang.String |
removeQuotes(java.lang.String string)
This method will remove any preceding and trailing quotes from the String. |
static java.lang.String |
replaceVar(java.lang.String origString,
java.lang.String variable,
java.lang.String newValue,
boolean all)
Replaces the variable string with the replacement value. |
static void |
setDataObject(NFBaseClass base,
java.lang.Object userObject)
Set the object to be associated with the NFUserObjectKeys.DATA_KEY key on the NFBaseClass instance. |
static void |
setStyleObject(NFBaseClass base,
java.lang.Object userObject)
Set the object to be associated with the NFUserObjectKeys.STYLE_KEY key on the NFBaseClass instance. |
static void |
setStyleObjectData(NFBaseClass base,
java.lang.Object data)
Set the data onto the style object associated with the NFUserObjectKeys.STYLE_KEY key on the NFBaseClass instance. |
static void |
setUserObject(NFBaseClass base,
java.lang.Object userObject)
Set the user object on the NFBaseClass instance. |
static void |
setUserObject(NFBaseClass base,
java.lang.Object userObject,
java.lang.String key)
Set the user object within the Map of user objects on the NFBaseClass instance. |
static java.lang.String[] |
splitNameAndSetIndex(java.lang.String itemParam)
Splits a name and set number (e.g. |
static java.lang.String |
trimParens(java.lang.String value)
Removes leading and following parentheses. |
static java.lang.String |
trimQuotes(java.lang.String value)
Removes leading and following quotes. |
static java.lang.String |
userObject2CDL(java.lang.Object userObject)
Produces the CDL representation of the user object instance. |
static java.lang.String |
userObject2CDL(java.lang.Object userObject,
java.lang.String param)
Produces the CDL representation of the user object instance. |
static boolean |
userObject2KeyValues(java.lang.Object userObject,
java.lang.String param,
java.util.Vector addTo)
Appends to the specified Vector the set of NFKeyValue based parameter definitions that represent the user object instance. |
static void |
verifyConstant(java.util.Hashtable hash,
int value,
java.lang.String itemName)
Verify constant value. |
static void |
verifyDiscreteData(java.lang.Object data)
Verify data object. |
static void |
verifyDiscreteData(java.lang.Object data,
java.lang.String[] dateFormats)
Verify data object. |
static void |
verifyNumericData(java.lang.Object data)
Verify the specified data object is a Number or a null. |
static void |
verifyVectorContent(NFVector vector,
java.lang.Class clazz)
Verify vector contents. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String DEFAULT_DATE_FORMAT
public static boolean dontValidate
public static java.lang.String ON
Constructor Detail |
---|
public NFProUtil()
Method Detail |
---|
public static void enableServerContext()
public static java.lang.String[] getTupleArray(java.lang.String value)
value
- A CDL tuple of the form (a, b, c),(d, e, f)
public static java.lang.String[] getAttributeArray(java.lang.String value)
value
- A CDL tuple of the form (a, b, c)
public static java.lang.String trimParens(java.lang.String value)
value
- String value in the form "(a, b, c)"
public static java.lang.String trimQuotes(java.lang.String value)
value
- String value in the form "a, b, c"
a, b, c
public static java.lang.Object getDataObject(java.lang.String cdl)
cdl
- String representation of a double or Date object.
public static java.lang.Object getDataObject(java.lang.String cdl, java.lang.String[] dateFormats)
cdl
- String representation of a double or Date object.dateFormats
- Formats to use to attempt to parse a Date object.
public static java.lang.Object[] cdlTuple2ObjectArray(java.lang.String cdl)
cdl
- Comma delimited string of data.
public static final java.lang.String[] splitNameAndSetIndex(java.lang.String itemParam)
itemParam
- Set name
public static void verifyConstant(java.util.Hashtable hash, int value, java.lang.String itemName)
hash
- Hashtable to check for the constant.value
- The constant that should be in the hashtableitemName
- the name of the item to be included in the exception.public static void verifyVectorContent(NFVector vector, java.lang.Class clazz)
vector
- Vector of objectsclazz
- The class (or superclass) of the objects.public static void verifyDiscreteData(java.lang.Object data)
data
- The data objectpublic static void verifyDiscreteData(java.lang.Object data, java.lang.String[] dateFormats)
data
- The data objectdateFormats
- Formats to use to attempt to parse a Date object.public static void verifyNumericData(java.lang.Object data)
data
- The data objectpublic static NFCdf getCDLTemplate(java.io.File cdlFile)
cdlFile
- A file containing CDL parameters.
public static NFCdf getCDLTemplate(java.io.File cdlFile, java.util.Vector errorVector)
cdlFile
- A file containing CDL parameters.errorVector
- The Vector to contain possible errors.
public static NFCdf getCDLTemplate(java.net.URL cdlURL)
cdlURL
- A URL that returns CDL parameters when called.
public static NFCdf getCDLTemplate(java.net.URL cdlURL, java.util.Vector errorVector)
cdlURL
- A URL that returns CDL parameters when called.errorVector
- The Vector to contain possible errors.
public static NFCdf getCDLTemplate(java.io.InputStream cdlStream)
cdlStream
- An input stream containing CDL parameters.
public static NFCdf getCDLTemplate(java.io.InputStream cdlStream, java.util.Vector errorVector)
cdlStream
- An input stream containing CDL parameters.errorVector
- The Vector to contain possible errors.
public static NFCdf getCDLTemplate(java.lang.String cdlString) throws java.lang.Exception
cdlString
- A string containing CDL parameters.
java.lang.Exception
public static NFCdf getCDLTemplate(java.lang.String cdlString, java.util.Vector errorVector) throws java.lang.Exception
cdlString
- A string containing CDL parameters.errorVector
- The Vector to contain possible errors.
java.lang.Exception
public static java.lang.StringBuffer filterStream(java.io.InputStream is, java.util.Hashtable filterValues) throws java.io.IOException
java.io.IOException
public static java.lang.StringBuffer filterString(java.lang.String s, java.util.Hashtable filterValues) throws java.io.IOException
java.io.IOException
public static java.lang.StringBuffer filterReader(java.io.Reader r, java.util.Hashtable filterValues) throws java.io.IOException
java.io.IOException
public static java.lang.Object getUserObject(NFBaseClass base)
base
- The object containing the user object to retrieve
null
if there is no associated value.public static java.lang.Object getUserObject(NFBaseClass base, java.lang.String key)
null
,
then the user object of the NFBaseClass is expected to implement java.util.Map. And the value associated with
the key within the Map instance will be returned.
base
- The object containing the user object to retrievekey
- The key used to associate the user object
null
if there is no associated value.public static void setUserObject(NFBaseClass base, java.lang.Object userObject)
base
- The NFBaseClass instance on which to set the user objectuserObject
- The user object to setpublic static void setUserObject(NFBaseClass base, java.lang.Object userObject, java.lang.String key)
base
- The NFBaseClass instance on which to set the user objectuserObject
- The user object to setkey
- The key to associate the user object withpublic static void setDataObject(NFBaseClass base, java.lang.Object userObject)
base
- The NFBaseClass instance on which to associate the user objectuserObject
- The user object to associated with the NFUserObjectKeys.DATA_KEY keypublic static java.lang.Object getDataObject(NFBaseClass base)
null
if there is no associated value.
base
- The object containing the user object to retrieve
null
if there is no associated value.public static void setStyleObject(NFBaseClass base, java.lang.Object userObject)
base
- The NFBaseClass instance on which to associate the user objectuserObject
- The user object to associated with the NFUserObjectKeys.STYLE_KEY keypublic static java.lang.Object getStyleObject(NFBaseClass base)
null
if there is no associated value.
base
- The object containing the user object to retrieve
null
if there is no associated value.public static void setStyleObjectData(NFBaseClass base, java.lang.Object data)
base
- The NFBaseClass instance containing the style object to set the data ondata
- The data to set onto the style objectpublic static java.lang.Object getStyleObjectData(NFBaseClass base)
null
if there is no associated value.
base
- The object containing the user object to retrieve
null
if there is no associated value.public static java.lang.String userObject2CDL(java.lang.Object userObject)
userObject
- The user object to convert to CDL
public static java.lang.String userObject2CDL(java.lang.Object userObject, java.lang.String param)
dataBean
- The user object to convert to CDLparam
- The parameter used within the NFDataBean expression
public static boolean userObject2KeyValues(java.lang.Object userObject, java.lang.String param, java.util.Vector addTo)
dataBean
- The user object instance to determine the parameter definitionsparam
- The parameter used within the NFDataBean expressionaddTo
- The Vector to append the parameter definitions to
true
if values were appended, false
otherwise.public static java.lang.String dataBean2CDL(NFDataBean dataBean)
dataBean
- The NFDataBean to convert to CDL
public static java.lang.String dataBean2CDL(NFDataBean dataBean, java.lang.String param)
dataBean
- The NFDataBean to convert to CDLparam
- The parameter used within the NFDataBean expression
public static boolean dataBean2KeyValues(NFDataBean dataBean, java.lang.String param, java.util.Vector addTo)
dataBean
- The NFDataBean instance to determine the parameter definitionsparam
- The parameter used within the NFDataBean expressionaddTo
- The Vector to append the parameter definitions to
true
if values were appended, false
otherwise.public static java.lang.String formatForHtml(java.lang.String in)
in
- The string to encode for HTML.public static java.lang.String formatForHtml(java.lang.String in, boolean nltab)
public static java.lang.String replaceVar(java.lang.String origString, java.lang.String variable, java.lang.String newValue, boolean all)
origString
- The original string containing variable to replace.variable
- The variable to replace.variable
- The value to replace the variable with.all
- Whether or not all variable instances should be replaced.public static java.lang.String escapeQuotes(java.lang.String in, boolean escapeSingleQuotes)
in
- The string to escape quotes in.escapeSingleQuotes
- If true, single quotes are escaped as well.
public static java.lang.String escapeQuotes(java.lang.String in)
in
- The string to escape quotes in.
public static boolean notANull(java.lang.String cdl)
public static java.lang.String removeQuotes(java.lang.String string)
value
-
public static java.lang.String getQuotedString(java.lang.String string)
string
- The String to add double quotes around.
public static boolean checkString(java.lang.String in, java.lang.String check)
in
- The string containing the value to check.check
- The string to check against.
true
if the string matches, false
otherwise.public static boolean checkString(java.lang.String in, java.lang.String check, boolean ignoreCase)
in
- The string containing the value to check.check
- The string to check against.ignoreCase
- Whether or not to ignore case.
true
if the string matches, false
otherwise.public static java.lang.Object determineValue(java.lang.String value)
value
- The value to check.
public static java.lang.String dateToCDLString(java.util.Date date, boolean quote)
quote
- Whether the entire string should be quoted. If set to
true, the formatted date has its double quotes escaped.
public static java.util.Date convertToDate(java.lang.String[] formats, java.lang.String value)
formats
- Formats to use to attempt to parse a Date object.value
- The value to attempt to convert to a Date
public static FillBorder makeFillBorder(IFillBorder fb)
|
NetCharts Pro | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Visual Mining, Inc. | Copyright © Visual Mining, Inc. 1996 - 2011 |
Last Modified: Jun 28, 2011 |