org.openstreetmap.josm.gui.preferences.plugin
Class PluginPreferencesModel

java.lang.Object
  extended by java.util.Observable
      extended by org.openstreetmap.josm.gui.preferences.plugin.PluginPreferencesModel

public class PluginPreferencesModel
extends java.util.Observable


Field Summary
private  java.util.ArrayList<PluginInformation> availablePlugins
           
private  java.util.Set<java.lang.String> currentActivePlugins
           
private  java.util.ArrayList<PluginInformation> displayedPlugins
           
private  java.lang.String filterExpression
           
private  java.util.Set<java.lang.String> pendingDownloads
           
private  java.util.HashMap<PluginInformation,java.lang.Boolean> selectedPluginsMap
           
 
Constructor Summary
PluginPreferencesModel()
           
 
Method Summary
 void clearPendingPlugins(java.util.Collection<PluginInformation> plugins)
          Removes all the plugin in plugins from the list of plugins with a pending download
 void filterDisplayedPlugins(java.lang.String filter)
           
 java.util.List<PluginInformation> getAvailablePlugins()
          Replies the set of all available plugins.
 java.util.List<PluginInformation> getDisplayedPlugins()
          Replies the list of plugin informations 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 set of plugins which have been added by the user to the set of activated plugins.
 java.util.List<PluginInformation> getNewlyDeactivatedPlugins()
          Replies the set of plugins which have been removed by the user from the set of activated plugins.
 PluginInformation getPluginInformation(java.lang.String name)
          Replies the plugin info with the name name.
 java.util.List<PluginInformation> getPluginsScheduledForUpdateOrDownload()
          Replies the list of plugins waiting for update or download
 java.util.Set<java.lang.String> getSelectedPluginNames()
          Replies the list of selected plugin information objects
 java.util.List<PluginInformation> getSelectedPlugins()
          Replies the list of selected plugin information objects
 void initFromPreferences()
          Initializes the model from preferences
 boolean 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 name name is currently selected in the plugin model
 void refreshLocalPluginVersion(java.util.Collection<PluginInformation> plugins)
          Refreshes the local version field on the plugins in plugins with the version in the manifest of the downloaded "jar.new"-file for this plugin.
 void setAvailablePlugins(java.util.Collection<PluginInformation> available)
           
 void setPluginSelected(java.lang.String name, boolean selected)
          Sets whether the plugin is selected or not.
protected  void sort()
          Sorts the list of available plugins
protected  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 java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

availablePlugins

private final java.util.ArrayList<PluginInformation> availablePlugins

displayedPlugins

private final java.util.ArrayList<PluginInformation> displayedPlugins

selectedPluginsMap

private final java.util.HashMap<PluginInformation,java.lang.Boolean> selectedPluginsMap

pendingDownloads

private java.util.Set<java.lang.String> pendingDownloads

filterExpression

private java.lang.String filterExpression

currentActivePlugins

private java.util.Set<java.lang.String> currentActivePlugins
Constructor Detail

PluginPreferencesModel

public PluginPreferencesModel()
Method Detail

filterDisplayedPlugins

public void filterDisplayedPlugins(java.lang.String filter)

setAvailablePlugins

public void setAvailablePlugins(java.util.Collection<PluginInformation> available)

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 list of selected plugin information objects

Returns:
the list 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 informations to display

Returns:
the list of plugin informations to display

getPluginsScheduledForUpdateOrDownload

public java.util.List<PluginInformation> getPluginsScheduledForUpdateOrDownload()
Replies the list of plugins waiting for update or download

Returns:
the list 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 plugin
selected - true, if selected; false, otherwise

clearPendingPlugins

public void clearPendingPlugins(java.util.Collection<PluginInformation> plugins)
Removes all the plugin in plugins 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 name name. 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 name name 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 set of plugins which have been added by the user to the set of activated plugins.

Returns:
the set of newly deactivated plugins

getNewlyDeactivatedPlugins

public java.util.List<PluginInformation> getNewlyDeactivatedPlugins()
Replies the set of plugins which have been removed by the user from the set of activated plugins.

Returns:
the set of newly deactivated plugins

getAvailablePlugins

public java.util.List<PluginInformation> getAvailablePlugins()
Replies the set of all available plugins.

Returns:
the set 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 in plugins with the version in the manifest of the downloaded "jar.new"-file for this plugin.

Parameters:
plugins - the collections of plugins to refresh


JOSM