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
,Serializable
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:
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
Modifier and TypeFieldDescriptionstatic final int
Prompt field allows both, discrete and range value.static final int
Prompt field allows a discrete value.static final int
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
Modifier and TypeMethodDescriptionvoid
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 ONLYDuplicates this field with all its settings and returns the created Field with the given name.boolean
Returns whether or not multiple values can be passed to this prompt or not.Returns the default values for this prompt as formula syntax, i.e. as an array if there are multiple default prompt values.getDefaultValue
(int i) Returns the default value at the given index.int
Returns The number of default values set for this prompt. 0 if none are set.If a DynamicValueProvider has been set for this PromptField, this method will return this provider.Fetches the default values.int
Returns the type of values which are allowed for this prompt.com.inet.report.formula.Evaluable
FOR INTERNAL USE ONLYIf property 'use range' is enabled this method returns the maximum value for an prompt value.If property 'use range' is enabled this method returns the minimum value for an prompt value.final String
Returns the prompting text.final int
Returns the value type of this prompt field.final Object
Returns the value set for this prompt.Get the set value of this prompt as a formula.String[]
Returns the array of the value descriptions of the default values of this prompt field, which are shown to the user when prompting.final int
FOR INTERNAL USE ONLYint
FOR INTERNAL USE ONLYcom.inet.report.ReferencedObject[]
FOR INTERNAL USE ONLYString[]
Returns the names of the stored procedures parameters.Returns the table sources this prompt field is a parameter for.final boolean
Returns whether or not any values which are to be for this prompt must be in a range.getValue()
Returns the prompt value.int
Returns the number of values set for this prompt.int
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.final boolean
Returns whether or not only the descriptions of the default values are to be shown when this field is prompted for.final boolean
Returns whether or not values are allowed to be entered other than the default values themselves.boolean
Returns whether this prompt field works as an input parameter for a stored procedure.final boolean
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
Returns whether this prompt is in a subreport and links to the main report.boolean
isUsed()
FOR INTERNAL USE ONLYboolean
Returns whether or notsetPromtValue(Object)
was called and a valid value for this prompt was set.Returns a prettified output of this field's name and type.parseElement
(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String, Object> parserMap) FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseEndElement
(com.inet.report.parser.XMLTag group, String tag, Map<String, Object> parserMap) FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
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
FOR INTERNAL USE ONLYprotected void
saveFieldXML2
(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.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.void
setDiscreteOrRangeType
(int newValue) Sets the value of the property 'discrete or range type'.final void
setEditable
(boolean isEditable) Sets whether or not values are allowed to be entered other than the default values themselves.void
setMaxRangeValue
(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
(Object min, 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
(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.final void
Sets the name of the prompt field.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.final void
setPromptText
(String promptText) Sets the prompting text.final void
setPromptType
(int valueType) Sets the Prompt Type.final void
setPromptValue
(Object prompt) Sets the actual value for this PromptField.void
setPromptValueAsFormula
(String formula) Sets the prompt value as a formula in Crystal syntax.void
setPromptValueDescriptions
(String[] descr) Sets the descriptions of the default values of this prompt field.void
FOR INTERNAL USE ONLYfinal void
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 Details
-
DISCRETE_VALUE
public static final int DISCRETE_VALUEPrompt field allows a discrete value.- See Also:
-
RANGE_VALUE
public static final int RANGE_VALUEPrompt field allows a range value.- See Also:
-
DISCRETE_AND_RANGE_VALUE
public static final int DISCRETE_AND_RANGE_VALUEPrompt field allows both, discrete and range value.- See Also:
-
-
Method Details
-
setName
Sets the name of the prompt field. The name can not exist already, otherwise an exception will be thrown.- Specified by:
setName
in classField
- Parameters:
name
- Name to be assigned to this prompt field- Throws:
IllegalArgumentException
- if the name already exists- Since:
- 6.0
-
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
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:
-
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:
-
setPromptValue
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:
-
setPromptValueAsFormula
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:
-
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:
-
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:
IllegalArgumentException
- will thrown if the value type not equals the the field type.- Since:
- 6.0
- See Also:
-
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:
-
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:
-
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:
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:
-
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
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:
IllegalArgumentException
- will thrown if value is out of range.UnsupportedOperationException
- if this is a password prompt field and a value is set which is notDISCRETE_VALUE
- Since:
- 6.0
- See Also:
-
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:
-
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:
UnsupportedOperationException
- if newValue is true and this field is a password prompt field- Since:
- 6.0
- See Also:
-
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:
-
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:
-
setMinRangeValue
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 maxIllegalStateException
- if range is disabled, seesetDiscreteOrRangeType(int)
- Since:
- 6.0
- See Also:
-
setMaxRangeValue
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 minIllegalStateException
- if range is disabled, seesetDiscreteOrRangeType(int)
- Since:
- 6.0
- See Also:
-
setMinMaxRangeValues
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
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
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:
-
setPromptValueDescriptions
Sets the descriptions of the default values of this prompt field.- Parameters:
descr
- a String[] which contains the descriptions of the default values.- Throws:
IllegalArgumentException
- if the description array's length does not match getDefaultValueCount().NullPointerException
- if the array is null- Since:
- 6.0
- See Also:
-
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:
-
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:
-
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
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
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:
IllegalArgumentException
- if the given provider is aCascadingValueProvider
which causes circular dependency.- Since:
- 7.6
- See Also:
-
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:
-
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
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:
IllegalArgumentException
- if one of the values is not the correct value type or is outside of a given allowed rangeUnsupportedOperationException
- 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:
-
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
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:
IllegalArgumentException
- if the default value could not be set because of the value was outside a set range.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:
IndexOutOfBoundsException
- If the index is less than 0 or greater than or equal to the size of the list.- Since:
- 7.0
- See Also:
-
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
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:
IllegalArgumentException
- if the value was outside a set range.IndexOutOfBoundsException
- if the index is less than 0 or greater or equal to the number of default values.- Since:
- 7.6
- See Also:
-
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:
-
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
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
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
-
isUsed
public boolean isUsed()FOR INTERNAL USE ONLY -
getDefaultValue
Returns the default value at the given index.- Parameters:
i
- index of desired default value- Returns:
- default value specified by the index
- Throws:
IndexOutOfBoundsException
- if the index is less than 0 or greater than the number of default values- Since:
- 7.6
- See Also:
-
saveFieldXML2
Saves PromptField attributes- Specified by:
saveFieldXML2
in classField
- Parameters:
pw
- the printwriter.depth
- the current depth.- Since:
- 8.1
-
parseText
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, String tag, Attributes atts, Map<String, Object> parserMap) throws FatalParserExceptionFOR 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, String tag, Map<String, Object> parserMap) throws FatalParserExceptionFOR 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
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
FOR INTERNAL USE ONLY- Since:
- 11.2
-