Changeset 14231 in josm


Ignore:
Timestamp:
2018-09-08T20:20:58+02:00 (5 weeks ago)
Author:
Don-vip
Message:

fix #16723 - Display changes count in changeset manager

Location:
trunk
Files:
5 edited

Legend:

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

    r13625 r14231  
    4343    /** the number of comments for this changeset */
    4444    private int commentsCount;
     45    /** the number of changes for this changeset */
     46    private int changesCount;
    4547    /** the map of tags */
    4648    private Map<String, String> tags;
     
    283285    }
    284286
     287    /**
     288     * Replies the number of changes for this changeset.
     289     * @return the number of changes for this changeset
     290     * @since 14231
     291     */
     292    public int getChangesCount() {
     293        return changesCount;
     294    }
     295
     296    /**
     297     * Sets the number of changes for this changeset.
     298     * @param changesCount the number of changes for this changeset
     299     * @since 14231
     300     */
     301    public void setChangesCount(int changesCount) {
     302        this.changesCount = changesCount;
     303    }
     304
    285305    @Override
    286306    public Map<String, String> getKeys() {
     
    346366     */
    347367    public boolean hasEqualSemanticAttributes(Changeset other) {
    348         if (other == null)
    349             return false;
    350         if (closedAt == null) {
    351             if (other.closedAt != null)
    352                 return false;
    353         } else if (!closedAt.equals(other.closedAt))
    354             return false;
    355         if (createdAt == null) {
    356             if (other.createdAt != null)
    357                 return false;
    358         } else if (!createdAt.equals(other.createdAt))
    359             return false;
    360         if (id != other.id)
    361             return false;
    362         if (max == null) {
    363             if (other.max != null)
    364                 return false;
    365         } else if (!max.equals(other.max))
    366             return false;
    367         if (min == null) {
    368             if (other.min != null)
    369                 return false;
    370         } else if (!min.equals(other.min))
    371             return false;
    372         if (open != other.open)
    373             return false;
    374         if (!tags.equals(other.tags))
    375             return false;
    376         if (user == null) {
    377             if (other.user != null)
    378                 return false;
    379         } else if (!user.equals(other.user))
    380             return false;
    381         return commentsCount == other.commentsCount;
     368        return other != null
     369            && id == other.id
     370            && open == other.open
     371            && commentsCount == other.commentsCount
     372            && changesCount == other.changesCount
     373            && Objects.equals(closedAt, other.closedAt)
     374            && Objects.equals(createdAt, other.createdAt)
     375            && Objects.equals(min, other.min)
     376            && Objects.equals(max, other.max)
     377            && Objects.equals(tags, other.tags)
     378            && Objects.equals(user, other.user);
    382379    }
    383380
     
    434431        this.max = other.max;
    435432        this.commentsCount = other.commentsCount;
     433        this.changesCount = other.changesCount;
    436434        this.tags = new HashMap<>(other.tags);
    437435        this.incomplete = other.incomplete;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java

    r12494 r14231  
    3939    }
    4040
     41    protected void renderChanges(Changeset cs) {
     42        setText(Integer.toString(cs.getChangesCount()));
     43        setToolTipText(null);
     44    }
     45
    4146    protected void renderDiscussions(Changeset cs) {
    4247        setText(Integer.toString(cs.getCommentsCount()));
     
    5964        case 4: /* created at */ renderDate(cs.getCreatedAt()); break;
    6065        case 5: /* closed at */ renderDate(cs.getClosedAt()); break;
    61         case 6: /* discussions */ renderDiscussions(cs); break;
     66        case 6: /* changes */ renderChanges(cs); break;
     67        case 7: /* discussions */ renderDiscussions(cs); break;
    6268        default: // Do nothing
    6369        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableColumnModel.java

    r7700 r14231  
    4747        createColumn(5, tr("Closed at"), 100, -1);
    4848
    49         // column 6 - Discussions
    50         createColumn(6, tr("Discussions"), 25, -1);
     49        // column 6 - Changes
     50        createColumn(6, tr("Changes"), 25, -1);
     51
     52        // column 7 - Discussions
     53        createColumn(7, tr("Discussions"), 25, -1);
    5154    }
    5255
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java

    r13901 r14231  
    160160            if (commentsCount != null) {
    161161                current.setCommentsCount(parseNumericAttribute(commentsCount, 0));
     162            }
     163
     164            // -- changes_count
     165            String changesCount = atts.getValue("changes_count");
     166            if (changesCount != null) {
     167                current.setChangesCount(parseNumericAttribute(changesCount, 0));
    162168            }
    163169        }
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetParserTest.java

    r11020 r14231  
    2727            "<changeset id=\"36749147\" user=\"kesler\" uid=\"13908\" created_at=\"2016-01-22T21:55:37Z\" "+
    2828                "closed_at=\"2016-01-22T21:56:39Z\"  open=\"false\" min_lat=\"36.6649211\" min_lon=\"55.377015\" max_lat=\"38.1490357\" " +
    29                 "max_lon=\"60.3766983\" comments_count=\"2\">" +
     29                "max_lon=\"60.3766983\" comments_count=\"2\" changes_count=\"9\">" +
    3030            "<tag k=\"created_by\" v=\"JOSM/1.5 (9329 en)\"/>" +
    3131            "<tag k=\"comment\" v=\"Fixing errors in North Khorasan\"/>";
     
    7575        Changeset cs = parse(BEGIN + END).iterator().next();
    7676        assertEquals(2, cs.getCommentsCount());
     77        assertEquals(9, cs.getChangesCount());
    7778        assertTrue(cs.getDiscussion().isEmpty());
    7879    }
     
    8788        Changeset cs = parse(BEGIN + DISCUSSION + END).iterator().next();
    8889        assertEquals(2, cs.getCommentsCount());
     90        assertEquals(9, cs.getChangesCount());
    8991        assertEquals(2, cs.getDiscussion().size());
    9092    }
Note: See TracChangeset for help on using the changeset viewer.