Changeset 12494 in josm


Ignore:
Timestamp:
2017-07-22T22:41:19+02:00 (2 years ago)
Author:
Don-vip
Message:

add Changeset.getComment()

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r12033 r12494  
    1010import java.util.Map;
    1111import java.util.Objects;
     12import java.util.Optional;
    1213
    1314import org.openstreetmap.josm.data.Bounds;
     
    264265
    265266    /**
    266      * Replies the number of comments for this changeset.
    267      * @return the number of comments for this changeset
     267     * Replies this changeset comment.
     268     * @return this changeset comment (empty string if missing)
     269     * @since 12494
     270     */
     271    public String getComment() {
     272        return Optional.ofNullable(get("comment")).orElse("");
     273    }
     274
     275    /**
     276     * Replies the number of comments for this changeset discussion.
     277     * @return the number of comments for this changeset discussion
    268278     * @since 7700
    269279     */
     
    273283
    274284    /**
    275      * Sets the number of comments for this changeset.
    276      * @param commentsCount the number of comments for this changeset
     285     * Sets the number of comments for this changeset discussion.
     286     * @param commentsCount the number of comments for this changeset discussion
    277287     * @since 7700
    278288     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java

    r10217 r12494  
    1919
    2020    protected void renderUploadComment(Changeset cs) {
    21         String comment = cs.get("comment");
    22         if (comment == null || comment.trim().isEmpty()) {
     21        String comment = cs.getComment();
     22        if (comment.trim().isEmpty()) {
    2323            setText(trc("changeset.upload-comment", "empty"));
    2424            setFont(UIManager.getFont("Table.font").deriveFont(Font.ITALIC));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

    r11878 r12494  
    221221        if (cs == null) return;
    222222        tfID.setText(Integer.toString(cs.getId()));
    223         String comment = cs.get("comment");
    224         taComment.setText(comment == null ? "" : comment);
     223        taComment.setText(cs.getComment());
    225224
    226225        if (cs.isOpen()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetListCellRenderer.java

    r12372 r12494  
    4242            sb.append(tr("{0} [incomplete]", cs.getId()));
    4343        } else {
    44             String comment = cs.get("comment");
     44            String comment = cs.getComment();
    4545            sb.append(cs.getId())
    4646              .append(" - ")
    4747              .append(cs.isOpen() ? tr("open") : tr("closed"));
    48             if (comment != null) {
     48            if (!comment.isEmpty()) {
    4949                sb.append(" - '").append(comment).append('\'');
    5050            }
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java

    r11878 r12494  
    4343                    DateUtils.formatDateTime(createdDate, DateFormat.SHORT, DateFormat.SHORT)).append("<br>");
    4444        }
    45         String comment = cs.get("comment");
    46         if (comment != null) {
     45        String comment = cs.getComment();
     46        if (!comment.isEmpty()) {
    4747            sb.append("<strong>").append(tr("Changeset comment:")).append("</strong>")
    4848              .append(Utils.escapeReservedCharactersHTML(comment)).append("<br>");
     
    6464            setIcon(icon);
    6565            StringBuilder sb = new StringBuilder();
    66             String comment = cs.get("comment");
    67             if (comment != null) {
     66            String comment = cs.getComment();
     67            if (!comment.isEmpty()) {
    6868                sb.append(cs.getId()).append(" - ").append(comment);
    6969            } else if (cs.get("name") != null) {
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r12370 r12494  
    88import java.beans.PropertyChangeEvent;
    99import java.beans.PropertyChangeListener;
    10 import java.util.Optional;
    1110
    1211import javax.swing.BorderFactory;
     
    5251            msg.append(tr("Objects are uploaded to the <strong>open changeset</strong> {0} with upload comment ''{1}''.",
    5352                    selectedChangeset.getId(),
    54                     Optional.ofNullable(selectedChangeset.get("comment")).orElse("")
     53                    selectedChangeset.getComment()
    5554            ));
    5655        }
Note: See TracChangeset for help on using the changeset viewer.