Overview | Package | Class | Tree | Index | Help NetCharts Pro (Applets) 7.0
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

netcharts.util
Class NFParam

java.lang.Object
  |
  +--java.util.Observable
        |
        +--netcharts.util.NFParam

public class NFParam
The NFParam class provides the user with a convenient mechanism for defining control parameters for one or more other classes. Users can define parameters inside an <applet> tag in an HTML file, within a text file that can be accessed via a URL, or can dynamically define parameters from a network server, via a TCP stream connection, thereby providing dynamic remote control of an object. The following parameter types are supported:


Constructor Summary
NFParam()
          Create a new parameter parser, with no associated applet.
NFParam(java.applet.Applet app)
          Create a new parameter parser.
NFParam(java.applet.Applet app, java.awt.Component comp)
          Create a new parameter parser.
 
Method Summary
void addObserver(java.util.Observer observer)
          Add the given observer to the list of observers for this object.
boolean changed(java.lang.String param)
          Returns true if the parameter has been changed since "get" was last called.
void clean()
          Cleans the parameter database for reuse.
void defineActiveLabel(java.lang.String param)
          Create a parser definition for an ActiveLabel tuple.
int defineActiveLabel(java.lang.String param, java.util.Vector v)
          Append the parser elements for an ActiveLabel to the given vector.
void defineAlias(java.lang.String alias, java.lang.String param)
          Define an alias for param.
NFParamDef defineArrow(java.lang.String param)
          Create a parser definition for a arrow.
int defineArrow(java.lang.String param, java.util.Vector v)
          Append the parameters needed for a line to the given vector.
NFParamDef defineBorderCornerType(java.lang.String param, int type)
          Create a parser definition for border corner type and assign the given type as the default.
NFParamDef defineBorderType(java.lang.String param, int type)
          Create a parser definition for border type and assign the given type as the default.
NFParamDef defineColor(java.lang.String param)
          Define a Color parameter.
NFParamDef defineColor(java.lang.String param, java.awt.Color color)
          Define a Color parameter with the given default color.
void defineColorExpression(java.lang.String param, java.util.Vector v, java.awt.Color defaultColor)
          Create a parser definition for a color expression.
NFParamDef defineDate(java.lang.String param)
          Define a Date parameter.
NFParamDef defineDate(java.lang.String param, java.lang.Object obj)
          Define a Date parameter, with the given default object which may be any of the following types:
  • NFDate
  • NFTimeUnit
  • Number
NFParamDef defineGraphSymbol(java.lang.String param)
          Create a parser definition for a graph symbol.
int defineGraphSymbol(java.lang.String param, java.util.Vector v)
          Append the parameters needed for a graph symbol to the given vector.
NFParamDef defineImage(java.lang.String param)
          Define a Image parameter with the given image URL.
NFParamDef defineImageType(java.lang.String param, int type)
          Create a parser definition for image type and assign the given type as the default.
NFParamDef defineLabel(java.lang.String param)
          Create a parser definition for a label.
NFParamDef defineLabel(java.lang.String param, boolean includeJustify)
          Create a parser definition for a label.
NFParamDef defineLabel(java.lang.String param, boolean includeJustify, boolean includeExternalJustify)
          Create a parser definition for a label.
NFParamDef defineLabel(java.lang.String param, boolean includeAngle, boolean includeJustify, boolean includeExternalJustify)
          Create a parser definition for a label.
NFParamDef defineLabel(java.lang.String param, boolean includeAngle, boolean includeJustify, boolean includeExternalJustify, boolean includeExtend)
          Create a parser definition for a label.
int defineLabel(java.lang.String param, java.util.Vector v)
          Append the parser elements for a label to the given vector.
int defineLabel(java.lang.String param, java.util.Vector v, boolean includeJustify)
          Append the parser elements for a label to the given vector.
int defineLabel(java.lang.String param, java.util.Vector v, boolean includeJustify, boolean includeExternalJustify)
          Append the parser elements for a label to the given vector.
NFParamDef defineLine(java.lang.String param)
          Create a parser definition for a line
int defineLine(java.lang.String param, java.util.Vector v)
          Append the parameters needed for a line to the given vector.
NFParamDef defineLineStyle(java.lang.String param, int defValue)
          Returns a parameter definition for a line style, using the given default value and parameter name.
NFParamDef defineNumber(java.lang.String param)
          Define a Number parameter, with a null initial value.
NFParamDef defineNumber(java.lang.String param, java.lang.Number val)
          Define a Number parameter, with a given initial value.
NFParamDef defineRegion(java.lang.String param)
          Create a parser definition for a background region.
int defineRegion(java.lang.String param, java.util.Vector v)
          Append the parameters needed for a region to the given vector.
NFParamDef defineString(java.lang.String param)
          Define a String parameter, with a null initial value.
NFParamDef defineString(java.lang.String param, java.lang.String val)
          Define a String parameter, with a given initial value.
NFParamDef defineSymbol(java.lang.String param, java.util.Hashtable symtable)
          Define a Symbol parameter, with the given SYMTABLE containing all valid keywords and their associated values.
NFParamDef defineSymbol(java.lang.String param, java.util.Hashtable symtable, java.lang.Object val)
          Define a Symbol parameter, with the given SYMTABLE containing all valid keywords and their associated values.
NFParamDef defineTuple(java.lang.String param, java.util.Vector defs)
          This method defines the parameter as a tuple (one or more elements).
NFParamDef defineTuple(java.lang.String param, java.util.Vector defs, boolean varLength)
          Defines a tuple definition which supports a variable number of items.
void defineVector(java.lang.String param, NFParamDef item)
          Define a vector of values for the given parameter.
static void doEscapes(java.lang.String str, java.lang.StringBuffer buf)
          This method appends the given string to the given string buffer, with all special characters escaped.
boolean exists(java.lang.String param)
          Returns true if the parameter has been defined.
java.lang.Object get(java.lang.String param)
          Returns the value of the given parameter.
double getChartScale()
          Returns the currently defined Chart ScaleFactor value.
java.util.Vector getChildKeys(java.lang.String parentName)
          Return a list of all the parameters defined within a TUPLE or VECTOR.
NFContext getContext()
          Get the context of this NFParam object.
java.util.Enumeration getKeys()
          Returns a list of all the keys in the parameter hashtable
NFParamDef getParamDef(java.lang.String param)
          Get the parameter definition for the named parameter.
java.lang.Object getParamExpr(java.lang.String param)
          Returns the databean (if any) associated with the given parameter.
java.util.Vector getPrimaryKeys(java.util.Vector v)
          Returns a list of keys for the parameters that are *NOT* part of a tuple or vector.
java.util.Enumeration getSymbolKeys(java.lang.String symbolName)
          Returns the possible values for the given symbol.
java.lang.Object getValue(NFParamDef def)
          Get the value of the given parameter definition.
void remove(java.lang.String param)
          Removes the given parameter from the parameter table
void setChanged(java.lang.String param)
          Changes the state of the given parameter to indicate that clients should reread the parameter.
void setContext(NFContext context)
          Set the context of this NParam object.
static void undoEscapes(java.lang.String str, java.lang.StringBuffer buf)
          This method processes the given string and replaces all escape sequences with the appropriate special character and appends it to the string buffer.
void update()
          This method should be called whenever a batch of parameters have been changed in order to notify all of the observers for the current NFParam object.
 

Constructor Detail

NFParam

public NFParam()
Create a new parameter parser, with no associated applet.

NFParam

public NFParam(java.applet.Applet app)
Create a new parameter parser.

NFParam

public NFParam(java.applet.Applet app,
               java.awt.Component comp)
Create a new parameter parser.
Method Detail

setContext

public void setContext(NFContext context)
Set the context of this NParam object. The context is used to resolve paths and store authentication information.
Parameters:
context - The context to set.

getContext

public NFContext getContext()
Get the context of this NFParam object.
Returns:
The current context.

addObserver

public void addObserver(java.util.Observer observer)
Add the given observer to the list of observers for this object. Whenever an "Update" command is parsed, all observers will be notified via their update() method. The specific parameter sent to the observer will be "LoadParams"
Parameters:
observer - The new observer to add.
Overrides:
addObserver in class java.util.Observable

getParamDef

public NFParamDef getParamDef(java.lang.String param)
                                     throws NFParamException
Get the parameter definition for the named parameter.
Parameters:
param - The paramater name.
Returns:
The definition of the given parameter.
Throws:
NFParamException - If there is a parameter error.

getParamExpr

public java.lang.Object getParamExpr(java.lang.String param)
                             throws NFParamException
Returns the databean (if any) associated with the given parameter.
Parameters:
param - The paramater name.
Returns:
The associated DataBean.
Throws:
NFParamException - If there is a parameter error.

exists

public boolean exists(java.lang.String param)
Returns true if the parameter has been defined.
Parameters:
param - The paramater name.
Returns:
true if the parameter exists, false otherwise.

changed

public boolean changed(java.lang.String param)
Returns true if the parameter has been changed since "get" was last called.
Parameters:
param - The paramater name.
Returns:
true if the parameter has been changed, false otherwise.

setChanged

public void setChanged(java.lang.String param)
Changes the state of the given parameter to indicate that clients should reread the parameter.
Parameters:
param - The paramater name.

get

public java.lang.Object get(java.lang.String param)
                    throws NFParamException
Returns the value of the given parameter. An exception is thrown if the parameter is not defined. A null value is returned if the value has not be set.
Parameters:
param - The paramater name.
Returns:
The parameter value.
Throws:
NFParamException - If the parameter is not defined.

remove

public void remove(java.lang.String param)
Removes the given parameter from the parameter table
Parameters:
param - The paramater name.

getKeys

public java.util.Enumeration getKeys()
Returns a list of all the keys in the parameter hashtable
Returns:
All the keys in the parameter database.

getPrimaryKeys

public java.util.Vector getPrimaryKeys(java.util.Vector v)
Returns a list of keys for the parameters that are *NOT* part of a tuple or vector. That is, it returns the list of parameter names that may be used to define a parameter in a parameter script. If the given vector is null, a new one will be created and returned. Otherwise, the parameters will be appended to the given vector.
Parameters:
v - The vector to place the keys into.
Returns:
The primary keys of the parameter database in a vector.

getChildKeys

public java.util.Vector getChildKeys(java.lang.String parentName)
                             throws NFParamException
Return a list of all the parameters defined within a TUPLE or VECTOR.
Parameters:
parentName - The name of the primary key for which the child keys are defined.
Returns:
The child keys of the named parameter in a vector.

getSymbolKeys

public java.util.Enumeration getSymbolKeys(java.lang.String symbolName)
                                   throws NFParamException
Returns the possible values for the given symbol.
Parameters:
The - symbol name.
Returns:
The possible values in a vector.
Throws:
NFParamException - If the symbol does not exist.

doEscapes

public static void doEscapes(java.lang.String str,
                             java.lang.StringBuffer buf)
This method appends the given string to the given string buffer, with all special characters escaped.
Parameters:
str - The string to escape.
buf - The buffer to append the escaped string to.

undoEscapes

public static void undoEscapes(java.lang.String str,
                               java.lang.StringBuffer buf)
This method processes the given string and replaces all escape sequences with the appropriate special character and appends it to the string buffer.
Parameters:
str - The string to unescape.
buf - The buffer to append the unescaped string to.

getValue

public java.lang.Object getValue(NFParamDef def)
Get the value of the given parameter definition.
Parameters:
def - The paramater definition.
Returns:
The parameter value.

update

public void update()
This method should be called whenever a batch of parameters have been changed in order to notify all of the observers for the current NFParam object. Generally, this results in the display being redrawn, using the new parameter values.

defineLabel

public NFParamDef defineLabel(java.lang.String param)
Create a parser definition for a label.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineLabel

public NFParamDef defineLabel(java.lang.String param,
                              boolean includeJustify)
Create a parser definition for a label.
Parameters:
param - The paramater name.
includeJustify - Whether to include the internal justification element.
Returns:
The parameter definition.

defineLabel

public NFParamDef defineLabel(java.lang.String param,
                              boolean includeJustify,
                              boolean includeExternalJustify)
Create a parser definition for a label.
Parameters:
param - The paramater name.
includeJustify - Whether to include the internal justification element.
includeExternalJustify - Whether to include the external justification element.
Returns:
The parameter definition.

defineLabel

public NFParamDef defineLabel(java.lang.String param,
                              boolean includeAngle,
                              boolean includeJustify,
                              boolean includeExternalJustify)
Create a parser definition for a label.
Parameters:
param - The paramater name.
includeAngle - Whether to include the angle element.
includeJustify - Whether to include the internal justification element.
includeExternalJustify - Whether to include the external justification element.
Returns:
The parameter definition.

defineLabel

public NFParamDef defineLabel(java.lang.String param,
                              boolean includeAngle,
                              boolean includeJustify,
                              boolean includeExternalJustify,
                              boolean includeExtend)
Create a parser definition for a label.
Parameters:
param - The paramater name.
includeAngle - Whether to include the angle element.
includeJustify - Whether to include the internal justification element.
includeExternalJustify - Whether to include the external justification element.
includeExtend - Whether to include the extend element.
Returns:
The parameter definition.

defineLabel

public int defineLabel(java.lang.String param,
                       java.util.Vector v)
Append the parser elements for a label to the given vector. This method returns the number of elements appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
Returns:
The number of attributes used in a label tuple.

defineLabel

public int defineLabel(java.lang.String param,
                       java.util.Vector v,
                       boolean includeJustify)
Append the parser elements for a label to the given vector. This method returns the number of elements appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
includeJustify - Whether to include the internal justification element.
Returns:
The number of attributes used in a label tuple.

defineLabel

public int defineLabel(java.lang.String param,
                       java.util.Vector v,
                       boolean includeJustify,
                       boolean includeExternalJustify)
Append the parser elements for a label to the given vector. This method returns the number of elements appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
includeJustify - Whether to include the internal justification element.
includeExternalJustify - Whether to include the external justification element.
Returns:
The number of attributes used in a label tuple.

defineColorExpression

public void defineColorExpression(java.lang.String param,
                                  java.util.Vector v,
                                  java.awt.Color defaultColor)
Create a parser definition for a color expression.
Parameters:
param - The parameter name.
v - The current tuple definition.
defaultColor -  

defineRegion

public NFParamDef defineRegion(java.lang.String param)
Create a parser definition for a background region.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineRegion

public int defineRegion(java.lang.String param,
                        java.util.Vector v)
Append the parameters needed for a region to the given vector. This method returns the number of parameters appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
Returns:
The number of attributes used in a region tuple.

defineActiveLabel

public void defineActiveLabel(java.lang.String param)
Create a parser definition for an ActiveLabel tuple.
Parameters:
param - The paramater name.

defineActiveLabel

public int defineActiveLabel(java.lang.String param,
                             java.util.Vector v)
Append the parser elements for an ActiveLabel to the given vector. This method returns the number of elements appended.
Parameters:
v - The current tuple definition.
param - The paramater name.
Returns:
The number of attributes used in an active label tuple.

defineString

public NFParamDef defineString(java.lang.String param)
Define a String parameter, with a null initial value.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineString

public NFParamDef defineString(java.lang.String param,
                               java.lang.String val)
Define a String parameter, with a given initial value.
Parameters:
param - The paramater name.
val - The initial paramater value.
Returns:
The parameter definition.

defineNumber

public NFParamDef defineNumber(java.lang.String param)
Define a Number parameter, with a null initial value.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineNumber

public NFParamDef defineNumber(java.lang.String param,
                               java.lang.Number val)
Define a Number parameter, with a given initial value.
Parameters:
val - The initial paramater value.
param - The paramater name.
Returns:
The parameter definition.

defineColor

public NFParamDef defineColor(java.lang.String param)
Define a Color parameter. The default value is WHITE.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineColor

public NFParamDef defineColor(java.lang.String param,
                              java.awt.Color color)
Define a Color parameter with the given default color.
Parameters:
color - The initial paramater value.
param - The paramater name.
Returns:
The parameter definition.

defineSymbol

public NFParamDef defineSymbol(java.lang.String param,
                               java.util.Hashtable symtable)
Define a Symbol parameter, with the given SYMTABLE containing all valid keywords and their associated values. The initial value is set to null.
Parameters:
param - The paramater name.
symtable - The symbol mappings.
Returns:
The parameter definition.

defineSymbol

public NFParamDef defineSymbol(java.lang.String param,
                               java.util.Hashtable symtable,
                               java.lang.Object val)
Define a Symbol parameter, with the given SYMTABLE containing all valid keywords and their associated values. Use VAL as the initial value.
Parameters:
param - The paramater name.
symtable - The symbol mappings.
val - The initial paramater value.
Returns:
The parameter definition.

defineTuple

public NFParamDef defineTuple(java.lang.String param,
                              java.util.Vector defs)
This method defines the parameter as a tuple (one or more elements). The <defs> vector should contain a NFParamDef object for each of the elements in the tuple. For example, the following code: defines a three-element tuple for the "Fred" parameter, in which the first element is a String, the second is a Number and the third is a Symbol, with an empty symbol table. When parsed, the tuple elements may be separated by whitespace or commas. Leading and trailing parenthesis are optional, except when a tuple is contained within a vector, then they are mandatory.
Parameters:
param - The paramater name.
defs - The tuple's child definitions.
Returns:
The parameter definition.

defineTuple

public NFParamDef defineTuple(java.lang.String param,
                              java.util.Vector defs,
                              boolean varLength)
Defines a tuple definition which supports a variable number of items. When defining attributes, the user can specify more items than the number of attribute definitions defined in the defs vector. In such cases, the last item definition is re-used for the extra items.
Parameters:
param - The paramater name.
defs - The tuple's child definitions.
varLength - Whether the tuple is variable length.
Returns:
The parameter definition.

defineVector

public void defineVector(java.lang.String param,
                         NFParamDef item)
Define a vector of values for the given parameter. When this parameter is parsed, one or more values can be defined separated by commas. The definition for each item is defined by the <item> parameter. For example, the following code: defines a vector for the "Fred" parameter, in which each element is a two-item tuple, containing a String and a Number. The following code: defines a vector of String items named "Sally".
Parameters:
param - The paramater name.
item - The paramater definition.

defineAlias

public void defineAlias(java.lang.String alias,
                        java.lang.String param)
Define an alias for param.
Parameters:
alias - The name of the alias.
param - The name of the parameter to alias.

defineImage

public NFParamDef defineImage(java.lang.String param)
Define a Image parameter with the given image URL.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineDate

public NFParamDef defineDate(java.lang.String param)
Define a Date parameter.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineDate

public NFParamDef defineDate(java.lang.String param,
                             java.lang.Object obj)
Define a Date parameter, with the given default object which may be any of the following types:
Parameters:
param - The paramater name.
obj - The initial paramater value.
Returns:
The parameter definition.

defineBorderType

public NFParamDef defineBorderType(java.lang.String param,
                                   int type)
Create a parser definition for border type and assign the given type as the default.
Parameters:
param - The paramater name.
type - The initial paramater value.
Returns:
The parameter definition.

defineBorderCornerType

public NFParamDef defineBorderCornerType(java.lang.String param,
                                         int type)
Create a parser definition for border corner type and assign the given type as the default.
Parameters:
param - The paramater name.
type - The initial paramater value.
Returns:
The parameter definition.

defineImageType

public NFParamDef defineImageType(java.lang.String param,
                                  int type)
Create a parser definition for image type and assign the given type as the default.
Parameters:
param - The paramater name.
type - The initial paramater value.
Returns:
The parameter definition.

defineGraphSymbol

public NFParamDef defineGraphSymbol(java.lang.String param)
Create a parser definition for a graph symbol.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineGraphSymbol

public int defineGraphSymbol(java.lang.String param,
                             java.util.Vector v)
Append the parameters needed for a graph symbol to the given vector. This method returns the number of parameters appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
Returns:
The number of attributes used in a graph symbol tuple.

defineLine

public NFParamDef defineLine(java.lang.String param)
Create a parser definition for a line
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineLine

public int defineLine(java.lang.String param,
                      java.util.Vector v)
Append the parameters needed for a line to the given vector. This method returns the number of parameters appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
Returns:
The number of attributes used in a line tuple.

defineLineStyle

public NFParamDef defineLineStyle(java.lang.String param,
                                  int defValue)
Returns a parameter definition for a line style, using the given default value and parameter name.
Parameters:
param - The paramater name.
defValue - The initial paramater value.
Returns:
The parameter definition.

defineArrow

public NFParamDef defineArrow(java.lang.String param)
Create a parser definition for a arrow.
Parameters:
param - The paramater name.
Returns:
The parameter definition.

defineArrow

public int defineArrow(java.lang.String param,
                       java.util.Vector v)
Append the parameters needed for a line to the given vector. This method returns the number of parameters appended.
Parameters:
param - The paramater name.
v - The current tuple definition.
Returns:
The number of attributes used in an arrow tuple.

getChartScale

public double getChartScale()
Returns the currently defined Chart ScaleFactor value. If ScaleFactor is not defined, 0.0 is returned.
Returns:
The current scaling factor.

clean

public void clean()
Cleans the parameter database for reuse.

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD


Visual Mining, Inc.
2099 Gaither Grove Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2010
All Rights Reserved.

NetCharts ProTM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 29, 2010