LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info.misc
Class LyFormula

java.lang.Object
  extended by leon.info.misc.LyFormula
All Implemented Interfaces:
LyClassControl, LyControlInterface, LyFieldInfoControl, LyFilterElement
Direct Known Subclasses:
LyMvelFormula, LyWSFormula

public abstract class LyFormula
extends java.lang.Object
implements LyFilterElement, LyClassControl, LyFieldInfoControl

Class used to compute a formula on a LyFieldInfo.


Field Summary
 
Fields inherited from interface leon.info.LyFilterElement
__VERSION
 
Fields inherited from interface leon.data.datainterface.LyClassControl
__VERSION
 
Fields inherited from interface leon.data.datainterface.LyFieldInfoControl
__VERSION
 
Fields inherited from interface leon.data.datainterface.LyControlInterface
STATUS_ERROR, STATUS_OK, STATUS_WARNING
 
Method Summary
static java.lang.String checkExpression(LyEnvironment environment, java.lang.String expression)
          Factory that checks the formula with chosen expression language.
 short checkNewValue(LyControl control, LyObject object, LyFieldInfoValue newValue, LyArgument[] args)
          Dynamic check the value for the given field.
 LyFormula cloneFormula()
          Clones this formula.
 boolean contains(LyFieldInfo fieldInfo)
          Checks if a formula contains the given field info.
static LyFormula formulaFactory(LyInfo info, java.lang.String expression)
          Factory that builds the formula with chosen expression language.
 LyInfoList<LyFieldInfo> getDependencies(LyClassInfo classInfo)
           
 java.lang.String getExpression()
          Gets expression of this formula.
 LyInfoList<LyFieldInfo> getFormulaFields()
          Returns a list of all fieldInfo necessary to compute this formula.
 java.lang.String[] getFormulaNames()
          Returns a vector of all fieldInfo necessary to compute this formula.
 LyInfoList<LyFieldInfo> getImports(LyClassInfo classInfo)
          Returns fields imported through relations for the given class info.
 java.lang.String getName()
          Returns a displayable string of this element.
abstract  java.lang.Object getValue(LyObject instance)
          Evaluate the formula Return depends on the fieldInto type All values are contained in the LyObject
abstract  java.lang.Object getValue(LyValueSet values)
          Evaluate the formula Return depends on the fieldInto type The value set must contains all the values necessary to compute the formula
 boolean match(LyValueSet values)
          Indicates whether the specified values matches the filter criterion.
 boolean match(java.lang.Object object)
          Indicates whether the specified object matches the filter criterion.
 void setInverted(boolean not)
          Set the inverted mode of this formula.
 short validate(LyControl control, LyObject object, LyValueSet newValues, LyArgument[] args)
          Global control of values before creating or modifying an object.
 void writeXml(java.io.PrintWriter pw)
          Writes XML corresponding to this filter element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cloneFormula

public LyFormula cloneFormula()
Clones this formula.


formulaFactory

public static LyFormula formulaFactory(LyInfo info,
                                       java.lang.String expression)
Factory that builds the formula with chosen expression language.


checkExpression

public static java.lang.String checkExpression(LyEnvironment environment,
                                               java.lang.String expression)
Factory that checks the formula with chosen expression language.


getValue

public abstract java.lang.Object getValue(LyObject instance)
Evaluate the formula Return depends on the fieldInto type All values are contained in the LyObject


getValue

public abstract java.lang.Object getValue(LyValueSet values)
Evaluate the formula Return depends on the fieldInto type The value set must contains all the values necessary to compute the formula


getExpression

public java.lang.String getExpression()
Gets expression of this formula.


getDependencies

public LyInfoList<LyFieldInfo> getDependencies(LyClassInfo classInfo)

getFormulaNames

public final java.lang.String[] getFormulaNames()
Returns a vector of all fieldInfo necessary to compute this formula.


getFormulaFields

public LyInfoList<LyFieldInfo> getFormulaFields()
Returns a list of all fieldInfo necessary to compute this formula.


contains

public boolean contains(LyFieldInfo fieldInfo)
Checks if a formula contains the given field info.

Parameters:
fieldInfo - The fieldInfo.
Returns:
True if the field info is found, false otherwise.

getImports

public LyInfoList<LyFieldInfo> getImports(LyClassInfo classInfo)
Returns fields imported through relations for the given class info.


match

public boolean match(java.lang.Object object)
Indicates whether the specified object matches the filter criterion.

Specified by:
match in interface LyFilterElement
Parameters:
object - Object for which the filter criterion is checked.
Returns:
True if the objects matches criterion, false otherwise.

match

public boolean match(LyValueSet values)
Indicates whether the specified values matches the filter criterion.

Specified by:
match in interface LyFilterElement
Parameters:
values - List of values for which the filter criterion is checked.
Returns:
True if the values matches criterion, false otherwise.

writeXml

public void writeXml(java.io.PrintWriter pw)
Writes XML corresponding to this filter element.

Specified by:
writeXml in interface LyFilterElement
Parameters:
pw - PrintWriter on which the XML is written.

getName

public java.lang.String getName()
Returns a displayable string of this element.

Specified by:
getName in interface LyFilterElement
Returns:
A displayable string representation of this element.

setInverted

public void setInverted(boolean not)
Set the inverted mode of this formula.


validate

public short validate(LyControl control,
                      LyObject object,
                      LyValueSet newValues,
                      LyArgument[] args)
Global control of values before creating or modifying an object. If needed, extra values may be added during this control.

Specified by:
validate in interface LyClassControl
Parameters:
control - the description of the control.
object - the modified object.
newValues - Set of values to control.
args - the list of arguments specified in the XML description of the control
Returns:
STATUS_ERROR if the control raises an error STATUS_WARNING if the control raises a warning STATUS_OK if the control is correct All other positive short values for user specific warning level.

checkNewValue

public short checkNewValue(LyControl control,
                           LyObject object,
                           LyFieldInfoValue newValue,
                           LyArgument[] args)
Dynamic check the value for the given field. This method is called when there is a modification of the field in the user interface (Value changed, focus lost...).

Specified by:
checkNewValue in interface LyFieldInfoControl
Parameters:
control - the description of the control.
object - the modified object.
newValue - field info value to check. This parameter cannot be null.
args - the list of arguments specified in the XML description of the control
Returns:
STATUS_ERROR if the control raises an error STATUS_WARNING if the control raises a warning STATUS_OK if the control is correct All other positive short values for user specific warning level.

(c) January 2013 - W4 S.A.

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