[Schmitzm-commits] r116 - in trunk/src: schmitzm/geotools/gui skrueger/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 13 19:37:12 CEST 2009


Author: alfonx
Date: 2009-05-13 19:37:11 +0200 (Wed, 13 May 2009)
New Revision: 116

Modified:
   trunk/src/schmitzm/geotools/gui/JMapPane.java
   trunk/src/skrueger/swing/TranslationAskJDialog.java
Log:
* JMapPane: cleanup, no semantic change
* TranslationAskJDialog now takes Component instead of Window for owner in the constructor

Modified: trunk/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-05-13 15:17:13 UTC (rev 115)
+++ trunk/src/schmitzm/geotools/gui/JMapPane.java	2009-05-13 17:37:11 UTC (rev 116)
@@ -272,7 +272,6 @@
 	};
 
 	private static final FilterFactoryImpl ff = FilterUtil.FILTER_FAC;
-	private static final FilterFactory2 ff2 = FilterUtil.FILTER_FAC2;
 	private static final GeometryFactory gf = FilterUtil.GEOMETRY_FAC;
 
 	/**
@@ -887,45 +886,6 @@
 		if (ox == px || oy == py)
 			return;
 
-		////********************************************************************
-		// ********
-		// // SK: Wenn der ausgewaehlte Bereich kleiner als 12x12 pixel ist,
-		// dann war es wohl ein Irrtum ("Verklickt")
-		// // und wird ignoriert. Zu starkes Zoomen (z.B. auf 2x2 pixel) kostet
-		// sehr viel Rechenzeit.
-		////********************************************************************
-		// ********
-		// if ( (Math.abs(ox-px)>12) && (Math.abs(oy-py)>12) ){
-		//
-		////********************************************************************
-		// ********
-		// // Changed by SK:
-		// // performing the zoom and/or pan by recalculating the mapArea
-		// // important and new here: don't zoom in/out more that the min/max
-		// scale!
-		// // n.b.: zoom is not only performed here, but also and with the mouse
-		// wheel and setMapArea
-		////********************************************************************
-		// ********
-		// Coordinate centre = getMapArea().centre();
-		// double zlevel = 2.6;
-		//
-		// Coordinate ll = new Coordinate(centre.x - (getMapArea().getWidth() /
-		// zlevel), centre.y
-		// - (getMapArea().getHeight() / zlevel));
-		// Coordinate ur = new Coordinate(centre.x + (getMapArea().getWidth() /
-		// zlevel), centre.y
-		// + (getMapArea().getHeight() / zlevel));
-		//
-		// final Envelope newMapArea = new Envelope(ll, ur);
-		//
-		// // Hier passiert die Ueberpruefung und ggf Anpassung der Scale
-		// setMapArea( bestAllowedMapArea( newMapArea ));
-		//
-		// repaint();
-		// return;
-		// }
-
 		// Fenster-Koordinaten in Map-Koordinaten umwandeln
 		Envelope env = tranformWindowToGeo(ox, oy, px, py);
 

Modified: trunk/src/skrueger/swing/TranslationAskJDialog.java
===================================================================
--- trunk/src/skrueger/swing/TranslationAskJDialog.java	2009-05-13 15:17:13 UTC (rev 115)
+++ trunk/src/skrueger/swing/TranslationAskJDialog.java	2009-05-13 17:37:11 UTC (rev 116)
@@ -82,10 +82,16 @@
 	 * This class handles the cancel button itself. You may still want to listen
 	 * to PROPERTY_APPLY_AND_CLOSE events. This dialog is modal. The dialog has
 	 * to be set visible afterwards.<br/>
+	 * 
+	 * @param owner
+	 *            A component of the GUI that this dialog is related to. If no
+	 *            {@link Window} is passed, SwingUtil.getParentWindow(owner) is
+	 *            called.
 	 */
-	public TranslationAskJDialog(Window owner,
+	public TranslationAskJDialog(Component owner,
 			final JComponent... translationEditJPanels) {
-		super(owner);
+		super(owner instanceof Window ? (Window) owner : SwingUtil
+				.getParentWindow(owner));
 		setComponents(translationEditJPanels);
 	}
 
@@ -101,7 +107,7 @@
 	 * Using this constructor, you have to call setComponents afterwards.
 	 */
 	public TranslationAskJDialog(Window owner) {
-		super(owner);
+		this(owner, new JComponent[] {});
 	}
 
 	/**
@@ -199,9 +205,10 @@
 				public void actionPerformed(ActionEvent evt) {
 					TranslationAskJDialog.this.firePropertyChange(
 							PROPERTY_APPLY_AND_CLOSE, null, null);
-					
-					if (!checkValidInputs()) return;
-					
+
+					if (!checkValidInputs())
+						return;
+
 					setVisible(false);
 					dispose();
 				}
@@ -229,25 +236,29 @@
 	}
 
 	/**
-	 * @return <code>true</code> if none of the translations contains illegal characters.
+	 * @return <code>true</code> if none of the translations contains illegal
+	 *         characters.
 	 */
 	protected boolean checkValidInputs() {
-		
+
 		for (JComponent component : translationEditJPanelsOrJustComponents) {
 			if (component instanceof TranslationEditJPanel) {
 				TranslationEditJPanel tep = (TranslationEditJPanel) component;
-				
-				for (String l : tep.getTranslation().values()){
-					if ( l.contains("{") || l.contains("}")) {
-						JOptionPane.showMessageDialog(this, RESOURCE.getString("ErrorMsg.InvalidCharacterInTranslation"));
+
+				for (String l : tep.getTranslation().values()) {
+					if (l.contains("{") || l.contains("}")) {
+						JOptionPane
+								.showMessageDialog(
+										this,
+										RESOURCE
+												.getString("ErrorMsg.InvalidCharacterInTranslation"));
 						return false;
 					}
 				}
-				
+
 			}
 		}
-		
-		
+
 		return true;
 	}
 



More information about the Schmitzm-commits mailing list