source: josm/trunk/src/org/openstreetmap/josm/gui/io/ChangesetCommentModel.java @ 10210

Last change on this file since 10210 was 10210, checked in by Don-vip, 3 years ago

see #11924 - Java 9 - replace calls to deprecated classes java.util.Observable / java.util.Observer by a new class ChangeNotifier + swing's ChangeListener

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.io;
3
4import java.util.Objects;
5
6import org.openstreetmap.josm.gui.util.ChangeNotifier;
7
8/**
9 * ChangesetCommentModel is an observable model for the changeset comment edited
10 * in the {@link UploadDialog}.
11 * @since 3133
12 */
13public class ChangesetCommentModel extends ChangeNotifier {
14    private String comment = "";
15
16    /**
17     * Sets the current changeset comment and notifies observers if the comment has changed.
18     *
19     * @param comment the new upload comment. Empty string assumed if null.
20     */
21    public void setComment(String comment) {
22        String oldValue = this.comment;
23        this.comment = comment == null ? "" : comment;
24        if (!Objects.equals(oldValue, this.comment)) {
25            fireStateChanged();
26        }
27    }
28
29    /**
30     * Replies the current changeset comment in this model.
31     *
32     * @return the current changeset comment in this model.
33     */
34    public String getComment() {
35        return comment == null ? "" : comment;
36    }
37}
Note: See TracBrowser for help on using the repository browser.