Class FilterClause

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers

public class FilterClause extends HStack
A horizontal, Layout-based widget that allows a user to input a single criterion based on one field and one operator.

Note that FilterClauses must be used in conjunction with a FilterBuilder. By default the FilterBuilder will auto-generate its clauses based on specified criteria, but for advanced usage a FilterClause may be instantiated directly and passed to a filterBuilder via FilterBuilder.addClause().

  • Constructor Details

    • FilterClause

      public FilterClause()
    • FilterClause

      public FilterClause(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static FilterClause getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class HStack
    • getClause

      public SearchForm getClause() throws IllegalStateException
      AutoChild containing the UI for the filter-properties in this FilterClause.

      This component is an AutoChild named "clause". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current clause value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setCriterion

      public FilterClause setCriterion(Criteria criterion)
      Initial criterion for this FilterClause.

      When initialized with a criterion, the clause will be automatically set up for editing the supplied criterion.

      Note that an empty or partial criterion is allowed, for example, it may specify Criterion.fieldName only and will generate an expression with the operator not chosen.

      Parameters:
      criterion - New criterion value. Default value is null
      Returns:
      FilterClause instance, for chaining setter calls
    • getCriterion

      public Criteria getCriterion()
      Initial criterion for this FilterClause.

      When initialized with a criterion, the clause will be automatically set up for editing the supplied criterion.

      Note that an empty or partial criterion is allowed, for example, it may specify Criterion.fieldName only and will generate an expression with the operator not chosen.

      Returns:
      Return the criterion specified by this FilterClause. Default value is null
    • setFieldPickerProperties

      public FilterClause setFieldPickerProperties(FormItem fieldPickerProperties) throws IllegalStateException
      Properties to combine with the FieldPicker autoChild FormItem.
      Parameters:
      fieldPickerProperties - New fieldPickerProperties value. Default value is null
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getFieldPickerProperties

      public FormItem getFieldPickerProperties()
      Properties to combine with the FieldPicker autoChild FormItem.
      Returns:
      Current fieldPickerProperties value. Default value is null
    • setFieldPickerTitle

      public FilterClause setFieldPickerTitle(String fieldPickerTitle) throws IllegalStateException
      The title for the field-picker select-item.
      Parameters:
      fieldPickerTitle - New fieldPickerTitle value. Default value is "Field Name"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getFieldPickerTitle

      public String getFieldPickerTitle()
      The title for the field-picker select-item.
      Returns:
      Current fieldPickerTitle value. Default value is "Field Name"
    • getOperatorPicker

      public SelectItem getOperatorPicker() throws IllegalStateException
      AutoChild for the FormItem that allows a user to select the operator when creating filter clauses. Each clause will create an operatorPicker automatically. To customize this item, use operatorPickerProperties

      This component is an AutoChild named "operatorPicker". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current operatorPicker value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setOperatorPickerProperties

      public FilterClause setOperatorPickerProperties(FormItem operatorPickerProperties) throws IllegalStateException
      Properties to combine with the operatorPicker autoChild FormItem.
      Parameters:
      operatorPickerProperties - New operatorPickerProperties value. Default value is null
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getOperatorPickerProperties

      public FormItem getOperatorPickerProperties()
      Properties to combine with the operatorPicker autoChild FormItem.
      Returns:
      Current operatorPickerProperties value. Default value is null
    • setOperatorPickerTitle

      public FilterClause setOperatorPickerTitle(String operatorPickerTitle) throws IllegalStateException
      The title for the operator-picker select-item.
      Parameters:
      operatorPickerTitle - New operatorPickerTitle value. Default value is "Operator"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getOperatorPickerTitle

      public String getOperatorPickerTitle()
      The title for the operator-picker select-item.
      Returns:
      Current operatorPickerTitle value. Default value is "Operator"
    • getRemoveButton

      public ImgButton getRemoveButton() throws IllegalStateException
      The clause removal ImgButton that appears before this clause if showRemoveButton is set.

      This component is an AutoChild named "removeButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current removeButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setRemoveButtonPrompt

      public FilterClause setRemoveButtonPrompt(String removeButtonPrompt) throws IllegalStateException
      The hover prompt text for the remove button.
      Parameters:
      removeButtonPrompt - New removeButtonPrompt value. Default value is "Remove"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getRemoveButtonPrompt

      public String getRemoveButtonPrompt()
      The hover prompt text for the remove button.
      Returns:
      Current removeButtonPrompt value. Default value is "Remove"
    • setShowFieldTitles

      public FilterClause setShowFieldTitles(Boolean showFieldTitles) throws IllegalStateException
      If true (the default), show field titles in the drop-down box used to select a field for querying. If false, show actual field names instead.
      Parameters:
      showFieldTitles - New showFieldTitles value. Default value is true
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowFieldTitles

      public Boolean getShowFieldTitles()
      If true (the default), show field titles in the drop-down box used to select a field for querying. If false, show actual field names instead.
      Returns:
      Current showFieldTitles value. Default value is true
    • setShowRemoveButton

      public FilterClause setShowRemoveButton(Boolean showRemoveButton) throws IllegalStateException
      If set, show a button for this clause allowing it to be removed.
      Parameters:
      showRemoveButton - New showRemoveButton value. Default value is true
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowRemoveButton

      public Boolean getShowRemoveButton()
      If set, show a button for this clause allowing it to be removed.
      Returns:
      Current showRemoveButton value. Default value is true
    • setValidateOnChange

      public FilterClause setValidateOnChange(Boolean validateOnChange) throws IllegalStateException
      If true (the default), validates the entered value when it changes, to make sure it is a a valid value of its type (valid string, number, and so on). No other validation is carried out. If you switch this property off, it is still possible to validate the FilterClause by calling validate() from your own code.
      Parameters:
      validateOnChange - New validateOnChange value. Default value is true
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValidateOnChange

      public Boolean getValidateOnChange()
      If true (the default), validates the entered value when it changes, to make sure it is a a valid value of its type (valid string, number, and so on). No other validation is carried out. If you switch this property off, it is still possible to validate the FilterClause by calling validate() from your own code.
      Returns:
      Current validateOnChange value. Default value is true
    • setValueItemFieldHint

      public FilterClause setValueItemFieldHint(String valueItemFieldHint) throws IllegalStateException
      A hint to show in the value-item when using an operator that allows users to select field-names from a list.
      Parameters:
      valueItemFieldHint - New valueItemFieldHint value. Default value is "Select a field"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueItemFieldHint

      public String getValueItemFieldHint()
      A hint to show in the value-item when using an operator that allows users to select field-names from a list.
      Returns:
      Current valueItemFieldHint value. Default value is "Select a field"
    • setValueItemListHint

      public FilterClause setValueItemListHint(String valueItemListHint) throws IllegalStateException
      A hint to show in the value-item when using an operator that allows users to select values from a list.
      Parameters:
      valueItemListHint - New valueItemListHint value. Default value is "Select a value"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueItemListHint

      public String getValueItemListHint()
      A hint to show in the value-item when using an operator that allows users to select values from a list.
      Returns:
      Current valueItemListHint value. Default value is "Select a value"
    • setValueItemTextHint

      public FilterClause setValueItemTextHint(String valueItemTextHint) throws IllegalStateException
      A hint to show in the value-item when using an operator that takes user-entered values.
      Parameters:
      valueItemTextHint - New valueItemTextHint value. Default value is "Enter a value"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueItemTextHint

      public String getValueItemTextHint()
      A hint to show in the value-item when using an operator that takes user-entered values.
      Returns:
      Current valueItemTextHint value. Default value is "Enter a value"
    • setValueItemTitle

      public FilterClause setValueItemTitle(String valueItemTitle) throws IllegalStateException
      The title for the value-item.
      Parameters:
      valueItemTitle - New valueItemTitle value. Default value is "Value"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueItemTitle

      public String getValueItemTitle()
      The title for the value-item.
      Returns:
      Current valueItemTitle value. Default value is "Value"
    • getValueQueryAggregateButton

      public ImgButton getValueQueryAggregateButton() throws IllegalStateException
      The ImgButton that appears after each clause if FilterBuilder.allowAggregates is set.

      This component is an AutoChild named "valueQueryAggregateButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current valueQueryAggregateButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setValueQueryButtonSize

      public FilterClause setValueQueryButtonSize(Integer valueQueryButtonSize) throws IllegalStateException
      The size of the buttons in each clause that allow Value-query functionality, such as related-field and aggregation features, if they don't specify sizes.
      Parameters:
      valueQueryButtonSize - New valueQueryButtonSize value. Default value is 18
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueQueryButtonSize

      public Integer getValueQueryButtonSize()
      The size of the buttons in each clause that allow Value-query functionality, such as related-field and aggregation features, if they don't specify sizes.
      Returns:
      Current valueQueryButtonSize value. Default value is 18
    • setValueQueryIconSize

      public FilterClause setValueQueryIconSize(Integer valueQueryIconSize) throws IllegalStateException
      The size of the icons in the buttons in each clause that allow Value-query functionality, such as related-field and aggregation features, if they don't specify separate image-sizes.
      Parameters:
      valueQueryIconSize - New valueQueryIconSize value. Default value is 18
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueQueryIconSize

      public Integer getValueQueryIconSize()
      The size of the icons in the buttons in each clause that allow Value-query functionality, such as related-field and aggregation features, if they don't specify separate image-sizes.
      Returns:
      Current valueQueryIconSize value. Default value is 18
    • getValueQueryRelatedFieldButton

      public ImgButton getValueQueryRelatedFieldButton() throws IllegalStateException
      The ImgButton that appears after each clause if FilterBuilder.allowAggregates is set.

      This component is an AutoChild named "valueQueryRelatedFieldButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current valueQueryRelatedFieldButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setValueSetHint

      public FilterClause setValueSetHint(String valueSetHint) throws IllegalStateException
      A hint to show in the value-item when using an operator that takes an array of values.
      Parameters:
      valueSetHint - New valueSetHint value. Default value is "Comma-separated values"
      Returns:
      FilterClause instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getValueSetHint

      public String getValueSetHint()
      A hint to show in the value-item when using an operator that takes an array of values.
      Returns:
      Current valueSetHint value. Default value is "Comma-separated values"
    • getFilterBuilder

      public void getFilterBuilder()
      Returns the filterBuilder containing this clause, or null if this filterClause is not embedded in a filterBuilder.
    • remove

      public void remove()
      Remove this clause by destroy()ing it.
    • validate

      public Boolean validate()
      Validate this clause.
      Returns:
      true if if the clause is valid, false otherwise
    • setDefaultProperties

      public static void setDefaultProperties(FilterClause filterClauseProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      filterClauseProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(FilterClauseLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class HStack