Changeset 4189 in josm
- Timestamp:
- 2011-07-01T09:31:07+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r3767 r4189 13 13 import java.beans.PropertyChangeEvent; 14 14 import java.beans.PropertyChangeListener; 15 import java.util.logging.Logger;16 15 17 16 import javax.swing.AbstractAction; … … 32 31 import org.openstreetmap.josm.gui.help.HelpUtil; 33 32 import org.openstreetmap.josm.tools.ImageProvider; 33 import org.openstreetmap.josm.tools.WindowGeometry; 34 34 35 35 /** … … 38 38 */ 39 39 public class ConflictResolutionDialog extends JDialog implements PropertyChangeListener { 40 private static final Logger logger = Logger.getLogger(ConflictResolutionDialog.class.getName());41 public final static Dimension DEFAULT_SIZE = new Dimension(600,400);42 43 40 /** the conflict resolver component */ 44 41 private ConflictResolver resolver; 45 42 46 43 private ApplyResolutionAction applyResolutionAction; 47 48 /**49 * restore position and size on screen from preference settings50 *51 */52 protected void restorePositionAndDimension() {53 Point p = new Point();54 Dimension d = new Dimension();55 try {56 p.x = Integer.parseInt(Main.pref.get("conflictresolutiondialog.x", "0"));57 p.x = Math.max(0,p.x);58 } catch(Exception e) {59 logger.warning("unexpected value for preference conflictresolutiondialog.x, assuming 0");60 p.x = 0;61 }62 try {63 p.y = Integer.parseInt(Main.pref.get("conflictresolutiondialog.y", "0"));64 p.y = Math.max(0,p.y);65 } catch(Exception e) {66 logger.warning("unexpected value for preference conflictresolutiondialog.x, assuming 0");67 p.y = 0;68 }69 try {70 d.width = Integer.parseInt(Main.pref.get("conflictresolutiondialog.width", Integer.toString(DEFAULT_SIZE.width)));71 d.width = Math.max(0,d.width);72 } catch(Exception e) {73 logger.warning("unexpected value for preference conflictresolutiondialog.width, assuming " + DEFAULT_SIZE.width);74 p.y = 0;75 }76 try {77 d.height = Integer.parseInt(Main.pref.get("conflictresolutiondialog.height", Integer.toString(DEFAULT_SIZE.height)));78 d.height = Math.max(0,d.height);79 } catch(Exception e) {80 logger.warning("unexpected value for preference conflictresolutiondialog.height, assuming " + + DEFAULT_SIZE.height);81 p.y = 0;82 }83 84 setLocation(p);85 setSize(d);86 }87 88 /**89 * remember position and size on screen in the preferences90 *91 */92 protected void rememberPositionAndDimension() {93 Point p = getLocation();94 Main.pref.put("conflictresolutiondialog.x", Integer.toString(p.x));95 Main.pref.put("conflictresolutiondialog.y", Integer.toString(p.y));96 97 Dimension d = getSize();98 Main.pref.put("conflictresolutiondialog.width", Integer.toString(d.width));99 Main.pref.put("conflictresolutiondialog.height", Integer.toString(d.height));100 }101 44 102 45 @Override … … 108 51 @Override 109 52 public void setVisible(boolean isVisible) { 53 String geom = getClass().getName() + ".geometry"; 110 54 if (isVisible){ 111 restorePositionAndDimension();112 55 toFront(); 56 new WindowGeometry(geom, WindowGeometry.centerInWindow(Main.parent, 57 new Dimension(600, 400))).applySafe(this); 113 58 } else { 114 rememberPositionAndDimension();59 new WindowGeometry(this).remember(geom); 115 60 unregisterListeners(); 116 61 }
Note:
See TracChangeset
for help on using the changeset viewer.