Changeset 13675 in josm for trunk/src


Ignore:
Timestamp:
2018-04-24T22:32:26+02:00 (7 years ago)
Author:
Don-vip
Message:

rework constructors of MemberRoleCellEditor / MemberTableColumnModel

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java

    r12758 r13675  
    1010import javax.swing.table.TableCellEditor;
    1111
    12 import org.openstreetmap.josm.data.osm.DataSet;
    1312import org.openstreetmap.josm.data.osm.Relation;
    1413import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
     
    2120public class MemberRoleCellEditor extends AbstractCellEditor implements TableCellEditor {
    2221    private final AutoCompletingTextField editor;
    23     private final transient DataSet ds;
     22    private final AutoCompletionManager autoCompletionManager;
    2423    private final transient Relation relation;
    2524
     
    2928    /**
    3029     * Constructs a new {@code MemberRoleCellEditor}.
    31      * @param ds the data set. Must not be null
     30     * @param autoCompletionManager the auto completion manager. Must not be null
    3231     * @param relation the relation. Can be null
     32     * @since 13675
    3333     */
    34     public MemberRoleCellEditor(DataSet ds, Relation relation) {
    35         this.ds = ds;
     34    public MemberRoleCellEditor(AutoCompletionManager autoCompletionManager, Relation relation) {
     35        this.autoCompletionManager = autoCompletionManager;
    3636        this.relation = relation;
    3737        editor = new AutoCompletingTextField(0, false);
     
    4848        editor.setText(role);
    4949        autoCompletionList.clear();
    50         AutoCompletionManager.of(ds).populateWithMemberRoles(autoCompletionList, relation);
     50        autoCompletionManager.populateWithMemberRoles(autoCompletionList, relation);
    5151        return editor;
    5252    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java

    r13176 r13675  
    3838import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    3939import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     40import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    4041import org.openstreetmap.josm.gui.util.HighlightHelper;
    4142import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable;
     
    6061     */
    6162    public MemberTable(OsmDataLayer layer, Relation relation, MemberTableModel model) {
    62         super(model, new MemberTableColumnModel(layer.data, relation), model.getSelectionModel());
     63        super(model, new MemberTableColumnModel(AutoCompletionManager.of(layer.data), relation), model.getSelectionModel());
    6364        setLayer(layer);
    6465        model.addMemberModelListener(this);
     
    133134        if (!highlightEnabled) return;
    134135        getMemberTableModel().getSelectionModel().addListSelectionListener(highlighterListener);
    135         if (MainApplication.isDisplayingMapView()) {
    136             HighlightHelper.clearAllHighlighted();
    137             MainApplication.getMap().mapView.repaint();
    138         }
     136        clearAllHighlighted();
    139137    }
    140138
     
    153151    }
    154152
     153    /**
     154     * Stops highlighting of selected objects.
     155     */
    155156    public void stopHighlighting() {
    156157        if (highlighterListener == null) return;
     
    158159        getMemberTableModel().getSelectionModel().removeListSelectionListener(highlighterListener);
    159160        highlighterListener = null;
     161        clearAllHighlighted();
     162    }
     163
     164    private static void clearAllHighlighted() {
    160165        if (MainApplication.isDisplayingMapView()) {
    161166            HighlightHelper.clearAllHighlighted();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableColumnModel.java

    r12657 r13675  
    77import javax.swing.table.TableColumn;
    88
    9 import org.openstreetmap.josm.data.osm.DataSet;
    109import org.openstreetmap.josm.data.osm.Relation;
     10import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    1111
    1212/**
     
    1717    /**
    1818     * Constructs a new {@code MemberTableColumnModel}.
    19      * @param ds the data set. Must not be null
     19     * @param autoCompletionManager the auto completion manager. Must not be null
    2020     * @param relation the relation. Can be null
     21     * @since 13675
    2122     */
    22     public MemberTableColumnModel(DataSet ds, Relation relation) {
     23    public MemberTableColumnModel(AutoCompletionManager autoCompletionManager, Relation relation) {
    2324        TableColumn col = null;
    2425
     
    2930        col.setPreferredWidth(100);
    3031        col.setCellRenderer(new MemberTableRoleCellRenderer());
    31         col.setCellEditor(new MemberRoleCellEditor(ds, relation));
     32        col.setCellEditor(new MemberRoleCellEditor(autoCompletionManager, relation));
    3233        addColumn(col);
    3334
Note: See TracChangeset for help on using the changeset viewer.