Class PresetCriteriaItem

All Implemented Interfaces:
HasHandlers, HasBlurHandlers, HasChangedHandlers, HasChangeHandlers, HasClickHandlers, HasDataArrivedHandlers, HasDoubleClickHandlers, HasEditorEnterHandlers, HasEditorExitHandlers, HasFocusHandlers, HasIconClickHandlers, HasIconKeyPressHandlers, HasItemHoverHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasPendingStatusChangedHandlers, HasPickerIconClickHandlers, HasShowContextMenuHandlers, HasTitleClickHandlers, HasTitleDoubleClickHandlers, HasTitleHoverHandlers, HasValueHoverHandlers, HasValueIconClickHandlers, PickList
Direct Known Subclasses:
PresetDateRangeItem

public class PresetCriteriaItem extends SelectItem
A FormItem for use with the FilterBuilder, allows the user to pick from a set of pre-configured search criteria such as specific ranges in numeric or date data, and provide user friendly titles for such criteria, such as "within the next two weeks" or "High (0.75 - 0.99)".
  • Constructor Details

    • PresetCriteriaItem

      public PresetCriteriaItem()
    • PresetCriteriaItem

      public PresetCriteriaItem(JavaScriptObject jsObj)
    • PresetCriteriaItem

      public PresetCriteriaItem(String name)
  • Method Details

    • getOrCreateRef

      public static PresetCriteriaItem 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:
    • changePickerIconDefaults

      public static void changePickerIconDefaults(FormItemIcon defaults)
    • setCustomOptionTitle

      public PresetCriteriaItem setCustomOptionTitle(String customOptionTitle)
      The title to show for the custom option.
      Parameters:
      customOptionTitle - New customOptionTitle value. Default value is "Custom..."
      Returns:
      PresetCriteriaItem instance, for chaining setter calls
    • getCustomOptionTitle

      public String getCustomOptionTitle()
      The title to show for the custom option.
      Returns:
      Current customOptionTitle value. Default value is "Custom..."
    • setShouldSaveValue

      public PresetCriteriaItem setShouldSaveValue(Boolean shouldSaveValue)
      Should this item's value be saved in the form's values and hence returned from form.getValues()?

      shouldSaveValue:false is used to mark formItems which do not correspond to the underlying data model and should not save a value into the form's values. Example includes visual separators, password re-type fields, or checkboxes used to show/hide other form items.

      A shouldSaveValue:false item should be given a value either via FormItem.defaultValue or by calling form.setValue(item, value) or formItem.setValue(value). Providing a value via form.values or form.setValues() will automatically switch the item to shouldSaveValue:true.

      Note that

      • if an item is shouldSaveValue true, but has no name, a warning is logged, and shouldSaveValue will be set to false.
      Overrides:
      setShouldSaveValue in class FormItem
      Parameters:
      shouldSaveValue - New shouldSaveValue value. Default value is true
      Returns:
      PresetCriteriaItem instance, for chaining setter calls
    • getShouldSaveValue

      public Boolean getShouldSaveValue()
      Should this item's value be saved in the form's values and hence returned from form.getValues()?

      shouldSaveValue:false is used to mark formItems which do not correspond to the underlying data model and should not save a value into the form's values. Example includes visual separators, password re-type fields, or checkboxes used to show/hide other form items.

      A shouldSaveValue:false item should be given a value either via FormItem.defaultValue or by calling form.setValue(item, value) or formItem.setValue(value). Providing a value via form.values or form.setValues() will automatically switch the item to shouldSaveValue:true.

      Note that

      • if an item is shouldSaveValue true, but has no name, a warning is logged, and shouldSaveValue will be set to false.
      Overrides:
      getShouldSaveValue in class FormItem
      Returns:
      Current shouldSaveValue value. Default value is true
    • setShowCustomOption

      public PresetCriteriaItem setShowCustomOption(boolean showCustomOption)
      If set, an additional option will be shown with the title customOptionTitle, which will cause getCustomCriteria() to be called.
      Parameters:
      showCustomOption - New showCustomOption value. Default value is false
      Returns:
      PresetCriteriaItem instance, for chaining setter calls
    • getShowCustomOption

      public boolean getShowCustomOption()
      If set, an additional option will be shown with the title customOptionTitle, which will cause getCustomCriteria() to be called.
      Returns:
      Current showCustomOption value. Default value is false
    • getCustomCriteria

      public void getCustomCriteria(String callback)
      This method is called when showCustomOption is true and the user selects the custom option. Implement this method by allowing the user to enter custom criteria, for example, by opening a modal dialog. Once the user has input custom criteria, fire the callback method with the resulting criteria.
      Parameters:
      callback - callback to fire when custom criteria has been gathered. Expects parameters "criteria,title". The "title" will be displayed as the currently selected value when custom criteria have been chosen. See Callback
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(PresetCriteriaItem presetCriteriaItemProperties)
      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 of the class instance passed to this function. 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:
      presetCriteriaItemProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setOptions

      public void setOptions(LinkedHashMap<String,Object> options)
    • getOptions

      public LinkedHashMap<String,Object> getOptions()