com.vaadin.shared.ui.dnd.criteria.
Class Criterion
- java.lang.Object
-
- com.vaadin.shared.ui.dnd.criteria.Criterion
-
All Implemented Interfaces:
public class Criterion extends Object implements Serializable
Stores parameters for the drag and drop acceptance criterion defined using the criteria API.
When data is dragged over a drop target, the value here is compared to the payload added in DropTargetExtension with same key and value type.
Since:
8.1
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Criterion.Match
Declares whether all or any of the given criteria should match when compared against the payload.
-
Constructor Summary
Constructors Constructor Description Criterion(String key, ComparisonOperator operator, double value)
Creates a criterion object.
Criterion(String key, ComparisonOperator operator, int value)
Creates a criterion object.
Criterion(String key, String value)
Creates a criterion object with the default comparison operator
ComparisonOperator.EQUALS
.
-
Method Summary
All Methods Modifier and Type Method Description String
getKey()
Gets the key of the payload to be compared.
ComparisonOperator
getOperator()
Gets the comparison operator.
String
getValue()
Gets the value of the payload to be compared.
Payload.ValueType
getValueType()
Gets the type of the payload value to be compared.
boolean
resolve(Collection<Payload> payloadCollection)
Compares this criterion's value to the given payload's value and returns whether the result matches the criterion's operator.
void
setKey(String key)
Sets the key of the payload to be compared.
void
setOperator(ComparisonOperator operator)
Sets the comparison operator.
void
setValue(String value)
Sets the value of the payload to be compared.
void
setValueType(Payload.ValueType valueType)
Sets the type of the payload value to be compared.
-
-
-
Constructor Detail
-
Criterion
public Criterion(String key, String value)
Creates a criterion object with the default comparison operator
ComparisonOperator.EQUALS
.Parameters:
key
- key of the payload to be comparedvalue
- value of the payload to be compared
-
Criterion
public Criterion(String key, ComparisonOperator operator, int value)
Creates a criterion object.
Parameters:
key
- key of the payload to be comparedoperator
- comparison operatorvalue
- value of the payload to be compared
-
Criterion
public Criterion(String key, ComparisonOperator operator, double value)
Creates a criterion object.
Parameters:
key
- key of the payload to be comparedoperator
- comparison operatorvalue
- value of the payload to be compared
-
-
Method Detail
-
getKey
public String getKey()
Gets the key of the payload to be compared.
Returns:
key of the payload to be compared
-
setKey
public void setKey(String key)
Sets the key of the payload to be compared.
Parameters:
key
- key of the payload to be compared
-
getValue
public String getValue()
Gets the value of the payload to be compared.
Returns:
value of the payload to be compared
-
setValue
public void setValue(String value)
Sets the value of the payload to be compared.
Parameters:
value
- value of the payload to be compared
-
getValueType
public Payload.ValueType getValueType()
Gets the type of the payload value to be compared.
Returns:
type of the payload value to be compared
-
setValueType
public void setValueType(Payload.ValueType valueType)
Sets the type of the payload value to be compared.
Parameters:
valueType
- type of the payload to be compared
-
getOperator
public ComparisonOperator getOperator()
Gets the comparison operator.
Returns:
operator to be used when comparing payload value with criterion
-
setOperator
public void setOperator(ComparisonOperator operator)
Sets the comparison operator.
Parameters:
operator
- comparison operator
-
resolve
public boolean resolve(Collection<Payload> payloadCollection)
Compares this criterion's value to the given payload's value and returns whether the result matches the criterion's operator. The comparison is done with the payload whose key and value type match the criterion's key and value type.
Parameters:
payloadCollection
- collection of payloads to compare the criterion againstReturns:
false
if there exists a payload in the collection with the same key and value type and it doesn't match the criterion,true
otherwise
-
-