Ignore:
Timestamp:
2018-03-25T18:53:04+02:00 (20 months ago)
Author:
Don-vip
Message:

introduce PrimitiveRenderer to replace OsmPrimitivRenderer (now deprecated). Change NameFormatter API to support IPrimitive instead of OsmPrimitive. Enhances interfaces in consequence.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java

    r12663 r13564  
    2626 * @author imi
    2727 * @author Frederik Ramm
     28 * @deprecated since 13564. Use {@link PrimitiveRenderer} instead
    2829 */
     30@Deprecated
    2931public class OsmPrimitivRenderer implements ListCellRenderer<OsmPrimitive>, TableCellRenderer {
    3032    private final DefaultNameFormatter formatter = DefaultNameFormatter.getInstance();
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverColumnModel.java

    r12660 r13564  
    1212import javax.swing.table.TableColumn;
    1313
    14 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     14import org.openstreetmap.josm.gui.PrimitiveRenderer;
    1515import org.openstreetmap.josm.gui.conflict.ConflictColors;
    1616import org.openstreetmap.josm.gui.conflict.pair.relation.RelationMemberTable;
     
    2222public class RelationMemberConflictResolverColumnModel extends DefaultTableColumnModel {
    2323
    24     static final class MemberRenderer extends OsmPrimitivRenderer {
     24    static final class MemberRenderer extends PrimitiveRenderer {
    2525        @Override
    2626        public Component getTableCellRendererComponent(JTable table,
     
    3333    private final DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer();
    3434
    35     private final transient OsmPrimitivRenderer primitiveRenderer = new MemberRenderer();
     35    private final transient PrimitiveRenderer primitiveRenderer = new MemberRenderer();
    3636
    3737    private final transient TableCellRenderer tableRenderer = (table, value, isSelected, hasFocus, row, column)
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r13434 r13564  
    5757import org.openstreetmap.josm.gui.MainApplication;
    5858import org.openstreetmap.josm.gui.NavigatableComponent;
    59 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     59import org.openstreetmap.josm.gui.PrimitiveRenderer;
    6060import org.openstreetmap.josm.gui.PopupMenuHandler;
    6161import org.openstreetmap.josm.gui.SideButton;
     
    127127            lstConflicts = new JList<>(model);
    128128            lstConflicts.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    129             lstConflicts.setCellRenderer(new OsmPrimitivRenderer());
     129            lstConflicts.setCellRenderer(new PrimitiveRenderer());
    130130            lstConflicts.addMouseListener(new MouseEventHandler());
    131131        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java

    r12678 r13564  
    3737import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3838import org.openstreetmap.josm.data.osm.RelationToChildReference;
    39 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     39import org.openstreetmap.josm.gui.PrimitiveRenderer;
    4040import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
    4141import org.openstreetmap.josm.gui.help.HelpUtil;
     
    296296            col.setWidth(100);
    297297            col.setPreferredWidth(100);
    298             col.setCellRenderer(new OsmPrimitivRenderer());
     298            col.setCellRenderer(new PrimitiveRenderer());
    299299            addColumn(col);
    300300
     
    305305            col.setWidth(100);
    306306            col.setPreferredWidth(100);
    307             col.setCellRenderer(new OsmPrimitivRenderer());
     307            col.setCellRenderer(new PrimitiveRenderer());
    308308            addColumn(col);
    309309
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r13453 r13564  
    4949import org.openstreetmap.josm.data.osm.DataSet;
    5050import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     51import org.openstreetmap.josm.data.osm.IPrimitive;
    5152import org.openstreetmap.josm.data.osm.OsmPrimitive;
    5253import org.openstreetmap.josm.data.osm.Relation;
     
    6667import org.openstreetmap.josm.gui.MapView;
    6768import org.openstreetmap.josm.gui.NavigatableComponent;
    68 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    6969import org.openstreetmap.josm.gui.PopupMenuHandler;
     70import org.openstreetmap.josm.gui.PrimitiveRenderer;
    7071import org.openstreetmap.josm.gui.SideButton;
    7172import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
     
    322323    }
    323324
    324     static final class NoTooltipOsmRenderer extends OsmPrimitivRenderer {
    325         @Override
    326         protected String getComponentToolTipText(OsmPrimitive value) {
     325    static final class NoTooltipOsmRenderer extends PrimitiveRenderer {
     326        @Override
     327        protected String getComponentToolTipText(IPrimitive value) {
    327328            // Don't show the default tooltip in the relation list
    328329            return null;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r13545 r13564  
    6565import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    6666import org.openstreetmap.josm.gui.MainApplication;
    67 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     67import org.openstreetmap.josm.gui.PrimitiveRenderer;
    6868import org.openstreetmap.josm.gui.PopupMenuHandler;
    6969import org.openstreetmap.josm.gui.SideButton;
     
    113113        lstPrimitives.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    114114        lstPrimitives.setSelectionModel(selectionModel);
    115         lstPrimitives.setCellRenderer(new OsmPrimitivRenderer());
     115        lstPrimitives.setCellRenderer(new PrimitiveRenderer());
    116116        lstPrimitives.setTransferHandler(new SelectionTransferHandler());
    117117        if (!GraphicsEnvironment.isHeadless()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableCellRenderer.java

    r13344 r13564  
    1313/**
    1414 * The table cell renderer used in the changeset content table, except for the "name"
    15  * column in which we use a {@link org.openstreetmap.josm.gui.OsmPrimitivRenderer}.
     15 * column in which we use a {@link org.openstreetmap.josm.gui.PrimitiveRenderer}.
    1616 */
    1717public class ChangesetContentTableCellRenderer extends AbstractCellRenderer {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableColumnModel.java

    r10308 r13564  
    77import javax.swing.table.TableColumn;
    88
    9 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     9import org.openstreetmap.josm.gui.PrimitiveRenderer;
    1010
    1111/**
     
    4848        col.setResizable(true);
    4949        col.setPreferredWidth(200);
    50         col.setCellRenderer(new OsmPrimitivRenderer());
     50        col.setCellRenderer(new PrimitiveRenderer());
    5151        addColumn(col);
    5252    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java

    r13171 r13564  
    2424import org.openstreetmap.josm.data.osm.Relation;
    2525import org.openstreetmap.josm.gui.MainApplication;
    26 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     26import org.openstreetmap.josm.gui.PrimitiveRenderer;
    2727import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2828import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
     
    5959        setLayout(new BorderLayout());
    6060        referrers = new JList<>(model);
    61         referrers.setCellRenderer(new OsmPrimitivRenderer());
     61        referrers.setCellRenderer(new PrimitiveRenderer());
    6262        add(new JScrollPane(referrers), BorderLayout.CENTER);
    6363        referrers.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r13071 r13564  
    3636import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3737import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    38 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     38import org.openstreetmap.josm.gui.PrimitiveRenderer;
    3939import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
    4040import org.openstreetmap.josm.gui.help.HelpUtil;
     
    196196        protected void init() {
    197197            setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    198             setCellRenderer(new OsmPrimitivRenderer());
     198            setCellRenderer(new PrimitiveRenderer());
    199199        }
    200200
  • trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java

    r12370 r13564  
    1818
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
    20 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     20import org.openstreetmap.josm.gui.PrimitiveRenderer;
    2121
    2222/**
     
    5252    protected void build() {
    5353        setLayout(new GridBagLayout());
    54         OsmPrimitivRenderer renderer = new OsmPrimitivRenderer();
     54        PrimitiveRenderer renderer = new PrimitiveRenderer();
    5555        // initialize the three lists for uploaded primitives, but don't add them to the dialog yet, see setUploadedPrimitives()
    5656        //
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetNameTemplateList.java

    r12620 r13564  
    77import java.util.List;
    88
    9 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     9import org.openstreetmap.josm.data.osm.IPrimitive;
    1010import org.openstreetmap.josm.tools.Logging;
    1111
     
    5252     * @return the first occurence of preset with template name matching the primitive
    5353     */
    54     public TaggingPreset findPresetTemplate(OsmPrimitive primitive) {
     54    public TaggingPreset findPresetTemplate(IPrimitive primitive) {
    5555        synchronized (this) {
    5656            for (TaggingPreset t : presetsWithPattern) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetType.java

    r9615 r13564  
    22package org.openstreetmap.josm.gui.tagging.presets;
    33
    4 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     4import org.openstreetmap.josm.data.osm.IPrimitive;
    55import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    66
     
    4949     * @return the {@code TaggingPresetType} of {@code p}
    5050     */
    51     public static TaggingPresetType forPrimitive(OsmPrimitive p) {
     51    public static TaggingPresetType forPrimitive(IPrimitive p) {
    5252        return forPrimitiveType(p.getDisplayType());
    5353    }
Note: See TracChangeset for help on using the changeset viewer.