[Schmitzm-commits] r1494 - in trunk: schmitzm-core/src/main/java/de/schmitzm/io schmitzm-gt/src/main/java/de/schmitzm/geotools/io schmitzm-gt/src/main/resources/de/schmitzm/geotools/gui/resource/locales
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Feb 8 13:50:04 CET 2011
Author: alfonx
Date: 2011-02-08 13:50:03 +0100 (Tue, 08 Feb 2011)
New Revision: 1494
Added:
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractServerSettings.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerListJComboBox.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsRestServerSettings.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerList.java
Removed:
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/io/AbstractServerList.java
trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerList.java
trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerSettings.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractGTServerSettings.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerList.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerSettings.java
trunk/schmitzm-gt/src/main/resources/de/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties
Log:
Started a noew Options Dialog for GP, which allows to set the GpHoster server you want to use.
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/AbstractServerList.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/AbstractServerList.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/AbstractServerList.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -12,11 +12,6 @@
ArrayList<T> implements ServerList<T> {
final Logger LOGGER = LangUtil.createLogger(this);
- /**
- * Character used to separate the parameters when serializing settings to a
- * String
- */
- public static final String DELIMITER = "@";
public AbstractServerList(T... wfss) {
for (T wfs : wfss) {
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerList.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerList.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerList.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -1,13 +1,17 @@
package de.schmitzm.io;
+public interface ServerList<T extends ServerSettings> {
+ /**
+ * Character used to separate the parameters when serializing settings to a
+ * String
+ */
+ public static final String DELIMITER = "@";
-public interface ServerList<T extends ServerSettings> {
-
String toPropertiesString();
boolean parsePropertiesString(String propString);
-
+
boolean add(T server);
}
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerSettings.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerSettings.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/ServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -2,6 +2,12 @@
public interface ServerSettings {
+ /**
+ * Character used to separate the parameters when serializing settings to a
+ * String
+ */
+ static final String DELIMITER = "|";
+
public String getTitle();
public String toPropertiesString();
@@ -9,7 +15,8 @@
public boolean parsePropertiesString(String propString);
/**
- * @return <code>true</code> is the server seems to be online
+ * @return <code>true</code> is the server seems to be online. This possibly
+ * hangs the Thread.
*/
public boolean isAvailable();
}
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractGTServerSettings.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractGTServerSettings.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractGTServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -22,12 +22,6 @@
return Integer.parseInt(string);
}
- /**
- * Character used to separate the parameters when serializing settings to a
- * String
- */
- protected static final String DELIMITER = "|";
-
private String title;
static String stringOrNull(String string) {
Added: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractServerSettings.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractServerSettings.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -0,0 +1,49 @@
+package de.schmitzm.geotools.io;
+
+import de.schmitzm.io.ServerList;
+import de.schmitzm.io.ServerSettings;
+
+/**
+ * This abstract implementation offers methods to check stings for compatibility
+ * withstoring them in a {@link ServerList}, see
+ * {@link #checkValidString(String)}. It also provides fields for title and
+ * alias.
+ */
+public abstract class AbstractServerSettings implements ServerSettings {
+
+ private String title;
+ private String alias;
+
+ public void setTitle(String title) {
+ this.title = checkValidString(title);
+ }
+
+ private String checkValidString(String valueString) {
+ if (valueString == null)
+ return null;
+ if (valueString.contains(DELIMITER))
+ throw new IllegalArgumentException("Title may not contain "
+ + DELIMITER);
+ if (valueString.contains(ServerList.DELIMITER))
+ throw new IllegalArgumentException("Title may not contain "
+ + WfsServerList.DELIMITER);
+ return valueString;
+ }
+
+ public String getTitle() {
+ if (title == null)
+ return "no title"; // i8n
+ return title;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = checkValidString(alias);
+ }
+
+ public String getAlias() {
+ if (alias == null)
+ return getTitle();
+ return alias;
+ }
+
+}
Property changes on: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/AbstractServerSettings.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
Deleted: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -1,23 +0,0 @@
-package de.schmitzm.geotools.io;
-
-import de.schmitzm.io.AbstractServerList;
-
-/**
- * A list of {@link GtDbServerSettings}.
- */
-public class DbServerList extends AbstractServerList<GtDbServerSettings> {
-
- public DbServerList(GtDbServerSettings... settings) {
- super(settings);
- }
-
- public DbServerList(String propertiesString) {
- parsePropertiesString(propertiesString);
- }
-
- @Override
- protected GtDbServerSettings newInstance() {
- return new GtDbServerSettings();
- }
-
-}
Copied: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerListJComboBox.java (from rev 1492, trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java)
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java 2011-02-05 14:00:13 UTC (rev 1492)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerListJComboBox.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -0,0 +1,23 @@
+package de.schmitzm.geotools.io;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+
+public class DbServerListJComboBox extends JComboBox {
+
+ private final GtDbServerList dbList;
+
+ public DbServerListJComboBox(GtDbServerList wfsList) {
+ super(wfsList.toArray(new GtDbServerSettings[0]));
+ this.dbList = wfsList;
+ }
+
+ public GtDbServerList getDbList() {
+ return dbList;
+ }
+
+ public void listChanged() {
+ setModel(new DefaultComboBoxModel(dbList.toArray(new GtDbServerSettings[0])));
+ }
+
+}
Property changes on: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerListJComboBox.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
Deleted: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbSettingsJComboBox.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -1,23 +0,0 @@
-package de.schmitzm.geotools.io;
-
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-
-public class DbSettingsJComboBox extends JComboBox {
-
- private final DbServerList dbList;
-
- public DbSettingsJComboBox(DbServerList wfsList) {
- super(wfsList.toArray(new GtDbServerSettings[0]));
- this.dbList = wfsList;
- }
-
- public DbServerList getDbList() {
- return dbList;
- }
-
- public void listChanged() {
- setModel(new DefaultComboBoxModel(dbList.toArray(new GtDbServerSettings[0])));
- }
-
-}
Copied: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsRestServerSettings.java (from rev 1492, trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java)
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java 2011-02-05 14:00:13 UTC (rev 1492)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsRestServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -0,0 +1,116 @@
+package de.schmitzm.geotools.io;
+
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import de.schmitzm.io.IOUtil;
+import de.schmitzm.lang.LangUtil;
+
+/**
+ * This class describes all settings needed to connect to a Geoserver server via
+ * REST configuration. This class extends a {@link HashMap} and contains two
+ * groups of keys:<br/>
+ * The first group of keys, are all keys provided by Geotools to create a WFS <br/>
+ * This class can serialize all important parameters needed to define the
+ * connection into a {@link String} with {@link #toPropertiesString()} and
+ * re-import the String with {@link #parsePropertiesString(String)}.
+ */
+public class GsRestServerSettings extends AbstractServerSettings {
+
+ final Logger LOGGER = LangUtil.createLogger(this);
+
+ @Override
+ public String toString() {
+ return "GsServerSettings [url=" + url + ", username=" + username
+ + ", password=" + password + "]";
+ }
+
+ public GsRestServerSettings() {
+ }
+
+ /**
+ * A constructor setting the URL
+ */
+ public GsRestServerSettings(String url) {
+ super();
+ setUrl(url);
+ }
+
+ @Override
+ public boolean parsePropertiesString(String propString) {
+ if (propString == null || propString.isEmpty())
+ return false;
+ try {
+
+ String[] split = propString.split(Pattern.quote(DELIMITER));
+
+ int i = 0;
+ setUrl(split[i++]);
+ setTitle(split[i++]);
+ setUsername(StringUtils.stripToNull(split[i++]));
+ setPassword(split[i++]);
+
+ return true;
+ } catch (Exception e) {
+ LOGGER.warn("couldn't parse " + propString, e);
+ return false;
+ }
+ }
+
+ String url;
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ String username;
+ String password;
+
+ @Override
+ public String toPropertiesString() {
+ StringBuffer serialized = new StringBuffer(100);
+
+ serialized.append(getUrl());
+ serialized.append(DELIMITER);
+
+ serialized.append(getTitle());
+ serialized.append(DELIMITER);
+
+ serialized.append(getUsername());
+ serialized.append(DELIMITER);
+
+ serialized.append(getPassword());
+ serialized.append(DELIMITER);
+
+ return serialized.toString();
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return IOUtil.urlExists(getUrl());
+ }
+
+}
Property changes on: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsRestServerSettings.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerList.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerList.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerList.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -6,9 +6,9 @@
/**
* A list of {@link GtWfsServerSettings}.
*/
-public class GsServerList extends AbstractServerList<GsServerSettings> {
+public class GsServerList extends AbstractServerList<GsRestServerSettings> {
- public GsServerList(GsServerSettings... wfss) {
+ public GsServerList(GsRestServerSettings... wfss) {
super(wfss);
}
@@ -17,7 +17,7 @@
}
@Override
- protected GsServerSettings newInstance() {
- return new GsServerSettings();
+ protected GsRestServerSettings newInstance() {
+ return new GsRestServerSettings();
}
}
Deleted: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GsServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -1,121 +0,0 @@
-package de.schmitzm.geotools.io;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-
-import de.schmitzm.lang.LangUtil;
-
-/**
- * This class describes all settings needed to connect to a Geoserver server via
- * REST configuration. This class extends a {@link HashMap} and contains two
- * groups of keys:<br/>
- * The first group of keys, are all keys provided by Geotools to create a WFS <br/>
- * This class can serialize all important parameters needed to define the
- * connection into a {@link String} with {@link #toPropertiesString()} and
- * re-import the String with {@link #parsePropertiesString(String)}.
- *
- * TODO THis is wrong, should not extend AbstractGTServerSettings since it is
- * not a GeoTools specific server setting
- */
-public class GsServerSettings extends AbstractGTServerSettings<Void, Void> {
-
- final Logger LOGGER = LangUtil.createLogger(this);
-
- @Override
- public String toString() {
- return "GsServerSettings [url=" + url + ", username=" + username
- + ", password=" + password + "]";
- }
-
- public GsServerSettings() {
- }
-
- public GsServerSettings(String s) {
- super(s);
- }
-
- @Override
- public boolean parsePropertiesString(String propString) {
- if (propString == null || propString.isEmpty())
- return false;
- try {
-
- String[] split = propString.split(Pattern.quote(DELIMITER));
-
- int i = 0;
- setUrl(split[i++]);
- setTitle(split[i++]);
- setUsername(StringUtils.stripToNull(split[i++]));
- setPassword(split[i++]);
-
- return true;
- } catch (Exception e) {
- LOGGER.warn("couldn't parse " + propString, e);
- return false;
- }
- }
-
- String url;
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- String username;
- String password;
-
- @Override
- public String toPropertiesString() {
- StringBuffer serialized = new StringBuffer(100);
-
- serialized.append(getUrl());
- serialized.append(DELIMITER);
-
- serialized.append(getTitle());
- serialized.append(DELIMITER);
-
- serialized.append(getUsername());
- serialized.append(DELIMITER);
-
- serialized.append(getPassword());
- serialized.append(DELIMITER);
-
- return serialized.toString();
- }
-
- @Override
- public boolean isAvailable() {
- try {
- new URL(getUrl()).openStream().close();
- return true;
- } catch (IOException e) {
- return false;
- }
-
- }
-}
Copied: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerList.java (from rev 1492, trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java)
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/DbServerList.java 2011-02-05 14:00:13 UTC (rev 1492)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerList.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -0,0 +1,23 @@
+package de.schmitzm.geotools.io;
+
+import de.schmitzm.io.AbstractServerList;
+
+/**
+ * A list of {@link GtDbServerSettings}.
+ */
+public class GtDbServerList extends AbstractServerList<GtDbServerSettings> {
+
+ public GtDbServerList(GtDbServerSettings... settings) {
+ super(settings);
+ }
+
+ public GtDbServerList(String propertiesString) {
+ parsePropertiesString(propertiesString);
+ }
+
+ @Override
+ protected GtDbServerSettings newInstance() {
+ return new GtDbServerSettings();
+ }
+
+}
Property changes on: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerSettings.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerSettings.java 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/io/GtDbServerSettings.java 2011-02-08 12:50:03 UTC (rev 1494)
@@ -97,27 +97,35 @@
"Database type", true, DbType.values(), ArrayUtils.indexOf(
DbType.values(), dbServer.getDbType()), DbType.values());
+ // i8n
Text hostInput = new ManualInputOption.Text("Hostname", true,
dbServer.getHost());
- de.schmitzm.swing.input.ManualInputOption.Integer portInput = new ManualInputOption.Integer("Port", true,
- dbServer.getPort());
+ // i8n
+ de.schmitzm.swing.input.ManualInputOption.Integer portInput = new ManualInputOption.Integer(
+ "Port", true, dbServer.getPort());
+ // i8n
Text databaseInput = new ManualInputOption.Text("Database", true,
dbServer.getDatabase());
+ // i8n
Text schemaInput = new ManualInputOption.Text("Schema", true,
dbServer.getSchema());
+ // i8n
Text userInput = new ManualInputOption.Text("Username", true,
dbServer.getUsername());
+ // i8n
PasswordViewable passwdInput = new ManualInputOption.PasswordViewable(
"Password", true, dbServer.getPassword());
+ // i8n
BooleanInputOption exposePkInput = new BooleanInputOption(
"Expose primary keys", dbServer.getExposePrimaryKey());
+ // i8n
Object[] input = MultipleOptionPane.showMultipleInputDialog(owner,
"DB Connection paramters", dpTypeInput, hostInput, portInput,
databaseInput, schemaInput, userInput, passwdInput,
Modified: trunk/schmitzm-gt/src/main/resources/de/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties
===================================================================
--- trunk/schmitzm-gt/src/main/resources/de/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties 2011-02-07 21:00:09 UTC (rev 1493)
+++ trunk/schmitzm-gt/src/main/resources/de/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties 2011-02-08 12:50:03 UTC (rev 1494)
@@ -60,7 +60,7 @@
MapPaneButtons.Selection.SetSelection.TT=Setzt die Selektion auf die ausgew\u00E4hlten Objekte
MapPaneButtons.ZoomIn.TT=Auf einen Auschnitt zoomen
MapPaneButtons.ZoomOut.TT=Aus der Karte herauszoomen
-ScalePane.OGCScaleDenominator=Ma\uFFFDstab\: 1\:${0}
+ScalePane.OGCScaleDenominator=Ma\u00DFstab\: 1\:${0}
ScalePane.PixelMetersScale=1 Pixel \= {0}m
SearchMapDialog.Explanation=<html>Es werden alle <b>Beschriftungen</b> dieser Karte durchsucht.</html>
SearchMapDialog.Results.Column.Layer=Gefunden in
More information about the Schmitzm-commits
mailing list