Ticket #2211: MakeRelEditorWorkAgain.patch
File MakeRelEditorWorkAgain.patch, 4.4 KB (added by , 16 years ago) |
---|
-
src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
9 9 import java.awt.event.ActionEvent; 10 10 import java.awt.event.ActionListener; 11 11 import java.awt.event.KeyEvent; 12 import java.awt.event.WindowEvent; 13 import java.awt.event.WindowListener; 12 14 import java.io.IOException; 13 15 import java.text.Collator; 14 16 import java.util.ArrayList; … … 18 20 import java.util.Comparator; 19 21 import java.util.Map.Entry; 20 22 23 import javax.swing.AbstractAction; 24 import javax.swing.Action; 21 25 import javax.swing.JLabel; 22 26 import javax.swing.JOptionPane; 23 27 import javax.swing.JPanel; … … 25 29 import javax.swing.JTabbedPane; 26 30 import javax.swing.JTable; 27 31 import javax.swing.ListSelectionModel; 32 import javax.swing.WindowConstants; 28 33 import javax.swing.event.ListSelectionEvent; 29 34 import javax.swing.event.ListSelectionListener; 30 35 import javax.swing.event.TableModelEvent; … … 174 179 // =================== FIXME FIXME FIXME ===================== 175 180 // ... until here, and also get rid of the "Collections.sort..." below. 176 181 182 // We need this twice, so cache result 183 protected final static String applyChangesText = tr("Apply Changes"); 184 177 185 /** 178 186 * Creates a new relation editor for the given relation. The relation 179 187 * will be saved if the user selects "ok" in the editor. … … 205 213 ? tr ("Edit new relation") 206 214 : tr("Edit relation #{0}", relation.id) 207 215 ), 208 new String[] { tr("Apply Changes"), tr("Cancel")},216 new String[] { applyChangesText, tr("Cancel")}, 209 217 false 210 218 ); 211 219 212 220 this.relation = relation; 213 221 ordered = !Main.pref.get("osm-server.version", "0.5").equals("0.5"); 214 ordered = true; 222 215 223 if (relation == null) { 216 224 // create a new relation 217 225 this.clone = new Relation(); … … 234 242 setSize(findMaxDialogSize()); 235 243 236 244 try { setAlwaysOnTop(true); } catch (SecurityException sx) {} 237 238 245 setVisible(true); 239 240 if(getValue() != 1)241 return;242 243 // User clicked "Apply"244 applyChanges();245 246 } 247 246 248 247 249 /** 248 250 * Basic Editor panel has two blocks: a tag table at the top and a membership list below … … 422 424 DataSet.fireSelectionChanged(Main.ds.getSelected()); 423 425 } 424 426 } 427 428 @Override 429 protected void buttonAction(ActionEvent evt) { 430 String a = evt.getActionCommand(); 431 if(applyChangesText.equals(a)) 432 applyChanges(); 433 434 setVisible(false); 435 } 425 436 426 437 @Override 427 438 protected Dimension findMaxDialogSize() { -
src/org/openstreetmap/josm/gui/ExtendedDialog.java
89 89 for(int i=0; i < bTexts.length; i++) { 90 90 Action action = new AbstractAction(bTexts[i]) { 91 91 public void actionPerformed(ActionEvent evt) { 92 String a = evt.getActionCommand(); 93 for(int i=0; i < bTexts.length; i++) 94 if(bTexts[i].equals(a)) { 95 result = i+1; 96 break; 97 } 98 99 setVisible(false); 92 buttonAction(evt); 100 93 } 101 94 }; 102 95 … … 146 139 } 147 140 148 141 /** 142 * This gets performed whenever a button is clicked or activated 143 * @param evt the button event 144 */ 145 protected void buttonAction(ActionEvent evt) { 146 String a = evt.getActionCommand(); 147 for(int i=0; i < bTexts.length; i++) 148 if(bTexts[i].equals(a)) { 149 result = i+1; 150 break; 151 } 152 153 setVisible(false); 154 } 155 156 /** 149 157 * Tries to find a good value of how large the dialog should be 150 158 * @return Dimension Size of the parent Component or 2/3 of screen size if not available 151 159 */