Changeset 27322 in osm for applications/editors/josm/plugins/FixAddresses/src/org
- Timestamp:
- 2011-12-27T19:47:45+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java
r25373 r27322 15 15 16 16 import static org.openstreetmap.josm.tools.I18n.tr; 17 17 18 import java.util.Collection; 18 19 import java.util.HashMap; 19 20 20 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions; 21 23 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction; 22 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction;23 24 import org.openstreetmap.josm.tools.CheckParameterUtil; 24 25 … … 728 729 AddressSolution s = new AddressSolution( 729 730 tr("Remove all address tags"), 730 new RemoveAddressTagsAction(),731 AddressActions.getRemoveTagsAction(), 731 732 SolutionType.Remove); 732 733 problem.addSolution(s); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java
r25373 r27322 57 57 import org.openstreetmap.josm.plugins.fixAddresses.StringUtils; 58 58 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AbstractAddressEditAction; 59 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction; 60 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AssignAddressToStreetAction; 61 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ConvertAllToRelationAction; 62 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ConvertToRelationAction; 63 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.GuessAddressDataAction; 64 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction; 65 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.SelectAddressesInMapAction; 59 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions; 66 60 import org.openstreetmap.josm.tools.ImageProvider; 67 61 … … 79 73 private JTable streetTable; 80 74 81 /* Actions */82 private AssignAddressToStreetAction resolveAction = new AssignAddressToStreetAction();83 private ApplyAllGuessesAction applyAllGuessesAction = new ApplyAllGuessesAction();84 private GuessAddressDataAction guessAddressAction = new GuessAddressDataAction();85 private SelectAddressesInMapAction selectAddressesInMapAction = new SelectAddressesInMapAction();86 private RemoveAddressTagsAction removeAddressTagsAction = new RemoveAddressTagsAction();87 private ConvertToRelationAction convertToRelationAction = new ConvertToRelationAction();88 private ConvertAllToRelationAction convertAllToRelationAction = new ConvertAllToRelationAction();89 90 75 private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[] { 91 resolveAction,92 guessAddressAction,93 applyAllGuessesAction,94 selectAddressesInMapAction,95 removeAddressTagsAction,96 convertToRelationAction,97 convertAllToRelationAction76 AddressActions.getResolveAction(), 77 AddressActions.getGuessAddressAction(), 78 AddressActions.getApplyGuessesAction(), 79 AddressActions.getSelectAction(), 80 AddressActions.getRemoveTagsAction(), 81 AddressActions.getConvertToRelationAction(), 82 AddressActions.getConvertAllToRelationAction() 98 83 }; 84 99 85 private JLabel streetLabel; 100 86 private JLabel unresolvedAddressesLabel; … … 157 143 unresolvedTable.getSelectionModel().addListSelectionListener(this); 158 144 unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener()); 159 unresolvedTable.addMouseListener( applyAllGuessesAction);145 unresolvedTable.addMouseListener(AddressActions.getApplyGuessesAction()); 160 146 161 147 JTableHeader header = unresolvedTable.getTableHeader(); … … 178 164 try { 179 165 JPanel unresolvedButtons = new JPanel(new GridLayout(2,5, 5, 5)); 180 SideButton assign = new SideButton( resolveAction);166 SideButton assign = new SideButton(AddressActions.getResolveAction()); 181 167 unresolvedButtons.add(assign); 182 168 183 SideButton guess = new SideButton( guessAddressAction);169 SideButton guess = new SideButton(AddressActions.getGuessAddressAction()); 184 170 unresolvedButtons.add(guess); 185 SideButton applyAllGuesses = new SideButton( applyAllGuessesAction);171 SideButton applyAllGuesses = new SideButton(AddressActions.getApplyGuessesAction()); 186 172 unresolvedButtons.add(applyAllGuesses); 187 173 188 SideButton removeAddressTags = new SideButton( removeAddressTagsAction);174 SideButton removeAddressTags = new SideButton(AddressActions.getRemoveTagsAction()); 189 175 unresolvedButtons.add(removeAddressTags); 190 176 191 177 unresolvedButtons.add(new JPanel()); 192 178 193 SideButton selectInMap = new SideButton( selectAddressesInMapAction);179 SideButton selectInMap = new SideButton(AddressActions.getSelectAction()); 194 180 unresolvedButtons.add(selectInMap); 195 181 headerPanel2.setMinimumSize(new Dimension(100, 70)); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/IncompleteAddressesDialog.java
r26509 r27322 21 21 import javax.swing.JScrollPane; 22 22 import javax.swing.JTable; 23 import javax.swing.SwingUtilities; 23 24 import javax.swing.event.ListSelectionEvent; 24 25 import javax.swing.event.ListSelectionListener; … … 29 30 import org.openstreetmap.josm.data.osm.event.DataSetListener; 30 31 import org.openstreetmap.josm.data.osm.event.DatasetEventManager; 32 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; 31 33 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 32 34 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; … … 35 37 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 36 38 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 37 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;38 39 import org.openstreetmap.josm.gui.SideButton; 39 40 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 43 44 import org.openstreetmap.josm.plugins.fixAddresses.OsmUtils; 44 45 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AbstractAddressEditAction; 45 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.ApplyAllGuessesAction; 46 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.GuessAddressDataAction; 47 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.RemoveAddressTagsAction; 48 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.SelectAddressesInMapAction; 46 import org.openstreetmap.josm.plugins.fixAddresses.gui.actions.AddressActions; 49 47 50 48 @SuppressWarnings("serial") … … 54 52 private AddressEditContainer container; 55 53 56 // Create action objects57 private SelectAddressesInMapAction selectAction = new SelectAddressesInMapAction();58 private GuessAddressDataAction guessDataAction = new GuessAddressDataAction();59 private ApplyAllGuessesAction applyGuessesAction = new ApplyAllGuessesAction();60 private RemoveAddressTagsAction removeTagsAction = new RemoveAddressTagsAction();61 54 62 55 // Array containing the available actions 63 56 private AbstractAddressEditAction[] actions = new AbstractAddressEditAction[]{ 64 selectAction,65 guessDataAction,66 applyGuessesAction,67 removeTagsAction57 AddressActions.getSelectAction(), 58 AddressActions.getGuessAddressAction(), 59 AddressActions.getApplyGuessesAction(), 60 AddressActions.getRemoveTagsAction(), 68 61 }; 69 62 … … 215 208 @Override 216 209 public void containerChanged(AddressEditContainer container) { 217 if (container != null && container.getNumberOfIncompleteAddresses() > 0) { 218 setTitle(String.format("%s (%d %s)", FIXED_DIALOG_TITLE, container.getNumberOfIncompleteAddresses(), tr("items"))); 219 } else { 220 setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items"))); 210 if (SwingUtilities.isEventDispatchThread()) { 211 if (container != null && container.getNumberOfIncompleteAddresses() > 0) { 212 setTitle(String.format("%s (%d %s)", FIXED_DIALOG_TITLE, container.getNumberOfIncompleteAddresses(), tr("items"))); 213 } else { 214 setTitle(String.format("%s (%s)", FIXED_DIALOG_TITLE, tr("no items"))); 215 } 221 216 } 222 217 } … … 227 222 @Override 228 223 public void entityChanged(IOSMEntity node) { 229 container.invalidate(); 224 if (SwingUtilities.isEventDispatchThread()) { 225 container.invalidate(); 226 } 230 227 } 231 228 }
Note:
See TracChangeset
for help on using the changeset viewer.