com.flexive.shared.search.query
Class QueryValueNode<T extends FxValue,VC extends ValueComparator>

java.lang.Object
  extended by com.flexive.shared.search.query.QueryNode
      extended by com.flexive.shared.search.query.QueryValueNode<T,VC>
Type Parameters:
T - the value type
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AssignmentValueNode, PropertyValueNode, SelectValueNode, TreeValueNode

public abstract class QueryValueNode<T extends FxValue,VC extends ValueComparator>
extends QueryNode

Base class for value types.

Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
protected  VC comparator
           
protected  InputMapper inputMapper
           
protected  T value
           
 
Fields inherited from class com.flexive.shared.search.query.QueryNode
children, id, parent
 
Constructor Summary
protected QueryValueNode()
          Default constructor
protected QueryValueNode(int id)
          Protected constructor.
 
Method Summary
 java.util.List<VC> getAvailableComparators()
          Returns all available enum values for this query node.
 VC getComparator()
           
protected  FxValue getEmptyValue(FxProperty property)
           
 InputMapper getInputMapper()
          Returns the input mapper to be used for this query node.
protected abstract  java.util.List<VC> getNodeComparators()
          Override this method to set the available value comparators of a node instance.
protected  InputMapper getPropertyInputMapper(FxProperty property)
          Return the input mapper for the given property.
 T getValue()
           
 FxValueFormatter getValueFormatter()
          Override this method to provide your own formatter for read-only mode.
 boolean isReadOnly()
          Return true if the input fields should be read only for this node.
 boolean isValueNode()
          Return true if this node is a "value" node, i.e.
 boolean isWideInput()
          Returns true if the node needs a wide input field, e.g.
 void setComparator(VC comparator)
           
 void setInputMapper(InputMapper inputMapper)
           
 void setValue(T value)
           
 void visit(QueryNodeVisitor visitor)
          Visit this node.
 
Methods inherited from class com.flexive.shared.search.query.QueryNode
addChild, addChild, addChildAfter, buildSqlQuery, equals, findChild, getChild, getChildren, getId, getLabel, getLevel, getNodeName, getParent, getPath, hashCode, isHidden, isValid, removeChild, setChildren, setId, setParent, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected T extends FxValue value

comparator

protected VC extends ValueComparator comparator

inputMapper

protected InputMapper inputMapper
Constructor Detail

QueryValueNode

protected QueryValueNode()
Default constructor


QueryValueNode

protected QueryValueNode(int id)
Protected constructor.

Parameters:
id - the node ID
Method Detail

getValue

public T getValue()

setValue

public void setValue(T value)

visit

public void visit(QueryNodeVisitor visitor)
Visit this node.

Specified by:
visit in class QueryNode
Parameters:
visitor - the visitor

isValueNode

public boolean isValueNode()
Return true if this node is a "value" node, i.e. is used to represent a scalar value in the query. Used for JSTL node handling.

Overrides:
isValueNode in class QueryNode
Returns:
true for scalar value nodes

isReadOnly

public boolean isReadOnly()
Return true if the input fields should be read only for this node.

Returns:
true if the input fields should be read only for this node.

getValueFormatter

public FxValueFormatter getValueFormatter()
Override this method to provide your own formatter for read-only mode.

Returns:
the FxValueFormatter to be used for rendering read-only mode.

getComparator

public VC getComparator()

setComparator

public void setComparator(VC comparator)

getInputMapper

public InputMapper getInputMapper()
Returns the input mapper to be used for this query node. Input mappers allow to use "fancier" inputs for common properties, e.g. a select list for an internal ordinal value like the ACL.

Returns:
the input mapper for this node
See Also:
InputMapper, InputMapper.getInstance(com.flexive.shared.structure.FxProperty)

setInputMapper

public void setInputMapper(InputMapper inputMapper)

isWideInput

public boolean isWideInput()
Returns true if the node needs a wide input field, e.g. a datepicker or file download field.

Overrides:
isWideInput in class QueryNode
Returns:
true if the node needs a wide input field

getNodeComparators

protected abstract java.util.List<VC> getNodeComparators()
Override this method to set the available value comparators of a node instance.

Returns:
all available enum values for this query node.

getAvailableComparators

public java.util.List<VC> getAvailableComparators()
Returns all available enum values for this query node. The returned comparator list is the intersection of the property value comparators returned by getNodeComparators() and those defined by the input mapper, if any.

Returns:
all available enum values for this query node.

getPropertyInputMapper

protected InputMapper getPropertyInputMapper(FxProperty property)
Return the input mapper for the given property.

Parameters:
property - the property to be rendered
Returns:
the input mapper for the given property assignmen.t

getEmptyValue

protected FxValue getEmptyValue(FxProperty property)