TPTP 4.6.0 Platform Project
Public API Specification

org.eclipse.tptp.filtertype.extension.sample.filter.definitions
Class SampleFilterAttribute

java.lang.Object
  extended by org.eclipse.tptp.filtertype.extension.sample.filter.definitions.SampleFilterAttribute
All Implemented Interfaces:
IFilterAttribute

public class SampleFilterAttribute
extends java.lang.Object
implements IFilterAttribute

This defines a sample filter attribute. It is kept simple and also to display that attribute can be rather dynamic. The user can construct any WhereExpression from the operator/value pair they wish for the filter. The operators in this sample are "Package starts with..." and "Package ends with...". This filter attribute basically would return packages that start with or end with the given value. The user cannot enter a value with a '*' character, this is shown in the validate method.


Constructor Summary
SampleFilterAttribute(java.lang.String _id)
          The constructor sets the id, this id must be unique from the others in the advanced tab.
 
Method Summary
 java.lang.String defaultValue()
          Returns the default value associated with this attribute.
 java.lang.String displayText()
          Returns the display text that will be visible in the advanced tab UI when adding/removing/editing attributes.
 java.lang.String getOperator(WhereExpression whereExpression)
          Returns the displayable/editable operator that will be in the advanced tab UI, for the given WhereExpression associated with this IFilterAttribute(matched by id).
 java.lang.String getValue(WhereExpression whereExpression)
          Returns the displayable/editable value that will be in the advanced tab UI, for the given WhereExpression associated with this IFilterAttribute(matched by id).
 WhereExpression getWhereExpression(java.lang.String operator, java.lang.String value)
          Returns the WhereExpression associated with the given displayable operator and displayable value for this attribute.
 java.lang.String id()
          Returns the unique ID, associated with this attribute.
 java.lang.String[] operators()
          Returns the set of operators associated with this attribute, these operators are Strings that are also displayable.
 java.lang.String validate(java.lang.String operator, java.lang.String value)
          Validates that the input data is valid for the given displayable operator and displayable value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleFilterAttribute

public SampleFilterAttribute(java.lang.String _id)
The constructor sets the id, this id must be unique from the others in the advanced tab.

Parameters:
_id -
Method Detail

id

public java.lang.String id()
Description copied from interface: IFilterAttribute
Returns the unique ID, associated with this attribute. The unique ID is used to later associate data with this filter attribute.

Specified by:
id in interface IFilterAttribute
Returns:
a String, the unique ID
See Also:
IFilterAttribute.id()

displayText

public java.lang.String displayText()
Description copied from interface: IFilterAttribute
Returns the display text that will be visible in the advanced tab UI when adding/removing/editing attributes.

Specified by:
displayText in interface IFilterAttribute
Returns:
a String, the displayable UI text
See Also:
IFilterAttribute.displayText()

validate

public java.lang.String validate(java.lang.String operator,
                                 java.lang.String value)
Description copied from interface: IFilterAttribute
Validates that the input data is valid for the given displayable operator and displayable value. If the data is valid it should return null. If it is not valid, it should return the error message that will be displayed in the advanced tab dialog.

Specified by:
validate in interface IFilterAttribute
Parameters:
operator - a String, the operator in the input that will be validated, this String would be among the Strings returned in the method operators()
value - a String, the value in the input that will be validated
Returns:
a String, null if the operator and value are valid for this filter attribute, and the displayable error message otherwise.
See Also:
IFilterAttribute.validate(java.lang.String, java.lang.String)

operators

public java.lang.String[] operators()
Description copied from interface: IFilterAttribute
Returns the set of operators associated with this attribute, these operators are Strings that are also displayable. They are also returned to the methods validate(String operator, String value) and getWhereExpression(String operator, String value) for these methods to do their tasks. These operators are shown in the combo box drop down when editing/adding attributes in the advanced tab.

Specified by:
operators in interface IFilterAttribute
Returns:
an array of Strings, the possible operators that will be displayed for this attribute
See Also:
IFilterAttribute.operators()

getWhereExpression

public WhereExpression getWhereExpression(java.lang.String operator,
                                          java.lang.String value)
Description copied from interface: IFilterAttribute
Returns the WhereExpression associated with the given displayable operator and displayable value for this attribute. This WhereExpression is used to create the filter associated with the advanced tab.

Specified by:
getWhereExpression in interface IFilterAttribute
Parameters:
operator - a String, the operator to construct the WhereExpression from, this String would be among the Strings returned in the method operators()
value - a String, the value to construct the WhereExpression from
Returns:
a WhereExpression, the filter WhereExpression associated with this attribute
See Also:
IFilterAttribute.getWhereExpression(java.lang.String, java.lang.String)

getValue

public java.lang.String getValue(WhereExpression whereExpression)
Description copied from interface: IFilterAttribute
Returns the displayable/editable value that will be in the advanced tab UI, for the given WhereExpression associated with this IFilterAttribute(matched by id).

Specified by:
getValue in interface IFilterAttribute
Parameters:
whereExpression - a WhereExpression associated with this attribute
Returns:
a String, the displayable value shown in the UI
See Also:
IFilterAttribute.getValue(org.eclipse.hyades.models.hierarchy.extensions.WhereExpression)

getOperator

public java.lang.String getOperator(WhereExpression whereExpression)
Description copied from interface: IFilterAttribute
Returns the displayable/editable operator that will be in the advanced tab UI, for the given WhereExpression associated with this IFilterAttribute(matched by id). This operator must be one of the operators returned from the method operators().

Specified by:
getOperator in interface IFilterAttribute
Parameters:
whereExpression - a WhereExpression associated with this attribute
Returns:
a String, the displayable operator shown in the davanced tab UI, must be one of the operators from the method operators().
See Also:
IFilterAttribute.getOperator(org.eclipse.hyades.models.hierarchy.extensions.WhereExpression)

defaultValue

public java.lang.String defaultValue()
Description copied from interface: IFilterAttribute
Returns the default value associated with this attribute. This value will be displayed when this attribute is selected to be added.

Specified by:
defaultValue in interface IFilterAttribute
Returns:
a String, the default value for this attribute
See Also:
IFilterAttribute.defaultValue()

TPTP 4.6.0 Platform Project
Public API Specification