Class PluginPreferencesModel
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.ChangeNotifier
-
- org.openstreetmap.josm.gui.preferences.plugin.PluginPreferencesModel
-
public class PluginPreferencesModel extends ChangeNotifier
The plugin model behind aPluginListPanel
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PluginInformation>
availablePlugins
private java.util.Set<java.lang.String>
currentActivePlugins
private java.util.List<PluginInformation>
displayedPlugins
private java.lang.String
filterExpression
private PluginInstallation
filterStatus
private java.util.Set<java.lang.String>
pendingDownloads
private java.util.Map<PluginInformation,java.lang.Boolean>
selectedPluginsMap
-
Constructor Summary
Constructors Constructor Description PluginPreferencesModel()
Constructs a newPluginPreferencesModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
availablePluginsModified()
void
clearPendingPlugins(java.util.Collection<PluginInformation> plugins)
Removes all the plugin inplugins
from the list of plugins with a pending downloadprivate void
doFilter()
void
filterDisplayedPlugins(java.lang.String filter)
Filters the list of displayed plugins by text.void
filterDisplayedPlugins(PluginInstallation status)
Filters the list of displayed plugins by installation status.java.util.List<PluginInformation>
getAvailablePlugins()
Replies the list of all available plugins.java.util.List<PluginInformation>
getDisplayedPlugins()
Replies the list of plugin information to display.java.util.Set<java.lang.String>
getNewlyActivatedPluginNames()
Replies the set of plugin names which have been added by the user to the set of activated plugins.java.util.List<PluginInformation>
getNewlyActivatedPlugins()
Replies the list of plugins which have been added by the user to the set of activated plugins.java.util.List<PluginInformation>
getNewlyDeactivatedPlugins()
Replies the list of plugins which have been removed by the user from the set of deactivated plugins.PluginInformation
getPluginInformation(java.lang.String name)
Replies the plugin info with the namename
.java.util.Set<PluginInformation>
getPluginsScheduledForUpdateOrDownload()
Replies the set of plugins waiting for update or download.java.util.Set<java.lang.String>
getSelectedPluginNames()
Replies the set of selected plugin information objectsjava.util.List<PluginInformation>
getSelectedPlugins()
Replies the list of selected plugin information objectsvoid
initFromPreferences()
Initializes the model from preferencesboolean
isActivePluginsChanged()
Replies true if the set of active plugins has been changed by the user in this preference model.boolean
isSelectedPlugin(java.lang.String name)
Replies true if the plugin with namename
is currently selected in the plugin modelprivate boolean
matchesInstallationStatus(PluginInformation pi)
void
refreshLocalPluginVersion(java.util.Collection<PluginInformation> plugins)
Refreshes the local version field on the plugins inplugins
with the version in the manifest of the downloaded "jar.new"-file for this plugin.void
setAvailablePlugins(java.util.Collection<PluginInformation> available)
Sets the list of available plugins.void
setPluginSelected(java.lang.String name, boolean selected)
Sets whether the plugin is selected or not.protected void
sort()
Sorts the list of available pluginsprotected void
updateAvailablePlugin(PluginInformation other)
void
updateAvailablePlugins(java.util.Collection<PluginInformation> fromPluginSite)
Updates the list of plugin information objects with new information from plugin update sites.-
Methods inherited from class org.openstreetmap.josm.gui.util.ChangeNotifier
addChangeListener, fireStateChanged, removeChangeListener
-
-
-
-
Field Detail
-
currentActivePlugins
private final java.util.Set<java.lang.String> currentActivePlugins
-
availablePlugins
private final java.util.List<PluginInformation> availablePlugins
-
filterStatus
private PluginInstallation filterStatus
-
filterExpression
private java.lang.String filterExpression
-
displayedPlugins
private final java.util.List<PluginInformation> displayedPlugins
-
selectedPluginsMap
private final java.util.Map<PluginInformation,java.lang.Boolean> selectedPluginsMap
-
pendingDownloads
private final java.util.Set<java.lang.String> pendingDownloads
-
-
Constructor Detail
-
PluginPreferencesModel
public PluginPreferencesModel()
Constructs a newPluginPreferencesModel
.
-
-
Method Detail
-
filterDisplayedPlugins
public void filterDisplayedPlugins(PluginInstallation status)
Filters the list of displayed plugins by installation status.- Parameters:
status
- The filter used against installation status- Since:
- 13799
-
filterDisplayedPlugins
public void filterDisplayedPlugins(java.lang.String filter)
Filters the list of displayed plugins by text.- Parameters:
filter
- The filter used against plugin name, description or version
-
doFilter
private void doFilter()
-
matchesInstallationStatus
private boolean matchesInstallationStatus(PluginInformation pi)
-
setAvailablePlugins
public void setAvailablePlugins(java.util.Collection<PluginInformation> available)
Sets the list of available plugins.- Parameters:
available
- The available plugins
-
availablePluginsModified
protected final void availablePluginsModified()
-
updateAvailablePlugin
protected void updateAvailablePlugin(PluginInformation other)
-
updateAvailablePlugins
public void updateAvailablePlugins(java.util.Collection<PluginInformation> fromPluginSite)
Updates the list of plugin information objects with new information from plugin update sites.- Parameters:
fromPluginSite
- plugin information read from plugin update sites
-
getSelectedPlugins
public java.util.List<PluginInformation> getSelectedPlugins()
Replies the list of selected plugin information objects- Returns:
- the list of selected plugin information objects
-
getSelectedPluginNames
public java.util.Set<java.lang.String> getSelectedPluginNames()
Replies the set of selected plugin information objects- Returns:
- the set of selected plugin information objects
-
sort
protected void sort()
Sorts the list of available plugins
-
getDisplayedPlugins
public java.util.List<PluginInformation> getDisplayedPlugins()
Replies the list of plugin information to display.- Returns:
- the list of plugin information to display
-
getPluginsScheduledForUpdateOrDownload
public java.util.Set<PluginInformation> getPluginsScheduledForUpdateOrDownload()
Replies the set of plugins waiting for update or download.- Returns:
- the set of plugins waiting for update or download
-
setPluginSelected
public void setPluginSelected(java.lang.String name, boolean selected)
Sets whether the plugin is selected or not.- Parameters:
name
- the name of the pluginselected
- true, if selected; false, otherwise
-
clearPendingPlugins
public void clearPendingPlugins(java.util.Collection<PluginInformation> plugins)
Removes all the plugin inplugins
from the list of plugins with a pending download- Parameters:
plugins
- the list of plugins to clear for a pending download
-
getPluginInformation
public PluginInformation getPluginInformation(java.lang.String name)
Replies the plugin info with the namename
. null, if no such plugin info exists.- Parameters:
name
- the name. If null, replies null.- Returns:
- the plugin info.
-
initFromPreferences
public void initFromPreferences()
Initializes the model from preferences
-
isSelectedPlugin
public boolean isSelectedPlugin(java.lang.String name)
Replies true if the plugin with namename
is currently selected in the plugin model- Parameters:
name
- the plugin name- Returns:
- true if the plugin is selected; false, otherwise
-
getNewlyActivatedPlugins
public java.util.List<PluginInformation> getNewlyActivatedPlugins()
Replies the list of plugins which have been added by the user to the set of activated plugins.- Returns:
- the list of newly activated plugins
-
getNewlyDeactivatedPlugins
public java.util.List<PluginInformation> getNewlyDeactivatedPlugins()
Replies the list of plugins which have been removed by the user from the set of deactivated plugins.- Returns:
- the list of newly deactivated plugins
-
getAvailablePlugins
public java.util.List<PluginInformation> getAvailablePlugins()
Replies the list of all available plugins.- Returns:
- the list of all available plugins
-
getNewlyActivatedPluginNames
public java.util.Set<java.lang.String> getNewlyActivatedPluginNames()
Replies the set of plugin names which have been added by the user to the set of activated plugins.- Returns:
- the set of newly activated plugin names
-
isActivePluginsChanged
public boolean isActivePluginsChanged()
Replies true if the set of active plugins has been changed by the user in this preference model. He has either added plugins or removed plugins being active before.- Returns:
- true if the collection of active plugins has changed
-
refreshLocalPluginVersion
public void refreshLocalPluginVersion(java.util.Collection<PluginInformation> plugins)
Refreshes the local version field on the plugins inplugins
with the version in the manifest of the downloaded "jar.new"-file for this plugin.- Parameters:
plugins
- the collections of plugins to refresh
-
-