Class SelectOtherItem

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

public class SelectOtherItem extends SelectItem
FormItem that shows a list of options, plus an "Other..." option that allows them to enter another value.

Note - SelectOtherItem does not support using an optionDataSource, instead, use a normal SelectItem and use the specialValues to implement a way to add new DataSource records to the optionDataSource. This creates a UI more appropriate to optionDataSource: the otherValue option or options can be placed at the top of the list, so that scrolling to the bottom of a long list is not required. In addition, the specialValues system allows you to open a custom form or other UI for adding new DataSource records, rather than just the simple single-value input dialog of SelectOtherItem.

  • Constructor Details

    • SelectOtherItem

      public SelectOtherItem()
    • SelectOtherItem

      public SelectOtherItem(JavaScriptObject jsObj)
    • SelectOtherItem

      public SelectOtherItem(String name)
    • SelectOtherItem

      public SelectOtherItem(String name, String title)
  • Method Details

    • getOrCreateRef

      public static SelectOtherItem 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)
    • setDialogWidth

      public SelectOtherItem setDialogWidth(int dialogWidth)
      Width for the "other value" prompt dialog.
      Parameters:
      dialogWidth - New dialogWidth value. Default value is 250
      Returns:
      SelectOtherItem instance, for chaining setter calls
    • getDialogWidth

      public int getDialogWidth()
      Width for the "other value" prompt dialog.
      Returns:
      Current dialogWidth value. Default value is 250
    • setOtherTitle

      public SelectOtherItem setOtherTitle(String otherTitle)
      Title for the Other... item. When this item is selected, the user will be shown a prompt allowing them to enter a new value for the item.
      Parameters:
      otherTitle - New otherTitle value. Default value is "Other..."
      Returns:
      SelectOtherItem instance, for chaining setter calls
      See Also:
    • getOtherTitle

      public String getOtherTitle()
      Title for the Other... item. When this item is selected, the user will be shown a prompt allowing them to enter a new value for the item.
      Returns:
      Current otherTitle value. Default value is "Other..."
      See Also:
    • setOtherValue

      public SelectOtherItem setOtherValue(String otherValue)
      Data value for the Other... item. If necessary this value may be changed to ensure it doesn't collide with any data values in this item's valueMap.

      Note : This is an advanced setting

      Parameters:
      otherValue - New otherValue value. Default value is "***other***"
      Returns:
      SelectOtherItem instance, for chaining setter calls
      See Also:
    • getOtherValue

      public String getOtherValue()
      Data value for the Other... item. If necessary this value may be changed to ensure it doesn't collide with any data values in this item's valueMap.
      Returns:
      Current otherValue value. Default value is "***other***"
      See Also:
    • setSelectOtherPrompt

      public SelectOtherItem setSelectOtherPrompt(String selectOtherPrompt)
      Title to show in prompt for "other" value. Note this is a dynamic string. JavaScript content is supported within ${...} tags, with local variables for item (a pointer to this item) and value a pointer to the currently selected item value.
      Parameters:
      selectOtherPrompt - New selectOtherPrompt value. Default value is "Other value for <br>${item.getTitle()}?"
      Returns:
      SelectOtherItem instance, for chaining setter calls
      See Also:
    • getSelectOtherPrompt

      public String getSelectOtherPrompt()
      Title to show in prompt for "other" value. Note this is a dynamic string. JavaScript content is supported within ${...} tags, with local variables for item (a pointer to this item) and value a pointer to the currently selected item value.
      Returns:
      Current selectOtherPrompt value. Default value is "Other value for <br>${item.getTitle()}?"
      See Also:
    • setSeparatorTitle

      public SelectOtherItem setSeparatorTitle(String separatorTitle)
      Title for the separator between normal items and the Other... item in the drop down list. Selecting this item will not change the FormItem's value.
      Parameters:
      separatorTitle - New separatorTitle value. Default value is "--------------------"
      Returns:
      SelectOtherItem instance, for chaining setter calls
      See Also:
    • getSeparatorTitle

      public String getSeparatorTitle()
      Title for the separator between normal items and the Other... item in the drop down list. Selecting this item will not change the FormItem's value.
      Returns:
      Current separatorTitle value. Default value is "--------------------"
      See Also:
    • setSeparatorValue

      public SelectOtherItem setSeparatorValue(String separatorValue)
      Value for the separator item between normal items and the Other... value. If necessary the value may be changed to ensure it doesn't collide with any data values in this item's valueMap.

      Note : This is an advanced setting

      Parameters:
      separatorValue - New separatorValue value. Default value is "----"
      Returns:
      SelectOtherItem instance, for chaining setter calls
      See Also:
    • getSeparatorValue

      public String getSeparatorValue()
      Value for the separator item between normal items and the Other... value. If necessary the value may be changed to ensure it doesn't collide with any data values in this item's valueMap.
      Returns:
      Current separatorValue value. Default value is "----"
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(SelectOtherItem selectOtherItemProperties)
      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:
      selectOtherItemProperties - properties that should be used as new defaults when instances of this class are created
      See Also: