[Schmitzm-commits] r152 - in trunk/src: schmitzm/geotools/gui skrueger/geotools skrueger/geotools/labelsearch skrueger/geotools/resource skrueger/geotools/resource/locales

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 19 20:13:37 CEST 2009


Author: alfonx
Date: 2009-06-19 20:13:35 +0200 (Fri, 19 Jun 2009)
New Revision: 152

Added:
   trunk/src/skrueger/geotools/resource/locales/
   trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar.properties
   trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_de.properties
   trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_fr.properties
Modified:
   trunk/src/schmitzm/geotools/gui/JMapPane.java
   trunk/src/skrueger/geotools/MapPaneToolBar.java
   trunk/src/skrueger/geotools/labelsearch/labelsearch.properties
Log:
* ToolTips f?\195?\188r alle MapPaneToolbarActions eingebaut: zoom in/out, pan, info...

Modified: trunk/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-06-19 18:13:35 UTC (rev 152)
@@ -156,7 +156,13 @@
 				&& e.getButton() != 3)
 			return;
 		super.processDrag(x1, y1, x2, y2, e);
-		fireMapPaneEvent(new MapAreaChangedEvent(this, oldMapArea, mapArea));
+
+		// SK, 19.6.2009:
+		// Ein MapAreaChangedEvent soll nur geworfen werden, wenn auch gezoomt
+		// wurde! Irgendwie wird das auch aufgerufen, wenn man mit InfoClick
+		// tool nur click - also garkeit kein draggin gemacht hat.
+		if (!oldMapArea.equals(mapArea) && (getState() == ZOOM_IN || getState() == ZOOM_OUT))
+			fireMapPaneEvent(new MapAreaChangedEvent(this, oldMapArea, mapArea));
 	}
 
 	private static final Cursor WAIT_CURSOR = Cursor

Modified: trunk/src/skrueger/geotools/MapPaneToolBar.java
===================================================================
--- trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-06-19 18:13:35 UTC (rev 152)
@@ -3,6 +3,7 @@
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -23,6 +24,8 @@
 import schmitzm.geotools.map.event.JMapPaneEvent;
 import schmitzm.geotools.map.event.JMapPaneListener;
 import schmitzm.geotools.map.event.MapAreaChangedEvent;
+import schmitzm.lang.LangUtil;
+import schmitzm.lang.ResourceProvider;
 import schmitzm.swing.ButtonGroup;
 import schmitzm.swing.SwingUtil;
 
@@ -42,6 +45,15 @@
 public class MapPaneToolBar extends JToolBar {
 	private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class
 			.getName());
+	
+	public static ResourceProvider RESOURCE = new ResourceProvider(LangUtil
+			.extendPackagePath(MapPaneToolBar.class,
+					"resource.locales.mapPaneToolbar"), Locale.ENGLISH);
+	
+	public static String R(String key, Object... values) {
+		return RESOURCE.getString(key, values);
+	}
+
 	/** Constant for the tool "Panning" (10). */
 	public static final int TOOL_PAN = 10;
 	/** Constant for the tool "Info" (20). */
@@ -126,7 +138,8 @@
 		super("Control the map", JToolBar.HORIZONTAL);
 		this.toolAndActionButtons = new TreeMap<Integer, JComponent>();
 		this.toolButtonGroup = new ButtonGroup();
-		// Create a Listener to sniff the zooms on the JMapPane
+		
+		// Create a Listener to listen to the zooms on the JMapPane
 		this.mapPaneListener = new JMapPaneListener() {
 			public void performMapPaneEvent(JMapPaneEvent e) {
 				if (!(e instanceof MapAreaChangedEvent))
@@ -137,14 +150,19 @@
 					return;
 				}
 
-				Envelope oldMapArea = ((MapAreaChangedEvent) e).getOldMapArea();
+				final MapAreaChangedEvent mapAreaChangedEvent = (MapAreaChangedEvent) e;
+				Envelope oldMapArea = mapAreaChangedEvent.getOldMapArea();
+				
+				final Envelope mapArea = mapAreaChangedEvent.getNewMapArea();
+				if (mapArea == null || mapArea.equals(oldMapArea) ) {
+					// If the MapArea didn't change... we don't want to register it as a zoom action.
+					return;
+				}
+				
 				if (lastZooms.size() == 0 && oldMapArea != null) {
 					lastZooms.add(oldMapArea);
 					zoomBackIndex = 1;
 				}
-
-				final Envelope mapArea = ((MapAreaChangedEvent) e)
-						.getNewMapArea();
 				if (mapArea == null)
 					return;
 
@@ -211,30 +229,30 @@
 	protected void initToolsAndActions() {
 		// Panning
 		addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon(
-				MapView.class.getResource("resource/icons/pan.png"))), false);
+				MapView.class.getResource("resource/icons/pan.png")), R("MapPaneButtons.Pan.TT")), false);
 		// Info
 		addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon(
-				MapView.class.getResource("resource/icons/info.png"))), false);
+				MapView.class.getResource("resource/icons/info.png")),R("MapPaneButtons.Info.TT")), false);
 
 		// Zoom in
 		addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon(
-				MapView.class.getResource("resource/icons/zoom_in.png"))),
+				MapView.class.getResource("resource/icons/zoom_in.png")), R("MapPaneButtons.ZoomIn.TT")),
 				false);
 		// Zoom out
 		addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon(
-				MapView.class.getResource("resource/icons/zoom_out.png"))),
+				MapView.class.getResource("resource/icons/zoom_out.png")), R("MapPaneButtons.ZoomOut.TT")),
 				false);
 
 		// Action button to revert the last zoom
 		addAction(new MapPaneToolBarAction(ACTION_ZOOM_BACK, this, "",
 				new ImageIcon(MapView.class
-						.getResource("resource/icons/zoom_back.png"))), false);
+						.getResource("resource/icons/zoom_back.png")), R("MapPaneButtons.LastZoom.TT")), false);
 		setButtonEnabled(ACTION_ZOOM_BACK, false);
 
 		// Action button to redo the last zoom
 		addAction(new MapPaneToolBarAction(ACTION_ZOOM_FORWARD, this, "",
 				new ImageIcon(MapView.class
-						.getResource("resource/icons/zoom_forward.png"))),
+						.getResource("resource/icons/zoom_forward.png")), R("MapPaneButtons.NextZoom.TT")),
 				false);
 		setButtonEnabled(ACTION_ZOOM_FORWARD, false);
 
@@ -394,7 +412,6 @@
 				mapPane.refresh();
 			}
 		}
-
 	}
 
 	/**

Modified: trunk/src/skrueger/geotools/labelsearch/labelsearch.properties
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/labelsearch.properties	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/skrueger/geotools/labelsearch/labelsearch.properties	2009-06-19 18:13:35 UTC (rev 152)
@@ -3,4 +3,5 @@
 SearchMapDialog.resultsTable.tt=Click on a result to show it. 
 SearchMapDialog.searchString.Label=Enter search string:
 SearchMapDialog.searchString.tt=Enter text and press [Enter or Return].
-SearchMapDialog.title=Search labels in map\: ${0}
\ No newline at end of file
+SearchMapDialog.title=Search labels in map\: ${0}
+

Added: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar.properties
===================================================================
--- trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar.properties	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar.properties	2009-06-19 18:13:35 UTC (rev 152)
@@ -0,0 +1,6 @@
+MapPaneButtons.Pan.TT=Move the visible map extend
+MapPaneButtons.Info.TT=Get information about objects 
+MapPaneButtons.ZoomIn.TT=Zoom nearer to the map
+MapPaneButtons.ZoomOut.TT=Zoom away from the map
+MapPaneButtons.LastZoom.TT=Go to last map extend
+MapPaneButtons.NextZoom.TT=Go to next map extend
\ No newline at end of file


Property changes on: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_de.properties
===================================================================
--- trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_de.properties	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_de.properties	2009-06-19 18:13:35 UTC (rev 152)
@@ -0,0 +1,6 @@
+MapPaneButtons.Pan.TT=Karte verschieben
+MapPaneButtons.Info.TT=Informationen zu Objekten abfragen 
+MapPaneButtons.ZoomIn.TT=Auf einen Auschnitt zoomen
+MapPaneButtons.ZoomOut.TT=Aus der Karte herauszoomen
+MapPaneButtons.LastZoom.TT=Letzten Kartenausschnitt wiederherstellen 
+MapPaneButtons.NextZoom.TT=Nächsten Kartenausschnitt wiederherstellen
\ No newline at end of file


Property changes on: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_de.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_fr.properties
===================================================================
--- trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_fr.properties	2009-06-19 16:22:29 UTC (rev 151)
+++ trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_fr.properties	2009-06-19 18:13:35 UTC (rev 152)
@@ -0,0 +1,6 @@
+MapPaneButtons.Pan.TT=Move the visible map extend. 
+MapPaneButtons.Info.TT=Get information about objects. 
+MapPaneButtons.ZoomIn.TT=Zoom nearer to the map.  
+MapPaneButtons.ZoomOut.TT=Zoom away from the map.
+MapPaneButtons.LastZoom.TT=Go to last selected map extend.
+MapPaneButtons.NextZoom.TT=Go to next selected map extend.
\ No newline at end of file


Property changes on: trunk/src/skrueger/geotools/resource/locales/mapPaneToolbar_fr.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Schmitzm-commits mailing list