to.etc.domui.component.lookup
Class LookupNumberControl<T extends java.lang.Number>

java.lang.Object
  extended by to.etc.domui.component.lookup.AbstractLookupControlImpl
      extended by to.etc.domui.component.lookup.LookupNumberControl<T>
All Implemented Interfaces:
ILookupControlInstance

public class LookupNumberControl<T extends java.lang.Number>
extends AbstractLookupControlImpl

Base utility class when lookups of custom numeric conditions should be implemented. Provides buitin expression parser and range checks, only custom conditions have to be implemented in descendant classes.

Author:
Vladimir Mijic Created on Feb 11, 2010

Nested Class Summary
 
Nested classes/interfaces inherited from interface to.etc.domui.component.lookup.ILookupControlInstance
ILookupControlInstance.AppendCriteriaResult
 
Field Summary
static java.util.Set<QOperation> BINARY_OPS
           
static java.util.Set<QOperation> UNARY_OPS
           
 
Constructor Summary
LookupNumberControl(java.lang.Class<T> valueType, Text<java.lang.String> node, java.lang.String propertyName, java.lang.Number minValue, java.lang.Number maxValue, boolean monetary)
           
LookupNumberControl(java.lang.Class<T> valueType, Text<java.lang.String> node, java.lang.String propertyName, java.lang.Number minValue, java.lang.Number maxValue, boolean monetary, boolean allowLike)
           
 
Method Summary
 ILookupControlInstance.AppendCriteriaResult appendCriteria(QCriteria<?> crit)
          Evaluate the contents of the input for this lookup line; if the user has added data there then add the values to the query.
protected  ILookupControlInstance.AppendCriteriaResult appendCriteria(QCriteria<?> crit, QOperation op, T val)
           
protected  void checkNumber(T value)
           
 boolean isMonetary()
          T if this control handles a monetary amount.
protected  T parseNumber(java.lang.String in)
          This delivers a number of the same type as the property by scanning the input string.
protected  QOperation scanOperation()
          Checks the current position for a supported operation.
 
Methods inherited from class to.etc.domui.component.lookup.AbstractLookupControlImpl
clearInput, getInputControls, getLabelControl, setDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNARY_OPS

public static final java.util.Set<QOperation> UNARY_OPS

BINARY_OPS

public static final java.util.Set<QOperation> BINARY_OPS
Constructor Detail

LookupNumberControl

public LookupNumberControl(java.lang.Class<T> valueType,
                           Text<java.lang.String> node,
                           java.lang.String propertyName,
                           java.lang.Number minValue,
                           java.lang.Number maxValue,
                           boolean monetary)

LookupNumberControl

public LookupNumberControl(java.lang.Class<T> valueType,
                           Text<java.lang.String> node,
                           java.lang.String propertyName,
                           java.lang.Number minValue,
                           java.lang.Number maxValue,
                           boolean monetary,
                           boolean allowLike)
Method Detail

isMonetary

public final boolean isMonetary()
T if this control handles a monetary amount.

Returns:

appendCriteria

protected ILookupControlInstance.AppendCriteriaResult appendCriteria(QCriteria<?> crit,
                                                                     QOperation op,
                                                                     T val)
                                                              throws java.lang.Exception
Throws:
java.lang.Exception

checkNumber

protected void checkNumber(T value)

appendCriteria

public ILookupControlInstance.AppendCriteriaResult appendCriteria(QCriteria<?> crit)
                                                           throws java.lang.Exception
Description copied from interface: ILookupControlInstance
Evaluate the contents of the input for this lookup line; if the user has added data there then add the values to the query.

Specified by:
appendCriteria in interface ILookupControlInstance
Specified by:
appendCriteria in class AbstractLookupControlImpl
Returns:
see ILookupControlInstance.AppendCriteriaResult
Throws:
java.lang.Exception

scanOperation

protected QOperation scanOperation()
Checks the current position for a supported operation. If OK the appropriate operation code is returned and the current pos is advanced after it.

Returns:

parseNumber

protected T parseNumber(java.lang.String in)
This delivers a number of the same type as the property by scanning the input string. I use the monetary amount scanner to allow for max flexibility in input, and the resulting BigDecimal will be converted to the appropriate type afterwards.

Parameters:
in -
Returns: