de.caff.util.settings.swing

## Class SwingUrlListPreferenceProperty

- java.lang.Object
- - de.caff.util.settings.AbstractBasicChangeableItem
  - - de.caff.util.settings.AbstractBasicLocalizableChangeableItem
    - - de.caff.util.settings.swing.AbstractBasicSimpleEditableChangeableItem
      - - de.caff.util.settings.swing.SwingUrlListPreferenceProperty

- All Implemented Interfaces:
    ChangeableItem, PreferenceProperty, EditablePreferenceProperty, EditableProperty, UrlListPreferenceProperty, java.io.Serializable

      public class SwingUrlListPreferenceProperty
      extends AbstractBasicSimpleEditableChangeableItem
      implements UrlListPreferenceProperty, EditablePreferenceProperty

  Editable URL list preference property.
  Author:
    Rammi
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SwingUrlListPreferenceProperty.UrlSelectionMode` Modes for local file URL selection.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DIALOG_BUTTON` I18n tag extension for button of associated dialog.
    `static java.lang.String` | `DIALOG_FILTER` 118n tag extension for file filter definition.
    `static java.lang.String` | `DIALOG_LABEL` I18n tag extension for label of associated dialog.
    `static java.lang.String` | `DIALOG_TITLE` I18n tag extension for title of associated dialog.

    - ### Fields inherited from interface de.caff.util.settings.PreferenceProperty

      `PROPERTY_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SwingUrlListPreferenceProperty(java.lang.String basicName, java.lang.String baseTag, java.util.Collection<java.lang.String> startList, SwingUrlListPreferenceProperty.UrlSelectionMode selectionMode)` Create a URL list with the given basic name and basic tag.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addUrl(java.lang.String url)` Add a URL to the end of the list.
    `void` | `addUrl(java.lang.String url, int pos)` Insert a URL at the given position.
    `Indexable<java.lang.String>` | `getDefaults()` Get the defaults.
    `(package private) javax.swing.JButton` | `getDialogButton()` Get the button of the associated dialog.
    `(package private) javax.swing.filechooser.FileFilter` | `getDialogFileFilter()` Get the file filter for the associated dialog.
    `(package private) javax.swing.JLabel` | `getDialogLabel()` Get the label text of the associated dialog.
    `(package private) java.lang.String` | `getDialogTitle()` Get the title of the associated dialog.
    `EditorProvider` | `getEditorProvider(java.util.Locale l)` Get the editor components for editing this preference property.
    `SwingUrlListPreferenceProperty.UrlSelectionMode` | `getSelectionMode()` Get the selection mode.
    `java.util.Collection<java.lang.String>` | `getUrlList()` Get the collection of URLs.
    `void` | `readFrom(java.util.prefs.Preferences preferences)` Read the property value from the preferences.
    `void` | `remove(int pos)` Remove the URL at the given position.
    `(package private) void` | `setUrlList(java.util.Collection<java.lang.String> newList)` Set the URL list.
    `void` | `storeTo(java.util.prefs.Preferences preferences)` Store the current property value in the preferences.
    `void` | `swap(int pos1, int pos2)` Exchange two entries in the URL list.

    - ### Methods inherited from class de.caff.util.settings.AbstractBasicLocalizableChangeableItem

      `getBaseTag, getLabelString, getMenuString, getName, getString`

    - ### Methods inherited from class de.caff.util.settings.AbstractBasicChangeableItem

      `addValueChangeListener, addValueChangeListenerWeakly, firePropertyChange, fireValueChange, fireValueChange, fireValueChange, getBasicName, getPropertyName, removeValueChangeListener, removeValueChangeListenerWeakly`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface de.caff.util.settings.swing.EditableProperty

      `getName`

    - ### Methods inherited from interface de.caff.util.settings.ChangeableItem

      `addValueChangeListener, addValueChangeListenerWeakly, removeValueChangeListener, removeValueChangeListenerWeakly`

- - ### Field Detail

    - #### DIALOG_TITLE

          public static final java.lang.String DIALOG_TITLE

      I18n tag extension for title of associated dialog.
      See Also:
        Constant Field Values

    - #### DIALOG_BUTTON

          public static final java.lang.String DIALOG_BUTTON

      I18n tag extension for button of associated dialog.
      See Also:
        Constant Field Values

    - #### DIALOG_LABEL

          public static final java.lang.String DIALOG_LABEL

      I18n tag extension for label of associated dialog.
      See Also:
        Constant Field Values

    - #### DIALOG_FILTER

          public static final java.lang.String DIALOG_FILTER

      118n tag extension for file filter definition.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SwingUrlListPreferenceProperty

          public SwingUrlListPreferenceProperty(@NotNull
                                                java.lang.String basicName,
                                                @NotNull
                                                java.lang.String baseTag,
                                                @Nullable
                                                java.util.Collection<java.lang.String> startList,
                                                @NotNull
                                                SwingUrlListPreferenceProperty.UrlSelectionMode selectionMode)

      Create a URL list with the given basic name and basic tag.
      Parameters:
        `basicName` - basic name
        `baseTag` - basic I18n tag
        `startList` - start list, if `null` there will be no "Defaults" button in the editor
        `selectionMode` - URL selection mode

  - ### Method Detail

    - #### getSelectionMode

          @NotNull
          public SwingUrlListPreferenceProperty.UrlSelectionMode getSelectionMode()

      Get the selection mode.
      Returns:
        selection mode

    - #### getEditorProvider

          @NotNull
          public EditorProvider getEditorProvider(@Nullable
                                                           java.util.Locale l)

      Get the editor components for editing this preference property.
      Specified by:
        `getEditorProvider` in interface `EditableProperty`
      Parameters:
        `l` - locale used for i18n
      Returns:
        editor component

    - #### readFrom

          public void readFrom(@NotNull
                               java.util.prefs.Preferences preferences)

      Read the property value from the preferences.
      Specified by:
        `readFrom` in interface `PreferenceProperty`
      Parameters:
        `preferences` - preferences from where to read the property value

    - #### storeTo

          public void storeTo(@NotNull
                              java.util.prefs.Preferences preferences)

      Store the current property value in the preferences.
      Specified by:
        `storeTo` in interface `PreferenceProperty`
      Parameters:
        `preferences` - preferences where to store the property value

    - #### addUrl

          public void addUrl(java.lang.String url)

      Add a URL to the end of the list.
      Parameters:
        `url` - string representing a URL

    - #### addUrl

          public void addUrl(java.lang.String url,
                             int pos)

      Insert a URL at the given position. If the position is invalid, the URL is added to the end.
      Parameters:
        `url` - string representing an URL
        `pos` - insertion position

    - #### remove

          public void remove(int pos)

      Remove the URL at the given position. If the position is invalid, nothing happens.
      Parameters:
        `pos` - position to remove from the list

    - #### swap

          public void swap(int pos1,
                           int pos2)

      Exchange two entries in the URL list.
      Parameters:
        `pos1` - position of first entry
        `pos2` - position of second entry

    - #### getUrlList

          public java.util.Collection<java.lang.String> getUrlList()

      Get the collection of URLs. This also includes any URLs that are prepended or appended.
      Specified by:
        `getUrlList` in interface `UrlListPreferenceProperty`
      Returns:
        URL list

    - #### setUrlList

          void setUrlList(@NotNull
                          java.util.Collection<java.lang.String> newList)

      Set the URL list.
      Parameters:
        `newList` - new URL list

    - #### getDefaults

          @Nullable
          public Indexable<java.lang.String> getDefaults()

      Get the defaults. This is the initial list this preference property had by default.
      Returns:
        default list, possibly empty, or `null` to have no reset button in the editor

    - #### getDialogTitle

          @NotNull
          java.lang.String getDialogTitle()

      Get the title of the associated dialog.
      Returns:
        dialog title

    - #### getDialogButton

          @NotNull
          javax.swing.JButton getDialogButton()

      Get the button of the associated dialog.
      Returns:
        dialog button

    - #### getDialogLabel

          @NotNull
          javax.swing.JLabel getDialogLabel()

      Get the label text of the associated dialog.
      Returns:
        dialog label

    - #### getDialogFileFilter

          @Nullable
          javax.swing.filechooser.FileFilter getDialogFileFilter()

      Get the file filter for the associated dialog.
      Returns:
        file filter