Ignore:
Timestamp:
2010-01-13T20:15:02+01:00 (10 years ago)
Author:
mjulius
Message:

fix messages for gui

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  
    1515
    1616import javax.swing.JCheckBox;
     17
     18import org.openstreetmap.josm.tools.CheckParameterUtil;
    1719
    1820/**
     
    7375     */
    7476    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");
    7878        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));
    8080
    8181        enabledMap.put(adjustable, isParticipating);
     
    113113     * @exception IllegalArgumentException thrown, if adjustable is null
    114114     */
    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");
    120118
    121119        if (! synchronizedAdjustables.contains(adjustable)) {
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r2512 r2850  
    1919import org.openstreetmap.josm.data.osm.history.HistoryNode;
    2020import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;
     21import org.openstreetmap.josm.tools.CheckParameterUtil;
    2122
    2223/**
     
    9293     */
    9394    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");
    9696        setModel(model);
    9797        build();
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r2655 r2850  
    4040import org.openstreetmap.josm.gui.layer.Layer;
    4141import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     42import org.openstreetmap.josm.tools.CheckParameterUtil;
    4243
    4344/**
     
    114115    public HistoryBrowserModel(History history) {
    115116        this();
    116         if (history == null)
    117             throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "history"));
     117        CheckParameterUtil.ensureParameterNotNull(history, "history");
    118118        setHistory(history);
    119119    }
     
    225225     */
    226226    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");
    229228        if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
    230229            return currentTagTableModel;
     
    237236
    238237    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");
    241239        if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
    242240            return currentNodeListTableModel;
     
    249247
    250248    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");
    253250        if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
    254251            return currentRelationMemberTableModel;
     
    273270     */
    274271    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");
    277273        if (history == null)
    278274            throw new IllegalStateException(tr("History not initialized yet. Failed to set reference primitive."));
     
    304300     */
    305301    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");
    308303        if (history == null)
    309304            throw new IllegalStateException(tr("History not initialized yet. Failed to set current primitive."));
     
    347342     */
    348343    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");
    351345        if (type.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
    352346            return current;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

    r2711 r2850  
    77import java.awt.Component;
    88import java.io.IOException;
     9import java.text.MessageFormat;
    910import java.util.Collection;
    1011import java.util.HashSet;
     
    7879    public HistoryLoadTask add(long id, OsmPrimitiveType type) throws IllegalArgumentException {
    7980        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");
    8383        SimplePrimitiveId pid = new SimplePrimitiveId(id, type);
    8484        toLoad.add(pid);
     
    9292     * @return this task
    9393     */
    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");
    9996        toLoad.add(pid);
    10097        return this;
     
    108105     * @throws IllegalArgumentException thrown if primitive is null
    109106     */
    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");
    113109        toLoad.add(primitive.getPrimitiveId());
    114110        return this;
     
    122118     * @throws IllegalArgumentException thrown if history is null
    123119     */
    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");
    127122        toLoad.add(history.getPrimitmiveId());
    128123        return this;
     
    137132     * @throws IllegalArgumentException thrown if primitive.getId() <= 0
    138133     */
    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");
    144136        toLoad.add(primitive.getPrimitiveId());
    145137        return this;
     
    154146     * @throws IllegalArgumentException thrown if one of the ids in the collection <= 0
    155147     */
    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");
    159150        for (OsmPrimitive primitive: primitives) {
    160151            if (primitive == null) {
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r2512 r2850  
    2323import org.openstreetmap.josm.gui.JMultilineLabel;
    2424import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     25import org.openstreetmap.josm.tools.CheckParameterUtil;
    2526import org.openstreetmap.josm.tools.UrlLabel;
    2627
     
    118119     */
    119120    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");
    124123
    125124        this.model = model;
Note: See TracChangeset for help on using the changeset viewer.