|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.info.LyTag
leon.info.LyInfo
leon.info.LyObjectInfo
leon.info.LyFieldInfo
leon.info.LyNumberFieldInfo
public final class LyNumberFieldInfo
This class implements the description of numeric fields such as integers, floats, percent ...
The different types of numbers supported are represented as public, static attributes, named TYPE_XXX. Supported types are INT, SHORT, LONG, FLOAT, DOUBLE.
A NumbeFieldInfo is the implementation of a numeric attribute in an application class. In addition to standard fieldInfo properties, instances of LyNumberFieldInfo also implements a minimum and a maximum value. Moreover, it is possible to specify a pitch increment (or decrement) which may be used when editing the field.
When real numbers (FLOAT, DOUBLE) are used, the number of decimals can be specified.
A unit may also be associated to this kind of field, this unit is only used to be displayed to the end-user when values of number fields are shown.
A function may be associated to a number field. This function defines the method to calculate the value corresponding to a column of values when this field is shown in a table. Supported functions are given has public, static attributes, named Function.XXX. Accepted values are : SUM, AVERAGE, NONE (no function).
Finally, number fields may also have a formula. This formula is a simple mathematic expression involving other fields of the same application class, used to calculate values for the number field (for example : suppose that this field represents a tax, and that this tax is ration of a price, the formula could be "(price * 10)/100").
See also tag
Nested Class Summary | |
---|---|
static class |
LyNumberFieldInfo.Function
Functions. |
static class |
LyNumberFieldInfo.Type
Number types. |
Nested classes/interfaces inherited from class leon.info.LyTag |
---|
LyTag.Model |
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
static double |
LY_DOUBLE_MIN_VALUE
|
static float |
LY_FLOAT_MIN_VALUE
|
static boolean |
USE_PRECISION
Indicates whether precision on numbers must be used to compare two values. |
Fields inherited from class leon.info.LyObjectInfo |
---|
NULL, PART_ALL, PART_BIND, PART_DATA, PART_GUI, PART_LABEL |
Method Summary | |
---|---|
void |
allowFormatAutomaticUpdate(boolean update)
Sets the parameter indicating whether the format may be changed automatically. |
LyValue |
buildFieldValue(java.lang.Object value)
Builds the appropriate LyValue corresponding to this field for the given value object. |
java.lang.String |
checkValue(LyEnvironment environment,
java.lang.Object fieldValue)
Checks the given value : - the value must be greater or equal to min value, - the value must be lower or equal to max value. |
int |
compare(java.lang.Object value1,
java.lang.Object value2,
java.util.BitSet modifiers)
Compare two numeric values for the specified fieldInfo. |
java.lang.Object |
compute(LyObjectList objectList,
boolean importField)
Method for computing a value using function associated to this field for a given objects list. |
java.lang.Object |
convertFromFieldUnit(java.lang.Object value,
LyUnit unit)
Convert a value to the field unit from another unit. |
java.lang.Object |
convertToFieldUnit(java.lang.Object value,
LyUnit unit)
Convert a value from the field unit to the given unit. |
int |
getDecimals()
Gets the number of digits displayed when shown to the user. |
java.lang.Number |
getDefault()
Gets the default value. |
LyFilterExpression.Condition[] |
getFilterConditions()
Returns the filter conditions authorized on this field. |
LyNumberFieldInfo.Function |
getFunction()
Gets the function associated to this number field. |
java.lang.Number |
getMax()
Gets the maximum value for this field, or null if no maximum value is specified. |
java.lang.Number |
getMin()
Gets the minimum value for this field, or null if no minimum value is specified. |
java.lang.Object |
getPeerValue(java.lang.Object value,
java.lang.Class<?> objectClass,
LyObject instance)
Returns an object of the given class from a value of this fieldInfo. |
java.lang.Number |
getPitch()
Gets the pitch (increment). |
java.lang.Number |
getPrecision()
Gets the precision used for computing. |
LyNumberFieldInfo.Type |
getType()
Accessor to the type of the field. |
java.lang.String |
getUnit()
Deprecated. see getFieldUnit() |
java.lang.Class<?> |
getValueClass()
Returns class of values for this field. |
java.lang.Object |
getValueFromObject(java.lang.Object object,
LyObject instance)
Constructs a value for this fieldInfo from an object for a given instance. |
boolean |
isModulo()
Checks if this number is a modulo. |
java.lang.Object |
parse(java.lang.String stringValue)
Builds internal value for an instance of LyNumberFieldInfo from a string (previously constructed by toString). |
java.lang.Object |
processValue(java.lang.Object value)
Processes the given value to get the right value before transmitting it to the peer layer. |
java.lang.String |
toName(java.lang.Object fieldValue)
Return the specified value for this field as a "displayable" string. |
java.lang.String |
toShortName(java.lang.Object fieldValue)
Return the specified value for this field as a short "displayable" string. |
java.lang.String |
toString(java.lang.Object fieldValue)
Converts the specified value for this field to an "internal" string (string that enables reconstruction through parse). |
Methods inherited from class leon.info.LyObjectInfo |
---|
clone, getAlias, getData, getDataList, getDatas, getFilePrefix, getGroup, getInternalAlias, getInternalFilePrefix, getInternalName, getMarks, getName, getTemplate, getTip, getUserData, hasMark, hasMarks, hasTemplate, isTemplate, putData, putData, removeData, toName |
Methods inherited from class leon.info.LyInfo |
---|
getApplication, getFile, getId, getInclude, isIncluded, isInternal, isInternal, isLoaded, isLocked, load, setApplication, setFile, toString |
Methods inherited from class leon.info.LyTag |
---|
getCommentsEnd, getCommentsStart, getEnvironment, getModelType, getParent, getRootProject, hasAncestor, isExtern, setCommentsEnd, setCommentsStart, wasCloned |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface leon.data.LyField |
---|
getId |
Methods inherited from interface leon.parser.LyCommentInterface |
---|
getCommentsEnd, getCommentsStart, setCommentsEnd, setCommentsStart |
Field Detail |
---|
public static final java.lang.String __VERSION
public static final double LY_DOUBLE_MIN_VALUE
public static final float LY_FLOAT_MIN_VALUE
public static boolean USE_PRECISION
Method Detail |
---|
public LyNumberFieldInfo.Type getType()
public java.lang.Class<?> getValueClass()
getValueClass
in interface LyField
getValueClass
in class LyFieldInfo
LyObject.getValue(leon.info.LyFieldInfo)
public LyValue buildFieldValue(java.lang.Object value)
buildFieldValue
in interface LyField
buildFieldValue
in class LyFieldInfo
value
- Value from which the LyValue is built.
LyNumberValue
public java.lang.Object processValue(java.lang.Object value)
processValue
in class LyFieldInfo
value
- Value to process.
public java.lang.Object parse(java.lang.String stringValue) throws LyFieldInfoFormatException
parse
in class LyFieldInfo
stringValue
- The value presented as a string as produced by the toString method.
LyFieldInfoFormatException
- If the string can't be parsed properly.toString(java.lang.Object)
public java.lang.String toName(java.lang.Object fieldValue)
toName
in class LyFieldInfo
LyFieldInfo.getValueClass()
public java.lang.String toShortName(java.lang.Object fieldValue)
toShortName
in class LyFieldInfo
toName(java.lang.Object)
public java.lang.String toString(java.lang.Object fieldValue)
toString
in class LyFieldInfo
parse(java.lang.String)
public void allowFormatAutomaticUpdate(boolean update)
toShortName(Object)
is called if it has not been set yet. Otherwise, format will
not be set.
update
- true if format must be changed automatically, false otherwise.public java.lang.String checkValue(LyEnvironment environment, java.lang.Object fieldValue)
checkValue
in class LyFieldInfo
environment
- Environment giving the user language if a message has to be produced.
LyFieldInfo.getValueClass()
public int compare(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
compare
in class LyFieldInfo
value1
- First value.value2
- Second value.modifiers
- Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
LyFieldInfo.getValueClass()
public LyFilterExpression.Condition[] getFilterConditions()
getFilterConditions
in class LyFieldInfo
LyFilterExpression
public java.lang.Object getValueFromObject(java.lang.Object object, LyObject instance)
Number, String, Character | Short, Integer |
Number, String | Long, Double, Float |
getValueFromObject
in class LyFieldInfo
object
- The peer value.instance
- Instance containing the required value (could be null). This instance is
provided to be able to construct a value for complex bindings (bindings
involving other fields).
LyUnsupportedFieldBindingException
- If the given object can't be converted to a
value of this field.LyFieldInfo.getPeerValue(java.lang.Object, java.lang.Class>, leon.data.LyObject)
,
LyFieldBinding
public java.lang.Object getPeerValue(java.lang.Object value, java.lang.Class<?> objectClass, LyObject instance)
Short, Integer, Long, Double, Float | Number, String, Character |
getPeerValue
in class LyFieldInfo
value
- Value of this fieldInfo. This value is an instance of the class
returned by getValueClass method.objectClass
- Expected class of the physical value.instance
- Instance containing the given value (could be null).
LyUnsupportedFieldBindingException
- If the requested conversion if none of the
supported conversions.LyFieldInfo.getValueClass()
public java.lang.Object compute(LyObjectList objectList, boolean importField)
compute
in class LyFieldInfo
objectList
- List of objects for which a footer value is computed.importField
- True if calling comes on computing of a field import, false otherwise.
public java.lang.Object convertFromFieldUnit(java.lang.Object value, LyUnit unit)
convertFromFieldUnit
in class LyFieldInfo
value
- The value to convert.unit
- The old unit.
public java.lang.Object convertToFieldUnit(java.lang.Object value, LyUnit unit)
convertToFieldUnit
in class LyFieldInfo
value
- The value to convert.unit
- The new unit.
public java.lang.Number getMin()
public java.lang.Number getMax()
public boolean isModulo()
public java.lang.Number getPitch()
public int getDecimals()
public java.lang.Number getPrecision()
public java.lang.Number getDefault()
public java.lang.String getUnit()
public LyNumberFieldInfo.Function getFunction()
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |