LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info
Class LyTextFieldInfo

java.lang.Object
  extended by leon.info.LyTag
      extended by leon.info.LyInfo
          extended by leon.info.LyObjectInfo
              extended by leon.info.LyFieldInfo
                  extended by leon.info.LyTextFieldInfo
All Implemented Interfaces:
java.lang.Cloneable, LyField, LyCommentInterface

public final class LyTextFieldInfo
extends LyFieldInfo

This class implements the description of text fields. Text fields may contain characters as simple text (ASCII/Unicode) or will use other text formating protocols in future versions : HTML, RTF. Displaying the content of this field will be up to the implementation of the graphical component.

In addition to standard fieldInfo properties, a textFieldInfo may contain some extra information about the way the text should be shown (number of rows/columns) or structured (format/number of characters allowed).

A text field may also be simple or multiple. This means that user inputs can be mono or multiline.

See also tag of leon.dtd


Nested Class Summary
static class LyTextFieldInfo.Type
          Text types.
 
Nested classes/interfaces inherited from class leon.info.LyTag
LyTag.Model
 
Field Summary
static java.lang.String __VERSION
           
static java.lang.String CLOSE_END_LANG
           
static java.lang.String CLOSE_START_LANG
           
static java.lang.String OPEN_END_LANG
           
static java.lang.String OPEN_START_LANG
           
 
Fields inherited from class leon.info.LyFieldInfo
__version, MARK_APP_ID, MARK_AUTO_COMPLETION, MARK_CHART, MARK_COMPLEX_TABLE, MARK_CONSULT, MARK_CREATE, MARK_CREATE_CONSULT, MARK_DISABLE, MARK_FILTER, MARK_FIND, MARK_HIDDEN, MARK_ID, MARK_LOAD, MARK_LOCAL, MARK_MAIN, MARK_NAME, MARK_NEED_POST, MARK_NO_CAPTION, MARK_NOT_NULL, MARK_OPTIONAL, MARK_PRIVATE, MARK_PROVIDER_VALUE, MARK_READ_ONLY, MARK_SEARCH, MARK_SECRET, MARK_SET, MARK_SET_CONSULT, MARK_SORT, MARK_STATUS, MARK_TABLE, MARK_TRANSLATE, MARK_UNIQUE, SECRET_VALUE, STRONG_DEPENDENCY_VALUE, WEAK_DEPENDENCY_VALUE
 
Fields inherited from class leon.info.LyObjectInfo
NULL, PART_ALL, PART_BIND, PART_DATA, PART_GUI, PART_LABEL
 
Method Summary
 java.lang.String addLangValue(java.lang.String value, java.lang.String lang, java.lang.String langValue)
          Adds/Replaces the value for specified language in given value.
 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 : - if the text field has a regex format (format starting with "regex:"), the given value must be conform to this format, - if a maximum number of characters is given on this text field, the value must not contain more characters than specified.
 int compare(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Compare two value objects for this field info.
 java.lang.Object compute(LyObjectList objectList, boolean importField)
          Method for computing a value using function associated to this field for a given objects list.
 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.Object encodeValue(java.lang.Object value)
          Encodes the given value to get the right value before transmitting 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, java.util.BitSet modifiers)
          Compares two values for equality on this field.
 LyInfoCharType getCharType(int idx)
          Gets the characters type enabled by this text field at the specified index.
 java.util.Vector<LyInfoCharType> getCharTypes()
          Gets the characters type enabled by this text field.
 int getCharTypesCount()
          Returns the number of characters type of this text fieldinfo.
 java.lang.String getCharTypeValue(int idx)
          Gets the characters type enabled by this text field at the specified index.
 java.lang.String getEncoding()
          Gets the name of the encoding class for this text field.
 LyFilterExpression.Condition[] getFilterConditions()
          Returns the filter conditions authorized on this field.
 short[] getFilterModifiers()
          Returns the filter modifiers authorized on this field.
 java.lang.String getLangValue(java.lang.String lang, java.lang.String value)
          Gets the value for specified language from given value.
 int getMaxChars()
          Gets the maximum number of characters allowed on values of this text field.
 int getMinChars()
          Gets the minimum number of characters allowed on values of this text field.
 int getNChars()
          Deprecated. see getMaxChars
 int getNCols()
          Gets the prefered number of columns shown to the user at the same time.
 int getNRows()
          Gets the prefered number of rows shown to the user at the same time.
 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.String getRegex()
          Deprecated. see getRegExp
 LyRegExp getRegExp()
          Gets the regular expression for matching format of this text field.
 LyTextFieldInfo.Type getType()
          Sets the type of this text field.
 java.lang.Class<java.lang.String> getValueClass()
          Returns class of values for this field.
 java.lang.Object getValueFromObject(java.lang.Object object, LyObject instance)
          Constructs a value for this field info from an object for a given instance.
 boolean isMultilingual()
          Checks whether this text field is multilingual.
 boolean isMultiple()
          Checks whether this text field is multiple.
 java.lang.Object parse(java.lang.String stringValue)
          Builds internal value for an instance of this fieldInfo from a string (previously constructed by toString).
 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.
 java.lang.String toName(java.lang.Object fieldValue)
          Return the specified value for this field as a "displayable" string.
 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)
          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.LyFieldInfo
addConstraint, addDepend, addDepend, buildLyValue, checkJavaName, compare, compute, compute, compute, contains, controlValue, convertFromFieldUnit, convertToFieldUnit, equals, fromFieldTag, getBean, getBeans, getBehaviorClass, getBehaviorClassName, getBinding, getCaptionConstraint, getConstraint, getConstraint, getConstraints, getControl, getControlCount, getControls, getDefaultJavaName, getDefaultValue, getDepends, getDepends, getFieldBean, getFieldGroup, getFieldTab, getFieldUnit, getFormat, getFormula, getFormulaFields, getFormulaImports, getGenericMarks, getImport, getJavaName, getLabel, getLabel, getLabelCount, getLabels, getLyFormula, getMark, getMark, getMarkName, getMarks, getPath, getPeerValues, getSpecificMarks, getTab, getUnits, getUserLabel, getUserLabel, getUserLabelCount, hasMark, isCalculated, isComputed, isImported, isLocal, processValue, setImport, setPath
 
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

OPEN_START_LANG

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

CLOSE_START_LANG

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

OPEN_END_LANG

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

CLOSE_END_LANG

public static final java.lang.String CLOSE_END_LANG
See Also:
Constant Field Values
Method Detail

getValueClass

public java.lang.Class<java.lang.String> getValueClass()
Returns class of values for this field. The unique value class corresponding to a text field is : String.class

Specified by:
getValueClass in interface LyField
Specified by:
getValueClass in class LyFieldInfo
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 for the given value object.

Specified by:
buildFieldValue in interface LyField
Overrides:
buildFieldValue in class LyFieldInfo
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.
See Also:
LyTextValue

encodeValue

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

Overrides:
encodeValue in class LyFieldInfo
Parameters:
value - Value to encode.
Returns:
The encoded value.

parse

public java.lang.Object parse(java.lang.String stringValue)
                       throws LyFieldInfoFormatException
Builds internal value for an instance of this fieldInfo from a string (previously constructed by toString).

Specified by:
parse in class LyFieldInfo
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)

toShortName

public java.lang.String toShortName(java.lang.Object fieldValue)
Return the specified value for this field as a short "displayable" string. This method is used when presenting values in tables. In that case, values are presented whithout unit.

Overrides:
toShortName in class LyFieldInfo
Returns:
The value presented as a short displayable String.
See Also:
LyNumberFieldInfo.toName(java.lang.Object)

toName

public java.lang.String toName(java.lang.Object fieldValue)
Return the specified value for this field as a "displayable" string.

Specified by:
toName in class LyFieldInfo
Returns:
The value presented as a displayable String.
See Also:
LyFieldInfo.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.

Overrides:
toName in class LyFieldInfo
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:
LyFieldInfo.getValueClass()

toString

public 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).

Specified by:
toString in class LyFieldInfo
Returns:
the value as an internal String.
See Also:
parse(java.lang.String)

getLangValue

public java.lang.String getLangValue(java.lang.String lang,
                                     java.lang.String value)
Gets the value for specified language from given value.

Parameters:
lang - Language (null for current lang).
value - Initial value.
Returns:
The value for given language, the initial value if not found.

addLangValue

public java.lang.String addLangValue(java.lang.String value,
                                     java.lang.String lang,
                                     java.lang.String langValue)
Adds/Replaces the value for specified language in given value.

Parameters:
value - Initial value.
lang - Language.
value - Lang value.
Returns:
The completed value.

getFilterConditions

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

Overrides:
getFilterConditions in class LyFieldInfo
Returns:
An array of conditions 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.

Overrides:
getFilterModifiers in class LyFieldInfo
Returns:
An array of short corresponding to the authorized modifiers on this field.
See Also:
LyFilterExpression

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.

Overrides:
equals in class LyFieldInfo
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:
LyFieldInfo.compare(java.lang.Object, java.lang.Object, java.util.BitSet), LyFieldInfo.getValueClass()

compare

public int compare(java.lang.Object value1,
                   java.lang.Object value2,
                   java.util.BitSet modifiers)
Compare two value objects for this field info.

Specified by:
compare in class LyFieldInfo
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:
LyFieldInfo.getValueClass()

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.

Overrides:
contains in class LyFieldInfo
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.

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.

Overrides:
startsWith in class LyFieldInfo
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.

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.

Overrides:
endsWith in class LyFieldInfo
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.

getValueFromObject

public java.lang.Object getValueFromObject(java.lang.Object object,
                                           LyObject instance)
Constructs a value for this field info from an object for a given instance. Supported conversions are the following :
String, String[], Number String

Overrides:
getValueFromObject in class LyFieldInfo
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 - If the requested conversion if none of the supported conversions.
See Also:
LyFieldInfo.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. Supported conversions are the following :
String String, String[], Number

Overrides:
getPeerValue in class LyFieldInfo
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 - If the requested conversion if none of the supported conversions.
See Also:
LyFieldInfo.getValueClass()

checkValue

public java.lang.String checkValue(LyEnvironment environment,
                                   java.lang.Object fieldValue)
Checks the given value : - if the text field has a regex format (format starting with "regex:"), the given value must be conform to this format, - if a maximum number of characters is given on this text field, the value must not contain more characters than specified.

Overrides:
checkValue in class LyFieldInfo
Parameters:
environment - Environment giving the user language if a message has to be produced.
Returns:
Returns an error message if the value is incorrect, null otherwise.
See Also:
LyFieldInfo.getValueClass()

isMultiple

public boolean isMultiple()
Checks whether this text field is multiple.

Overrides:
isMultiple in class LyFieldInfo
Returns:
True if the text field is multiple, false otherwise.

getNRows

public int getNRows()
Gets the prefered number of rows shown to the user at the same time. Not used for non multiple text fields.

Returns:
Number of rows, or -1 if no preference is given.

getNCols

public int getNCols()
Gets the prefered number of columns shown to the user at the same time. For simple text fields, if no preference on the number of columns is given, this method will return the maximum number of chars allowed on this field.

Returns:
Number of columns, or -1 if no preference is given.

getMinChars

public int getMinChars()
Gets the minimum number of characters allowed on values of this text field.

Returns:
Minimum number of characters, or -1 if non minimum is specified.

getMaxChars

public int getMaxChars()
Gets the maximum number of characters allowed on values of this text field.

Returns:
Maximum number of characters, or -1 if non maximum is specified.

getNChars

public int getNChars()
Deprecated. see getMaxChars

Gets the maximum number of characters allowed on values of this text field.

Returns:
Maximum number of characters, or -1 if non maximum is specified.

getRegex

public java.lang.String getRegex()
Deprecated. see getRegExp

Gets the regular expression for matching format of this text field.

Returns:
the regular expression, or null if non regular expression is specified.

getRegExp

public LyRegExp getRegExp()
Gets the regular expression for matching format of this text field.

Returns:
the regular expression, or null if non regular expression is specified.

getCharTypesCount

public int getCharTypesCount()
Returns the number of characters type of this text fieldinfo.


getCharType

public LyInfoCharType getCharType(int idx)
Gets the characters type enabled by this text field at the specified index.

Parameters:
idx - Index of the characters type.
Returns:
Characters enabled by this text field.

getCharTypes

public java.util.Vector<LyInfoCharType> getCharTypes()
Gets the characters type enabled by this text field.

Returns:
the text field.

getCharTypeValue

public java.lang.String getCharTypeValue(int idx)
Gets the characters type enabled by this text field at the specified index.

Parameters:
idx - Index of the characters type.
Returns:
Characters enabled by this text field.

getEncoding

public java.lang.String getEncoding()
Gets the name of the encoding class for this text field.

Returns:
Name of the java class used to encode values for this text field if this text is secret.

getType

public LyTextFieldInfo.Type getType()
Sets the type of this text field.

Returns:
Type of this text.

isMultilingual

public boolean isMultilingual()
Checks whether this text field is multilingual.

Returns:
True if the text field is multilingual, false otherwise.

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.

Overrides:
compute in class LyFieldInfo
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.

(c) January 2013 - W4 S.A.

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