Changeset 2263 in osm for utils/josm


Ignore:
Timestamp:
2007-03-15T21:53:32+01:00 (18 years ago)
Author:
frederik
Message:

applied patch by Francisco R. Sanots <frsantos@…> to allow other plugins
to programmatically change WMS URLs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java

    r2121 r2263  
    123123        }
    124124       
     125    /**
     126     * Updates a server URL in the preferences dialog. Used by other plugins.
     127     *
     128     * @param server The server name
     129     * @param url The server URL
     130     */
     131    public void setServerUrl(String server, String url)
     132    {
     133        for (int i = 0; i < model.getRowCount(); i++)
     134        {
     135            String name = model.getValueAt(i,1).toString();
     136            if( name.equals(server) )
     137            {
     138                model.setValueAt(url, i, 2);
     139                return;
     140            }
     141        }       
     142
     143        highestIdUsed++;
     144        model.addRow(new String[]{Integer.toString(highestIdUsed), server, url});
     145    }
     146   
     147    /**
     148     * Gets a server URL in the preferences dialog. Used by other plugins.
     149     *
     150     * @param server The server name
     151     * @return The server URL
     152     */
     153    public String getServerUrl(String server)
     154    {
     155        for (int i = 0; i < model.getRowCount(); i++)
     156        {
     157            String name = model.getValueAt(i,1).toString();
     158            if( name.equals(server) )
     159            {
     160                String url = model.getValueAt(i,2).toString();
     161                return url;
     162            }
     163        }
     164       
     165        return null;
     166    }
    125167}
    126168
Note: See TracChangeset for help on using the changeset viewer.