Changeset 5301 in josm for trunk/src


Ignore:
Timestamp:
2012-06-25T21:25:50+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #4493, fix #7750 - conflict manager: select and zoom primitives with id:0

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java

    r5297 r5301  
    1010
    1111import org.openstreetmap.josm.Main;
    12 import org.openstreetmap.josm.data.osm.PrimitiveId;
     12import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1313import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1414import org.openstreetmap.josm.gui.conflict.pair.nodes.NodeListTable;
     
    6767            return;
    6868        int row = rows[0];
    69         PrimitiveId primitive = this.table.getOsmPrimitivesTableModel().getReferredPrimitive(row);
    7069        OsmDataLayer layer = this.table.getLayer();
     70        OsmPrimitive primitive = this.table.getPrimitiveToZoomTo(row, layer);
    7171        if (layer != null && primitive != null) {
    7272            layer.data.setSelected(primitive);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r5298 r5301  
    126126     * @return Primitive from my dataset referenced by entry
    127127     */
    128     protected OsmPrimitive getMyPrimitive(T entry) {
    129         return getMyPrimitiveDefault(entry);
     128    public OsmPrimitive getMyPrimitive(T entry) {
     129        return getMyPrimitiveById(entry);
    130130    }
    131131   
    132     protected final OsmPrimitive getMyPrimitiveDefault(PrimitiveId entry) {
     132    public final OsmPrimitive getMyPrimitiveById(PrimitiveId entry) {
    133133        OsmPrimitive result = myDataset.getPrimitiveById(entry);
    134134        if (result == null && mergedMap != null) {
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMerger.java

    r5298 r5301  
    2828        myEntriesTable  = new NodeListTable(
    2929                "table.mynodes",
     30                model,
    3031                model.getMyTableModel(),
    3132                model.getMySelectionModel()
     
    3839        mergedEntriesTable  = new NodeListTable(
    3940                "table.mergednodes",
     41                model,
    4042                model.getMergedTableModel(),
    4143                model.getMergedSelectionModel()
     
    4850        theirEntriesTable  = new NodeListTable(
    4951                "table.theirnodes",
     52                model,
    5053                model.getTheirTableModel(),
    5154                model.getTheirSelectionModel()
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTable.java

    r5297 r5301  
    22package org.openstreetmap.josm.gui.conflict.pair.nodes;
    33
    4 import javax.swing.JTable;
    54import javax.swing.ListSelectionModel;
    65
    76import org.openstreetmap.josm.actions.ZoomToAction;
    8 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable;
     7import org.openstreetmap.josm.data.osm.Node;
     8import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel;
     9import org.openstreetmap.josm.gui.conflict.pair.PairTable;
    910import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel;
    1011
    11 public class NodeListTable extends OsmPrimitivesTable {
     12public class NodeListTable extends PairTable {
    1213
    13     public NodeListTable(String name, OsmPrimitivesTableModel dm, ListSelectionModel sm) {
    14         super(dm, new NodeListColumnModel(new NodeListTableCellRenderer()), sm);
    15         setName(name);
    16         setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
     14    public NodeListTable(String name, ListMergeModel<Node> model, OsmPrimitivesTableModel dm, ListSelectionModel sm) {
     15        super(name, model, dm, new NodeListColumnModel(new NodeListTableCellRenderer()), sm);
    1716    }
    1817
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java

    r5298 r5301  
    9292
    9393    @Override
    94     protected OsmPrimitive getMyPrimitive(RelationMember entry) {
    95         return getMyPrimitiveDefault(entry.getMember());
     94    public OsmPrimitive getMyPrimitive(RelationMember entry) {
     95        return getMyPrimitiveById(entry.getMember());
    9696    }
    9797
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMerger.java

    r5298 r5301  
    1919        myEntriesTable  = new RelationMemberTable(
    2020                "table.mymembers",
     21                model,
    2122                model.getMyTableModel(),
    2223                model.getMySelectionModel()
     
    2930        mergedEntriesTable  = new RelationMemberTable(
    3031                "table.mergedmembers",
     32                model,
    3133                model.getMergedTableModel(),
    3234                model.getMergedSelectionModel()
     
    4042        theirEntriesTable  = new RelationMemberTable(
    4143                "table.theirmembers",
     44                model,
    4245                model.getTheirTableModel(),
    4346                model.getTheirSelectionModel()
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTable.java

    r5297 r5301  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.gui.conflict.pair.relation;
    23
    3 import javax.swing.JTable;
    44import javax.swing.ListSelectionModel;
    55
    66import org.openstreetmap.josm.actions.ZoomToAction;
    7 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable;
     7import org.openstreetmap.josm.data.osm.RelationMember;
     8import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel;
     9import org.openstreetmap.josm.gui.conflict.pair.PairTable;
    810import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel;
    911
    10 public class RelationMemberTable extends OsmPrimitivesTable {
     12public class RelationMemberTable extends PairTable {
    1113
    12     public RelationMemberTable(String name, OsmPrimitivesTableModel dm, ListSelectionModel sm) {
    13         super(dm, new RelationMemberListColumnModel(), sm);
    14         setName(name);
    15         setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
     14    public RelationMemberTable(String name, ListMergeModel<RelationMember> model, OsmPrimitivesTableModel dm, ListSelectionModel sm) {
     15        super(name, model, dm, new RelationMemberListColumnModel(), sm);
    1616    }
    1717
  • trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitivesTable.java

    r5297 r5301  
    7171        MapView.removeLayerChangeListener(zoomToAction);
    7272    }
     73   
     74    public OsmPrimitive getPrimitiveToZoomTo(int row, OsmDataLayer layer) {
     75        return getOsmPrimitivesTableModel().getReferredPrimitive(row);
     76    }
    7377
    7478    protected class PopupListener extends MouseAdapter {
Note: See TracChangeset for help on using the changeset viewer.