LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info
Class LyFieldInfo

java.lang.Object
  extended by leon.info.LyTag
      extended by leon.info.LyInfo
          extended by leon.info.LyObjectInfo
              extended by leon.info.LyFieldInfo
All Implemented Interfaces:
java.lang.Cloneable, LyField, LyCommentInterface
Direct Known Subclasses:
LyArrayFieldInfo, LyChoiceFieldInfo, LyDateFieldInfo, LyFileFieldInfo, LyNumberFieldInfo, LyRelationFieldInfo, LyTextFieldInfo

public abstract class LyFieldInfo
extends LyObjectInfo
implements LyField

This class represents the information related to a field (information attached to an attribute of an application class). It's merely a direct mapping of information as it is defined in the data description file to describe a given field. This class is an abstract one, it contains common attributes for all type of fields. One specific class is then defined fo each type of fields :

These instances are built by the parser from the data description file and must not be modified after parsing.

This class extends LyObjectInfo and thus contains all attributes defined in that class (name, alias, marks, tip, ...).

Specific attributes are added to describe information related to a field. These specific attributes are :


Nested Class Summary
 
Nested classes/interfaces inherited from class leon.info.LyTag
LyTag.Model
 
Field Summary
static java.lang.String __version
           
static short MARK_APP_ID
          Mark : indicating that the value for the field having this mark is used as part of the application identifier for objects corresponding to classes that contain this field.
static short MARK_AUTO_COMPLETION
          Mark : this mark activates auto-completion for this field.
static short MARK_CHART
          Mark : indicates that the field is chartable on fields having this mark.
static short MARK_COMPLEX_TABLE
          Mark : this mark indicates that a field is present in views showing complex tables.
static short MARK_CONSULT
          Mark : indicates that the field is present in editable forms but can't be modified (consult only).
static short MARK_CREATE
          Mark : fields having this mark are present in creation form.
static short MARK_CREATE_CONSULT
          Mark : indicates that the field is present in creation forms but can't be modified (consult only).
static short MARK_DISABLE
          Mark : indicates that the field is disable (not enabled).
static short MARK_FILTER
          Mark : indicating that views presenting objects of classes may be filtered on fields having this mark.
static short MARK_FIND
          Mark : indicates that the field is shown in the find object form.
static short MARK_HIDDEN
          Mark : indicates that the field in not shown in consultation form.
static short MARK_ID
          Mark : indicating that the value for the field having this mark is used as part of the identifier for objects corresponding to classes that contain this field.
static short MARK_LOAD
          Mark : indicates that values for this field must be loaded.
static short MARK_LOCAL
          Mark : indicates that the field is local (no physical representation).
static short MARK_MAIN
          Mark : shortcut for TABLE, FILTER, SORT and FIND marks.
static short MARK_NAME
          Mark : indicating that the value for the field having this mark is used as part of the name for objects corresponding to classes that contain this field.
static short MARK_NEED_POST
          Mark : indicates that the field must be posted when modified.
static short MARK_NO_CAPTION
          Mark : this mark removes caption for this field in forms.
static short MARK_NOT_NULL
          Mark : indicating that the field having this mark must not be transmitted to data providers with a null value.
static short MARK_OPTIONAL
          Mark : a field with this mark has an optional input when presented in forms (creation or modification).
static short MARK_PRIVATE
          Mark : indicates that a field is private and so can't be copied when cloning an object from an existing one.
static short MARK_PROVIDER_VALUE
          Mark : indicates that values for this field is computed by data provider.
static short MARK_READ_ONLY
          Mark : indicates that the field is read-only (not editable).
static short MARK_SEARCH
          Mark : this mark indicates that a field is used by text search action.
static short MARK_SECRET
          Mark : indicates that a field is never shown directly to the end user (for example, when used on text fields, the associated text input in forms shows asterisks when user enters text).
static short MARK_SET
          Mark : Fields having this mark are present in modification form.
static short MARK_SET_CONSULT
          Mark : indicates that the field is present in set forms but can't be modified (consult only).
static short MARK_SORT
          Mark : indicating that table views are sortable on fields having this mark.
static short MARK_STATUS
          Mark : indicating that a field represents the status of the object.
static short MARK_TABLE
          Mark : this mark indicates that a field is present in views showing tables.
static short MARK_TRANSLATE
          Mark : this mark activates translation for this field.
static short MARK_UNIQUE
          Mark : indicates that a field must have a unique value (value not present for other objects belonging to the same class).
static java.lang.String SECRET_VALUE
          Secret value.
static java.lang.Boolean STRONG_DEPENDENCY_VALUE
          Boolean used to store a strong dependency.
static java.lang.Boolean WEAK_DEPENDENCY_VALUE
          Boolean used to store a weak dependency.
 
Fields inherited from class leon.info.LyObjectInfo
__VERSION, NULL, PART_ALL, PART_BIND, PART_DATA, PART_GUI, PART_LABEL
 
Fields inherited from interface leon.data.LyField
__VERSION
 
Method Summary
 void addConstraint(LyFieldConstraint constraint)
          Adds a constraint used in forms layouts.
 void addDepend(LyFieldInfo fieldInfo)
          Add a dependency on the given fieldInfo.
 void addDepend(LyFieldInfo fieldInfo, boolean strong)
          Add a dependency on the given fieldInfo.
 LyValue buildFieldValue(java.lang.Object value)
          Builds the appropriate LyValue corresponding to this field from a value provided as an Object.
 LyValue buildLyValue(java.lang.Object value)
          Deprecated. Replaced by buildFieldValue
 java.lang.String checkJavaName(java.lang.String javaName)
          check javaName attribute, replace points with underscore.
 java.lang.String checkValue(LyEnvironment environment, java.lang.Object fieldValue)
          Unitary check of the given value and produce a legible message to the end user if the value is incorrect.
 int compare(java.lang.Object value1, java.lang.Object value2)
          Compares two values for the specified field.
abstract  int compare(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Compares two values for the specified field.
 java.lang.Object compute(LyObject object)
          Method for computing value for local fields.
 java.lang.Object compute(LyObjectList objectList)
          Method for computing a value using function associated to this field for a given objects list.
 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 compute(LyValueSet values)
          Method for evaluating the value corresponding to this field with the given values set.
 boolean contains(java.lang.Object value1, java.lang.Object value2)
          Checks if the second value is contained in the first one, for this field.
 boolean contains(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Checks if the second value is contained in the first one, for this field.
 java.lang.String controlValue(LyEnvironment environment, java.lang.Object fieldValue)
          Unitary control of the given value and produce a legible message to the end user if the value is incorrect.
 java.lang.Object convertFromFieldUnit(java.lang.Object value, LyUnit unit)
          Convert a value to the reference unit from the given unit.
 java.lang.Object convertToFieldUnit(java.lang.Object value, LyUnit unit)
          Convert a value from the reference unit to the given one.
 java.lang.Object encodeValue(java.lang.Object value)
          Encodes the given value to get the right value before tranmitting it to the peer layer.
 boolean endsWith(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Checks if the second value ends the first one, for this field.
 boolean equals(java.lang.Object value1, java.lang.Object value2)
          Compares two values for equality on this field.
 boolean equals(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Compares two values for equality on this field.
 boolean fromFieldTag()
          Tests if the field was built with a FIELD tag.
 java.lang.String getBean(java.lang.String actionId)
          Deprecated. Use getFieldBean
 java.util.Vector<LyFieldBean> getBeans()
          Gets list of beans defined for one field info.
 java.lang.Class<?> getBehaviorClass()
          Gets behavior class.
 java.lang.String getBehaviorClassName()
          Gets behavior class name.
 LyFieldBinding getBinding()
          Reads the binding information.
 LyFieldConstraint getCaptionConstraint()
          Gets field caption (label) constraint used in forms layouts.
 LyFieldConstraint getConstraint()
          Gets field constraint used in forms layouts.
 LyFieldConstraint getConstraint(LyFieldConstraint.Type type, LyAction action)
          Gets field constraint used in forms layouts.
 java.util.Vector<LyFieldConstraint> getConstraints()
          Gets all constraints of this field info.
 LyControl getControl(int index)
          Fetches the control at the specified index.
 int getControlCount()
          Return the number of controls associated to this field.
 LyInfoList<LyControl> getControls()
          Get field controls.
 java.lang.String getDefaultJavaName()
          Gets default java field name corresponding to this field info.
 java.lang.Object getDefaultValue()
          Gets the default value.
 LyInfoDataList<LyFieldInfo,java.lang.Boolean> getDepends()
          Get field dependencies.
 LyInfoDataList<LyFieldInfo,java.lang.Boolean> getDepends(boolean strong)
          Get field dependencies.
 LyFieldBean getFieldBean(java.lang.String actionId)
          Accessor to the field bean.
 LyFieldGroup getFieldGroup()
          Accessor to the field group.
 LyFieldTab getFieldTab()
          Accessor to the field tab.
 LyUnit getFieldUnit()
          Get field unit.
 LyFilterExpression.Condition[] getFilterConditions()
          Returns the filter conditions authorized on this field.
 short[] getFilterModifiers()
          Returns the filter modifiers authorized on this field.
 java.lang.String getFormat()
          Gets the format as a string.
 java.lang.String getFormula()
          Gets the formula (as a string) associated to this number field.
 LyInfoList<LyFieldInfo> getFormulaFields()
          Gets field infos required for computing value of this field.
 LyInfoList<LyFieldInfo> getFormulaImports(LyClassInfo classInfo)
          Gets field imports of the given class required for computing value of this field.
 java.util.BitSet getGenericMarks()
          Accessor to the generic marks attached to this instance.
 LyFieldInfoImport getImport()
          Gets import information for this field info.
 java.lang.String getJavaName()
          Gets java field name corresponding to this field when java code generation is used.
 LyInfoLabel getLabel(int index)
          Returns the label of this fieldInfo at the given index.
 LyInfoLabel getLabel(LyInfoLabel.Type type)
          Returns the the label of this fieldInfo for the specified type.
 int getLabelCount()
          Returns the number of labels of this fieldInfo.
 LyInfoLabel[] getLabels()
          Returns all labels of this classInfo.
 LyFormula getLyFormula()
          Gets the formula associated to this control.
static int getMark(java.lang.String markName)
          Gets mark index corresponding to the specific given mark name.
static int getMark(java.lang.String markName, boolean add)
          Gets mark index corresponding to the specific given mark name.
static java.lang.String getMarkName(int markIndex)
          Get mark name corresponding to a given mark value.
static java.util.BitSet getMarks(java.util.BitSet marks, int parts)
          Accessor to the marks attached to this instance (presented as a bitset).
 LyPath getPath()
          Gets path information for this field info.
 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.Object[] getPeerValues(java.lang.Object value, java.lang.Class<?>[] objectClasses, LyObject instance)
          Returns a table of objects for the given classes from a value of this fieldInfo.
 java.lang.String[] getSpecificMarks()
          Accessor to the specific marks attached to this instance (presented as an array of strings).
 java.lang.String getTab()
          Accessor to the tab name.
 LyUnits getUnits()
          Get field units.
 LyInfoLabel getUserLabel(int i)
          Returns the user label at the given position.
 LyInfoLabel getUserLabel(java.lang.String subType)
          Returns the user label for the given subType.
 int getUserLabelCount()
          Returns the number of labels of this fieldInfo.
abstract  java.lang.Class<?> getValueClass()
          Returns class of values for this field.
 java.lang.Object getValueFromObject(java.lang.Object object, LyObject instance)
          Builds a logical value for this fieldInfo from a physical (peer) value.
 boolean hasMark(java.lang.String markName)
          Check if a specific mark is set on this field info from its name.
 boolean isCalculated()
          Tests if the field is calculated.
 boolean isComputed()
          Returns a boolean indicating is the value of this fieldInfo is computed or not.
 boolean isImported()
          Returns a boolean indicating is the value of this fieldInfo is imported or not (default is false).
 boolean isLocal()
          Tests if the field is local.
 boolean isMultiple()
          Tests if the field is multiple.
abstract  java.lang.Object parse(java.lang.String stringValue)
          This method allows to create a value from a string for this field.
 java.lang.Object processValue(java.lang.Object value)
          Processes the given value to get the right value before transmitting it to the peer layer.
 void setImport(LyFieldInfoImport importInfo)
          Sets import information for this field info.
 void setPath(LyPath path)
          Sets path information for this field info.
 boolean startsWith(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Checks if the second value starts the first one, for this field.
abstract  java.lang.String toName(java.lang.Object fieldValue)
          Returns a "displayable string" (string that can be shown to the end-user) of the specified value for this field.
 java.lang.String toName(java.lang.Object fieldValue, boolean removeTags)
          Returns a "displayable string" (string that can be shown to the end-user) of the specified value for this field.
 java.lang.String toShortName(java.lang.Object fieldValue)
          Returns the specified value for this field as a short "displayable" string (short string that can be shown to the end-user).
abstract  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, but not shown to the user).
 
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

__version

public static final java.lang.String __version
See Also:
Constant Field Values

STRONG_DEPENDENCY_VALUE

public static final java.lang.Boolean STRONG_DEPENDENCY_VALUE
Boolean used to store a strong dependency.


WEAK_DEPENDENCY_VALUE

public static final java.lang.Boolean WEAK_DEPENDENCY_VALUE
Boolean used to store a weak dependency.


SECRET_VALUE

public static final java.lang.String SECRET_VALUE
Secret value.

See Also:
Constant Field Values

MARK_ID

public static final short MARK_ID
Mark : indicating that the value for the field having this mark is used as part of the identifier for objects corresponding to classes that contain this field. Ids are reserved for internal used and rarely displayed to the user. Several fields may have this mark whithin the same class. The value associated to an id field can not be modified.

See Also:
Constant Field Values

MARK_NAME

public static final short MARK_NAME
Mark : indicating that the value for the field having this mark is used as part of the name for objects corresponding to classes that contain this field. Names are used when displaying objects to the user. Several fields may have this mark whithin the same class.

See Also:
Constant Field Values

MARK_NOT_NULL

public static final short MARK_NOT_NULL
Mark : indicating that the field having this mark must not be transmitted to data providers with a null value. This means that is no value is given when building a request to data providers, the default value is used.

See Also:
Constant Field Values

MARK_CREATE

public static final short MARK_CREATE
Mark : fields having this mark are present in creation form.

See Also:
Constant Field Values

MARK_SET

public static final short MARK_SET
Mark : Fields having this mark are present in modification form. Fields which have mark ID can't have this mark in the same time.

See Also:
Constant Field Values

MARK_OPTIONAL

public static final short MARK_OPTIONAL
Mark : a field with this mark has an optional input when presented in forms (creation or modification).

See Also:
Constant Field Values

MARK_UNIQUE

public static final short MARK_UNIQUE
Mark : indicates that a field must have a unique value (value not present for other objects belonging to the same class).

See Also:
Constant Field Values

MARK_SECRET

public static final short MARK_SECRET
Mark : indicates that a field is never shown directly to the end user (for example, when used on text fields, the associated text input in forms shows asterisks when user enters text). This mark is merely used for passwords.

See Also:
Constant Field Values

MARK_PRIVATE

public static final short MARK_PRIVATE
Mark : indicates that a field is private and so can't be copied when cloning an object from an existing one.

See Also:
Constant Field Values

MARK_TABLE

public static final short MARK_TABLE
Mark : this mark indicates that a field is present in views showing tables. This mark is put on main fields of a class.

See Also:
Constant Field Values

MARK_STATUS

public static final short MARK_STATUS
Mark : indicating that a field represents the status of the object. Several fields can have this mark in the same class. For instance in a table, this status is shown as an icon to the left of each row.

See Also:
Constant Field Values

MARK_SORT

public static final short MARK_SORT
Mark : indicating that table views are sortable on fields having this mark.

See Also:
Constant Field Values

MARK_FILTER

public static final short MARK_FILTER
Mark : indicating that views presenting objects of classes may be filtered on fields having this mark.

See Also:
Constant Field Values

MARK_FIND

public static final short MARK_FIND
Mark : indicates that the field is shown in the find object form. This form allows to retrieve objects by giving searched value on fields having this mark.

See Also:
Constant Field Values

MARK_LOCAL

public static final short MARK_LOCAL
Mark : indicates that the field is local (no physical representation). Local fields are never transmitted to data providers, and so can't be persistent. Depending on field type, local fields may be calculated.

See Also:
Constant Field Values

MARK_CONSULT

public static final short MARK_CONSULT
Mark : indicates that the field is present in editable forms but can't be modified (consult only).

See Also:
Constant Field Values

MARK_CREATE_CONSULT

public static final short MARK_CREATE_CONSULT
Mark : indicates that the field is present in creation forms but can't be modified (consult only).

See Also:
Constant Field Values

MARK_SET_CONSULT

public static final short MARK_SET_CONSULT
Mark : indicates that the field is present in set forms but can't be modified (consult only).

See Also:
Constant Field Values

MARK_NEED_POST

public static final short MARK_NEED_POST
Mark : indicates that the field must be posted when modified.

See Also:
Constant Field Values

MARK_CHART

public static final short MARK_CHART
Mark : indicates that the field is chartable on fields having this mark.

See Also:
Constant Field Values

MARK_READ_ONLY

public static final short MARK_READ_ONLY
Mark : indicates that the field is read-only (not editable).

See Also:
Constant Field Values

MARK_DISABLE

public static final short MARK_DISABLE
Mark : indicates that the field is disable (not enabled).

See Also:
Constant Field Values

MARK_MAIN

public static final short MARK_MAIN
Mark : shortcut for TABLE, FILTER, SORT and FIND marks.

See Also:
Constant Field Values

MARK_HIDDEN

public static final short MARK_HIDDEN
Mark : indicates that the field in not shown in consultation form.

See Also:
Constant Field Values

MARK_LOAD

public static final short MARK_LOAD
Mark : indicates that values for this field must be loaded.

See Also:
Constant Field Values

MARK_PROVIDER_VALUE

public static final short MARK_PROVIDER_VALUE
Mark : indicates that values for this field is computed by data provider.

See Also:
Constant Field Values

MARK_APP_ID

public static final short MARK_APP_ID
Mark : indicating that the value for the field having this mark is used as part of the application identifier for objects corresponding to classes that contain this field. Several fields may have this mark whithin the same class and the combination of values of these fields must be unique for a classInfo. The value associated to an appId field can be modified.

See Also:
Constant Field Values

MARK_COMPLEX_TABLE

public static final short MARK_COMPLEX_TABLE
Mark : this mark indicates that a field is present in views showing complex tables.

See Also:
Constant Field Values

MARK_SEARCH

public static final short MARK_SEARCH
Mark : this mark indicates that a field is used by text search action.

See Also:
Constant Field Values

MARK_AUTO_COMPLETION

public static final short MARK_AUTO_COMPLETION
Mark : this mark activates auto-completion for this field.

See Also:
Constant Field Values

MARK_TRANSLATE

public static final short MARK_TRANSLATE
Mark : this mark activates translation for this field.

See Also:
Constant Field Values

MARK_NO_CAPTION

public static final short MARK_NO_CAPTION
Mark : this mark removes caption for this field in forms.

See Also:
Constant Field Values
Method Detail

getMark

public static int getMark(java.lang.String markName,
                          boolean add)
Gets mark index corresponding to the specific given mark name. Marks are represented as bits in a bitset. Each mark has a bit position assigned to it. This mark allows to retrieve this bit value by the name of the mark.

Parameters:
markName - Name of the mark.
add - indicates if the.mark must be added if it doesn't exit
Returns:
Returns mark value (bit position in a bits set)
See Also:
getMarkName(int)

getMark

public static int getMark(java.lang.String markName)
Gets mark index corresponding to the specific given mark name. Marks are represented as bits in a bitset. Each mark has a bit position assigned to it. This mark allows to retrieve this bit value by the name of the mark.

Parameters:
markName - Name of the mark.
Returns:
Returns mark value (bit position in a bits set)
See Also:
getMarkName(int)

getMarkName

public static java.lang.String getMarkName(int markIndex)
Get mark name corresponding to a given mark value.

Parameters:
markIndex - Mark value (index of a bit in a bits set).
Returns:
Corresponding mark name.
See Also:
getMark(java.lang.String, boolean)

getValueClass

public abstract java.lang.Class<?> getValueClass()
Returns class of values for this field. This class is the class of the value returned when getValue is done on an object. This is the class of the internal Leonardi representation for the values of this field whatever the real "physical class" to which this field binds to, is.

Specified by:
getValueClass in interface LyField
Returns:
Effective class of values built by this fieldInfo. This method is abstract, the real class depends on each type of field.
See Also:
LyObject.getValue(leon.info.LyFieldInfo)

buildFieldValue

public LyValue buildFieldValue(java.lang.Object value)
Builds the appropriate LyValue corresponding to this field from a value provided as an Object.

Specified by:
buildFieldValue in interface LyField
Parameters:
value - Value from which the LyValue is built.
Returns:
An instance of a class that inherits from LyValue corresponding the given value. Classes extending LyValue are given to ease data manipulations, they contain methods that encapsulate data conversions from and to the internal representation. There is one class for each type of field.

processValue

public java.lang.Object processValue(java.lang.Object value)
Processes the given value to get the right value before transmitting it to the peer layer.

Parameters:
value - Value to process.
Returns:
The processed value.

encodeValue

public java.lang.Object encodeValue(java.lang.Object value)
Encodes the given value to get the right value before tranmitting it to the peer layer.

Parameters:
value - Value to encode.
Returns:
The encoded value.

parse

public abstract java.lang.Object parse(java.lang.String stringValue)
                                throws LyFieldInfoFormatException
This method allows to create a value from a string for this field. The class of the returned value is the one given by getValueClass method.

Parameters:
stringValue - The value presented as a string as produced by the toString method.
Returns:
The value decoded from the given string.
Throws:
LyFieldInfoFormatException - If the string can't be parsed properly.
See Also:
toString(java.lang.Object), getValueClass()

toName

public abstract java.lang.String toName(java.lang.Object fieldValue)
Returns a "displayable string" (string that can be shown to the end-user) of the specified value for this field.

Parameters:
value - The internal value to convert to a displayable string. The excepted class of this value is the one returned from the getValueClass method.
Returns:
The value presented as a displayable String.
See Also:
getValueClass()

toName

public java.lang.String toName(java.lang.Object fieldValue,
                               boolean removeTags)
Returns a "displayable string" (string that can be shown to the end-user) of the specified value for this field.

Parameters:
value - The internal value to convert to a displayable string. The excepted class of this value is the one returned from the getValueClass method.
removeTags - Indicates whether HTML tags have to be removed from result.
Returns:
The value presented as a displayable String.
See Also:
getValueClass()

toShortName

public java.lang.String toShortName(java.lang.Object fieldValue)
Returns the specified value for this field as a short "displayable" string (short string that can be shown to the end-user). Default implementation consists of returning same result as toName.

Parameters:
value - The internal value to convert to a short displayable string. The excepted class of this value is the one returned from the getValueClass method.
Returns:
The value presented as a short displayable String.
See Also:
getValueClass(), toName(java.lang.Object)

toString

public abstract 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, but not shown to the user). This string may not be significant to the end-user and usually should not be displayed.

Parameters:
value - The internal value to convert to an internal string. The excepted class of this value is the one returned from the getValueClass method.
Returns:
the value as an internal String.
See Also:
parse(java.lang.String), getValueClass()

controlValue

public java.lang.String controlValue(LyEnvironment environment,
                                     java.lang.Object fieldValue)
Unitary control of the given value and produce a legible message to the end user if the value is incorrect. This method is called when validating a form containing this field info. Default implementation calls check value to prevent cases where it was not done on changes.

Parameters:
environment - Environment giving the user language if a message has to be produced.
value - Value to control. The excepted class of this value is the one returned from the getValueClass method.
Returns:
Returns an error message if the value is incorrect, null otherwise.
See Also:
getValueClass()

checkValue

public java.lang.String checkValue(LyEnvironment environment,
                                   java.lang.Object fieldValue)
Unitary check of the given value and produce a legible message to the end user if the value is incorrect. This method is called when changing in a form the value corresponding to this field info.

Parameters:
environment - Environment giving the user language if a message has to be produced.
value - Value to check. The excepted class of this value is the one returned from the getValueClass method.
Returns:
Returns an error message if the value is incorrect, null otherwise.
See Also:
getValueClass()

compare

public abstract int compare(java.lang.Object value1,
                            java.lang.Object value2,
                            java.util.BitSet modifiers)
Compares two values for the specified field. The excepted class of the values to compare is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
modifiers - Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
Returns:
0 If the two values are identical for the specified fieldInfo, a positive number if value1 is "greater" than value2. If value2 is "greater" than value1, a negative number is returned.
See Also:
getValueClass()

compare

public final int compare(java.lang.Object value1,
                         java.lang.Object value2)
Compares two values for the specified field. The excepted class of the values to compare is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
Returns:
0 If the two values are identical for the specified fieldInfo, a positive number if value1 is "greater" than value2. If value2 is "greater" than value1, a negative number is returned.
See Also:
getValueClass()

equals

public final boolean equals(java.lang.Object value1,
                            java.lang.Object value2)
Compares two values for equality on this field. The excepted class of the values to compare is the one returned from the getValueClass method. The default implementation consits of comparing values using compare method and returning true when result is 0. Due to the fact that this method can be called often, this method is provided to speed up this compare when it's possible to do better.

Parameters:
value1 - First value.
value2 - Second value.
Returns:
True if the values are equals, else false.
See Also:
compare(java.lang.Object, java.lang.Object, java.util.BitSet), getValueClass()

equals

public boolean equals(java.lang.Object value1,
                      java.lang.Object value2,
                      java.util.BitSet modifiers)
Compares two values for equality on this field. The excepted class of the values to compare is the one returned from the getValueClass method. The default implementation consits of comparing values using compare method and returning true when result is 0. Due to the fact that this method can be called often, this method is provided to speed up this compare when it's possible to do better.

Parameters:
value1 - First value.
value2 - Second value.
modifiers - Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
Returns:
True if the values are equals, else false.
See Also:
compare(java.lang.Object, java.lang.Object, java.util.BitSet), getValueClass()

contains

public final boolean contains(java.lang.Object value1,
                              java.lang.Object value2)
Checks if the second value is contained in the first one, for this field. Warning ! This kind of check does not make sense for every type of field and an exception can be thrown in that case. The excepted class of the values is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
Returns:
True if the second value is contained in the first one, else returns false.
Throws:
LyUnsupportedComparisonException - If it does not make sense to check if a value is contained in an other one from this field "point of view".

contains

public boolean contains(java.lang.Object value1,
                        java.lang.Object value2,
                        java.util.BitSet modifiers)
Checks if the second value is contained in the first one, for this field. Warning ! This kind of check does not make sense for every type of field and an exception can be thrown in that case. The excepted class of the values is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
modifiers - Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
Returns:
True if the second value is contained in the first one, else returns false.
Throws:
LyUnsupportedComparisonException - If it does not make sense to check if a value is contained in an other one from this field "point of view".

startsWith

public boolean startsWith(java.lang.Object value1,
                          java.lang.Object value2,
                          java.util.BitSet modifiers)
Checks if the second value starts the first one, for this field. Warning ! This kind of check does not make sense for every type of field and an exception can be thrown in that case. The excepted class of the values is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
modifiers - Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
Returns:
True if the second value starts the first one, else returns false.
Throws:
LyUnsupportedComparisonException - If it does not make sense to check if a value starts the other one from this field "point of view".

endsWith

public boolean endsWith(java.lang.Object value1,
                        java.lang.Object value2,
                        java.util.BitSet modifiers)
Checks if the second value ends the first one, for this field. Warning ! This kind of check does not make sense for every type of field and an exception can be thrown in that case. The excepted class of the values is the one returned from the getValueClass method.

Parameters:
value1 - First value.
value2 - Second value.
modifiers - Modifiers used for checking (see MOD_XXX constants of LyFilterExpression).
Returns:
True if the second value ends the first one, else returns false.
Throws:
LyUnsupportedComparisonException - If it does not make sense to check if a value ends the other one from this field "point of view".

getFilterConditions

public LyFilterExpression.Condition[] getFilterConditions()
Returns the filter conditions authorized on this field. The values must match the short constants defined in LyFilterExpression.

Returns:
An array of short corresponding to the authorized conditions on this field.
See Also:
LyFilterExpression

getFilterModifiers

public short[] getFilterModifiers()
Returns the filter modifiers authorized on this field. The values must match the short constants defined in LyFilterExpression.

Returns:
An array of short corresponding to the authorized modifiers on this field.
See Also:
LyFilterExpression

getValueFromObject

public java.lang.Object getValueFromObject(java.lang.Object object,
                                           LyObject instance)
Builds a logical value for this fieldInfo from a physical (peer) value. This method is used when the binding specified for this field is a LyFieldBinding.

Parameters:
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).
Returns:
The logical value that was built (instance of the class returned from getValueClass).
Throws:
LyUnsupportedFieldBindingException - Thrown if we don't known how to build a value from the given object.
See Also:
getPeerValue(java.lang.Object, java.lang.Class, leon.data.LyObject), LyFieldBinding

getPeerValue

public 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. The purpose of this method is to support transformations from logical to physical representation when simple bindings are used.

Parameters:
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).
Throws:
LyUnsupportedFieldBindingException - Thrown if we don't known how to build a peer value from the given parameters.
See Also:
getValueClass()

getPeerValues

public java.lang.Object[] getPeerValues(java.lang.Object value,
                                        java.lang.Class<?>[] objectClasses,
                                        LyObject instance)
Returns a table of objects for the given classes from a value of this fieldInfo. The purpose of this method is to support transformations from logical to physical representation when multiple bindings are used.

Parameters:
value - Value of this fieldInfo. This value is an instance of the class returned by getValueClass method.
objectClasses - Expected classes of the physical values.
instance - Instance containing the given value (could be null).
Throws:
LyUnsupportedFieldBindingException - Thrown if we don't known how to build the peer values from the given parameters.
See Also:
getValueClass()

compute

public java.lang.Object compute(LyObject object)
Method for computing value for local fields.

Parameters:
object - Object for which the value of this field is computed.
Returns:
The computed value if it could be done. The returned value is an instance of the class given by getValueClass().
Throws:
java.lang.IllegalStateException - Thrown if values of this fieldInfo are not computed.
See Also:
getValueClass()

compute

public java.lang.Object compute(LyValueSet values)
Method for evaluating the value corresponding to this field with the given values set. If this number field has a formula, it's used to calculate the returned value.

Parameters:
values - Values set that contains part or all of the values needed to compute the formula. If not all values are given, the formula uses the previous value
Returns:
The value corresponding to this field using the given values. The returned value is an instance of the class given by getValueClass method.

isComputed

public boolean isComputed()
Returns a boolean indicating is the value of this fieldInfo is computed or not. Returns true if the field is local and controlled by a daemon.

Returns:
True if the relation is computed, false otherwise.

isImported

public boolean isImported()
Returns a boolean indicating is the value of this fieldInfo is imported or not (default is false).

Returns:
True if values of this fieldInfo are imported, false otherwise.

compute

public final java.lang.Object compute(LyObjectList objectList)
Method for computing a value using function associated to this field for a given objects list. This method is called when this field is presented in a table that has a footer.

Parameters:
objectList - List of objects for which a footer value is computed.
Returns:
Value computed with field function for the given objects. Returns null if this field has no associated function.

compute

public java.lang.Object compute(LyObjectList objectList,
                                boolean importField)
Method for computing a value using function associated to this field for a given objects list. This method is called when this field is presented in a table that has a footer.

Parameters:
objectList - List of objects for which a footer value is computed.
importField - True if calling comes on computing of a field import, false otherwise.
Returns:
Value computed with field function for the given objects. Returns null if this field has no associated function.

convertFromFieldUnit

public java.lang.Object convertFromFieldUnit(java.lang.Object value,
                                             LyUnit unit)
Convert a value to the reference unit from the given unit.

Parameters:
value - The value to convert.
unit - The old unit.
Returns:
The value converted to the given unit from the reference unit.

convertToFieldUnit

public java.lang.Object convertToFieldUnit(java.lang.Object value,
                                           LyUnit unit)
Convert a value from the reference unit to the given one.

Parameters:
value - The value to convert.
unit - The new unit.
Returns:
The value converted from the given unit to the reference unit.

getDepends

public final LyInfoDataList<LyFieldInfo,java.lang.Boolean> getDepends()
Get field dependencies. A dependency means that a change on this field impacts the given field. If both fields are presented in a view, when a change occurs on this field graphical items representing both fields need to be refresh.


getDepends

public LyInfoDataList<LyFieldInfo,java.lang.Boolean> getDepends(boolean strong)
Get field dependencies. A dependency means that a change on this field impacts the given field. If both fields are presented in a view, when a change occurs on this field graphical items representing both fields need to be refresh.

Parameters:
strong - If true, gives only strong dependencies.
Returns:
List of field infos that depend on this field info (the associated data is a Boolean indicating if the dependency is strong or not).

getControlCount

public int getControlCount()
Return the number of controls associated to this field.

Returns:
Number of controls of this field.

getControl

public LyControl getControl(int index)
Fetches the control at the specified index.

Parameters:
index - Index of the searched control.
Returns:
The requested control if found, or null if it could not be found.

getControls

public LyInfoList<LyControl> getControls()
Get field controls.


getUnits

public LyUnits getUnits()
Get field units.

Returns:
Units list.

getFieldUnit

public LyUnit getFieldUnit()
Get field unit.

Returns:
Unit of the field.

getBehaviorClassName

public java.lang.String getBehaviorClassName()
Gets behavior class name.

Returns:
Java name of behavior (may be null).

getBehaviorClass

public java.lang.Class<?> getBehaviorClass()
Gets behavior class. Class that defines behavior for this field info for filtering and sorting.

Returns:
Behavior class for this field info (may be null).

getJavaName

public java.lang.String getJavaName()
Gets java field name corresponding to this field when java code generation is used.

Returns:
Name of the java field corresponding to this fieldInfo. By default, if no java name is set, this method returns the id of this field.

getDefaultJavaName

public final java.lang.String getDefaultJavaName()
Gets default java field name corresponding to this field info.

Returns:
Name of the default java field corresponding to this fieldInfo.

checkJavaName

public java.lang.String checkJavaName(java.lang.String javaName)
check javaName attribute, replace points with underscore.

Returns:
new javaName

getTab

public final java.lang.String getTab()
Accessor to the tab name. The tab information is used by generic processing to build Windows (for example modification window), and will add the corresponding control in a tab. Tab info may be null (do not add to any tab)

Returns:
the tab or null if no tab is requested.

getFieldTab

public final LyFieldTab getFieldTab()
Accessor to the field tab.

Returns:
the field tab or null if no field tab was defined on this field.

getFieldGroup

public final LyFieldGroup getFieldGroup()
Accessor to the field group.

Returns:
the field group or null if no field group was defined on this field.

getBean

public final java.lang.String getBean(java.lang.String actionId)
Deprecated. Use getFieldBean

Accessor to the beans information. A bean is an interface for a graphical object that may be used instead of standard objects for a given action.

Parameters:
actionId - Action id for which a bean is searched.
Returns:
Bean associated to the given action id, null if no bean is specified on this action.

getFieldBean

public final LyFieldBean getFieldBean(java.lang.String actionId)
Accessor to the field bean. A bean is an interface for a graphical object that may be used instead of standard objects for a given action.

Parameters:
actionId - Action id for which a bean is searched.
Returns:
Bean associated to the given action id, null if no bean is specified on this action.

getBeans

public final java.util.Vector<LyFieldBean> getBeans()
Gets list of beans defined for one field info.

Returns:
Vector containing all beans, null if no beans was registered for this field info.

getBinding

public LyFieldBinding getBinding()
Reads the binding information. Generic or specific connection classes use the binding information to fetch data from and to a data provider. For instance the binding info may be a column name in a RDBMS.

Returns:
the binding information.

getFormat

public java.lang.String getFormat()
Gets the format as a string. The meaning of this format depends on each type of field.

Returns:
Current format or null if no format is specified for this field.

getDefaultValue

public java.lang.Object getDefaultValue()
Gets the default value. This default value if an instance of the class returned by getValueClass.

Returns:
Default value for this fieldInfo, null if no default value was set.

isCalculated

public boolean isCalculated()
Tests if the field is calculated.

Returns:
True if the field is calculated, false otherwise

isMultiple

public boolean isMultiple()
Tests if the field is multiple.

Returns:
True if this field is multiple, false otherwise.

isLocal

public final boolean isLocal()
Tests if the field is local. This means that this field has no physical representation and thus is not persistent.

Returns:
True if this field is local, false otherwise.

getImport

public LyFieldInfoImport getImport()
Gets import information for this field info. Import allows to use a relation of the same class info to get the value of a field of the object(s) pointed by the relation.

Returns:
Import information for this fieldInfo, null if no import was defined.

getPath

public LyPath getPath()
Gets path information for this field info. Path allows to get the value of a field of the objects pointed by this path.

Returns:
Path information for this fieldInfo, null if no path was defined.

getConstraint

public final LyFieldConstraint getConstraint()
Gets field constraint used in forms layouts. This applies to the content of the edition field, the related label is managed by a caption constraint (getCaptionConstraint).

Returns:
Field constraint of this fieldInfo, null if no constraint was defined.

getCaptionConstraint

public final LyFieldConstraint getCaptionConstraint()
Gets field caption (label) constraint used in forms layouts. This applies to the caption (label) of the edition field. The constraint for the field itself is managed by getConstraint

Returns:
Caption constraint of this fieldInfo, null if no constraint was defined.

getConstraint

public final LyFieldConstraint getConstraint(LyFieldConstraint.Type type,
                                             LyAction action)
Gets field constraint used in forms layouts.

Parameters:
type - Type of the requested constraint.
action - Action where the constraint is used.
Returns:
Constraint found, null if no constraint was defined.

getConstraints

public final java.util.Vector<LyFieldConstraint> getConstraints()
Gets all constraints of this field info.


fromFieldTag

public boolean fromFieldTag()
Tests if the field was built with a FIELD tag.

Returns:
True if this field was declared with a FIELD tag, false otherwise.

addDepend

public final void addDepend(LyFieldInfo fieldInfo)
Add a dependency on the given fieldInfo.

Parameters:
fieldInfo - Field for which a dependency on this field is added.

addDepend

public final void addDepend(LyFieldInfo fieldInfo,
                            boolean strong)
Add a dependency on the given fieldInfo.

Parameters:
fieldInfo - Field for which a dependency on this field is added.
strong - True if the dependency between this field and the given one is strong (they must be modified simultaneously).

buildLyValue

public final LyValue buildLyValue(java.lang.Object value)
Deprecated. Replaced by buildFieldValue

Builds the appropriate field value corresponding to this field from a value given as an Object.


setImport

public void setImport(LyFieldInfoImport importInfo)
Sets import information for this field info. Import allows to use a relation of the same class info to get the value of a field of the object(s) pointed by the relation.

Parameters:
importInfo - Import information.

setPath

public void setPath(LyPath path)
Sets path information for this field info. Path allows to get the value of a field of the object(s) pointed this path.

Parameters:
path - Path information.

addConstraint

public void addConstraint(LyFieldConstraint constraint)
Adds a constraint used in forms layouts.

Parameters:
constraint - Constraint of this fieldInfo.

getMarks

public static final java.util.BitSet getMarks(java.util.BitSet marks,
                                              int parts)
Accessor to the marks attached to this instance (presented as a bitset).

Returns:
A copy of the bitset which represents the marks (properties) of this instance.
See Also:
BitSet

getLabelCount

public int getLabelCount()
Returns the number of labels of this fieldInfo.


getLabel

public LyInfoLabel getLabel(LyInfoLabel.Type type)
Returns the the label of this fieldInfo for the specified type.


getLabel

public LyInfoLabel getLabel(int index)
Returns the label of this fieldInfo at the given index.


getUserLabelCount

public int getUserLabelCount()
Returns the number of labels of this fieldInfo.


getUserLabel

public LyInfoLabel getUserLabel(int i)
Returns the user label at the given position.


getUserLabel

public LyInfoLabel getUserLabel(java.lang.String subType)
Returns the user label for the given subType.


getLabels

public LyInfoLabel[] getLabels()
Returns all labels of this classInfo.


hasMark

public final boolean hasMark(java.lang.String markName)
Check if a specific mark is set on this field info from its name.

Parameters:
markName - Name of the mark tested for this field info.
Returns:
True if the mark is set, false otherwise.

getGenericMarks

public java.util.BitSet getGenericMarks()
Accessor to the generic marks attached to this instance.


getSpecificMarks

public java.lang.String[] getSpecificMarks()
Accessor to the specific marks attached to this instance (presented as an array of strings).


getFormula

public java.lang.String getFormula()
Gets the formula (as a string) associated to this number field. The formula is provided to calculate values of this field thanks to a simple mathematic expression using other numerc fields in the same application class.

Returns:
Current formula or null if no formula is set.

getLyFormula

public final LyFormula getLyFormula()
Gets the formula associated to this control.

Returns:
Current formula or null if no formula is set.

getFormulaFields

public LyInfoList<LyFieldInfo> getFormulaFields()
Gets field infos required for computing value of this field.

Returns:
The list of fields used in the field formula, null if this field doesn't have a formula.

getFormulaImports

public LyInfoList<LyFieldInfo> getFormulaImports(LyClassInfo classInfo)
Gets field imports of the given class required for computing value of this field.

Parameters:
classInfo - Class of the fields.
Returns:
The list of fields used in the field formula, null if this field doesn't have a formula.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com