Changeset 2850 in josm for trunk/src/org/openstreetmap/josm/gui/history
- Timestamp:
- 2010-01-13T20:15:02+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/history
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/AdjustmentSynchronizer.java
r2512 r2850 15 15 16 16 import javax.swing.JCheckBox; 17 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 19 18 20 /** … … 73 75 */ 74 76 protected void setParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating) { 75 if (adjustable == null) 76 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "adjustable")); 77 77 CheckParameterUtil.ensureParameterNotNull(adjustable, "adjustable"); 78 78 if (! synchronizedAdjustables.contains(adjustable)) 79 throw new IllegalStateException(tr("Adjustable {0} not registered yet. Can 't set participation in synchronized adjustment.", adjustable));79 throw new IllegalStateException(tr("Adjustable {0} not registered yet. Cannot set participation in synchronized adjustment.", adjustable)); 80 80 81 81 enabledMap.put(adjustable, isParticipating); … … 113 113 * @exception IllegalArgumentException thrown, if adjustable is null 114 114 */ 115 protected void adapt(final JCheckBox view, final Adjustable adjustable) throws IllegalArgumentException, IllegalStateException { 116 if (adjustable == null) 117 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "adjustable")); 118 if (view == null) 119 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "view")); 115 protected void adapt(final JCheckBox view, final Adjustable adjustable) throws IllegalStateException { 116 CheckParameterUtil.ensureParameterNotNull(adjustable, "adjustable"); 117 CheckParameterUtil.ensureParameterNotNull(view, "view"); 120 118 121 119 if (! synchronizedAdjustables.contains(adjustable)) { -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r2512 r2850 19 19 import org.openstreetmap.josm.data.osm.history.HistoryNode; 20 20 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 21 22 22 23 /** … … 92 93 */ 93 94 public CoordinateInfoViewer(HistoryBrowserModel model) throws IllegalArgumentException{ 94 if (model == null) 95 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "model")); 95 CheckParameterUtil.ensureParameterNotNull(model, "model"); 96 96 setModel(model); 97 97 build(); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r2655 r2850 40 40 import org.openstreetmap.josm.gui.layer.Layer; 41 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 import org.openstreetmap.josm.tools.CheckParameterUtil; 42 43 43 44 /** … … 114 115 public HistoryBrowserModel(History history) { 115 116 this(); 116 if (history == null) 117 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "history")); 117 CheckParameterUtil.ensureParameterNotNull(history, "history"); 118 118 setHistory(history); 119 119 } … … 225 225 */ 226 226 public TagTableModel getTagTableModel(PointInTimeType pointInTimeType) throws IllegalArgumentException { 227 if (pointInTimeType == null) 228 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "pointInTimeType")); 227 CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType"); 229 228 if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME)) 230 229 return currentTagTableModel; … … 237 236 238 237 public NodeListTableModel getNodeListTableModel(PointInTimeType pointInTimeType) throws IllegalArgumentException { 239 if (pointInTimeType == null) 240 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "pointInTimeType")); 238 CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType"); 241 239 if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME)) 242 240 return currentNodeListTableModel; … … 249 247 250 248 public RelationMemberTableModel getRelationMemberTableModel(PointInTimeType pointInTimeType) throws IllegalArgumentException { 251 if (pointInTimeType == null) 252 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "pointInTimeType")); 249 CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType"); 253 250 if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME)) 254 251 return currentRelationMemberTableModel; … … 273 270 */ 274 271 public void setReferencePointInTime(HistoryOsmPrimitive reference) throws IllegalArgumentException, IllegalStateException{ 275 if (reference == null) 276 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "reference")); 272 CheckParameterUtil.ensureParameterNotNull(reference, "reference"); 277 273 if (history == null) 278 274 throw new IllegalStateException(tr("History not initialized yet. Failed to set reference primitive.")); … … 304 300 */ 305 301 public void setCurrentPointInTime(HistoryOsmPrimitive current) throws IllegalArgumentException, IllegalStateException{ 306 if (current == null) 307 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "current")); 302 CheckParameterUtil.ensureParameterNotNull(current, "current"); 308 303 if (history == null) 309 304 throw new IllegalStateException(tr("History not initialized yet. Failed to set current primitive.")); … … 347 342 */ 348 343 public HistoryOsmPrimitive getPointInTime(PointInTimeType type) throws IllegalArgumentException { 349 if (type == null) 350 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "type")); 344 CheckParameterUtil.ensureParameterNotNull(type, "type"); 351 345 if (type.equals(PointInTimeType.CURRENT_POINT_IN_TIME)) 352 346 return current; -
trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java
r2711 r2850 7 7 import java.awt.Component; 8 8 import java.io.IOException; 9 import java.text.MessageFormat; 9 10 import java.util.Collection; 10 11 import java.util.HashSet; … … 78 79 public HistoryLoadTask add(long id, OsmPrimitiveType type) throws IllegalArgumentException { 79 80 if (id <= 0) 80 throw new IllegalArgumentException(tr("Parameter ''{0}'' > 0 expected. Got {1}.", "id", id)); 81 if (type == null) 82 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "type")); 81 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0 expected. Got {1}.", "id", id)); 82 CheckParameterUtil.ensureParameterNotNull(type, "type"); 83 83 SimplePrimitiveId pid = new SimplePrimitiveId(id, type); 84 84 toLoad.add(pid); … … 92 92 * @return this task 93 93 */ 94 public HistoryLoadTask add(PrimitiveId pid) throws IllegalArgumentException { 95 if (pid == null) 96 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "pid")); 97 if (pid.getUniqueId() <= 0) 98 throw new IllegalArgumentException(tr("id in parameter ''{0}'' > 0 expected, got {1}.", "pid", pid.getUniqueId())); 94 public HistoryLoadTask add(PrimitiveId pid) { 95 CheckParameterUtil.ensureValidPrimitiveId(pid, "pid"); 99 96 toLoad.add(pid); 100 97 return this; … … 108 105 * @throws IllegalArgumentException thrown if primitive is null 109 106 */ 110 public HistoryLoadTask add(HistoryOsmPrimitive primitive) throws IllegalArgumentException { 111 if (primitive == null) 112 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitive")); 107 public HistoryLoadTask add(HistoryOsmPrimitive primitive) { 108 CheckParameterUtil.ensureParameterNotNull(primitive, "primitive"); 113 109 toLoad.add(primitive.getPrimitiveId()); 114 110 return this; … … 122 118 * @throws IllegalArgumentException thrown if history is null 123 119 */ 124 public HistoryLoadTask add(History history)throws IllegalArgumentException { 125 if (history == null) 126 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "history")); 120 public HistoryLoadTask add(History history) { 121 CheckParameterUtil.ensureParameterNotNull(history, "history"); 127 122 toLoad.add(history.getPrimitmiveId()); 128 123 return this; … … 137 132 * @throws IllegalArgumentException thrown if primitive.getId() <= 0 138 133 */ 139 public HistoryLoadTask add(OsmPrimitive primitive) throws IllegalArgumentException { 140 if (primitive == null) 141 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitive")); 142 if (primitive.getId() <= 0) 143 throw new IllegalArgumentException(tr("Object id > 0 expected. Got {0}", primitive.getId())); 134 public HistoryLoadTask add(OsmPrimitive primitive) { 135 CheckParameterUtil.ensureValidPrimitiveId(primitive, "primitive"); 144 136 toLoad.add(primitive.getPrimitiveId()); 145 137 return this; … … 154 146 * @throws IllegalArgumentException thrown if one of the ids in the collection <= 0 155 147 */ 156 public HistoryLoadTask add(Collection<? extends OsmPrimitive> primitives) throws IllegalArgumentException{ 157 if (primitives == null) 158 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitives")); 148 public HistoryLoadTask add(Collection<? extends OsmPrimitive> primitives) { 149 CheckParameterUtil.ensureParameterNotNull(primitives, "primitives"); 159 150 for (OsmPrimitive primitive: primitives) { 160 151 if (primitive == null) { -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r2512 r2850 23 23 import org.openstreetmap.josm.gui.JMultilineLabel; 24 24 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 25 import org.openstreetmap.josm.tools.CheckParameterUtil; 25 26 import org.openstreetmap.josm.tools.UrlLabel; 26 27 … … 118 119 */ 119 120 public VersionInfoPanel(HistoryBrowserModel model, PointInTimeType pointInTimeType) throws IllegalArgumentException { 120 if (pointInTimeType == null) 121 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "pointInTimeType")); 122 if (model == null) 123 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "model")); 121 CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType"); 122 CheckParameterUtil.ensureParameterNotNull(model, "model"); 124 123 125 124 this.model = model;
Note:
See TracChangeset
for help on using the changeset viewer.