Interface SettingWidgets


@NonExtendable public interface SettingWidgets
Maps setting classes to editor widgets, from Ui.settingWidgets(). Lookup walks the setting's class hierarchy, so registering a widget for your custom Setting subclass is all it takes for it to show up in settings panels (a module's settings, a panel's settings window, SettingsView).
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Widget
    create(Setting<?> setting)
    Builds the row (name and editor, a SettingRow) for a setting, or null if no widget is registered for its class or any superclass.
    <S extends Setting<?>>
    void
    register(Class<S> type, Function<S,Widget> factory, boolean stacked)
    Makes factory the editor for settings of type and its subclasses (unless a subclass has its own), replacing any editor registered for exactly type before.
  • Method Details

    • register

      <S extends Setting<?>> void register(Class<S> type, Function<S,Widget> factory, boolean stacked)
      Makes factory the editor for settings of type and its subclasses (unless a subclass has its own), replacing any editor registered for exactly type before. The factory is called each time a settings view is built, once per setting; the editor it returns is put in a SettingRow beside or under the setting's name.
      Parameters:
      stacked - true if the editor is wide and should sit below the setting name rather than beside it
    • create

      @Nullable Widget create(Setting<?> setting)
      Builds the row (name and editor, a SettingRow) for a setting, or null if no widget is registered for its class or any superclass. The row hides itself while the setting isn't visible.