Last change
on this file since 13042 was 10210, checked in by Don-vip, 8 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.
|
---|
2 | package org.openstreetmap.josm.gui.io;
|
---|
3 |
|
---|
4 | import java.util.Objects;
|
---|
5 |
|
---|
6 | import 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 | */
|
---|
13 | public 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.