Java Doc for Parameter.java in  » Report » datavision-1.1.0 » jimm » datavision » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » datavision 1.1.0 » jimm.datavision 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Observable
      jimm.datavision.Parameter

Parameter
public class Parameter extends Observable implements Identity,Nameable,Writeable,Draggable,Cloneable(Code)
A parameter is a piece of data the value of which is determined by asking the user each time a report runs. Default values are only used when asking the user for values, not when generating values in getValue.

I started out with subclasses for each type of parameter. The problem is, the user gets to pick what kind of data the parameter holds and that type can be changed any time after the parameter gets created. Therefore, we hold objects and change our output based on the type of the data.
author:
   Jim Menard, jimm@io.com



Field Summary
final public static  intARITY_LIST_MULTIPLE
    
final public static  intARITY_LIST_SINGLE
    
final public static  intARITY_ONE
    
final public static  intARITY_RANGE
    
final public static  intTYPE_BOOLEAN
    
final public static  intTYPE_DATE
    
final public static  intTYPE_NUMERIC
    
final public static  intTYPE_STRING
    
protected  intarity
    
protected  ArrayListdefaultValues
    
protected static  SimpleDateFormatformatter
    
protected  Longid
    
protected  Stringname
    
protected static  ParsePositionparsePosition
    
protected  Stringquestion
    
protected  Reportreport
    
protected  inttype
    
protected  ArrayListvalues
    

Constructor Summary
public  Parameter(Long id, Report report)
     Constructor.
public  Parameter(Long id, Report report, String typeName, String name, String question, String arityString)
     Constructor.

If id is null, generates a new id number.

public  Parameter(Long id, Report report, int type, String name, String question, int arity)
     Constructor.

If id is null, generates a new id number.


Method Summary
public  voidaddDefaultValue(Object newDefaultValue)
     Adds a default value to the list.
public  voidaddValue(Object newValue)
     Adds a value to the list.
public  Objectclone()
    
protected  ObjectconvertType(Object val)
     Converts the specified object to the proper type for this parameter.
public  IteratordefaultValues()
     Returns an iterator over the default values for this parameter.
public  StringdesignLabel()
    
public  StringdragString()
    
public  StringformulaString()
    
public  intgetArity()
     Returns the arity of this field.
public  ObjectgetDefaultForType(int type)
     Returns the default value for a specific parameter type.
public  ObjectgetDefaultValue(int i)
     Returns the i'th defaultValue for this parameter.
public  ObjectgetId()
    
public  StringgetName()
     Returns the name for this parameter.
public  StringgetQuestion()
     Returns the question for this parameter.
public  intgetType()
     Returns the type of this field.
public  ObjectgetValue()
     Returns the parameter value(s) the user has previously specified.
public  ObjectgetValue(int i)
     Returns the current value or, if that is null, the default value.
public  booleanisLegal(int aType, int anArity)
     Returns true if the specified combination of type and arity are legal.
public  voidremoveDefaultValues()
     Erases all default values.
public  voidremoveValues()
     Erases all values.
public  voidsetArity(int newArity)
     Sets the parameter arity.
public  voidsetDefaultValue(int i, Object newDefaultValue)
     Sets the i'th defaultValue.
public  voidsetName(String newName)
     Sets the name.
public  voidsetQuestion(String newQuestion)
     Sets the question.
public  voidsetType(int newType)
     Sets the parameter type.
public  voidsetValue(int i, Object newValue)
     Sets the i'th value.
public  StringtoString()
    
protected  StringtypeString()
     Returns the string used as the "type" attribute when writing this parameter as XML.
public  Iteratorvalues()
     Returns an iterator over the values for this parameter.
public  voidwriteXML(XMLWriter out)
     Writes this parameter as an XML tag.

Field Detail
ARITY_LIST_MULTIPLE
final public static int ARITY_LIST_MULTIPLE(Code)



ARITY_LIST_SINGLE
final public static int ARITY_LIST_SINGLE(Code)



ARITY_ONE
final public static int ARITY_ONE(Code)



ARITY_RANGE
final public static int ARITY_RANGE(Code)



TYPE_BOOLEAN
final public static int TYPE_BOOLEAN(Code)



TYPE_DATE
final public static int TYPE_DATE(Code)



TYPE_NUMERIC
final public static int TYPE_NUMERIC(Code)



TYPE_STRING
final public static int TYPE_STRING(Code)



arity
protected int arity(Code)



defaultValues
protected ArrayList defaultValues(Code)



formatter
protected static SimpleDateFormat formatter(Code)



id
protected Long id(Code)



name
protected String name(Code)



parsePosition
protected static ParsePosition parsePosition(Code)



question
protected String question(Code)



report
protected Report report(Code)



type
protected int type(Code)



values
protected ArrayList values(Code)




Constructor Detail
Parameter
public Parameter(Long id, Report report)(Code)
Constructor. Creates a string parameter with no name or question string.
Parameters:
  id - the unique identifier for the new parameter; ifnull, generate a new id
Parameters:
  report - the report in which this parameter resides



Parameter
public Parameter(Long id, Report report, String typeName, String name, String question, String arityString)(Code)
Constructor.

If id is null, generates a new id number. This number is one higher than any previously-seen id number. This does not guarantee that no later parameter will be created manually with the same id number.
Parameters:
  id - the unique identifier for the new parameter; ifnull, generate a new id
Parameters:
  report - the report in which this parameter resides
Parameters:
  typeName - one of "string", "numeric", or "date"; found in report XML
Parameters:
  name - the name of this parameter
Parameters:
  question - the question to ask when getting the parameter's valuefrom the user
Parameters:
  arityString - arity (single, range, list) as a string




Parameter
public Parameter(Long id, Report report, int type, String name, String question, int arity)(Code)
Constructor.

If id is null, generates a new id number. This number is one higher than any previously-seen id number. This does not guarantee that no later parameter will be created manually with the same id number.
Parameters:
  id - the unique identifier for the new parameter; ifnull, generate a new id
Parameters:
  report - the report in which this parameter resides
Parameters:
  type - one ofTYPE_BOOLEAN, TYPE_STRING,TYPE_NUMERIC, or TYPE_DATE
Parameters:
  name - the name of this parameter
Parameters:
  question - the name of this parameter
Parameters:
  arity - one of ARITY_ONE, ARITY_RANGE,ARITY_LIST_SINGLE, or ARITY_LIST_MULTIPLE





Method Detail
addDefaultValue
public void addDefaultValue(Object newDefaultValue)(Code)
Adds a default value to the list.
Parameters:
  newDefaultValue - a new default value



addValue
public void addValue(Object newValue)(Code)
Adds a value to the list.
Parameters:
  newValue - a new value



clone
public Object clone()(Code)



convertType
protected Object convertType(Object val)(Code)
Converts the specified object to the proper type for this parameter. Whenever we add or set a value or default value, we convert it to the proper type (string, date, etc.)

If our type is boolean and the incoming object is:

  • A string, return a true Boolean if the value matches "true", "t", "yes", or "y" (ignoring case).
  • A number, return a true Boolean if the value is non-zero.
  • Anything else, return a true Boolean (any better suggestions?)
    Parameters:
      val - any old object some object of the proper type



defaultValues
public Iterator defaultValues()(Code)
Returns an iterator over the default values for this parameter. an interator



designLabel
public String designLabel()(Code)



dragString
public String dragString()(Code)



formulaString
public String formulaString()(Code)



getArity
public int getArity()(Code)
Returns the arity of this field. Will be one of ARITY_ONE, ARITY_RANGE, ARITY_LIST_SINGLE, or ARITY_LIST_MULTIPLE. the arity number



getDefaultForType
public Object getDefaultForType(int type)(Code)
Returns the default value for a specific parameter type. This is not the same as the i'th default value; it is called when you have a parameter that has no value or default value, or when you have one with a different type and you want to switch types.
Parameters:
  type - one of TYPE_BOOLEAN, TYPE_STRING,TYPE_NUMERIC, or TYPE_DATE a new object appropriate for the type



getDefaultValue
public Object getDefaultValue(int i)(Code)
Returns the i'th defaultValue for this parameter. If none has been assigned, create and return -- but do not store -- a reasonable default. The default is obtained by calling Parameter.getDefaultForType .
Parameters:
  i - the index the defaultValue



getId
public Object getId()(Code)



getName
public String getName()(Code)
Returns the name for this parameter. the name



getQuestion
public String getQuestion()(Code)
Returns the question for this parameter. the question



getType
public int getType()(Code)
Returns the type of this field. Will be one of TYPE_BOOLEAN, TYPE_STRING, TYPE_NUMERIC, or TYPE_DATE. the type number



getValue
public Object getValue()(Code)
Returns the parameter value(s) the user has previously specified. If the parameter has one value, return that value or possibly null. Else, return a copy of our list of values. values (see description)



getValue
public Object getValue(int i)(Code)
Returns the current value or, if that is null, the default value. If the index is out of range, return null.
Parameters:
  i - the index the current or default value.



isLegal
public boolean isLegal(int aType, int anArity)(Code)
Returns true if the specified combination of type and arity are legal.
Parameters:
  aType - one of TYPE_BOOLEAN, TYPE_STRING,TYPE_NUMERIC, or TYPE_DATE
Parameters:
  anArity - one of ARITY_ONE, ARITY_RANGE,ARITY_LIST_SINGLE, or ARITY_LIST_MULTIPLE true if the specified combination of type and arityare legal



removeDefaultValues
public void removeDefaultValues()(Code)
Erases all default values.



removeValues
public void removeValues()(Code)
Erases all values.



setArity
public void setArity(int newArity)(Code)
Sets the parameter arity. Must be one of ARITY_ONE, ARITY_RANGE, ARITY_LIST_SINGLE, or ARITY_LIST_MULTIPLE. We disallow illegal arity values. For example, if our type is boolean we disallow a list arity.
Parameters:
  newArity - one of ARITY_ONE, ARITY_RANGE,ARITY_LIST_SINGLE, or ARITY_LIST_MULTIPLE



setDefaultValue
public void setDefaultValue(int i, Object newDefaultValue)(Code)
Sets the i'th defaultValue. If i is out of range, the list of default values grows to fit.
Parameters:
  i - the index
Parameters:
  newDefaultValue - a value



setName
public void setName(String newName)(Code)
Sets the name.
Parameters:
  newName - the new name



setQuestion
public void setQuestion(String newQuestion)(Code)
Sets the question.
Parameters:
  newQuestion - the new question



setType
public void setType(int newType)(Code)
Sets the parameter type. Must be one of TYPE_BOOLEAN, TYPE_STRING, TYPE_NUMERIC, or TYPE_DATE. If the new type is different than the old, we also make sure the arity is appropriate (for example, no boolean lists) and clear the value and default value lists.
Parameters:
  newType - the new type; must be one of TYPE_BOOLEAN,TYPE_STRING, TYPE_NUMERIC, orTYPE_DATE



setValue
public void setValue(int i, Object newValue)(Code)
Sets the i'th value. If i is out of range, the list of values grows to fit. param i the index
Parameters:
  newValue - the new value



toString
public String toString()(Code)



typeString
protected String typeString()(Code)
Returns the string used as the "type" attribute when writing this parameter as XML. the "type" attribute string



values
public Iterator values()(Code)
Returns an iterator over the values for this parameter. an interator



writeXML
public void writeXML(XMLWriter out)(Code)
Writes this parameter as an XML tag.
Parameters:
  out - a writer that knows how to write XML



Methods inherited from java.util.Observable
public synchronized void addObserver(Observer o)(Code)(Java Doc)
protected synchronized void clearChanged()(Code)(Java Doc)
public synchronized int countObservers()(Code)(Java Doc)
public synchronized void deleteObserver(Observer o)(Code)(Java Doc)
public synchronized void deleteObservers()(Code)(Java Doc)
public synchronized boolean hasChanged()(Code)(Java Doc)
public void notifyObservers()(Code)(Java Doc)
public void notifyObservers(Object arg)(Code)(Java Doc)
protected synchronized void setChanged()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.