LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info
Class LyFileFieldInfo

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.LyFileFieldInfo
All Implemented Interfaces:
java.lang.Cloneable, LyField, LyCommentInterface

public final class LyFileFieldInfo
extends LyFieldInfo

This class implements the description of a file (path) field from an application class. Displaying the content of this field will be up to the implementation of the graphical component.

Additionally, a fileFieldInfo may contain some extra information about the way the text should be shown (number of rows/columns).

See also tag of leon.dtd


Nested Class Summary
static class LyFileFieldInfo.Type
          File types.
 
Nested classes/interfaces inherited from class leon.info.LyTag
LyTag.Model
 
Field Summary
static java.lang.String __VERSION
           
static java.lang.String VALUE_ABSOLUTE
          Value : absolute.
 
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
 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 end with gif or jpg or jpeg if image type.
 int compare(java.lang.Object value1, java.lang.Object value2, java.util.BitSet modifiers)
          Compare two objects for the specified fieldInfo.
 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 getAttachmentDirectory()
          Get Attachment directory used to create the path of files submitted.
 java.lang.String getAttachmentHandler()
          Get Attachment handler used to encode/decode files submitted. one default implementation is leon.view.web.LyFileDecoder
 java.lang.String getDirectory()
          Get directory where value of this field is searched.
 java.lang.String getFilter()
          Get filter applied to this file values.
 LyFilterExpression.Condition[] getFilterConditions()
          Returns the filter conditions authorized on this field.
 java.lang.String getMimeTypes()
          Get current mime-types supported by this file field.
 int getNCols()
          Gets the expected number of columns shown to the end-user.
 int getNRows()
          Gets the expected number of rows shown to the end-user.
 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.
 LyFileFieldInfo.Type getType()
          Get types of the file field.
 java.lang.String getUrl(LyEnvironment environment, java.lang.String label)
          Utility method to get an URL from a value.
 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 fieldInfo from an object for a given instance.
 java.lang.Object parse(java.lang.String stringValue)
          Builds internal value for an instance of this fieldInfo from a string (previously constructed by toString).
 java.lang.String toName(java.lang.Object fieldValue)
          Return the specified value for this field as a "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, compute, contains, controlValue, convertFromFieldUnit, convertToFieldUnit, encodeValue, endsWith, equals, equals, fromFieldTag, getBean, getBeans, getBehaviorClass, getBehaviorClassName, getBinding, getCaptionConstraint, getConstraint, getConstraint, getConstraints, getControl, getControlCount, getControls, getDefaultJavaName, getDefaultValue, getDepends, getDepends, getFieldBean, getFieldGroup, getFieldTab, getFieldUnit, getFilterModifiers, 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, isMultiple, processValue, setImport, setPath, startsWith, toName, toShortName
 
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

VALUE_ABSOLUTE

public static java.lang.String VALUE_ABSOLUTE
Value : absolute.

Method Detail

getValueClass

public java.lang.Class<java.lang.String> getValueClass()
Returns class of values for this field. The value class corresponding to a file 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:
LyFileValue

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)

checkValue

public java.lang.String checkValue(LyEnvironment environment,
                                   java.lang.Object fieldValue)
Checks the given value : - the value must end with gif or jpg or jpeg if image type.

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()

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()

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)

compare

public int compare(java.lang.Object value1,
                   java.lang.Object value2,
                   java.util.BitSet modifiers)
Compare two objects for the specified fieldInfo.

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()

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

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.

getValueFromObject

public java.lang.Object getValueFromObject(java.lang.Object object,
                                           LyObject instance)
Constructs a value for this fieldInfo 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()

getNRows

public int getNRows()
Gets the expected number of rows shown to the end-user.

Returns:
Number of rows specified for this file field when displaying content of the file.

getNCols

public int getNCols()
Gets the expected number of columns shown to the end-user.

Returns:
Number of columns specified for this file field when displaying content of the file.

getType

public LyFileFieldInfo.Type getType()
Get types of the file field. The type is found from the mime types value.

Returns:
Type of this fieldInfo, or TYPE_TEXT if type is not set. One of the constants starting with TYPE_.

getMimeTypes

public java.lang.String getMimeTypes()
Get current mime-types supported by this file field.

Returns:
List of mime-types given in a string separated by blank.

getAttachmentHandler

public java.lang.String getAttachmentHandler()
Get Attachment handler used to encode/decode files submitted. one default implementation is leon.view.web.LyFileDecoder

Returns:
the attachment handler, or null to disable server upload (default).

getAttachmentDirectory

public java.lang.String getAttachmentDirectory()
Get Attachment directory used to create the path of files submitted.

Returns:
the path of the attachment directory.

getDirectory

public java.lang.String getDirectory()
Get directory where value of this field is searched.

Returns:
the path of the directory (default is null)

getFilter

public java.lang.String getFilter()
Get filter applied to this file values.

Returns:
the filter (default is null : all files accepted)

getUrl

public java.lang.String getUrl(LyEnvironment environment,
                               java.lang.String label)
Utility method to get an URL from a value.

Parameters:
label - the current label of the field
Returns:
the url to use in order to display this field.

(c) January 2013 - W4 S.A.

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