Ticket #6652: ticket-6652-last-member-repeated-in-history-diff-v2.patch

File ticket-6652-last-member-repeated-in-history-diff-v2.patch, 3.5 KB (added by olejorgenb, 13 years ago)
  • src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    diff --git a/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java b/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
    index 335f000..bb218ac 100644
    a b public class HistoryBrowserModel extends Observable implements LayerChangeListen  
    145145    protected boolean canShowAsLatest(OsmPrimitive primitive) {
    146146        if (primitive == null) return false;
    147147        if (primitive.isNew() || !primitive.isUsable()) return false;
    148        
     148
    149149        //try creating a history primitive. if that fails, the primitive cannot be used.
    150150        try {
    151151            HistoryOsmPrimitive.forOsmPrimitive(primitive);
    public class HistoryBrowserModel extends Observable implements LayerChangeListen  
    670670
    671671        @Override
    672672        public int getRowCount() {
     673            // Match the size of the opposite table so comparison is less confusing.
     674            // (scroll bars lines up properly, etc.)
    673675            int n = 0;
    674676            if (current != null && current.getType().equals(OsmPrimitiveType.RELATION)) {
    675677                n = ((HistoryRelation)current).getNumMembers();
    public class HistoryBrowserModel extends Observable implements LayerChangeListen  
    718720            HistoryRelation relation = getRelation();
    719721            if (relation == null)
    720722                return null;
    721             if (row >= relation.getNumMembers())
     723            if (row >= relation.getNumMembers()) // see getRowCount
    722724                return null;
    723725            return relation.getMembers().get(row);
    724726        }
  • src/org/openstreetmap/josm/gui/history/NodeListTableCellRenderer.java

    diff --git a/src/org/openstreetmap/josm/gui/history/NodeListTableCellRenderer.java b/src/org/openstreetmap/josm/gui/history/NodeListTableCellRenderer.java
    index c8aae4e..b6aec9e 100644
    a b public class NodeListTableCellRenderer extends JLabel implements TableCellRender  
    5858        setBackground(bgColor);
    5959    }
    6060
     61    // Warning: The model pads with null-rows to match the size of the opposite table. 'value' could be null
    6162    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
    6263            int row, int column) {
    63         if (value == null)
    64             return this;
    6564
    6665        HistoryBrowserModel.NodeListTableModel model = getNodeListTableModel(table);
    6766        Long nodeId = (Long)value;
  • src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java

    diff --git a/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java b/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java
    index 2b9bebe..08c2e5f 100644
    a b public class RelationMemberListTableCellRenderer extends JLabel implements Table  
    9191        setBackground(bgColor);
    9292    }
    9393
     94    // Warning: The model pads with null-rows to match the size of the opposite table. 'value' could be null
    9495    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
    9596            int row, int column) {
    96         if (value == null)
    97             return this;
    9897
    9998        HistoryBrowserModel.RelationMemberTableModel model = gteRelationMemberTableModel(table);
    10099        RelationMember member = (RelationMember)value;