Package com.inet.report
Class PromptField
- java.lang.Object
-
- com.inet.report.Field
-
- com.inet.report.PromptField
-
- All Implemented Interfaces:
NodeParser
,com.inet.report.ReferencedObject
,com.inet.report.ReferenceHolder
,java.io.Serializable
public class PromptField extends Field implements com.inet.report.ReferenceHolder
This class represents a prompt, that is, a field whose value(s) are asked for from the user at runtime. Using prompt fields, it is possible to change the parameterization and looks of a report by using the value(s) given by the user.
An example would be to use a prompt field in the record selection formula, in order to only show records with an ID equal to the prompted value.
It is possible to have single or multiple discrete values, single or multiple range values, or also multiple discrete and/or range values be passed to a prompt. Range values are considered as all values in between the two limits.
Here are two examples of how to use this class://getting all fields, where engine references your Engine Fields fields = engine.getFields(); //add a prompt of prompt value type NUMBER PromptField pField = fields.addPromptField("PromptName","PromptText", PromptField.NUMBER); --- //get total number of prompts int promptFieldsCount = fields.getPromptFieldsCount(); //for all prompts in fields... for (int i=0;i< promptFieldsCount;i++){ //...print name System.out.println(fields.getPromptField(i).getName()); }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inet.report.Field
Field.FieldAttributeTag
-
-
Field Summary
Fields Modifier and Type Field Description static int
DISCRETE_AND_RANGE_VALUE
Prompt field allows both, discrete and range value.static int
DISCRETE_VALUE
Prompt field allows a discrete value.static int
RANGE_VALUE
Prompt field allows a range value.-
Fields inherited from class com.inet.report.Field
BINARY, BOOLEAN, CURRENCY, CURSOR, DATABASE_FIELD, DATE, DATETIME, FORMULA_FIELD, GROUP_NAME_FIELD, NUMBER, PARAMETER_FIELD, SORT_FIELD, SPECIAL_FIELD, SQL_FIELD, STRING, SUMMARY_FIELD, TIME, UNKNOWN
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDefaultValue(DefaultValue value)
Adds a single default value to the end of the default value list.void
addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLYvoid
copySPParametersTo(PromptField toField)
FOR INTERNAL USE ONLYField
duplicate(java.lang.String name)
Duplicates this field with all its settings and returns the created Field with the given name.boolean
getAllowMultipleValues()
Returns whether or not multiple values can be passed to this prompt or not.java.lang.String
getDefaultPromptValuesAsString()
Returns the default values for this prompt as formula syntax, i.e. as an array if there are multiple default prompt values.DefaultValue
getDefaultValue(int i)
Returns the default value at the given index.int
getDefaultValueCount()
Returns The number of default values set for this prompt. 0 if none are set.DynamicValueProvider
getDefaultValueProvider()
If a DynamicValueProvider has been set for this PromptField, this method will return this provider.DefaultValue[]
getDefaultValues()
Fetches the default values.int
getDiscreteOrRangeType()
Returns the type of values which are allowed for this prompt.com.inet.report.formula.Evaluable
getFormulaAst()
FOR INTERNAL USE ONLYjava.lang.Object
getMaxRangeValue()
If property 'use range' is enabled this method returns the maximum value for an prompt value.java.lang.Object
getMinRangeValue()
If property 'use range' is enabled this method returns the minimum value for an prompt value.java.lang.String
getPromptText()
Returns the prompting text.int
getPromptType()
Returns the value type of this prompt field.java.lang.Object
getPromptValue()
Returns the value set for this prompt.java.lang.String
getPromptValueAsFormula()
Get the set value of this prompt as a formula.java.lang.String[]
getPromptValueDescriptions()
Returns the array of the value descriptions of the default values of this prompt field, which are shown to the user when prompting.int
getRealReferencedObjectCount()
FOR INTERNAL USE ONLYint
getReferencedObjectCount()
FOR INTERNAL USE ONLYcom.inet.report.ReferencedObject[]
getReferencedObjects()
FOR INTERNAL USE ONLYjava.lang.String[]
getStoredProceduresParameterNames()
Returns the names of the stored procedures parameters.TableSource[]
getTableSources()
Returns the table sources this prompt field is a parameter for.boolean
getUseRange()
Returns whether or not any values which are to be for this prompt must be in a range.java.lang.Object
getValue()
Returns the prompt value.int
getValuesCount()
Returns the number of values set for this prompt.int
getValueType()
Returns the value type (or return type) of the field.
NOTE:If DefaultAttribute is used within the formula it has to be set before calling this method.boolean
isDescriptionOnly()
Returns whether or not only the descriptions of the default values are to be shown when this field is prompted for.boolean
isEditable()
Returns whether or not values are allowed to be entered other than the default values themselves.boolean
isParameterOfStoredProcedure()
Returns whether this prompt field works as an input parameter for a stored procedure.boolean
isPasswordField()
Returns whether or not this prompt field is to be treated as a password field, that is, showing asterisks (*) for entered characters, hiding the entered value from view.boolean
isSubreportLink()
Returns whether this prompt is in a subreport and links to the main report.boolean
isUsed()
FOR INTERNAL USE ONLYboolean
isValueSet()
Returns whether or notsetPromtValue(Object)
was called and a valid value for this prompt was set.java.lang.String
paramString()
Returns a prettified output of this field's name and type.NodeParser
parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
removeDefaultValue(int index)
Removes the default prompt value and its description at the given index from the default value list.void
removeReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLYvoid
resetReferences()
FOR INTERNAL USE ONLYprotected void
saveFieldXML2(java.io.PrintWriter pw, int depth)
Saves PromptField attributesvoid
setAllowMultipleValues(boolean newValue)
Sets whether multiple values can be passed to this prompt or only a single value.void
setDefaultValue(int index, DefaultValue defaultValue)
Overrides a single default value at the given index.void
setDefaultValueProvider(DynamicValueProvider provider)
Sets the DynamicValueProvider which will dynamically create values for the default values at run-time.void
setDefaultValues(DefaultValue[] values)
Sets the default values for this prompt.void
setDescriptionOnly(boolean descOnly)
Sets whether or not only the descriptions of the default values are to be shown when this field is prompted for.void
setDiscreteOrRangeType(int newValue)
Sets the value of the property 'discrete or range type'.void
setEditable(boolean isEditable)
Sets whether or not values are allowed to be entered other than the default values themselves.void
setMaxRangeValue(java.lang.Object max)
Sets the maximum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField.void
setMinMaxRangeValues(java.lang.Object min, java.lang.Object max)
Sets the minimum and maximum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField.void
setMinRangeValue(java.lang.Object min)
Sets the minimum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField.void
setName(java.lang.String name)
Sets the name of the prompt field.void
setPasswordField(boolean isPasswordField)
Sets whether or not this prompt field is to be treated as a password field, that is, showing asterisks (*) for entered characters, hiding the entered value from view.void
setPromptText(java.lang.String promptText)
Sets the prompting text.void
setPromptType(int valueType)
Sets the Prompt Type.void
setPromptValue(java.lang.Object prompt)
Sets the actual value for this PromptField.void
setPromptValueAsFormula(java.lang.String formula)
Sets the prompt value as a formula in Crystal syntax.void
setPromptValueDescriptions(java.lang.String[] descr)
Sets the descriptions of the default values of this prompt field.void
setReferences()
FOR INTERNAL USE ONLYvoid
setUseRange(boolean newValue)
Sets whether the values must be in a certain value range or not.void
setValueType(int newValue)
Sets the value of the property 'value type'.-
Methods inherited from class com.inet.report.Field
addReferenceHolder, checkNameExists, equals, extractReference, getField, getGroup, getName, getPlaceholderName, getRealReferenceCount, getReferenceHolderCount, getReferenceHolders, getRefName, getType, indexOf, isDOMParser, parseDOM, removeReferenceHolder, rename, setField, setGroup, trimAwayBrackets
-
-
-
-
Field Detail
-
DISCRETE_VALUE
public static final int DISCRETE_VALUE
Prompt field allows a discrete value.- See Also:
- Constant Field Values
-
RANGE_VALUE
public static final int RANGE_VALUE
Prompt field allows a range value.- See Also:
- Constant Field Values
-
DISCRETE_AND_RANGE_VALUE
public static final int DISCRETE_AND_RANGE_VALUE
Prompt field allows both, discrete and range value.- See Also:
- Constant Field Values
-
-
Method Detail
-
setName
public final void setName(java.lang.String name)
Sets the name of the prompt field. The name can not exist already, otherwise an exception will be thrown.
-
getPromptText
public final java.lang.String getPromptText()
Returns the prompting text. The prompting text is a text that will ask for the value of the prompt field and can explain the default values, etc.- Returns:
- the prompting text for this default value
- Since:
- 6.0
- See Also:
setPromptText(java.lang.String)
-
setPromptText
public final void setPromptText(java.lang.String promptText)
Sets the prompting text. The prompting text is a text that will ask for the value of the prompt field and can explain the default values, etc.- Parameters:
promptText
- the prompting text, can be null for no text- Since:
- 6.0
- See Also:
getPromptText()
-
getPromptValue
public final java.lang.Object getPromptValue()
Returns the value set for this prompt. By default, this will return null, but if a value is set for the prompt (either viasetPromptValue(Object)
or by entering a value in the prompt dialog), this will return the value set for this PromptField.
If the prompt value is a multi-value prompt, this will return an array of values, so you can cast the returned Object to an Object[].
The returned value's class depends on the value type of the PromptField:
NUMBER
-java.lang.Number
CURRENCY
-java.lang.Number
BOOLEAN
-java.lang.Boolean
DATE
-java.sql.Date
TIME
-java.sql.Time
DATETIME
-java.sql.Timestamp
STRING
-java.lang.String
Range
-com.inet.report.FormulaRange
.
- Returns:
- The actually set value (either by API or by prompt dialog) for this prompt field.
- Since:
- 6.0
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.DATETIME
,Field.STRING
,FormulaRange
,setPromptValue(java.lang.Object)
,setPromptValueAsFormula(java.lang.String)
,getValuesCount()
-
setPromptValue
public final void setPromptValue(java.lang.Object prompt) throws ReportException
Sets the actual value for this PromptField. Calling this will cause this PromptField to be viewed as set and therefore as not necessary to be prompted at run-time.
This method checks the plausibility of the given value, that means if 'multiple values' is enabled, it checks that the given Object is an array. If the property 'discrete and range type' is set to discrete it checks that there's no FormulaRange. If the property 'use range' is enabled it checks that all values are in the allowed range. Furthermore it checks that the value type of the PromptField fits with the object provided.- Parameters:
prompt
- The given Object can either be
java.lang.Number
orjava.lang.Long
etc. for value typesNUMBER
andCURRENCY
java.lang.Boolean
for value typeBOOLEAN
java.sql.Date
for value typeDATE
java.sql.Time
for value typeTIME
java.sql.Timestamp
for value typeDATETIME
java.lang.String
for value typeSTRING
com.inet.report.FormulaRange
for ranges- An array of the above objects for multiple values and multiple ranges.
- Throws:
ReportException
- when you have enabled a range checking for prompt values and the parameter object has value(s) which are not in this range: - You have chosen a prompt with multiple values but parameter prompt is no array.
- You have chosen a prompt with discrete values but parameter prompt is a range value.
- You have chosen a prompt with one single value but parameter prompt is an array.
- You have chosen a prompt with a single range value but parameter prompt is no range.
- You have chosen neither a prompt with discrete values or with range values but parameter object is an array with mixed of both type.- Since:
- 6.0
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.DATETIME
,Field.STRING
,FormulaRange
,getPromptValue()
,setPromptValueAsFormula(java.lang.String)
,getValuesCount()
,setDefaultValues(DefaultValue[])
-
setPromptValueAsFormula
public void setPromptValueAsFormula(java.lang.String formula) throws ReportException
Sets the prompt value as a formula in Crystal syntax. This formula is evaluated on the fly and its value is set.- Parameters:
formula
- Value to set for this prompt, as a formula in Crystal syntax- Throws:
ReportException
- when you have enabled a range checking for prompt values and the parameter object has value(s) which are not in this range: - you have chosen a prompt with multiple values but parameter prompt is no array.
- you have chosen a prompt with discrete values but parameter prompt is a range value.
- you have chosen a prompt with one single value but parameter prompt is an array.
- you have chosen a prompt with a single range value but parameter prompt is no range.
- you have chosen neither a prompt with discrete values or with range values but parameter object is an array with mixed of both type.- Since:
- 6.0
- See Also:
Engine.setPrompt(String, int)
,getPromptValue()
,setPromptValue(java.lang.Object)
,getValuesCount()
-
getPromptType
public final int getPromptType()
Returns the value type of this prompt field. This can either be:
NUMBER
CURRENCY
BOOLEAN
DATE
TIME
DATETIME
STRING
BINARY
- Returns:
- Value type of this prompt field.
- Since:
- 6.0
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.DATETIME
,Field.STRING
,Fields.addPromptField(java.lang.String, java.lang.String, int)
,setPromptType(int)
-
setPromptType
public final void setPromptType(int valueType)
Sets the Prompt Type. This can be be one of the following:
NUMBER
CURRENCY
BOOLEAN
DATE
TIME
DATETIME
STRING
BINARY
- Parameters:
valueType
- Value type for this prompt field- Throws:
java.lang.IllegalArgumentException
- will thrown if the value type not equals the the field type.- Since:
- 6.0
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.DATETIME
,Field.STRING
,Field.BINARY
,getPromptType()
-
setUseRange
public final void setUseRange(boolean newValue)
Sets whether the values must be in a certain value range or not. If it is set to true, all values of the prompt will be checked if they are in the given range or not.- Parameters:
newValue
- True if the prompt values must be within a range of values.- Since:
- 6.0
- See Also:
setMinMaxRangeValues(java.lang.Object, java.lang.Object)
,getMaxRangeValue()
,getMinRangeValue()
,getUseRange()
-
getUseRange
public final boolean getUseRange()
Returns whether or not any values which are to be for this prompt must be in a range.- Returns:
- True if the values should be in a value range.
- Since:
- 6.0
- See Also:
setMinMaxRangeValues(java.lang.Object, java.lang.Object)
,getMaxRangeValue()
,getMinRangeValue()
,setUseRange(boolean)
-
setDescriptionOnly
public final void setDescriptionOnly(boolean descOnly)
Sets whether or not only the descriptions of the default values are to be shown when this field is prompted for. For example, a number prompt field with the default values of 4 and 5 with the descriptions "Number Four" and "Number Five" respectively would only show as two default entries "Number Four" and "Number Five" if this setting was on. By default, this is off.- Parameters:
descOnly
- Should only the descriptions of the default values be shown when prompting for this field?- Since:
- 7.0
-
isDescriptionOnly
public final boolean isDescriptionOnly()
Returns whether or not only the descriptions of the default values are to be shown when this field is prompted for. For example, a number prompt field with the default values of 4 and 5 with the descriptions "Number Four" and "Number Five" respectively would only show as two default entries "Number Four" and "Number Five" if this setting was on. By default, this is off.- Returns:
- Should only the descriptions of the default values be shown when prompting for this field?
- Since:
- 7.0
-
setEditable
public final void setEditable(boolean isEditable)
Sets whether or not values are allowed to be entered other than the default values themselves. For example, a number prompt field with the default values of 4 and 5 would only allow values 4 or 5, nothing else, if this setting was off. By default, this is on. Note that if this is set to false and there is only one default value, then this prompt field is viewed as hidden and will not be shown in the prompt dialog.- Parameters:
isEditable
- Should other values than the default values be accepted as valid values for this prompt field?- Throws:
java.lang.UnsupportedOperationException
- if isEditable is false and this is a password field, since password fields must be editable.- Since:
- 7.0
-
isEditable
public final boolean isEditable()
Returns whether or not values are allowed to be entered other than the default values themselves. For example, a number prompt field with the default values of 4 and 5 would only allow values 4 or 5, nothing else, if this setting was off. By default, this is on.- Returns:
- Should other values than the default values be accepted as valid values for this prompt field?
- Since:
- 7.0
-
isValueSet
public boolean isValueSet()
Returns whether or notsetPromtValue(Object)
was called and a valid value for this prompt was set. If this function returnstrue
, this PromptField is viewed as set and therefore as not necessary to be prompted at run-time.- Returns:
- Has this prompt field beens set to a valid value?
- Since:
- 8.3
- See Also:
setPromptValue(Object)
-
isPasswordField
public final boolean isPasswordField()
Returns whether or not this prompt field is to be treated as a password field, that is, showing asterisks (*) for entered characters, hiding the entered value from view.- Returns:
- Is this prompt field to be treated as a password field?
- Since:
- 7.0
-
setPasswordField
public final void setPasswordField(boolean isPasswordField)
Sets whether or not this prompt field is to be treated as a password field, that is, showing asterisks (*) for entered characters, hiding the entered value from view. Note that setting this prompt field to a password prompt field automatically causes the field to become a single, discrete, editable prompt with no default values or default value provider.- Parameters:
isPasswordField
- Is this prompt field to be treated as a password field?- Since:
- 7.0
-
setDiscreteOrRangeType
public void setDiscreteOrRangeType(int newValue) throws java.lang.IllegalArgumentException
Sets the value of the property 'discrete or range type'. This property indicates whether a single valueDISCRETE_VALUE
, a single rangeRANGE_VALUE
or both ranges and single valueDISCRETE_AND_RANGE_VALUE
are allowed. In the last case, this prompt field must already be set to allow multiple values, withsetAllowMultipleValues(boolean)
.- Parameters:
newValue
- The new value of the property 'discrete or range type'.- Throws:
java.lang.IllegalArgumentException
- will thrown if value is out of range.java.lang.UnsupportedOperationException
- if this is a password prompt field and a value is set which is notDISCRETE_VALUE
- Since:
- 6.0
- See Also:
DISCRETE_AND_RANGE_VALUE
,DISCRETE_VALUE
,setAllowMultipleValues(boolean)
,getAllowMultipleValues()
,getDiscreteOrRangeType()
,setUseRange(boolean)
,getUseRange()
-
getDiscreteOrRangeType
public int getDiscreteOrRangeType()
Returns the type of values which are allowed for this prompt.- Returns:
- which type of values are allowed for this prompt field.
- Since:
- 6.0
- See Also:
DISCRETE_VALUE
,RANGE_VALUE
,DISCRETE_AND_RANGE_VALUE
,setDiscreteOrRangeType(int)
,setUseRange(boolean)
,getUseRange()
,setAllowMultipleValues(boolean)
,getAllowMultipleValues()
-
setAllowMultipleValues
public void setAllowMultipleValues(boolean newValue)
Sets whether multiple values can be passed to this prompt or only a single value.- Parameters:
newValue
-true
if multiple values should be able to be entered for this prompt.- Throws:
java.lang.UnsupportedOperationException
- if newValue is true and this field is a password prompt field- Since:
- 6.0
- See Also:
getAllowMultipleValues()
,getDiscreteOrRangeType()
,setDiscreteOrRangeType(int)
-
getAllowMultipleValues
public boolean getAllowMultipleValues()
Returns whether or not multiple values can be passed to this prompt or not.- Returns:
true
if multiple values can be passed to this prompt.- Since:
- 6.0
- See Also:
setAllowMultipleValues(boolean)
-
getValuesCount
public int getValuesCount()
Returns the number of values set for this prompt. Each range value counts as one value only. Note that this will only return a number greater than one if this is a multiple value prompt.- Returns:
- Number of set values for this prompt.
- Since:
- 6.0
- See Also:
setPromptValue(java.lang.Object)
,setPromptValueAsFormula(java.lang.String)
,getPromptValue()
,getAllowMultipleValues()
,setAllowMultipleValues(boolean)
-
setMinRangeValue
public void setMinRangeValue(java.lang.Object min) throws ReportException
Sets the minimum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField. This can be activated by callingsetUseRange(boolean)
.
Passing null as a minimum value has the effect that no minimum limit is set. This makes it possible to limit values with an open interval.
If the prompt's value type is one of Number, Currency or String then any value must be an instance of java.lang.Number.
If the prompt's value type is Boolean then no range is possible for prompt values. If the prompt's value type is Date then any value must be an instance of java.sql.Date.
If the prompt's value type is Time then any value must be an instance of java.sql.Time.
If the prompt's value type is DateTime then any value must be an instance of java.sql.Timestamp.- Parameters:
min
- The minimum value that a prompt value can assume, or null if no minimum is to be set- Throws:
ReportException
- will thrown if:
- value type is unknown or boolean
- value does not match value type
- min is greater than maxjava.lang.IllegalStateException
- if range is disabled, seesetDiscreteOrRangeType(int)
- Since:
- 6.0
- See Also:
getMinRangeValue()
,getUseRange()
,setUseRange(boolean)
-
setMaxRangeValue
public void setMaxRangeValue(java.lang.Object max) throws ReportException
Sets the maximum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField. This can be activated by callingsetUseRange(boolean)
.
Passing null as a maximum value has the effect that no maximum limit is set. This makes it possible to limit values with an open interval.
If the prompt's value type is one of Number, Currency or String then any value must be an instance of java.lang.Number.
If the prompt's value type is Boolean then no range is possible for prompt values. If the prompt's value type is Date then any value must be an instance of java.sql.Date.
If the prompt's value type is Time then any value must be an instance of java.sql.Time.
If the prompt's value type is DateTime then any value must be an instance of java.sql.Timestamp.- Parameters:
max
- The maximum value that a prompt value can assume, or null if no maximum is to be set- Throws:
ReportException
- will thrown if:
- value type is unknown or boolean
- value does not match value type
- max is less than minjava.lang.IllegalStateException
- if range is disabled, seesetDiscreteOrRangeType(int)
- Since:
- 6.0
- See Also:
getMaxRangeValue()
,getUseRange()
,setUseRange(boolean)
-
setMinMaxRangeValues
public void setMinMaxRangeValues(java.lang.Object min, java.lang.Object max) throws ReportException
Sets the minimum and maximum allowed value for any value of this prompt field.
Calling this method is only allowed if "use range" is activated for this PromptField. This can be activated by callingsetUseRange(boolean)
. Passing null as a minimum or maximum value has the effect that no such limit is set. This makes it possible to limit values with an open interval.- If the prompt's value type is one of Number, Currency or String then any value must be an instance of java.lang.Number.
- If the prompt's value type is Boolean then no range is possible for prompt values. If the prompt's value type is Date then any value must be an instance of java.sql.Date.
- If the prompt's value type is Time then any value must be an instance of java.sql.Time.
- If the prompt's value type is DateTime then any value must be an instance of java.sql.Timestamp.
- Parameters:
min
- The minimum value that a prompt value can assume, or null if no minimum is to be setmax
- The maximum value that a prompt value can assume, or null if no maximum is to be set- Throws:
ReportException
- will be thrown if:
- value type is unknown or boolean
- value does not match value type
- range is disabled
- max is less than min- Since:
- 6.0
- See Also:
getMinRangeValue()
,getMaxRangeValue()
,getUseRange()
,setUseRange(boolean)
-
getMinRangeValue
public java.lang.Object getMinRangeValue() throws ReportException
If property 'use range' is enabled this method returns the minimum value for an prompt value.- Returns:
- The return value can in according to property 'value type' either be a java.lang.Number, a java.sql.Date, a java.sql.Time or a java.sql.Timestamp. Note that this can also return null if there is no minimum limit.
- Throws:
ReportException
- will be thrown if value type is boolean, value does not match value type or if range is disabled.- Since:
- 6.0
- See Also:
getMaxRangeValue()
,setMinMaxRangeValues(java.lang.Object, java.lang.Object)
,getUseRange()
,setUseRange(boolean)
-
getMaxRangeValue
public java.lang.Object getMaxRangeValue() throws ReportException
If property 'use range' is enabled this method returns the maximum value for an prompt value.- Returns:
- The return value can in according to property 'value type' either be a java.lang.Number, a java.sql.Date, a java.sql.Time or a java.sql.Timestamp. Note that null can also be returned if there is no maximum limit.
- Throws:
ReportException
- will be thrown if value type is boolean, value does not match value type or if range is disabled.- Since:
- 6.0
- See Also:
getMinRangeValue()
,setMinMaxRangeValues(java.lang.Object, java.lang.Object)
,getUseRange()
,setUseRange(boolean)
-
setPromptValueDescriptions
public void setPromptValueDescriptions(java.lang.String[] descr)
Sets the descriptions of the default values of this prompt field.- Parameters:
descr
- a String[] which contains the descriptions of the default values.- Throws:
java.lang.IllegalArgumentException
- if the description array's length does not match getDefaultValueCount().java.lang.NullPointerException
- if the array is null- Since:
- 6.0
- See Also:
getDefaultValueCount()
-
getPromptValueDescriptions
public java.lang.String[] getPromptValueDescriptions()
Returns the array of the value descriptions of the default values of this prompt field, which are shown to the user when prompting.- Returns:
- a String[] which contains the descriptions
- Since:
- 7.0
-
setValueType
public void setValueType(int newValue)
Sets the value of the property 'value type'.- Overrides:
setValueType
in classField
- Parameters:
newValue
- The new value of the property 'value type'.- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.STRING
,Field.DATETIME
,Field.CURSOR
,Field.BINARY
-
getValueType
public int getValueType()
Returns the value type (or return type) of the field.
NOTE:If DefaultAttribute is used within the formula it has to be set before calling this method. A null-value will cause an exception here. If you don't know the exact value of the DefaultAttribute you may use a dummy-value for getValueType. The reason is that getValueType only regards the type of object not their value.- Overrides:
getValueType
in classField
- Returns:
- The value of the property 'value type'.
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.STRING
,Field.DATETIME
-
paramString
public java.lang.String paramString()
Returns a prettified output of this field's name and type.- Overrides:
paramString
in classField
- Returns:
- Prettified output of this field's name and type.
-
getPromptValueAsFormula
public java.lang.String getPromptValueAsFormula()
Get the set value of this prompt as a formula. In order to instead get the default value(s) of this prompt as a formula string, usegetDefaultPromptValuesAsString()
.- Returns:
- the formula string of the set values for this prompt.
- Since:
- 6.0
-
setDefaultValueProvider
public void setDefaultValueProvider(DynamicValueProvider provider)
Sets the DynamicValueProvider which will dynamically create values for the default values at run-time. Setting null will cause this setting to be removed.- Parameters:
provider
- Provider class which supplies the necessary default values at run-time.- Throws:
java.lang.IllegalArgumentException
- if the given provider is aCascadingValueProvider
which causes circular dependency.- Since:
- 7.6
- See Also:
getDefaultValueProvider()
-
getDefaultValueProvider
public DynamicValueProvider getDefaultValueProvider()
If a DynamicValueProvider has been set for this PromptField, this method will return this provider.- Returns:
- DynamicValueProvider which will dynamically provide default values for this prompt at run-time, or null if no such provider has been set.
- Since:
- 7.6
- See Also:
setDefaultValueProvider(DynamicValueProvider)
-
getDefaultValues
public DefaultValue[] getDefaultValues()
Fetches the default values. If a dynamic provider has been set, this will cause the provider to generate the default values.- Returns:
- default values for this prompt (can be null if none are set)
- Since:
- 7.6
-
setDefaultValues
public void setDefaultValues(DefaultValue[] values)
Sets the default values for this prompt. All values must have the correct type and also must be within the range if one has been set, otherwise an IllegalArgumentException will be thrown.Note that this will have the effect of removing a DynamicValueProvider if one has been specified.
- Parameters:
values
- default values to set, null if none are to be set- Throws:
java.lang.IllegalArgumentException
- if one of the values is not the correct value type or is outside of a given allowed rangejava.lang.UnsupportedOperationException
- if this is a password prompt field and one or more default values is to be set, since password prompt fields can not have default values.- Since:
- 7.6
- See Also:
setUseRange(boolean)
,setMinMaxRangeValues(Object, Object)
,DefaultValue(Object, String)
-
getDefaultPromptValuesAsString
public java.lang.String getDefaultPromptValuesAsString()
Returns the default values for this prompt as formula syntax, i.e. as an array if there are multiple default prompt values. It is recommended to usegetDefaultValues()
instead.- Returns:
- Default values as a single formula string.
- Since:
- 8.0
-
addDefaultValue
public void addDefaultValue(DefaultValue value)
Adds a single default value to the end of the default value list. Note that calling this will remove any DefaultValueProvider you may have set.- Parameters:
value
- default value to add to the list of default values for this prompt- Throws:
java.lang.IllegalArgumentException
- if the default value could not be set because of the value was outside a set range.java.lang.UnsupportedOperationException
- if this is a password prompt field, since password prompt fields can not have default values- Since:
- 7.6
-
removeDefaultValue
public void removeDefaultValue(int index)
Removes the default prompt value and its description at the given index from the default value list. Shifts any subsequent default values to the left. If no default values are left, the default value list will be null.- Parameters:
index
- Index of default value to remove from the list- Throws:
java.lang.IndexOutOfBoundsException
- If the index is less than 0 or greater than or equal to the size of the list.- Since:
- 7.0
- See Also:
addDefaultValue(DefaultValue)
,getDefaultValueCount()
,getDefaultValue(int)
-
getDefaultValueCount
public int getDefaultValueCount()
Returns The number of default values set for this prompt. 0 if none are set.- Returns:
- The number of default values set for this prompt. 0 if none are set.
- Since:
- 7.0
-
setDefaultValue
public void setDefaultValue(int index, DefaultValue defaultValue)
Overrides a single default value at the given index.- Parameters:
index
- index of the default value to place. This index is 0-based and must specify an already existing default valuedefaultValue
- default value to replace the specified default value with.- Throws:
java.lang.IllegalArgumentException
- if the value was outside a set range.java.lang.IndexOutOfBoundsException
- if the index is less than 0 or greater or equal to the number of default values.- Since:
- 7.6
- See Also:
getDefaultValueCount()
-
getValue
public java.lang.Object getValue()
Returns the prompt value. If the prompt value is multi-value prompt, you can cast it to an Object[]. For example
The returned//get prompt value, where f is the referenz to a PromptField - instance Object val = f.getPromptValue(); if (val instanceof Object[]) { //get single value and print it to stdout. val0 can be, //i.e. a NUMBER etc. or a FormulaRange that holds two NUMBERs if prompt value type is NUMBER Object val0 = ((Object[])val)[0]; System.out.println(val0); }
Object
or in matter of case each field of the returnedObject
-array can either beNUMBER
forjava.lang.Number
CURRENCY
forjava.lang.Number
BOOLEAN
forjava.lang.Boolean
DATE
forjava.sql.Date
TIME
forjava.sql.Time
DATETIME
forjava.sql.Timestamp
STRING
forjava.lang.String
FormulaRange
for a range of values.
- Returns:
- The actually set value for this prompt.
- Since:
- 7.0
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.DATETIME
,Field.STRING
,FormulaRange
,setPromptValue(java.lang.Object)
,setPromptValueAsFormula(java.lang.String)
,getValuesCount()
-
isParameterOfStoredProcedure
public boolean isParameterOfStoredProcedure()
Returns whether this prompt field works as an input parameter for a stored procedure.- Returns:
- True, if it is a input parameter of a stored procedure otherwise false.
- Since:
- 8.0
-
getTableSources
public TableSource[] getTableSources()
Returns the table sources this prompt field is a parameter for. This can be either stored procedures or views with parameters. If the prompt is not a parameter for a database objectnull
will be returned.- Returns:
- The TableSources this prompt field is a parameter for or
null
if this prompt field is not a parameter for a database object. - Since:
- 6.5
-
getStoredProceduresParameterNames
public java.lang.String[] getStoredProceduresParameterNames()
Returns the names of the stored procedures parameters. This can be either stored procedures or views with parameters. If the prompt is not a parameter for a database objectnull
will be returned.- Returns:
- The parameter names or
null
if this prompt field is not a parameter for a database object. - Since:
- 15.0
-
isSubreportLink
public boolean isSubreportLink()
Returns whether this prompt is in a subreport and links to the main report.- Returns:
- Whether this prompt is in a subreport and links to the main report.
- Since:
- 6.5
-
getDefaultValue
public DefaultValue getDefaultValue(int i)
Returns the default value at the given index.- Parameters:
i
- index of desired default value- Returns:
- default value specified by the index
- Throws:
java.lang.IndexOutOfBoundsException
- if the index is less than 0 or greater than the number of default values- Since:
- 7.6
- See Also:
getDefaultValueCount()
-
saveFieldXML2
protected void saveFieldXML2(java.io.PrintWriter pw, int depth)
Saves PromptField attributes- Specified by:
saveFieldXML2
in classField
- Parameters:
pw
- the printwriter.depth
- the current depth.- Since:
- 8.1
-
parseText
public void parseText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLThis method is called if text was encountered in the context of this node. (Examples would be a formula's text or a text element's text)
- Specified by:
parseText
in interfaceNodeParser
- Overrides:
parseText
in classField
- Parameters:
text
- text encountered and to be storedparserMap
- The map of current Parser.
-
parseElement
public NodeParser parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLParses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.
- Specified by:
parseElement
in interfaceNodeParser
- Overrides:
parseElement
in classField
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.tag
- The XMLTag to be parsedatts
- The set of attributes in the current XMLTagparserMap
- The map of current Parser.- Returns:
- The NodeParser sub-element if one needed to be created, or null if none was created.
- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-
parseEndElement
public void parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLReceive notification of the end of an XML tag.
- Specified by:
parseEndElement
in interfaceNodeParser
- Overrides:
parseEndElement
in classField
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group.tag
- The XMLTag to be parsedparserMap
- The map of current Parser.- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-
addReferencedObject
public void addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY- Specified by:
addReferencedObject
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
removeReferencedObject
public void removeReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY- Specified by:
removeReferencedObject
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
getReferencedObjectCount
public int getReferencedObjectCount()
FOR INTERNAL USE ONLY- Specified by:
getReferencedObjectCount
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
getReferencedObjects
public com.inet.report.ReferencedObject[] getReferencedObjects()
FOR INTERNAL USE ONLY- Specified by:
getReferencedObjects
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
resetReferences
public void resetReferences()
FOR INTERNAL USE ONLY- Specified by:
resetReferences
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
getRealReferencedObjectCount
public final int getRealReferencedObjectCount()
FOR INTERNAL USE ONLY- Specified by:
getRealReferencedObjectCount
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
setReferences
public void setReferences()
FOR INTERNAL USE ONLY- Specified by:
setReferences
in interfacecom.inet.report.ReferenceHolder
- Since:
- 7.0
-
duplicate
public Field duplicate(java.lang.String name)
Duplicates this field with all its settings and returns the created Field with the given name. Note that the new formula field will not initially be referenced by any other report objects. If you duplicate a property formula, you will have to set the new formula as a separate property formula.
-
getFormulaAst
public com.inet.report.formula.Evaluable getFormulaAst()
FOR INTERNAL USE ONLY- Since:
- 9.2
-
copySPParametersTo
public void copySPParametersTo(PromptField toField)
FOR INTERNAL USE ONLY- Since:
- 11.2
-
-