- Timestamp:
- 2011-02-01T08:28:03+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r3720 r3839 7 7 import java.io.IOException; 8 8 import java.util.ArrayList; 9 import java.util.Arrays;10 9 import java.util.Date; 11 10 import java.util.Deque; … … 274 273 moveToDeletedLayersFolder(f); 275 274 } 276 } 275 } 277 276 }); 278 277 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r3796 r3839 11 11 import java.awt.Image; 12 12 import java.awt.Insets; 13 import java.awt.Color;14 13 import java.awt.event.ActionEvent; 15 14 import java.io.BufferedReader; … … 182 181 } 183 182 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 183 protected static class PresetListEntry { 184 String value; 185 String display_value; 186 String short_description; 187 188 public String getListDisplay() { 189 if (value.equals(DIFFERENT)) 190 return "<b>"+DIFFERENT.replaceAll("<", "<").replaceAll(">", ">")+"</b>"; 191 192 if (value.equals("")) 193 return " "; 194 195 StringBuilder res = new StringBuilder("<b>"); 196 if (display_value != null) { 197 res.append(display_value); 198 } else { 199 res.append(value); 200 } 201 res.append("</b>"); 202 if (short_description != null) { 203 // wrap in table to restrict the text width 204 res.append("<br><table><td width='232'>(").append(short_description).append(")</td></table>"); 205 } 206 return res.toString(); 207 } 208 209 public PresetListEntry(String value) { 210 this.value = value; 211 this.display_value = value; 212 } 213 214 public PresetListEntry(String value, String display_value) { 215 this.value = value; 216 this.display_value = display_value; 217 } 218 219 // toString is mainly used to initialize the Editor 220 @Override 221 public String toString() { 222 if (value.equals(DIFFERENT)) 223 return DIFFERENT; 224 return display_value.replaceAll("<.*>", ""); // remove additional markup, e.g. <br> 225 } 226 } 228 227 229 228 public static class Text extends Item { … … 460 459 PresetListEntry e = new PresetListEntry(value_array[i]); 461 460 e.display_value = (locale_display_values == null) 462 463 461 ? (values_context == null ? tr(display_array[i]) 462 : trc(values_context, display_array[i])) : display_array[i]; 464 463 if (short_descriptions_array != null) { 465 464 e.short_description = locale_short_descriptions == null ? tr(short_descriptions_array[i]) … … 633 632 int j = 0; 634 633 for (int i = 0; i < lm.getSize(); i++) { 635 if (parts.contains((((PresetListEntry)lm.getElementAt(i)).value))) 634 if (parts.contains((((PresetListEntry)lm.getElementAt(i)).value))) { 636 635 intParts[j++]=i; 636 } 637 637 } 638 638 setSelectedIndices(Arrays.copyOf(intParts, j)); 639 // check if we have acutally managed to represent the full 639 // check if we have acutally managed to represent the full 640 640 // value with our presets. if not, cop out; we will not offer 641 641 // a selection list that threatens to ruin the value. … … 647 647 int[] si = getSelectedIndices(); 648 648 StringBuilder builder = new StringBuilder(); 649 for (int i=0; i<si.length; i++) { 650 if (i>0) builder.append(delimiter); 649 for (int i=0; i<si.length; i++) { 650 if (i>0) { 651 builder.append(delimiter); 652 } 651 653 builder.append(((PresetListEntry)lm.getElementAt(si[i])).value); 652 654 } … … 726 728 PresetListEntry e = new PresetListEntry(value_array[i]); 727 729 e.display_value = (locale_display_values == null) 728 729 730 ? (values_context == null ? tr(display_array[i]) 731 : trc(values_context, display_array[i])) : display_array[i]; 730 732 if (short_descriptions_array != null) { 731 733 e.short_description = locale_short_descriptions == null ? tr(short_descriptions_array[i]) -
trunk/src/org/openstreetmap/josm/tools/PresetTextComparator.java
r3719 r3839 7 7 import javax.swing.JMenuItem; 8 8 9 import org.openstreetmap.josm.Main; 10 9 11 public class PresetTextComparator implements Comparator<JMenuItem>, Serializable { 10 //TODO add error checking and stuff11 12 public int compare(JMenuItem arg0, JMenuItem arg1) { 12 return arg0.getText().compareTo(arg1.getText()); 13 if (Main.main.menu.presetSearchAction.equals(arg0.getAction())) 14 return -1; 15 else if (Main.main.menu.presetSearchAction.equals(arg0.getAction())) 16 return 1; 17 else if (arg0.getText() == arg1.getText()) 18 return 0; 19 else if (arg0.getText() == null) 20 return -1; 21 else if (arg1.getText() == null) 22 return 1; 23 else 24 return arg0.getText().compareTo(arg1.getText()); 13 25 } 14 26
Note:
See TracChangeset
for help on using the changeset viewer.