[Schmitzm-commits] r140 - in trunk/src: . junit junit/skrueger junit/skrueger/i8n schmitzm/geotools skrueger/geotools skrueger/geotools/labelsearch skrueger/i8n

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Jun 14 19:24:45 CEST 2009


Author: alfonx
Date: 2009-06-14 19:24:44 +0200 (Sun, 14 Jun 2009)
New Revision: 140

Added:
   trunk/src/junit/
   trunk/src/junit/skrueger/
   trunk/src/junit/skrueger/i8n/
   trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
Modified:
   trunk/src/schmitzm/geotools/JTSUtil.java
   trunk/src/skrueger/geotools/MapPaneToolBar.java
   trunk/src/skrueger/geotools/labelsearch/labelsearch.properties
   trunk/src/skrueger/i8n/I8NUtil.java
   trunk/src/skrueger/i8n/SwitchLanguageDialog.java
Log:
* Not really an atomic commit: hacking session going on.. just switching from laptop to dektop.

* Minimally improved dialog to choose a language if the atlas only contains languages that your computer doesn't.
* GP: Added a menu item to send the logfile by email to Steve
* GP: List of languages to select from is now sorted
* Version-management in build.xml ... using a release.properties
** TODO: Still need integration with the webpage
* BUGFIXed: Layers expanding and collapsing every time while the AS is updating the preview
* UNDER WORK: AV: Only show selection-related buttons when they make sense.

Added: trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
===================================================================
--- trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java	2009-06-14 17:24:44 UTC (rev 140)
@@ -0,0 +1,19 @@
+package junit.skrueger.i8n;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+
+import skrueger.i8n.SwitchLanguageDialog;
+import junit.framework.TestCase;
+
+public class SwitchLanguageDialogTest extends TestCase {
+	@Test
+	public void  testDialog() {
+		ArrayList<String> langsa = new ArrayList<String>();
+		langsa.add("fr");
+		langsa.add("tr");
+		SwitchLanguageDialog switchLanguageDialog = new SwitchLanguageDialog(null, langsa);
+		switchLanguageDialog.setVisible(true);
+	}
+}

Modified: trunk/src/schmitzm/geotools/JTSUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/JTSUtil.java	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/schmitzm/geotools/JTSUtil.java	2009-06-14 17:24:44 UTC (rev 140)
@@ -57,7 +57,7 @@
     Envelope destEnv = null;
       MathTransform transform;
 	try {
-		transform = CRS.findMathTransform(sourceCRS,destCRS);
+		transform = CRS.findMathTransform(sourceCRS, destCRS);
 		destEnv = JTS.transform(sourceEnv,transform);
 	} catch (FactoryException e) {
 		LOGGER.warn("CRS tranformation for JTS envelope not successfully",e);

Modified: trunk/src/skrueger/geotools/MapPaneToolBar.java
===================================================================
--- trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-06-14 17:24:44 UTC (rev 140)
@@ -28,22 +28,25 @@
 import com.vividsolutions.jts.geom.Envelope;
 
 /**
- * A toolbar to control an {@link JMapPane} (Atlas visualization). This contains two types
- * of buttons. A group of <i>tools</i> for the mouse actions on the map represented
- * by {@link JToggleButton JToggleButtons}, where only one tool can be activated
- * every time. And some (general) <i>actions</i>, represented by normal
- * {@link JButton JButtons}. 
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ * A toolbar to control an {@link JMapPane} (Atlas visualization). This contains
+ * two types of buttons. A group of <i>tools</i> for the mouse actions on the
+ * map represented by {@link JToggleButton JToggleButtons}, where only one tool
+ * can be activated every time. And some (general) <i>actions</i>, represented
+ * by normal {@link JButton JButtons}.
+ * 
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ *         (University of Bonn/Germany)
  * @version 1.2 Stefan Krüger
  */
 public class MapPaneToolBar extends JToolBar {
-	private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class.getName());
+	private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class
+			.getName());
 	/** Constant for the tool "Panning" (10). */
 	public static final int TOOL_PAN = 10;
 	/** Constant for the tool "Info" (20). */
 	public static final int TOOL_INFO = 20;
 	public static final int SEPERATOR0 = 99;
-	
+
 	/** Constant for the tool "Zoom In" (110). */
 	public static final int TOOL_ZOOMIN = 110;
 	/** Constant for the tool "Zoom Out" (120). */
@@ -53,32 +56,41 @@
 	/** Constant for the action "Zoom forward" (140). */
 	public static final int ACTION_ZOOM_FORWARD = 140;
 	public static final int SEPERATOR1 = 199;
-	
-	/** Constant for the tool "Select" which sets the Selection to the selected features (210). */
+
+	/**
+	 * Constant for the tool "Selection Reset" which clears the selection (240).
+	 */
+	public static final int TOOL_SELECTION_CLEAR = 240;
+
+	/**
+	 * Constant for the tool "Select" which sets the Selection to the selected
+	 * features (210).
+	 */
 	public static final int TOOL_SELECTION_SET = 210;
-	/** Constant for the tool "Selection add" which adds the features to the Selection (220). */
+	/**
+	 * Constant for the tool "Selection add" which adds the features to the
+	 * Selection (220).
+	 */
 	public static final int TOOL_SELECTION_ADD = 220;
-	/** Constant for the tool "Selection subtract" which removes the selected features from the selection (230). */
+	/**
+	 * Constant for the tool "Selection subtract" which removes the selected
+	 * features from the selection (230).
+	 */
 	public static final int TOOL_SELECTION_REMOVE = 230;
-	/** Constant for the tool "Selection Reset" which clears the selection (240). */
-	public static final int TOOL_SELECTION_CLEAR = 240;
-	public static final int SEPERATOR2 = 299;
 
-	/** Constant for the action "Search Labels" (120). */
-	public static final int ACTION_SEARCH = 300;
-
 	/** Tool currently selected */
-    protected int selectedTool = TOOL_ZOOMIN;
-    
-    /** Holds the tool buttons of the tool bar. */
-    protected SortedMap<Integer, JComponent> toolAndActionButtons = null;
-    /** Controls that only one tool button is activated. */
-    protected ButtonGroup toolButtonGroup = null;
+	protected int selectedTool = TOOL_ZOOMIN;
 
-// SK: Musste ich ändern damit man Tools und Actions in der Reihenfolge mischen kann.    
-//    /** Holds the action buttons of the bar. */
-//    protected SortedMap<Integer, JButton> actionButtons = null;
+	/** Holds the tool buttons of the tool bar. */
+	protected SortedMap<Integer, JComponent> toolAndActionButtons = null;
+	/** Controls that only one tool button is activated. */
+	protected ButtonGroup toolButtonGroup = null;
 
+	// SK: Musste ich ändern damit man Tools und Actions in der Reihenfolge
+	// mischen kann.
+	// /** Holds the action buttons of the bar. */
+	// protected SortedMap<Integer, JButton> actionButtons = null;
+
 	/** Holds the {@link JMapPane} this tool bar controls. */
 	protected JMapPane mapPane = null;
 
@@ -92,613 +104,629 @@
 
 	/** Listener to sniff the zoom actions on the map. */
 	protected JMapPaneListener mapPaneListener = null;
-	
+
 	protected boolean zoomBackForwardButtonInAction;
 
-    /**
-     * Creates a new toolbar. Notice: This toolbar does nothing
-     * until {@link #setMapPane(JMapPane)} is called!
-     */
-    public MapPaneToolBar() {
-      this(null);
-    }
-    
-    /**
+	/**
+	 * Creates a new toolbar. Notice: This toolbar does nothing until
+	 * {@link #setMapPane(JMapPane)} is called!
+	 */
+	public MapPaneToolBar() {
+		this(null);
+	}
+
+	/**
 	 * Creates a new tool bar.
-	 * @param mapPane {@link JMapPane} the tool bar controls
+	 * 
+	 * @param mapPane
+	 *            {@link JMapPane} the tool bar controls
 	 */
 	public MapPaneToolBar(JMapPane mapPane) {
-	  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
-      this.mapPaneListener = new JMapPaneListener() {
-          public void performMapPaneEvent(JMapPaneEvent e) {
-              if ( !(e instanceof MapAreaChangedEvent) )
-                return;
-                
-              if ( zoomBackForwardButtonInAction ) {
-                zoomBackForwardButtonInAction = false;
-                return;
-              }
-             
-              Envelope oldMapArea = ((MapAreaChangedEvent)e).getOldMapArea();
-              if (lastZooms.size() == 0 && oldMapArea != null ) {
-                lastZooms.add(oldMapArea);
-                zoomBackIndex = 1;
-              }
+		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
+		this.mapPaneListener = new JMapPaneListener() {
+			public void performMapPaneEvent(JMapPaneEvent e) {
+				if (!(e instanceof MapAreaChangedEvent))
+					return;
 
-              final Envelope mapArea = ((MapAreaChangedEvent)e).getNewMapArea();
-              if (mapArea == null)
-                return;
-              
-              if (lastZooms.size() > 0 && mapArea.equals(lastZooms.get(lastZooms.size() - 1))) {
-                // LOGGER.debug("MapAreaChangedEvent ausgelassen bei der Zaehlung der Zoomschritt weil identisch");
-                return;
-              }
+				if (zoomBackForwardButtonInAction) {
+					zoomBackForwardButtonInAction = false;
+					return;
+				}
 
-              if (lastZooms.size() > 0)
-                while (zoomBackIndex < lastZooms.size())
-                  lastZooms.remove(lastZooms.size() - 1);
+				Envelope oldMapArea = ((MapAreaChangedEvent) e).getOldMapArea();
+				if (lastZooms.size() == 0 && oldMapArea != null) {
+					lastZooms.add(oldMapArea);
+					zoomBackIndex = 1;
+				}
 
-              lastZooms.add(mapArea);
-              zoomBackIndex = lastZooms.size();
-              setButtonEnabled(ACTION_ZOOM_BACK, lastZooms.size() > 1);
-              setButtonEnabled(ACTION_ZOOM_FORWARD, false);
-          }
-      };    
-     
-      setMapPane(mapPane);
-	  setFloatable(false);
-	  setRollover(true);
-	  
-	  init();
+				final Envelope mapArea = ((MapAreaChangedEvent) e)
+						.getNewMapArea();
+				if (mapArea == null)
+					return;
+
+				if (lastZooms.size() > 0
+						&& mapArea.equals(lastZooms.get(lastZooms.size() - 1))) {
+					// LOGGER.debug("MapAreaChangedEvent ausgelassen bei der Zaehlung der Zoomschritt weil identisch");
+					return;
+				}
+
+				if (lastZooms.size() > 0)
+					while (zoomBackIndex < lastZooms.size())
+						lastZooms.remove(lastZooms.size() - 1);
+
+				lastZooms.add(mapArea);
+				zoomBackIndex = lastZooms.size();
+				setButtonEnabled(ACTION_ZOOM_BACK, lastZooms.size() > 1);
+				setButtonEnabled(ACTION_ZOOM_FORWARD, false);
+			}
+		};
+
+		setMapPane(mapPane);
+		setFloatable(false);
+		setRollover(true);
+
+		init();
 	}
-	
+
 	/**
 	 * Sets the {@link JMapPane} controlled by this tool bar.
-	 * @param mapPane {@link JMapPane} to control (if {@code null} this
-	 *                tool bar controls NOTHING!)
+	 * 
+	 * @param mapPane
+	 *            {@link JMapPane} to control (if {@code null} this tool bar
+	 *            controls NOTHING!)
 	 */
 	public void setMapPane(JMapPane mapPane) {
-	  // Remove listener from old MapPane
-	  if ( this.mapPane != null )
-	    this.mapPane.removeMapPaneListener( mapPaneListener );
-      this.mapPane = mapPane;
-      if ( this.mapPane != null && mapPaneListener != null )
-        this.mapPane.addMapPaneListener( mapPaneListener );
+		// Remove listener from old MapPane
+		if (this.mapPane != null)
+			this.mapPane.removeMapPaneListener(mapPaneListener);
+		this.mapPane = mapPane;
+		if (this.mapPane != null && mapPaneListener != null)
+			this.mapPane.addMapPaneListener(mapPaneListener);
 	}
-	
+
 	/**
-	 * Calls {@link #initToolsAndActions()} and {@link #initActions()} and then puts
-	 * all tool buttons and all actions buttons to the tool bar.
+	 * Calls {@link #initToolsAndActions()} and {@link #initActions()} and then
+	 * puts all tool buttons and all actions buttons to the tool bar.
 	 */
 	protected void init() {
-	  initToolsAndActions();
-      
-	  addSeparator(SEPERATOR0, new JToolBar.Separator());
-      addSeparator(SEPERATOR1, new JToolBar.Separator());
-      addSeparator(SEPERATOR2, new JToolBar.Separator());
-      
-	  initToolBar();
+		initToolsAndActions();
+
+		addSeparator(SEPERATOR0, new JToolBar.Separator());
+		addSeparator(SEPERATOR1, new JToolBar.Separator());
+
+		initToolBar();
 	}
 
-
 	/**
-	 * Creates the tool buttons and action buttons and seperators, adds them to 
-	 * {@link #toolAndActionButtons} and finally creates a button group for all tools. 
-	 * So sub-classes which override this method should FIRST add their new tool 
-	 * buttons to {@link #toolAndActionButtons} before calling {@code super.initTools()}.
+	 * Creates the tool buttons and action buttons and seperators, adds them to
+	 * {@link #toolAndActionButtons} and finally creates a button group for all
+	 * tools. So sub-classes which override this method should FIRST add their
+	 * new tool buttons to {@link #toolAndActionButtons} before calling {@code
+	 * super.initTools()}.
 	 */
 	protected void initToolsAndActions() {
-      // Panning
-      addTool( new MapPaneToolBarAction(
-          TOOL_PAN,
-          this,
-          "",
-          new ImageIcon(MapView.class.getResource("resource/icons/pan.png"))
-      ), false );
-      // Info
-      addTool( new MapPaneToolBarAction(
-          TOOL_INFO, 
-          this, 
-          "",
-          new ImageIcon(MapView.class.getResource("resource/icons/info.png"))
-      ), false );
-      
-      // Set Selection
-      addTool( new MapPaneToolBarAction(
-          TOOL_SELECTION_SET, 
-          this, 
-          "",
-          new ImageIcon(MapView.class.getResource("resource/icons/selection_set.png"))
-      ), false );
+		// Panning
+		addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon(
+				MapView.class.getResource("resource/icons/pan.png"))), false);
+		// Info
+		addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon(
+				MapView.class.getResource("resource/icons/info.png"))), false);
 
-      // Add Selection
-      addTool( new MapPaneToolBarAction(
-    		  TOOL_SELECTION_ADD, 
-    		  this, 
-    		  "",
-    		  new ImageIcon(MapView.class.getResource("resource/icons/selection_add.png"))
-      ), false );
+		// Zoom in
+		addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon(
+				MapView.class.getResource("resource/icons/zoom_in.png"))),
+				false);
+		// Zoom out
+		addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon(
+				MapView.class.getResource("resource/icons/zoom_out.png"))),
+				false);
 
-      // Remove Selection
-      addTool( new MapPaneToolBarAction(
-    		  TOOL_SELECTION_REMOVE, 
-    		  this, 
-    		  "",
-    		  new ImageIcon(MapView.class.getResource("resource/icons/selection_remove.png"))
-      ), false );
-      
-      // ResetSelection
-      addAction( new MapPaneToolBarAction(
-    		  TOOL_SELECTION_CLEAR, 
-    		  this, 
-    		  "",
-    		  new ImageIcon(MapView.class.getResource("resource/icons/selection_clear.png"))
-      ), false );
-      
-      // Zoom in
-      addTool( new MapPaneToolBarAction(
-          TOOL_ZOOMIN,
-          this,
-          "",
-          new ImageIcon(MapView.class.getResource("resource/icons/zoom_in.png"))
-      ), false );
-      // Zoom out
-      addTool( new MapPaneToolBarAction(
-          TOOL_ZOOMOUT,
-          this,
-          "",
-          new ImageIcon(MapView.class.getResource("resource/icons/zoom_out.png"))
-      ), 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);
-      setButtonEnabled( ACTION_ZOOM_BACK, 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);
+		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"))
-      ), false);
-      setButtonEnabled( ACTION_ZOOM_FORWARD, false );
-      
-      
-	  // set the selected tool enabled
-      setSelectedTool(selectedTool);
-      
+		// Action button to redo the last zoom
+		addAction(new MapPaneToolBarAction(ACTION_ZOOM_FORWARD, this, "",
+				new ImageIcon(MapView.class
+						.getResource("resource/icons/zoom_forward.png"))),
+				false);
+		setButtonEnabled(ACTION_ZOOM_FORWARD, false);
+
+		// set the selected tool enabled
+		setSelectedTool(selectedTool);
+
 	}
 
+	/**
+	 * Clears the GUI of all components and adds all tool and action buttons to
+	 * the tool bar.
+	 */
+	protected void initToolBar() {
+		setAlignmentY(1f);
+		removeAll();
+		// Separator to the left of the tool actions to start
+		// the tool buttons with the map (not with the coordinate grid)
+		Dimension dimension = new Dimension(49, 10);
+		addSeparator(dimension);
+		// Tool buttons
+		for (JComponent b : toolAndActionButtons.values())
+			add(b);
+	}
 
+	// Space between tool buttons and action buttons
+	// SK: Seperators are now als manages like actions and tools
+	// Dimension dimension2 = new Dimension( 10,10);
+	// this.addSeparator(dimension2);
+
+	// // Action buttons
+	// for (JButton b : actionButtons.values())
+	// add(b);
+	// }
+
 	/**
-     * Clears the GUI of all components and adds all tool and action buttons to the
-     * tool bar.
-     */
-    protected void initToolBar() {
-      setAlignmentY( 1f );
-      removeAll();
-      // Separator to the left of the tool actions to start
-      // the tool buttons with the map (not with the coordinate grid)
-      Dimension dimension = new Dimension( 49,10);
-      addSeparator(dimension);
-      // Tool buttons
-      for (JComponent b : toolAndActionButtons.values())
-        add(b);
-    }
-      // Space between tool buttons and action buttons
-// SK: Seperators are now als manages like actions and tools      
-//      Dimension dimension2 = new Dimension( 10,10);
-//      this.addSeparator(dimension2);
-      
-//      // Action buttons
-//      for (JButton b : actionButtons.values())
-//        add(b);
-//    }
-    
-	/**
 	 * Performs the activation of a tool.
-	 * @param tool the tool to activate
-	 * @param e    the event of the button
+	 * 
+	 * @param tool
+	 *            the tool to activate
+	 * @param e
+	 *            the event of the button
 	 */
 	public void performToolButton(int tool, ActionEvent e) {
-	  if ( mapPane == null )
-	    return;
-	  
-	  selectedTool = tool;
-	  
-      switch( tool ) {
-        case TOOL_PAN:
-          // Set the mouse tool to "Panning"
-          mapPane.setWindowSelectionState(JMapPane.NONE);
-          mapPane.setState(JMapPane.PAN);
-          mapPane.setHighlight(false);
-          mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);
-          break;
-        case TOOL_INFO: 
-          // Set the mouse tool to "Info"
-          mapPane.setWindowSelectionState(JMapPane.NONE);
-          mapPane.setState(JMapPane.SELECT_TOP); // Why not: JMapPane.SELECT_TOP_ONEONLY
-          mapPane.setHighlight(false);// SK: Was true, but since it not works properly removed it to save performance
-          mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);
-          break;
-        case TOOL_SELECTION_SET: 
-        case TOOL_SELECTION_ADD:
-        case TOOL_SELECTION_REMOVE:
-        	// Set the mouse tool to "Select"
-        	mapPane.setWindowSelectionState(JMapPane.SELECT_TOP);
-        	mapPane.setState(JMapPane.SELECT_TOP);
-        	mapPane.setHighlight(false);
-        	mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR); // TODO Select Cursor
-        	break;
-        case TOOL_ZOOMIN:
-          // Set the mouse tool to "Zoom in"
-          mapPane.setWindowSelectionState(JMapPane.ZOOM_IN);
-          mapPane.setState(JMapPane.ZOOM_IN);
-          mapPane.setHighlight(false);
-          mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);
-          break;
-        case TOOL_ZOOMOUT:
-          // Set the mouse tool to "Zoom out"
-          mapPane.setWindowSelectionState(JMapPane.NONE);
-          mapPane.setState(JMapPane.ZOOM_OUT);
-          mapPane.setHighlight(false);
-          mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
-          break;
-        default:
-          // Set map actions to default
-          mapPane.setWindowSelectionState(JMapPane.NONE);
-          mapPane.setState(JMapPane.NONE);
-          mapPane.setHighlight(false);
-          mapPane.setNormalCursor(null);
-          break;
-      }
-      mapPane.updateCursor();
+		if (mapPane == null)
+			return;
+
+		selectedTool = tool;
+
+		switch (tool) {
+		case TOOL_PAN:
+			// Set the mouse tool to "Panning"
+			mapPane.setWindowSelectionState(JMapPane.NONE);
+			mapPane.setState(JMapPane.PAN);
+			mapPane.setHighlight(false);
+			mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);
+			break;
+		case TOOL_INFO:
+			// Set the mouse tool to "Info"
+			mapPane.setWindowSelectionState(JMapPane.NONE);
+			mapPane.setState(JMapPane.SELECT_TOP); // Why not:
+													// JMapPane.SELECT_TOP_ONEONLY
+			mapPane.setHighlight(false);// SK: Was true, but since it not works
+										// properly removed it to save
+										// performance
+			mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);
+			break;
+		case TOOL_ZOOMIN:
+			// Set the mouse tool to "Zoom in"
+			mapPane.setWindowSelectionState(JMapPane.ZOOM_IN);
+			mapPane.setState(JMapPane.ZOOM_IN);
+			mapPane.setHighlight(false);
+			mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);
+			break;
+		case TOOL_ZOOMOUT:
+			// Set the mouse tool to "Zoom out"
+			mapPane.setWindowSelectionState(JMapPane.NONE);
+			mapPane.setState(JMapPane.ZOOM_OUT);
+			mapPane.setHighlight(false);
+			mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
+			break;
+//		default:
+//			// Set map actions to default
+//			mapPane.setWindowSelectionState(JMapPane.NONE);
+//			mapPane.setState(JMapPane.NONE);
+//			mapPane.setHighlight(false);
+//			mapPane.setNormalCursor(null);
+//			break;
+		}
+		mapPane.updateCursor();
 	}
 	
-    /**
-     * Performs the action of an action button.
-     * @param tool the action
-     * @param e    the event of the button
-     */
+	/**
+	 * @param id The ID of the Component to remove
+	 * @return <code>null</code> or the component that has been removed.
+	 */
+	public JComponent removeId(int id){
+		return toolAndActionButtons.remove(id);
+	}
+
+	/**
+	 * Performs the action of an action button.
+	 * 
+	 * @param tool
+	 *            the action
+	 * @param e
+	 *            the event of the button
+	 */
 	protected void performActionButton(int action, ActionEvent e) {
-      if ( mapPane == null )
-        return;
+		if (mapPane == null)
+			return;
 
-      // Perform the action "Zoom back": Revert the last zoom
-      if ( action == ACTION_ZOOM_BACK ) {
-	    if (zoomBackIndex <= 1)
-          return;
-  
-        zoomBackForwardButtonInAction = true;
-        zoomBackIndex--;
-        getButton(ACTION_ZOOM_FORWARD).setEnabled(true);
-        getButton(ACTION_ZOOM_BACK).setEnabled( zoomBackIndex > 1 );
-  
-        mapPane.setMapArea( lastZooms.get(zoomBackIndex-1) );
-        mapPane.refresh();
-      }
+		// Perform the action "Zoom back": Revert the last zoom
+		if (action == ACTION_ZOOM_BACK) {
+			if (zoomBackIndex <= 1)
+				return;
 
-      // Perform the action "Zoom forward": Redo the last zoom
-      if ( action == ACTION_ZOOM_FORWARD ) {
-        if (zoomBackIndex < lastZooms.size()) {
-          zoomBackForwardButtonInAction = true;
-          zoomBackIndex++;
-          getButton(ACTION_ZOOM_BACK).setEnabled(true);
-          getButton(ACTION_ZOOM_FORWARD).setEnabled(zoomBackIndex < lastZooms.size());
+			zoomBackForwardButtonInAction = true;
+			zoomBackIndex--;
+			getButton(ACTION_ZOOM_FORWARD).setEnabled(true);
+			getButton(ACTION_ZOOM_BACK).setEnabled(zoomBackIndex > 1);
 
-          mapPane.setMapArea( lastZooms.get(zoomBackIndex-1) );
-          mapPane.refresh();
-        }
-      }
-      
-      /**
-       * Clear the selection by calling the selection model 
-       */
-      if (action == TOOL_SELECTION_CLEAR) {
-    	  // TODO
-      }
+			mapPane.setMapArea(lastZooms.get(zoomBackIndex - 1));
+			mapPane.refresh();
+		}
+
+		// Perform the action "Zoom forward": Re-do the last zoom
+		if (action == ACTION_ZOOM_FORWARD) {
+			if (zoomBackIndex < lastZooms.size()) {
+				zoomBackForwardButtonInAction = true;
+				zoomBackIndex++;
+				getButton(ACTION_ZOOM_BACK).setEnabled(true);
+				getButton(ACTION_ZOOM_FORWARD).setEnabled(
+						zoomBackIndex < lastZooms.size());
+
+				mapPane.setMapArea(lastZooms.get(zoomBackIndex - 1));
+				mapPane.refresh();
+			}
+		}
+
 	}
-	
-	
+
 	/**
 	 * Adds a tool to the tool bar. Does nothing if a tool or action with the
 	 * specified ID already exists!
-	 * @param buttonAction action for the toggle button
-	 * @param resetToolBar indicates whether the toolbar GUI is reset after adding
-	 *                     the button (if adding several actions it useful only to
-	 *                     reset the GUI for the last added tool) 
+	 * 
+	 * @param buttonAction
+	 *            action for the toggle button
+	 * @param resetToolBar
+	 *            indicates whether the toolbar GUI is reset after adding the
+	 *            button (if adding several actions it useful only to reset the
+	 *            GUI for the last added tool)
 	 */
 	public void addTool(MapPaneToolBarAction buttonAction, boolean resetToolBar) {
-	  if ( isButtonIDUsed(buttonAction.getID()) ) {
-	    LOGGER.warn("addTool(.) ignored because ID already used for tool or action: "+buttonAction.getID());
-	    return;
-	  }
-	  JToggleButton button = new JToggleButton(buttonAction);
-	  button.setBorder( BorderFactory.createRaisedBevelBorder() );
-	  toolButtonGroup.add(button);
-	  toolAndActionButtons.put(buttonAction.getID(), button);
-	  if ( resetToolBar )
-	    initToolBar();
+		if (isButtonIDUsed(buttonAction.getID())) {
+			LOGGER
+					.warn("addTool(.) ignored because ID already used for tool or action: "
+							+ buttonAction.getID());
+			return;
+		}
+		JToggleButton button = new JToggleButton(buttonAction);
+		button.setBorder(BorderFactory.createRaisedBevelBorder());
+		toolButtonGroup.add(button);
+		toolAndActionButtons.put(buttonAction.getID(), button);
+		if (resetToolBar)
+			initToolBar();
 	}
 
-    /**
-     * Adds a tool to the tool bar and resets the toolbar GUI.
-     * @param buttonAction action for the toggle button
-     */
-    public void addTool(MapPaneToolBarAction buttonAction) {
-      addTool(buttonAction, true);
-    }
+	/**
+	 * Adds a tool to the tool bar and resets the toolbar GUI.
+	 * 
+	 * @param buttonAction
+	 *            action for the toggle button
+	 */
+	public void addTool(MapPaneToolBarAction buttonAction) {
+		addTool(buttonAction, true);
+	}
 
-    /**
-     * Adds an action to the tool bar. Does nothing if a tool or action with the
-     * specified ID already exists!
-     * @param buttonAction action for the button
-     * @param resetToolBar indicates whether the toolbar GUI is reset after adding
-     *                     the button (if adding several actions it useful only to
-     *                     reset the GUI for the last added tool) 
-     */
-    public void addAction(MapPaneToolBarAction buttonAction, boolean resetToolBar) {
-      if ( isButtonIDUsed(buttonAction.getID()) ) {
-        LOGGER.warn("addAction(.) ignored because ID already used for tool or action: "+buttonAction.getID());
-        return;
-      }
-      JButton button = new JButton(buttonAction);
-      button.setBorder( BorderFactory.createRaisedBevelBorder() );
-      toolAndActionButtons.put( buttonAction.getID(), button );
-      if ( resetToolBar )
-        initToolBar();
-    }
-    
+	/**
+	 * Adds an action to the tool bar. Does nothing if a tool or action with the
+	 * specified ID already exists!
+	 * 
+	 * @param buttonAction
+	 *            action for the button
+	 * @param resetToolBar
+	 *            indicates whether the toolbar GUI is reset after adding the
+	 *            button (if adding several actions it useful only to reset the
+	 *            GUI for the last added tool)
+	 */
+	public void addAction(MapPaneToolBarAction buttonAction,
+			boolean resetToolBar) {
+		if (isButtonIDUsed(buttonAction.getID())) {
+			LOGGER
+					.warn("addAction(.) ignored because ID already used for tool or action: "
+							+ buttonAction.getID());
+			return;
+		}
+		JButton button = new JButton(buttonAction);
+		button.setBorder(BorderFactory.createRaisedBevelBorder());
+		toolAndActionButtons.put(buttonAction.getID(), button);
+		if (resetToolBar)
+			initToolBar();
+	}
 
-    private void addSeparator(int id, Separator separator) {
-        if ( isButtonIDUsed(id) ) {
-            LOGGER.warn("addSeparator(.) ignored because ID already used for tool or action. ");
-            return;
-          }
-          toolAndActionButtons.put( id, separator);
+	public void addSeparator(int id, Separator separator) {
+		if (isButtonIDUsed(id)) {
+			LOGGER
+					.warn("addSeparator(.) ignored because ID already used for tool or action. ");
+			return;
+		}
+		toolAndActionButtons.put(id, separator);
 	}
 
-    /**
-     * Adds an action to the tool bar and resets the toolbar GUI.
-     * @param buttonAction action for the toggle button
-     */
-    public void addAction(MapPaneToolBarAction buttonAction) {
-      addAction(buttonAction, true);
-    }
-    
-    /**
-     * Returns the button for a specific tool or action.
-     * @param id the constant for any button in the {@link MapPaneToolBar}
-     * @return a {@link JButton} if {@code id} specifies an {@linkplain #getActionButton(int) action button}
-     *         or {@link JToogleButton} if {@code id} specifies a {@linkplain #getToolButton(int) tool button}
-     */
-    public AbstractButton getButton(int id) {
-      AbstractButton button = (AbstractButton)toolAndActionButtons.get(id);
-      if ( button == null )
-        LOGGER.warn("Unknown tool or action ID: "+id);
-      return button;
-    }
+	/**
+	 * Adds an action to the tool bar and resets the toolbar GUI.
+	 * 
+	 * @param buttonAction
+	 *            action for the toggle button
+	 */
+	public void addAction(MapPaneToolBarAction buttonAction) {
+		addAction(buttonAction, true);
+	}
 
-    /**
-     * Returns the button for a specific tool.
-     * @param tool the constant for a tool
-     */
+	/**
+	 * Returns the button for a specific tool or action.
+	 * 
+	 * @param id
+	 *            the constant for any button in the {@link MapPaneToolBar}
+	 * @return a {@link JButton} if {@code id} specifies an
+	 *         {@linkplain #getActionButton(int) action button} or
+	 *         {@link JToogleButton} if {@code id} specifies a
+	 *         {@linkplain #getToolButton(int) tool button}
+	 */
+	public AbstractButton getButton(int id) {
+		AbstractButton button = (AbstractButton) toolAndActionButtons.get(id);
+		if (button == null)
+			LOGGER.warn("Unknown tool or action ID: " + id);
+		return button;
+	}
+
+	/**
+	 * Returns the button for a specific tool.
+	 * 
+	 * @param tool
+	 *            the constant for a tool
+	 */
 	public JToggleButton getToolButton(int tool) {
-      AbstractButton button = getButton(tool);
-      if ( button != null && !(button instanceof JToggleButton) ) {
-        LOGGER.warn("ID specifies no tool: "+tool);
-        button = null;
-      }
-      return (JToggleButton)button; 
-    }
+		AbstractButton button = getButton(tool);
+		if (button != null && !(button instanceof JToggleButton)) {
+			LOGGER.warn("ID specifies no tool: " + tool);
+			button = null;
+		}
+		return (JToggleButton) button;
+	}
 
-    /**
-     * Returns the button for a specific action.
-     * @param action the constant an action 
-     */
-    public JButton getActionButton(int action) {
-      AbstractButton button = getButton(action);
-      if ( button != null && !(button instanceof JButton) ) {
-        LOGGER.warn("ID specifies no action: "+action);
-        button = null;
-      }
-      return (JButton)button; 
+	/**
+	 * Returns the button for a specific action.
+	 * 
+	 * @param action
+	 *            the constant an action
+	 */
+	public JButton getActionButton(int action) {
+		AbstractButton button = getButton(action);
+		if (button != null && !(button instanceof JButton)) {
+			LOGGER.warn("ID specifies no action: " + action);
+			button = null;
+		}
+		return (JButton) button;
 
-    }
+	}
 
 	/**
 	 * Sets the selected tool.
-	 * @param tool ID of the tool
+	 * 
+	 * @param tool
+	 *            ID of the tool
 	 */
 	public void setSelectedTool(Integer tool) {
-	  if ( tool == null )
-	    toolButtonGroup.setUnselected();
-	  
-	  JToggleButton button = getToolButton(tool);
-	  if ( button == null )
-	    return;
-	  button.setSelected( true );
-	  button.getAction().actionPerformed(null);
+		if (tool == null)
+			toolButtonGroup.setUnselected();
+
+		JToggleButton button = getToolButton(tool);
+		if (button == null)
+			return;
+		button.setSelected(true);
+		button.getAction().actionPerformed(null);
 	}
-	
+
 	/**
 	 * Returns the selected tool.
+	 * 
 	 * @return -1 if no tool is active
 	 */
 	public int getSelectedTool() {
-	  if ( toolButtonGroup.getSelectedButton() == null )
-	    return -1;
-	  return selectedTool;
+		if (toolButtonGroup.getSelectedButton() == null)
+			return -1;
+		return selectedTool;
 	}
-	
-    /**
-     * Sets whether a tool or action is activated or not. The visible property
-     * of the button is not affected.
-     * @param id tool or actionID
-     * @param enabled if {@code true} the tool becomes available
-     */
-    public void setButtonEnabled(int id, boolean enabled) {
-      AbstractButton button = getButton(id);
-      if ( button == null )
-        return;
-      button.setEnabled( enabled );
-    }
 
-    /**
-     * Sets whether a tool or action is activated or not.
-     * @param id tool or actionID
-     * @param enabled if {@code true} the tool becomes available
-     * @param hideOnDisable if {@code true} the button is also hidden if
-     *                      {@code enabled} is {@code false}
-     */
+	/**
+	 * Sets whether a tool or action is activated or not. The visible property
+	 * of the button is not affected.
+	 * 
+	 * @param id
+	 *            tool or actionID
+	 * @param enabled
+	 *            if {@code true} the tool becomes available
+	 */
+	public void setButtonEnabled(int id, boolean enabled) {
+		AbstractButton button = getButton(id);
+		if (button == null)
+			return;
+		button.setEnabled(enabled);
+	}
+
+	/**
+	 * Sets whether a tool or action is activated or not.
+	 * 
+	 * @param id
+	 *            tool or actionID
+	 * @param enabled
+	 *            if {@code true} the tool becomes available
+	 * @param hideOnDisable
+	 *            if {@code true} the button is also hidden if {@code enabled}
+	 *            is {@code false}
+	 */
 	public void setButtonEnabled(int id, boolean enabled, boolean hideOnDisable) {
-	  AbstractButton button = getButton(id);
-	  if ( button == null )
-	    return;
-	  button.setEnabled( enabled );
-	  // if button is enabled, it becomes visible anyway
-	  // if button is disabled and the "hide" option is set, it is also hidden 
-	  if ( enabled )
-	    button.setVisible( true );
-	  else
-	    button.setVisible( !hideOnDisable );
+		AbstractButton button = getButton(id);
+		if (button == null)
+			return;
+		button.setEnabled(enabled);
+		// if button is enabled, it becomes visible anyway
+		// if button is disabled and the "hide" option is set, it is also hidden
+		if (enabled)
+			button.setVisible(true);
+		else
+			button.setVisible(!hideOnDisable);
 	}
 
-    /**
-     * Checks whether a ID is already used for a tool or action.
-     * @param tool tool ID
-     */
-    public boolean isButtonIDUsed(int id) {
-      return toolAndActionButtons.get(id) != null;
-    }
+	/**
+	 * Checks whether a ID is already used for a tool or action.
+	 * 
+	 * @param tool
+	 *            tool ID
+	 */
+	public boolean isButtonIDUsed(int id) {
+		return toolAndActionButtons.get(id) != null;
+	}
 
-    /**
-     * Checks whether a tool is activated.
-     * @param tool tool ID
-     * @return {@code false} if an unknown ID is specified
-     */
-    public boolean isButtonEnabled(int id) {
-      AbstractButton button = getButton(id);
-      if ( button != null )
-        return button.isEnabled();
-      return false;
-    }
+	/**
+	 * Checks whether a tool is activated.
+	 * 
+	 * @param tool
+	 *            tool ID
+	 * @return {@code false} if an unknown ID is specified
+	 */
+	public boolean isButtonEnabled(int id) {
+		AbstractButton button = getButton(id);
+		if (button != null)
+			return button.isEnabled();
+		return false;
+	}
 
-    /**
-     * Sets the activation for all tools.
-     * @param enabled if {@code true} all tools becomes available
-     * @param hideOnDisable if {@code true} the buttons are also hidden if
-     *                      {@code enabled} is {@code false}
-     */
-    public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
-      for (int tool : toolAndActionButtons.keySet())
-        setButtonEnabled(tool,enabled,hideOnDisable);
-    }	
+	/**
+	 * Sets the activation for all tools.
+	 * 
+	 * @param enabled
+	 *            if {@code true} all tools becomes available
+	 * @param hideOnDisable
+	 *            if {@code true} the buttons are also hidden if {@code enabled}
+	 *            is {@code false}
+	 */
+	public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
+		for (int tool : toolAndActionButtons.keySet())
+			setButtonEnabled(tool, enabled, hideOnDisable);
+	}
 
-    /**
-     * Sets the activation for all actions.
-     * @param enabled if {@code true} all actions becomes available
-     * @param hideOnDisable if {@code true} the buttons are also hidden if
-     *                      {@code enabled} is {@code false}
-     */
-    public void setAllActionsEnabled(boolean enabled, boolean hideOnDisable) {
-      for (int id : toolAndActionButtons.keySet()){
-    	  if (toolAndActionButtons.get(id) instanceof JButton){
-    		  setButtonEnabled(id,enabled,hideOnDisable);
-    	  }
-      }
-    	 
-    }   
-    
-    /**
-     * Returns the maximum ID of tools. 
-     */
-    public int getMaxToolID() {
-      return toolAndActionButtons.lastKey();
-    }
+	/**
+	 * Sets the activation for all actions.
+	 * 
+	 * @param enabled
+	 *            if {@code true} all actions becomes available
+	 * @param hideOnDisable
+	 *            if {@code true} the buttons are also hidden if {@code enabled}
+	 *            is {@code false}
+	 */
+	public void setAllActionsEnabled(boolean enabled, boolean hideOnDisable) {
+		for (int id : toolAndActionButtons.keySet()) {
+			if (toolAndActionButtons.get(id) instanceof JButton) {
+				setButtonEnabled(id, enabled, hideOnDisable);
+			}
+		}
 
-    /**
-     * Returns the minimum ID of tools. 
-     */
-    public int getMinToolID() {
-      return toolAndActionButtons.firstKey();
-    }
+	}
 
-    /**
-     * Extends the {@link AbstractAction} with maintaining an ID and
-     * the {@link MapPaneToolBar} the actions controls.
-     * Additionally this class automatically calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)}
-     * or {@link MapPaneToolBar#performActionButton(int, ActionEvent)}
-     * depending on whether the action is added via {@link MapPaneToolBar#addTool(MapPaneToolBarAction)}
-     * or {@link MapPaneToolBar#addAction(MapPaneToolBarAction)}.
-     * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
-     */
-    public static class MapPaneToolBarAction extends AbstractAction {
-      /** The ID of the action */
-      protected int id = -1;
-      /** The tool bar, this action is made for. */
-      protected MapPaneToolBar toolBar = null;
+	/**
+	 * Returns the maximum ID of tools.
+	 */
+	public int getMaxToolID() {
+		return toolAndActionButtons.lastKey();
+	}
 
-      /**
-       * Creates a new action with a dummy description and no icon.
-       * @param id      unique ID for the action
-       * @param toolBar toolbar this action is made for
-       */
-      public MapPaneToolBarAction(int id, MapPaneToolBar toolBar) {
-        this(id,toolBar,""+id);
-      }
+	/**
+	 * Returns the minimum ID of tools.
+	 */
+	public int getMinToolID() {
+		return toolAndActionButtons.firstKey();
+	}
 
-      /**
-       * Creates a new action without an icon.
-       * @param id      unique ID for the action
-       * @param toolBar toolbar this action is made for
-       * @param name    description used for buttons or menus 
-       */
-      public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, String name) {
-        this(id,toolBar,name,null);
-      }
+	/**
+	 * Extends the {@link AbstractAction} with maintaining an ID and the
+	 * {@link MapPaneToolBar} the actions controls. Additionally this class
+	 * automatically calls
+	 * {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or
+	 * {@link MapPaneToolBar#performActionButton(int, ActionEvent)} depending on
+	 * whether the action is added via
+	 * {@link MapPaneToolBar#addTool(MapPaneToolBarAction)} or
+	 * {@link MapPaneToolBar#addAction(MapPaneToolBarAction)}.
+	 * 
+	 * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+	 *         (University of Bonn/Germany)
+	 */
+	public static class MapPaneToolBarAction extends AbstractAction {
+		/** The ID of the action */
+		protected int id = -1;
+		/** The tool bar, this action is made for. */
+		protected MapPaneToolBar toolBar = null;
 
-      /**
-       * Creates a new action.
-       * @param id      unique ID for the action
-       * @param toolBar toolbar this action is made for
-       * @param name    description used for buttons or menus 
-       * @param icon    icon used for buttons or menus 
-       */
-      public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, String name, Icon icon) {
-        super(name,icon);
-        this.id      = id;
-        this.toolBar = toolBar;
-      }
-      
-      /**
-       * Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)}
-       * or {@link MapPaneToolBar#performActionButton(int, ActionEvent)}
-       * depending on whether the action is added to the toolbar via
-       * {@link MapPaneToolBar#addTool(MapPaneToolBarAction)}
-       * or {@link MapPaneToolBar#addAction(MapPaneToolBarAction)}.
-       */
-      public void actionPerformed(ActionEvent e) {
-        if ( toolBar.toolAndActionButtons.get(id) instanceof JToggleButton)
-          toolBar.performToolButton(id, e);
-        else if ( toolBar.toolAndActionButtons.get(id) instanceof JButton )
-          toolBar.performActionButton(id, e);
-      }
-      
-      /**
-       * Returns the (unique) id of this action.
-       * @return
-       */
-      public int getID() {
-        return id;
-      }
-    }
+		/**
+		 * Creates a new action with a dummy description and no icon.
+		 * 
+		 * @param id
+		 *            unique ID for the action
+		 * @param toolBar
+		 *            toolbar this action is made for
+		 */
+		public MapPaneToolBarAction(int id, MapPaneToolBar toolBar) {
+			this(id, toolBar, "" + id);
+		}
+
+		/**
+		 * Creates a new action without an icon.
+		 * 
+		 * @param id
+		 *            unique ID for the action
+		 * @param toolBar
+		 *            toolbar this action is made for
+		 * @param name
+		 *            description used for buttons or menus
+		 */
+		public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, String name) {
+			this(id, toolBar, name, null);
+		}
+
+		/**
+		 * Creates a new action.
+		 * 
+		 * @param id
+		 *            unique ID for the action
+		 * @param toolBar
+		 *            toolbar this action is made for
+		 * @param name
+		 *            description used for buttons or menus
+		 * @param icon
+		 *            icon used for buttons or menus
+		 */
+		public MapPaneToolBarAction(int id, MapPaneToolBar toolBar,
+				String name, Icon icon) {
+			super(name, icon);
+			this.id = id;
+			this.toolBar = toolBar;
+		}
+
+		/**
+		 * Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or
+		 * {@link MapPaneToolBar#performActionButton(int, ActionEvent)}
+		 * depending on whether the action is added to the toolbar via
+		 * {@link MapPaneToolBar#addTool(MapPaneToolBarAction)} or
+		 * {@link MapPaneToolBar#addAction(MapPaneToolBarAction)}.
+		 */
+		public void actionPerformed(ActionEvent e) {
+			if (toolBar.toolAndActionButtons.get(id) instanceof JToggleButton)
+				toolBar.performToolButton(id, e);
+			else if (toolBar.toolAndActionButtons.get(id) instanceof JButton)
+				toolBar.performActionButton(id, e);
+		}
+
+		/**
+		 * Returns the (unique) id of this action.
+		 * 
+		 * @return
+		 */
+		public int getID() {
+			return id;
+		}
+	}
 }

Modified: trunk/src/skrueger/geotools/labelsearch/labelsearch.properties
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/labelsearch.properties	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/skrueger/geotools/labelsearch/labelsearch.properties	2009-06-14 17:24:44 UTC (rev 140)
@@ -1,6 +1,6 @@
-SearSearchMapDialog.Results.Column.Layer=found in
+SearchMapDialog.Results.Column.Layer=found in
 SearchMapDialog.Results.Column.Name=name
 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 map: ${0}
\ No newline at end of file
+SearchMapDialog.title=Search labels in map\: ${0}
\ No newline at end of file

Modified: trunk/src/skrueger/i8n/I8NUtil.java
===================================================================
--- trunk/src/skrueger/i8n/I8NUtil.java	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/skrueger/i8n/I8NUtil.java	2009-06-14 17:24:44 UTC (rev 140)
@@ -44,13 +44,15 @@
 	 */
 	public static Locale getLocaleFor(String code) {
 		for (Locale l : Locale.getAvailableLocales()) {
-			// System.out.println(l.getLanguage()+" not = "+code);
-			if (l.getLanguage().toLowerCase().equals(code.toLowerCase())) {
+			if (l.getLanguage().equals(code.toLowerCase())) {
 				return l;
 			}
+			LOGGER.debug(l.getLanguage() + " not = " + code);
 		}
+
 		LOGGER.error("Can't create a Locale for code " + code
 				+ "! Returning the system default locale to avoid NPEs.");
+
 		return Locale.getDefault();
 	}
 

Modified: trunk/src/skrueger/i8n/SwitchLanguageDialog.java
===================================================================
--- trunk/src/skrueger/i8n/SwitchLanguageDialog.java	2009-06-11 12:52:58 UTC (rev 139)
+++ trunk/src/skrueger/i8n/SwitchLanguageDialog.java	2009-06-14 17:24:44 UTC (rev 140)
@@ -25,6 +25,12 @@
 import skrueger.swing.OkButton;
 import skrueger.swing.TranslationEditJPanel;
 
+/**
+ * This dialog ask the user to select one of list of given languages. The dialog
+ * is modal and not visible after construction.
+ * 
+ * @author Stefan A. Krueger
+ */
 public class SwitchLanguageDialog extends JDialog {
 	protected Logger LOGGER = Logger.getLogger(SwitchLanguageDialog.class);
 
@@ -54,8 +60,10 @@
 	 * @param owner
 	 * @param atlasConfig
 	 */
-	public SwitchLanguageDialog(final Component owner, final List<String> languages) {
-		super(owner instanceof Window ? (Window)owner : SwingUtil.getParentWindow(owner));
+	public SwitchLanguageDialog(final Component owner,
+			final List<String> languages) {
+		super(owner instanceof Window ? (Window) owner : SwingUtil
+				.getParentWindow(owner));
 		this.languages = languages;
 
 		Translation.setActiveLang(languages.get(0));
@@ -67,8 +75,6 @@
 		}
 
 		initialize();
-
-		setVisible(true);
 	}
 
 	/**
@@ -80,6 +86,9 @@
 		this.setContentPane(getJContentPane());
 		setModal(true);
 		SwingUtil.centerFrameOnScreenRandom(this);
+		
+		setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE);
+		
 		pack();
 	}
 
@@ -176,7 +185,7 @@
 			gridBagConstraints.insets = new Insets(0, 5, 0, 0);
 			gridBagConstraints.gridy = 0;
 			jLabel = new JLabel();
-			jLabel.setText("Select language: ");
+			jLabel.setText("Select language: "); //i8n!?! Maybe replace with an icon of an index finger
 			jPanel1 = new JPanel();
 			jPanel1.setLayout(new GridBagLayout());
 			jPanel1.add(jLabel, gridBagConstraints);
@@ -231,9 +240,18 @@
 						getJButton().setEnabled(false);
 						return;
 					}
-					Translation.setActiveLang(languages.get(jComboBox
-							.getSelectedIndex()));
-					getJButton().setEnabled(true);
+					
+					String l = languages.get(jComboBox
+							.getSelectedIndex());
+					try {
+						Translation.setActiveLang(l);
+						
+						getJButton().setEnabled(true);
+					} catch (java.lang.IllegalArgumentException ee) {
+						LOGGER.warn("The language "+l+" is not valid",ee);
+						getJButton().setEnabled(false);
+					}
+					
 				}
 
 			});



More information about the Schmitzm-commits mailing list