- Timestamp:
- 2016-11-27T17:06:21+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 16 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r11277 r11330 315 315 getInputStream()) { 316 316 byte[] data = Utils.readBytesFromStream(in); 317 if (data == null || data.length == 0) {317 if (data.length == 0) { 318 318 cf.clear(); 319 319 throw new IllegalArgumentException("Could not read data from: " + baseUrl); -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r11309 r11330 31 31 private boolean ignored; 32 32 /** Severity */ 33 private Severity severity;33 private final Severity severity; 34 34 /** The error message */ 35 private String message;35 private final String message; 36 36 /** Deeper error description */ 37 37 private final String description; 38 38 private final String descriptionEn; 39 39 /** The affected primitives */ 40 private Collection<? extends OsmPrimitive> primitives;40 private final Collection<? extends OsmPrimitive> primitives; 41 41 /** The primitives or way segments to be highlighted */ 42 42 private final Collection<?> highlighted; 43 43 /** The tester that raised this error */ 44 private Test tester;44 private final Test tester; 45 45 /** Internal code used by testers to classify errors */ 46 46 private final int code; -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java
r11321 r11330 54 54 * <ol> 55 55 * <li>the table model and the list selection for for a {@link JTable} which shows my entries. 56 * See {@link #getMyTableModel()} and {@link ListMergeModel#getMySelectionModel()}</li>56 * See {@link #getMyTableModel()} and {@link AbstractListMergeModel#getMySelectionModel()}</li> 57 57 * <li>dito for their entries and merged entries</li> 58 58 * </ol> … … 64 64 * ListMergeModel is an abstract class. Three methods have to be implemented by subclasses: 65 65 * <ul> 66 * <li>{@link ListMergeModel#cloneEntryForMergedList} - clones an entry of type T</li>67 * <li>{@link ListMergeModel#isEqualEntry} - checks whether two entries are equals </li>68 * <li>{@link ListMergeModel#setValueAt(DefaultTableModel, Object, int, int)} - handles values edited in66 * <li>{@link AbstractListMergeModel#cloneEntryForMergedList} - clones an entry of type T</li> 67 * <li>{@link AbstractListMergeModel#isEqualEntry} - checks whether two entries are equals </li> 68 * <li>{@link AbstractListMergeModel#setValueAt(DefaultTableModel, Object, int, int)} - handles values edited in 69 69 * a JTable, dispatched from {@link TableModel#setValueAt(Object, int, int)} </li> 70 70 * </ul> 71 * A ListMergeModel is used in combination with a {@link ListMerger}.71 * A ListMergeModel is used in combination with a {@link AbstractListMerger}. 72 72 * 73 73 * @param <T> the type of the list entries 74 74 * @param <C> the type of conflict resolution command 75 * @see ListMerger75 * @see AbstractListMerger 76 76 */ 77 public abstract class ListMergeModel<T extends PrimitiveId, C extends ConflictResolveCommand> extends ChangeNotifier {78 public static final String FROZEN_PROP = ListMergeModel.class.getName() + ".frozen";77 public abstract class AbstractListMergeModel<T extends PrimitiveId, C extends ConflictResolveCommand> extends ChangeNotifier { 78 public static final String FROZEN_PROP = AbstractListMergeModel.class.getName() + ".frozen"; 79 79 80 80 private static final int MAX_DELETED_PRIMITIVE_IN_DIALOG = 5; … … 190 190 * Constructs a new {@code ListMergeModel}. 191 191 */ 192 public ListMergeModel() {192 public AbstractListMergeModel() { 193 193 entries = new EnumMap<>(ListRole.class); 194 194 for (ListRole role : ListRole.values()) { … … 575 575 /** 576 576 * This an adapter between a {@link JTable} and one of the three entry lists 577 * in the role {@link ListRole} managed by the {@link ListMergeModel}.577 * in the role {@link ListRole} managed by the {@link AbstractListMergeModel}. 578 578 * 579 579 * From the point of view of the {@link JTable} it is a {@link TableModel}. 580 580 * 581 * @see ListMergeModel#getMyTableModel()582 * @see ListMergeModel#getTheirTableModel()583 * @see ListMergeModel#getMergedTableModel()581 * @see AbstractListMergeModel#getMyTableModel() 582 * @see AbstractListMergeModel#getTheirTableModel() 583 * @see AbstractListMergeModel#getMergedTableModel() 584 584 */ 585 585 public class EntriesTableModel extends DefaultTableModel implements OsmPrimitivesTableModel { … … 614 614 @Override 615 615 public void setValueAt(Object value, int row, int col) { 616 ListMergeModel.this.setValueAt(this, value, row, col);616 AbstractListMergeModel.this.setValueAt(this, value, row, col); 617 617 } 618 618 … … 621 621 * @return the list merge model 622 622 */ 623 public ListMergeModel<T, C> getListMergeModel() {624 return ListMergeModel.this;623 public AbstractListMergeModel<T, C> getListMergeModel() { 624 return AbstractListMergeModel.this; 625 625 } 626 626 … … 632 632 * participates in the current {@link ComparePairType} 633 633 * 634 * @see ListMergeModel.ComparePairListModel#getSelectedComparePair()634 * @see AbstractListMergeModel.ComparePairListModel#getSelectedComparePair() 635 635 */ 636 636 public boolean isParticipatingInCurrentComparePair() { … … 720 720 /** 721 721 * This is the selection model to be used in a {@link JTable} which displays 722 * an entry list managed by {@link ListMergeModel}.722 * an entry list managed by {@link AbstractListMergeModel}. 723 723 * 724 724 * The model ensures that only rows displaying an entry in the entry list 725 725 * can be selected. "Empty" rows can't be selected. 726 726 * 727 * @see ListMergeModel#getMySelectionModel()728 * @see ListMergeModel#getMergedSelectionModel()729 * @see ListMergeModel#getTheirSelectionModel()727 * @see AbstractListMergeModel#getMySelectionModel() 728 * @see AbstractListMergeModel#getMergedSelectionModel() 729 * @see AbstractListMergeModel#getTheirSelectionModel() 730 730 * 731 731 */ -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java
r11321 r11330 48 48 * @param <T> the type of the entries 49 49 * @param <C> the type of conflict resolution command 50 * @see ListMergeModel50 * @see AbstractListMergeModel 51 51 * @since 1631 52 52 */ 53 public abstract class ListMerger<T extends PrimitiveId, C extends ConflictResolveCommand> extends JPanel53 public abstract class AbstractListMerger<T extends PrimitiveId, C extends ConflictResolveCommand> extends JPanel 54 54 implements PropertyChangeListener, ChangeListener, IConflictResolver { 55 55 protected OsmPrimitivesTable myEntriesTable; … … 57 57 protected OsmPrimitivesTable theirEntriesTable; 58 58 59 protected transient ListMergeModel<T, C> model;59 protected transient AbstractListMergeModel<T, C> model; 60 60 61 61 private CopyStartLeftAction copyStartLeftAction; … … 409 409 * @param model list merger model 410 410 */ 411 public ListMerger(ListMergeModel<T, C> model) {411 public AbstractListMerger(AbstractListMergeModel<T, C> model) { 412 412 this.model = model; 413 413 model.addChangeListener(this); … … 859 859 @Override 860 860 public void propertyChange(PropertyChangeEvent evt) { 861 if (evt.getPropertyName().equals( ListMergeModel.FROZEN_PROP)) {861 if (evt.getPropertyName().equals(AbstractListMergeModel.FROZEN_PROP)) { 862 862 handlePropertyChangeFrozen((Boolean) evt.getOldValue(), (Boolean) evt.getNewValue()); 863 863 } … … 868 868 * @return the model 869 869 */ 870 public ListMergeModel<T, C> getModel() {870 public AbstractListMergeModel<T, C> getModel() { 871 871 return model; 872 872 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r11318 r11330 163 163 * @param evt the event 164 164 * @see TagMergeModel 165 * @see ListMergeModel165 * @see AbstractListMergeModel 166 166 * @see PropertiesMergeModel 167 167 */ … … 181 181 } 182 182 updateResolvedCompletely(); 183 } else if (evt.getPropertyName().equals( ListMergeModel.FROZEN_PROP)) {183 } else if (evt.getPropertyName().equals(AbstractListMergeModel.FROZEN_PROP)) { 184 184 boolean frozen = (Boolean) evt.getNewValue(); 185 185 if (evt.getSource() == nodeListMerger.getModel() && my instanceof Way) { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListRole.java
r5266 r11330 3 3 4 4 /** 5 * Enumeration of roles entry lists play in {@link ListMergeModel}5 * Enumeration of roles entry lists play in {@link AbstractListMergeModel} 6 6 */ 7 7 public enum ListRole { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/PairTable.java
r11318 r11330 15 15 public abstract class PairTable extends OsmPrimitivesTable { 16 16 17 private final transient ListMergeModel<? extends PrimitiveId, ? extends ConflictResolveCommand> model;17 private final transient AbstractListMergeModel<? extends PrimitiveId, ? extends ConflictResolveCommand> model; 18 18 19 19 /** … … 25 25 * @param sm selection model 26 26 */ 27 public PairTable(String name, ListMergeModel<? extends PrimitiveId, ? extends ConflictResolveCommand> model,27 public PairTable(String name, AbstractListMergeModel<? extends PrimitiveId, ? extends ConflictResolveCommand> model, 28 28 OsmPrimitivesTableModel dm, TableColumnModel cm, ListSelectionModel sm) { 29 29 super(dm, cm, sm); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java
r11318 r11330 15 15 import org.openstreetmap.josm.data.osm.PrimitiveId; 16 16 import org.openstreetmap.josm.data.osm.Way; 17 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;17 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 18 18 import org.openstreetmap.josm.gui.conflict.pair.ListRole; 19 19 … … 22 22 * @since 1622 23 23 */ 24 public class NodeListMergeModel extends ListMergeModel<Node, WayNodesConflictResolverCommand> {24 public class NodeListMergeModel extends AbstractListMergeModel<Node, WayNodesConflictResolverCommand> { 25 25 26 26 /** -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMerger.java
r11318 r11330 9 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 10 10 import org.openstreetmap.josm.data.osm.Way; 11 import org.openstreetmap.josm.gui.conflict.pair. ListMerger;11 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMerger; 12 12 13 13 /** … … 15 15 * @since 1622 16 16 */ 17 public class NodeListMerger extends ListMerger<Node, WayNodesConflictResolverCommand> {17 public class NodeListMerger extends AbstractListMerger<Node, WayNodesConflictResolverCommand> { 18 18 19 19 /** -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTable.java
r11318 r11330 7 7 import org.openstreetmap.josm.command.conflict.WayNodesConflictResolverCommand; 8 8 import org.openstreetmap.josm.data.osm.Node; 9 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;9 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 10 10 import org.openstreetmap.josm.gui.conflict.pair.PairTable; 11 11 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel; … … 24 24 * @param sm selection model 25 25 */ 26 public NodeListTable(String name, ListMergeModel<Node, WayNodesConflictResolverCommand> model,26 public NodeListTable(String name, AbstractListMergeModel<Node, WayNodesConflictResolverCommand> model, 27 27 OsmPrimitivesTableModel dm, ListSelectionModel sm) { 28 28 super(name, model, dm, new NodeListColumnModel(new NodeListTableCellRenderer()), sm); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java
r11318 r11330 16 16 import org.openstreetmap.josm.gui.DefaultNameFormatter; 17 17 import org.openstreetmap.josm.gui.conflict.ConflictColors; 18 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;18 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 19 19 import org.openstreetmap.josm.tools.ImageProvider; 20 20 … … 55 55 * @param isSelected true, if the current row is selected 56 56 */ 57 protected void renderNode( ListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel model, Node node,57 protected void renderNode(AbstractListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel model, Node node, 58 58 int row, boolean isSelected) { 59 59 setIcon(icon); … … 90 90 * @param row the row index 91 91 */ 92 protected void renderRowId( ListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel model, int row) {92 protected void renderRowId(AbstractListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel model, int row) { 93 93 setIcon(null); 94 94 setBorder(rowNumberBorder); … … 132 132 */ 133 133 @SuppressWarnings("unchecked") 134 protected ListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel getModel(JTable table) {135 return ( ListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel) table.getModel();134 protected AbstractListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel getModel(JTable table) { 135 return (AbstractListMergeModel<Node, WayNodesConflictResolverCommand>.EntriesTableModel) table.getModel(); 136 136 } 137 137 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java
r11318 r11330 14 14 import org.openstreetmap.josm.data.osm.Relation; 15 15 import org.openstreetmap.josm.data.osm.RelationMember; 16 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;16 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 17 17 import org.openstreetmap.josm.gui.conflict.pair.ListRole; 18 18 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 22 22 * @since 1631 23 23 */ 24 public class RelationMemberListMergeModel extends ListMergeModel<RelationMember, RelationMemberConflictResolverCommand> {24 public class RelationMemberListMergeModel extends AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand> { 25 25 26 26 @Override -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMerger.java
r11318 r11330 9 9 import org.openstreetmap.josm.data.osm.Relation; 10 10 import org.openstreetmap.josm.data.osm.RelationMember; 11 import org.openstreetmap.josm.gui.conflict.pair. ListMerger;11 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMerger; 12 12 13 13 /** … … 15 15 * @since 1631 16 16 */ 17 public class RelationMemberMerger extends ListMerger<RelationMember, RelationMemberConflictResolverCommand> {17 public class RelationMemberMerger extends AbstractListMerger<RelationMember, RelationMemberConflictResolverCommand> { 18 18 19 19 /** -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTable.java
r11318 r11330 7 7 import org.openstreetmap.josm.command.conflict.RelationMemberConflictResolverCommand; 8 8 import org.openstreetmap.josm.data.osm.RelationMember; 9 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;9 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 10 10 import org.openstreetmap.josm.gui.conflict.pair.PairTable; 11 11 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel; … … 24 24 * @param sm selection model 25 25 */ 26 public RelationMemberTable(String name, ListMergeModel<RelationMember, RelationMemberConflictResolverCommand> model,26 public RelationMemberTable(String name, AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand> model, 27 27 OsmPrimitivesTableModel dm, ListSelectionModel sm) { 28 28 super(name, model, dm, new RelationMemberListColumnModel(), sm); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
r11318 r11330 15 15 import org.openstreetmap.josm.gui.DefaultNameFormatter; 16 16 import org.openstreetmap.josm.gui.conflict.ConflictColors; 17 import org.openstreetmap.josm.gui.conflict.pair. ListMergeModel;17 import org.openstreetmap.josm.gui.conflict.pair.AbstractListMergeModel; 18 18 import org.openstreetmap.josm.tools.ImageProvider; 19 19 … … 45 45 } 46 46 47 protected void renderBackground( ListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel model,47 protected void renderBackground(AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel model, 48 48 RelationMember member, int row, int col, boolean isSelected) { 49 49 Color bgc = ConflictColors.BGCOLOR.get(); … … 78 78 } 79 79 80 protected void renderForeground( ListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel model,80 protected void renderForeground(AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel model, 81 81 RelationMember member, int row, int col, boolean isSelected) { 82 82 Color fgc = ConflictColors.FGCOLOR.get(); … … 148 148 */ 149 149 @SuppressWarnings("unchecked") 150 protected ListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel getModel(JTable table) {151 return ( ListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel) table.getModel();150 protected AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel getModel(JTable table) { 151 return (AbstractListMergeModel<RelationMember, RelationMemberConflictResolverCommand>.EntriesTableModel) table.getModel(); 152 152 } 153 153 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/OpenAndCloseStateRestrictionPanel.java
r11326 r11330 23 23 */ 24 24 public class OpenAndCloseStateRestrictionPanel extends JPanel implements RestrictionPanel { 25 26 private static final String PREF_ROOT = "changeset-query.advanced.open-restrictions"; 27 private static final String PREF_QUERY_TYPE = PREF_ROOT + ".query-type"; 25 28 26 29 private final JRadioButton rbOpenOnly = new JRadioButton(); … … 105 108 */ 106 109 public void rememberSettings() { 107 String prefRoot = "changeset-query.advanced.open-restrictions";108 110 if (rbBoth.isSelected()) { 109 Main.pref.put( prefRoot + ".query-type", "both");111 Main.pref.put(PREF_QUERY_TYPE, "both"); 110 112 } else if (rbOpenOnly.isSelected()) { 111 Main.pref.put( prefRoot + ".query-type", "open");113 Main.pref.put(PREF_QUERY_TYPE, "open"); 112 114 } else if (rbClosedOnly.isSelected()) { 113 Main.pref.put( prefRoot + ".query-type", "closed");115 Main.pref.put(PREF_QUERY_TYPE, "closed"); 114 116 } 115 117 } … … 119 121 */ 120 122 public void restoreFromSettings() { 121 String prefRoot = "changeset-query.advanced.open-restrictions"; 122 String v = Main.pref.get(prefRoot + ".query-type", "open"); 123 String v = Main.pref.get(PREF_QUERY_TYPE, "open"); 123 124 rbBoth.setSelected("both".equals(v)); 124 125 rbOpenOnly.setSelected("open".equals(v)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UserRestrictionPanel.java
r11326 r11330 34 34 */ 35 35 public class UserRestrictionPanel extends JPanel implements RestrictionPanel { 36 private static final String PREF_ROOT = "changeset-query.advanced.user-restrictions"; 37 private static final String PREF_QUERY_TYPE = PREF_ROOT + ".query-type"; 38 36 39 private final ButtonGroup bgUserRestrictions = new ButtonGroup(); 37 40 private final JRadioButton rbRestrictToMyself = new JRadioButton(); … … 257 260 */ 258 261 public void rememberSettings() { 259 String prefRoot = "changeset-query.advanced.user-restrictions";260 262 if (rbRestrictToMyself.isSelected()) { 261 Main.pref.put( prefRoot + ".query-type", "mine");263 Main.pref.put(PREF_QUERY_TYPE, "mine"); 262 264 } else if (rbRestrictToUid.isSelected()) { 263 Main.pref.put( prefRoot + ".query-type", "uid");265 Main.pref.put(PREF_QUERY_TYPE, "uid"); 264 266 } else if (rbRestrictToUserName.isSelected()) { 265 Main.pref.put( prefRoot + ".query-type", "username");266 } 267 Main.pref.put( prefRoot+ ".uid", tfUid.getText());268 Main.pref.put( prefRoot+ ".username", tfUserName.getText());267 Main.pref.put(PREF_QUERY_TYPE, "username"); 268 } 269 Main.pref.put(PREF_ROOT + ".uid", tfUid.getText()); 270 Main.pref.put(PREF_ROOT + ".username", tfUserName.getText()); 269 271 } 270 272 … … 273 275 */ 274 276 public void restoreFromSettings() { 275 String prefRoot = "changeset-query.advanced.user-restrictions"; 276 String v = Main.pref.get(prefRoot + ".query-type", "mine"); 277 String v = Main.pref.get(PREF_QUERY_TYPE, "mine"); 277 278 if ("mine".equals(v)) { 278 279 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance(); … … 287 288 rbRestrictToUserName.setSelected(true); 288 289 } 289 tfUid.setText(Main.pref.get( prefRoot+ ".uid", ""));290 tfUid.setText(Main.pref.get(PREF_ROOT + ".uid", "")); 290 291 if (!valUid.isValid()) { 291 292 tfUid.setText(""); 292 293 } 293 tfUserName.setText(Main.pref.get( prefRoot+ ".username", ""));294 tfUserName.setText(Main.pref.get(PREF_ROOT + ".username", "")); 294 295 } 295 296 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r11320 r11330 1366 1366 * 1367 1367 * @param stream input stream 1368 * @return byte array of data in input stream or null if stream is null1368 * @return byte array of data in input stream (empty if stream is null) 1369 1369 * @throws IOException if any I/O error occurs 1370 1370 */ 1371 1371 public static byte[] readBytesFromStream(InputStream stream) throws IOException { 1372 1372 if (stream == null) { 1373 return n ull;1373 return new byte[0]; 1374 1374 } 1375 1375 try { … … 1386 1386 } while (!finished); 1387 1387 if (bout.size() == 0) 1388 return n ull;1388 return new byte[0]; 1389 1389 return bout.toByteArray(); 1390 1390 } finally { 1391 if (stream != null) { 1392 stream.close(); 1393 } 1391 stream.close(); 1394 1392 } 1395 1393 }
Note:
See TracChangeset
for help on using the changeset viewer.