Changeset 13959 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2018-06-19T19:44:45+02:00 (16 months ago)
Author:
Don-vip
Message:

use IRelation in PropertiesDialog

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/HelpAction.java

    r13849 r13959  
    2020import javax.swing.KeyStroke;
    2121
    22 import org.openstreetmap.josm.data.osm.Relation;
     22import org.openstreetmap.josm.data.osm.IRelation;
    2323import org.openstreetmap.josm.gui.MainApplication;
    2424import org.openstreetmap.josm.spi.preferences.Config;
     
    4040
    4141    private final JTable membershipTable;
    42     private final IntFunction<Relation> memberValueSupplier;
     42    private final IntFunction<IRelation<?>> memberValueSupplier;
    4343
    4444    /**
     
    4949     * @param membershipTable The membership table. Can be null
    5050     * @param memberValueSupplier Finds the parent relation from given row of membership table. Can be null
     51     * @since 13959 (signature)
    5152     */
    5253    public HelpAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier,
    53             JTable membershipTable, IntFunction<Relation> memberValueSupplier) {
     54            JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier) {
    5455        this.tagTable = Objects.requireNonNull(tagTable);
    5556        this.tagKeySupplier = Objects.requireNonNull(tagKeySupplier);
     
    128129     * @throws URISyntaxException in case of internal error
    129130     * @since 13522
    130      */
    131     public static List<URI> getRelationURIs(String base, String lang, Relation rel) throws URISyntaxException {
     131     * @since 13959 (signature)
     132     */
     133    public static List<URI> getRelationURIs(String base, String lang, IRelation<?> rel) throws URISyntaxException {
    132134        List<URI> uris = new ArrayList<>();
    133135        String type = rel.get("type");
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r13956 r13959  
    178178    private final transient DataSetListenerAdapter dataChangedAdapter = new DataSetListenerAdapter(this);
    179179    private final HelpAction helpAction = new HelpAction(tagTable, editHelper::getDataKey, editHelper::getDataValues,
    180             membershipTable, x -> (Relation) membershipData.getValueAt(x, 0));
     180            membershipTable, x -> (IRelation<?>) membershipData.getValueAt(x, 0));
    181181    private final TaginfoAction taginfoAction = new TaginfoAction(tagTable, editHelper::getDataKey, editHelper::getDataValues,
    182             membershipTable, x -> (Relation) membershipData.getValueAt(x, 0));
     182            membershipTable, x -> (IRelation<?>) membershipData.getValueAt(x, 0));
    183183    private final PasteValueAction pasteValueAction = new PasteValueAction();
    184184    private final CopyValueAction copyValueAction = new CopyValueAction(
     
    378378            protected int checkTableSelection(JTable table, Point p) {
    379379                int row = super.checkTableSelection(table, p);
    380                 List<Relation> rels = new ArrayList<>();
     380                List<IRelation<?>> rels = new ArrayList<>();
    381381                for (int i: table.getSelectedRows()) {
    382                     rels.add((Relation) table.getValueAt(i, 0));
     382                    rels.add((IRelation<?>) table.getValueAt(i, 0));
    383383                }
    384384                membershipMenuHandler.setPrimitives(rels);
     
    569569        Collection<? extends IPrimitive> newSel = Main.main.getInProgressISelection();
    570570        String selectedTag;
    571         Relation selectedRelation = null;
     571        IRelation<?> selectedRelation = null;
    572572        selectedTag = editHelper.getChangedKey(); // select last added or last edited key by default
    573573        if (selectedTag == null && tagTable.getSelectedRowCount() == 1) {
     
    575575        }
    576576        if (membershipTable.getSelectedRowCount() == 1) {
    577             selectedRelation = (Relation) membershipData.getValueAt(membershipTable.getSelectedRow(), 0);
     577            selectedRelation = (IRelation<?>) membershipData.getValueAt(membershipTable.getSelectedRow(), 0);
    578578        }
    579579
     
    775775            if (c instanceof JLabel) {
    776776                JLabel label = (JLabel) c;
    777                 Relation r = (Relation) value;
     777                IRelation<?> r = (IRelation<?>) value;
    778778                label.setText(r.getDisplayName(DefaultNameFormatter.getInstance()));
    779779                if (r.isDisabledAndHidden()) {
     
    792792                return this;
    793793            Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
    794             boolean isDisabledAndHidden = ((Relation) table.getValueAt(row, 0)).isDisabledAndHidden();
     794            boolean isDisabledAndHidden = ((IRelation<?>) table.getValueAt(row, 0)).isDisabledAndHidden();
    795795            if (c instanceof JLabel) {
    796796                JLabel label = (JLabel) c;
     
    809809                boolean isSelected, boolean hasFocus, int row, int column) {
    810810            Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
    811             boolean isDisabledAndHidden = ((Relation) table.getValueAt(row, 0)).isDisabledAndHidden();
     811            boolean isDisabledAndHidden = ((IRelation<?>) table.getValueAt(row, 0)).isDisabledAndHidden();
    812812            if (c instanceof JLabel) {
    813813                JLabel label = (JLabel) c;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TaginfoAction.java

    r13849 r13959  
    1212
    1313import org.openstreetmap.josm.actions.JosmAction;
    14 import org.openstreetmap.josm.data.osm.Relation;
     14import org.openstreetmap.josm.data.osm.IRelation;
    1515import org.openstreetmap.josm.data.preferences.StringProperty;
    1616import org.openstreetmap.josm.tools.OpenBrowser;
     
    3030
    3131    private final JTable membershipTable;
    32     private final IntFunction<Relation> memberValueSupplier;
     32    private final IntFunction<IRelation<?>> memberValueSupplier;
    3333
    3434    /**
     
    3939     * @param membershipTable The membership table. Can be null
    4040     * @param memberValueSupplier Finds the parent relation from given row of membership table. Can be null
     41     * @since 13959 (signature)
    4142     */
    4243    public TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier,
    43             JTable membershipTable, IntFunction<Relation> memberValueSupplier) {
     44            JTable membershipTable, IntFunction<IRelation<?>> memberValueSupplier) {
    4445        super(tr("Go to Taginfo"), "dialogs/taginfo", tr("Launch browser with Taginfo statistics for selected object"), null, false);
    4546        this.tagTable = Objects.requireNonNull(tagTable);
Note: See TracChangeset for help on using the changeset viewer.