001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.gui.io; 003 004import java.util.Objects; 005 006import org.openstreetmap.josm.gui.util.ChangeNotifier; 007 008/** 009 * ChangesetCommentModel is an observable model for the changeset comment edited 010 * in the {@link UploadDialog}. 011 * @since 3133 012 */ 013public class ChangesetCommentModel extends ChangeNotifier { 014 private String comment = ""; 015 016 /** 017 * Sets the current changeset comment and notifies observers if the comment has changed. 018 * 019 * @param comment the new upload comment. Empty string assumed if null. 020 */ 021 public void setComment(String comment) { 022 String oldValue = this.comment; 023 this.comment = comment == null ? "" : comment; 024 if (!Objects.equals(oldValue, this.comment)) { 025 fireStateChanged(); 026 } 027 } 028 029 /** 030 * Replies the current changeset comment in this model. 031 * 032 * @return the current changeset comment in this model. 033 */ 034 public String getComment() { 035 return comment == null ? "" : comment; 036 } 037}