Changeset 14029 in josm


Ignore:
Timestamp:
2018-07-15T12:16:21+02:00 (3 months ago)
Author:
michael2402
Message:

See #16388: Checkstyle: Convert tabs to spaces.

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

Legend:

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

    r14027 r14029  
    251251            }
    252252        });
    253        
     253
    254254        IRelationEditorActionAccess actionAccess = new RelationEditorActionAccess();
    255255
     
    294294            // handle uncommon situation, that user has no keystroke assigned to paste
    295295            registerCopyPasteAction(new PasteMembersAction(actionAccess) {
    296                                 private static final long serialVersionUID = 1L;
    297 
    298                                 @Override
     296                private static final long serialVersionUID = 1L;
     297
     298                @Override
    299299                public void actionPerformed(ActionEvent e) {
    300300                    super.actionPerformed(e);
     
    609609     */
    610610    static class LeftButtonToolbar extends JToolBar {
    611                 private static final long serialVersionUID = 1L;
    612 
    613                 /**
     611        private static final long serialVersionUID = 1L;
     612
     613        /**
    614614         * Constructs a new {@code LeftButtonToolbar}.
    615615         * @param re relation editor
     
    622622            // Move
    623623            groups.add(buildNativeGroup(10,
    624                         new MoveUpAction(editorAccess, "moveUp"),
    625                         new MoveDownAction(editorAccess, "moveDown")
    626                         ));
     624                    new MoveUpAction(editorAccess, "moveUp"),
     625                    new MoveDownAction(editorAccess, "moveDown")
     626                    ));
    627627            // Edit
    628628            groups.add(buildNativeGroup(20,
    629                         new EditAction(editorAccess),
    630                         new RemoveAction(editorAccess, "removeSelected")
    631                         ));
     629                    new EditAction(editorAccess),
     630                    new RemoveAction(editorAccess, "removeSelected")
     631                    ));
    632632            // Sort
    633633            groups.add(buildNativeGroup(30,
    634                         new SortAction(editorAccess),
    635                         new SortBelowAction(editorAccess)
    636                         ));
     634                    new SortAction(editorAccess),
     635                    new SortBelowAction(editorAccess)
     636                    ));
    637637            // Reverse
    638638            groups.add(buildNativeGroup(40,
    639                         new ReverseAction(editorAccess)
    640                         ));
     639                    new ReverseAction(editorAccess)
     640                    ));
    641641            // Download
    642642            groups.add(buildNativeGroup(50,
    643                         new DownloadIncompleteMembersAction(editorAccess, "downloadIncomplete"),
    644                         new DownloadSelectedIncompleteMembersAction(editorAccess)
    645                         ));
     643                    new DownloadIncompleteMembersAction(editorAccess, "downloadIncomplete"),
     644                    new DownloadSelectedIncompleteMembersAction(editorAccess)
     645                    ));
    646646            groups.addAll(RelationEditorHooks.getMemberActions());
    647            
     647
    648648            IRelationEditorActionGroup.fillToolbar(this, groups, editorAccess);
    649            
     649
    650650
    651651            InputMap inputMap = editorAccess.getMemberTable().getInputMap(MemberTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
     
    654654            inputMap.put((KeyStroke) new MoveDownAction(editorAccess, "moveDown").getValue(AbstractAction.ACCELERATOR_KEY), "moveDown");
    655655            inputMap.put((KeyStroke) new DownloadIncompleteMembersAction(
    656                         editorAccess, "downloadIncomplete").getValue(AbstractAction.ACCELERATOR_KEY), "downloadIncomplete");
     656                    editorAccess, "downloadIncomplete").getValue(AbstractAction.ACCELERATOR_KEY), "downloadIncomplete");
    657657        }
    658658    }
     
    671671        tb.setFloatable(false);
    672672
    673                 List<IRelationEditorActionGroup> groups = new ArrayList<>();
    674                 groups.add(buildNativeGroup(10,
    675                                 new AddSelectedAtStartAction(editorAccess),
    676                                 new AddSelectedBeforeSelection(editorAccess),
    677                                 new AddSelectedAfterSelection(editorAccess),
    678                                 new AddSelectedAtEndAction(editorAccess)
    679                                 ));
    680                 groups.add(buildNativeGroup(20,
    681                                 new SelectedMembersForSelectionAction(editorAccess),
    682                                 new SelectPrimitivesForSelectedMembersAction(editorAccess)
    683                                 ));
    684                 groups.add(buildNativeGroup(30,
    685                                 new RemoveSelectedAction(editorAccess)
    686                                 ));
    687                 groups.addAll(RelationEditorHooks.getSelectActions());
    688        
     673        List<IRelationEditorActionGroup> groups = new ArrayList<>();
     674        groups.add(buildNativeGroup(10,
     675                new AddSelectedAtStartAction(editorAccess),
     676                new AddSelectedBeforeSelection(editorAccess),
     677                new AddSelectedAfterSelection(editorAccess),
     678                new AddSelectedAtEndAction(editorAccess)
     679                ));
     680        groups.add(buildNativeGroup(20,
     681                new SelectedMembersForSelectionAction(editorAccess),
     682                new SelectPrimitivesForSelectedMembersAction(editorAccess)
     683                ));
     684        groups.add(buildNativeGroup(30,
     685                new RemoveSelectedAction(editorAccess)
     686                ));
     687        groups.addAll(RelationEditorHooks.getSelectActions());
     688
    689689        IRelationEditorActionGroup.fillToolbar(tb, groups, editorAccess);
    690690        return tb;
    691691    }
    692    
     692
    693693    private static IRelationEditorActionGroup buildNativeGroup(int order, AbstractRelationEditorAction... actions) {
    694         return new IRelationEditorActionGroup() {
    695                 @Override
    696                 public int order() {
    697                         return order;
    698                 }
    699                
    700                         @Override
    701                         public List<AbstractRelationEditorAction> getActions(IRelationEditorActionAccess editorAccess) {
    702                                 return Arrays.asList(actions);
    703                         }
    704                 };
     694        return new IRelationEditorActionGroup() {
     695            @Override
     696            public int order() {
     697                return order;
     698            }
     699
     700            @Override
     701            public List<AbstractRelationEditorAction> getActions(IRelationEditorActionAccess editorAccess) {
     702                return Arrays.asList(actions);
     703            }
     704        };
    705705    }
    706706
     
    761761                tr("Focus Relation Editor with relation ''{0}'' in layer ''{1}''", name, layerName),
    762762                null, false, false) {
    763                         private static final long serialVersionUID = 1L;
    764 
    765                         @Override
     763            private static final long serialVersionUID = 1L;
     764
     765            @Override
    766766            public void actionPerformed(ActionEvent e) {
    767767                ((RelationEditor) getValue("relationEditor")).setVisible(true);
     
    949949        }
    950950    }
    951    
     951
    952952    private class RelationEditorActionAccess implements IRelationEditorActionAccess {
    953953
    954                 @Override
    955                 public MemberTable getMemberTable() {
    956                         return memberTable;
    957                 }
    958 
    959                 @Override
    960                 public MemberTableModel getMemberTableModel() {
    961                         return memberTableModel;
    962                 }
    963 
    964                 @Override
    965                 public SelectionTable getSelectionTable() {
    966                         return selectionTable;
    967                 }
    968 
    969                 @Override
    970                 public SelectionTableModel getSelectionTableModel() {
    971                         return selectionTableModel;
    972                 }
    973 
    974                 @Override
    975                 public IRelationEditor getEditor() {
    976                         return GenericRelationEditor.this;
    977                 }
    978 
    979                 @Override
    980                 public TagEditorModel getTagModel() {
    981                         return tagEditorPanel.getModel();
    982                 }
    983 
    984                 @Override
    985                 public AutoCompletingTextField getTextFieldRole() {
    986                         return tfRole;
    987                 }
    988        
     954        @Override
     955        public MemberTable getMemberTable() {
     956            return memberTable;
     957        }
     958
     959        @Override
     960        public MemberTableModel getMemberTableModel() {
     961            return memberTableModel;
     962        }
     963
     964        @Override
     965        public SelectionTable getSelectionTable() {
     966            return selectionTable;
     967        }
     968
     969        @Override
     970        public SelectionTableModel getSelectionTableModel() {
     971            return selectionTableModel;
     972        }
     973
     974        @Override
     975        public IRelationEditor getEditor() {
     976            return GenericRelationEditor.this;
     977        }
     978
     979        @Override
     980        public TagEditorModel getTagModel() {
     981            return tagEditorPanel.getModel();
     982        }
     983
     984        @Override
     985        public AutoCompletingTextField getTextFieldRole() {
     986            return tfRole;
     987        }
     988
    989989    }
    990990}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r14027 r14029  
    2020 */
    2121public abstract class RelationEditor extends ExtendedDialog implements IRelationEditor {
    22         private static final long serialVersionUID = 1L;
     22    private static final long serialVersionUID = 1L;
    2323
    24         /** the property name for the current relation.
     24    /** the property name for the current relation.
    2525     * @see #setRelation(Relation)
    2626     * @see #getRelation()
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditorHooks.java

    r14027 r14029  
    1414 */
    1515public class RelationEditorHooks {
    16        
    17         private static final CopyOnWriteArrayList<IRelationEditorActionGroup> memberActions = new CopyOnWriteArrayList<>();
    18         private static final CopyOnWriteArrayList<IRelationEditorActionGroup> selectionActions = new CopyOnWriteArrayList<>();
     16   
     17    private static final CopyOnWriteArrayList<IRelationEditorActionGroup> memberActions = new CopyOnWriteArrayList<>();
     18    private static final CopyOnWriteArrayList<IRelationEditorActionGroup> selectionActions = new CopyOnWriteArrayList<>();
    1919
    20         private RelationEditorHooks() {
    21                 // only static methods.
    22         }
    23        
    24         /**
    25         * Adds actions to the members action toolbar
    26         * @param group The group to add
    27         */
    28         public static void addActionsToMembers(IRelationEditorActionGroup group) {
    29                 memberActions.add(group);
    30         }
    31        
    32         /**
    33         * Adds actions to the selection action toolbar
    34         * @param group The group to add
    35         */
    36         public static void addActionsToSelectio(IRelationEditorActionGroup group) {
    37                 selectionActions.add(group);
    38         }
    39        
    40         /* package */ static List<IRelationEditorActionGroup> getMemberActions() {
    41                 return Collections.unmodifiableList(memberActions);
    42         }
    43        
    44         /* package */ static List<IRelationEditorActionGroup> getSelectActions() {
    45                 return Collections.unmodifiableList(selectionActions);
    46         }
    47        
     20    private RelationEditorHooks() {
     21        // only static methods.
     22    }
     23   
     24    /**
     25    * Adds actions to the members action toolbar
     26    * @param group The group to add
     27    */
     28    public static void addActionsToMembers(IRelationEditorActionGroup group) {
     29        memberActions.add(group);
     30    }
     31   
     32    /**
     33    * Adds actions to the selection action toolbar
     34    * @param group The group to add
     35    */
     36    public static void addActionsToSelectio(IRelationEditorActionGroup group) {
     37        selectionActions.add(group);
     38    }
     39   
     40    /* package */ static List<IRelationEditorActionGroup> getMemberActions() {
     41        return Collections.unmodifiableList(memberActions);
     42    }
     43   
     44    /* package */ static List<IRelationEditorActionGroup> getSelectActions() {
     45        return Collections.unmodifiableList(selectionActions);
     46    }
     47   
    4848}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java

    r14027 r14029  
    3030 */
    3131public abstract class AbstractRelationEditorAction extends AbstractAction
    32                 implements TableModelListener, ListSelectionListener, PropertyChangeListener {
    33         private static final long serialVersionUID = 1L;
    34         protected final transient IRelationEditorActionAccess editorAccess;
     32        implements TableModelListener, ListSelectionListener, PropertyChangeListener {
     33    private static final long serialVersionUID = 1L;
     34    protected final transient IRelationEditorActionAccess editorAccess;
    3535
    36         /**
    37         * Create a new relation editor action
    38         *
    39         * @param editorAccess
    40         *            The editor this action is for
    41         * @param actionMapKey
    42         *            The key for the member table action map.
    43         * @param updateOn
    44         *            The events that may cause the enabled state of this button to
    45         *            change.
    46         */
    47         protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess,
    48                         IRelationEditorUpdateOn... updateOn) {
    49                 Objects.requireNonNull(editorAccess, "editorAccess");
    50                 Objects.requireNonNull(updateOn, "updateOn");
    51                 this.editorAccess = editorAccess;
    52                 for (IRelationEditorUpdateOn u : updateOn) {
    53                         u.register(editorAccess, this);
    54                 }
    55         }
     36    /**
     37    * Create a new relation editor action
     38    *
     39    * @param editorAccess
     40    *            The editor this action is for
     41    * @param actionMapKey
     42    *            The key for the member table action map.
     43    * @param updateOn
     44    *            The events that may cause the enabled state of this button to
     45    *            change.
     46    */
     47    protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess,
     48            IRelationEditorUpdateOn... updateOn) {
     49        Objects.requireNonNull(editorAccess, "editorAccess");
     50        Objects.requireNonNull(updateOn, "updateOn");
     51        this.editorAccess = editorAccess;
     52        for (IRelationEditorUpdateOn u : updateOn) {
     53            u.register(editorAccess, this);
     54        }
     55    }
    5656
    57         /**
    58         * Create a new relation editor action
    59         *
    60         * @param editorAccess
    61         *            The editor this action is for
    62         * @param actionMapKey
    63         *            The key for the member table action map.
    64         * @param updateOn
    65         *            The events that may cause the enabled state of this button to
    66         *            change.
    67         */
    68         protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess, String actionMapKey,
    69                         IRelationEditorUpdateOn... updateOn) {
    70                 this(editorAccess, updateOn);
    71                 Objects.requireNonNull(actionMapKey, "actionMapKey");
     57    /**
     58    * Create a new relation editor action
     59    *
     60    * @param editorAccess
     61    *            The editor this action is for
     62    * @param actionMapKey
     63    *            The key for the member table action map.
     64    * @param updateOn
     65    *            The events that may cause the enabled state of this button to
     66    *            change.
     67    */
     68    protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess, String actionMapKey,
     69            IRelationEditorUpdateOn... updateOn) {
     70        this(editorAccess, updateOn);
     71        Objects.requireNonNull(actionMapKey, "actionMapKey");
    7272
    73                 this.editorAccess.addMemberTableAction(actionMapKey, this);
    74         }
     73        this.editorAccess.addMemberTableAction(actionMapKey, this);
     74    }
    7575
    76         @Override
    77         public void tableChanged(TableModelEvent e) {
    78                 updateEnabledState();
    79         }
     76    @Override
     77    public void tableChanged(TableModelEvent e) {
     78        updateEnabledState();
     79    }
    8080
    81         @Override
    82         public void valueChanged(ListSelectionEvent e) {
    83                 updateEnabledState();
    84         }
     81    @Override
     82    public void valueChanged(ListSelectionEvent e) {
     83        updateEnabledState();
     84    }
    8585
    8686    @Override
     
    8989    }
    9090
    91         protected abstract void updateEnabledState();
     91    protected abstract void updateEnabledState();
    9292
    93         protected final boolean canDownload() {
    94                 if (editorAccess.getEditor().getRelation() == null)
    95                         return false;
    96                 DataSet ds = editorAccess.getEditor().getRelation().getDataSet();
    97                 return !Main.isOffline(OnlineResource.OSM_API) && ds != null && !ds.isLocked()
    98                                 && !DownloadPolicy.BLOCKED.equals(ds.getDownloadPolicy());
    99         }
     93    protected final boolean canDownload() {
     94        if (editorAccess.getEditor().getRelation() == null)
     95            return false;
     96        DataSet ds = editorAccess.getEditor().getRelation().getDataSet();
     97        return !Main.isOffline(OnlineResource.OSM_API) && ds != null && !ds.isLocked()
     98                && !DownloadPolicy.BLOCKED.equals(ds.getDownloadPolicy());
     99    }
    100100
    101         protected MemberTable getMemberTable() {
    102                 return editorAccess.getMemberTable();
    103         }
     101    protected MemberTable getMemberTable() {
     102        return editorAccess.getMemberTable();
     103    }
    104104
    105         protected MemberTableModel getMemberTableModel() {
    106                 return editorAccess.getMemberTableModel();
    107         }
     105    protected MemberTableModel getMemberTableModel() {
     106        return editorAccess.getMemberTableModel();
     107    }
    108108
    109         protected SelectionTable getSelectionTable() {
    110                 return editorAccess.getSelectionTable();
    111         }
     109    protected SelectionTable getSelectionTable() {
     110        return editorAccess.getSelectionTable();
     111    }
    112112
    113         protected SelectionTableModel getSelectionTableModel() {
    114                 return editorAccess.getSelectionTableModel();
    115         }
     113    protected SelectionTableModel getSelectionTableModel() {
     114        return editorAccess.getSelectionTableModel();
     115    }
    116116
    117         protected IRelationEditor getEditor() {
    118                 return editorAccess.getEditor();
    119         }
     117    protected IRelationEditor getEditor() {
     118        return editorAccess.getEditor();
     119    }
    120120
    121         protected TagEditorModel getTagModel() {
    122                 return editorAccess.getTagModel();
    123         }
     121    protected TagEditorModel getTagModel() {
     122        return editorAccess.getTagModel();
     123    }
    124124
    125         protected OsmDataLayer getLayer() {
    126                 return editorAccess.getEditor().getLayer();
    127         }
     125    protected OsmDataLayer getLayer() {
     126        return editorAccess.getEditor().getLayer();
     127    }
    128128
    129         public boolean isExpertOnly() {
    130                 return false;
    131         }
     129    public boolean isExpertOnly() {
     130        return false;
     131    }
    132132}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddFromSelectionAction.java

    r14027 r14029  
    1717 */
    1818abstract class AddFromSelectionAction extends AbstractRelationEditorAction {
    19         private static final long serialVersionUID = 1L;
     19    private static final long serialVersionUID = 1L;
    2020
    2121    protected AddFromSelectionAction(IRelationEditorActionAccess editorAccess,
    22                         IRelationEditorUpdateOn... updateOn) {
     22            IRelationEditorUpdateOn... updateOn) {
    2323        super(editorAccess, updateOn);
    2424    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAfterSelection.java

    r14027 r14029  
    1515 */
    1616public class AddSelectedAfterSelection extends AddFromSelectionAction {
    17         private static final long serialVersionUID = 1L;
     17    private static final long serialVersionUID = 1L;
    1818
    1919    /**
     
    3232    @Override
    3333    protected void updateEnabledState() {
    34                 setEnabled(getSelectionTableModel().getRowCount() > 0
    35                                 && getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
     34        setEnabled(getSelectionTableModel().getRowCount() > 0
     35                && getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
    3636    }
    3737
     
    3939    public void actionPerformed(ActionEvent e) {
    4040        try {
    41                 getMemberTableModel().addMembersAfterIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
    42                                 getMemberTableModel().getSelectionModel().getMaxSelectionIndex());
     41            getMemberTableModel().addMembersAfterIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
     42                    getMemberTableModel().getSelectionModel().getMaxSelectionIndex());
    4343        } catch (AddAbortException ex) {
    4444            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtEndAction.java

    r14027 r14029  
    1515 */
    1616public class AddSelectedAtEndAction extends AddFromSelectionAction {
    17         private static final long serialVersionUID = 1L;
     17    private static final long serialVersionUID = 1L;
    1818
    1919    /**
     
    3838    public void actionPerformed(ActionEvent e) {
    3939        try {
    40                 getMemberTableModel().addMembersAtEnd(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
     40            getMemberTableModel().addMembersAtEnd(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
    4141        } catch (AddAbortException ex) {
    4242            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtStartAction.java

    r14027 r14029  
    1515 */
    1616public class AddSelectedAtStartAction extends AddFromSelectionAction {
    17         private static final long serialVersionUID = 1L;
     17    private static final long serialVersionUID = 1L;
    1818
    1919    /**
     
    3838    public void actionPerformed(ActionEvent e) {
    3939        try {
    40                 getMemberTableModel().addMembersAtBeginning(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
     40            getMemberTableModel().addMembersAtBeginning(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
    4141        } catch (AddAbortException ex) {
    4242            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedBeforeSelection.java

    r14027 r14029  
    1515 */
    1616public class AddSelectedBeforeSelection extends AddFromSelectionAction {
    17         private static final long serialVersionUID = 1L;
     17    private static final long serialVersionUID = 1L;
    1818
    1919    /**
     
    3232    @Override
    3333    protected void updateEnabledState() {
    34                 setEnabled(getSelectionTableModel().getRowCount() > 0
    35                                 && editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
     34        setEnabled(getSelectionTableModel().getRowCount() > 0
     35                && editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
    3636    }
    3737
     
    3939    public void actionPerformed(ActionEvent e) {
    4040        try {
    41                 editorAccess.getMemberTableModel().addMembersBeforeIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
    42                                 editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex());
     41            editorAccess.getMemberTableModel().addMembersBeforeIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
     42                    editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex());
    4343        } catch (AddAbortException ex) {
    4444            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java

    r14027 r14029  
    1313 */
    1414public class ApplyAction extends SavingAction {
    15         private static final long serialVersionUID = 1L;
     15    private static final long serialVersionUID = 1L;
    1616
    1717    /**
     
    3434    public void actionPerformed(ActionEvent e) {
    3535        if (applyChanges()) {
    36                 editorAccess.getEditor().reloadDataFromRelation();
     36            editorAccess.getEditor().reloadDataFromRelation();
    3737        }
    3838    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java

    r14027 r14029  
    2222 */
    2323public class CancelAction extends SavingAction {
    24         private static final long serialVersionUID = 1L;
     24    private static final long serialVersionUID = 1L;
    2525
    2626    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CopyMembersAction.java

    r14027 r14029  
    1414 */
    1515public class CopyMembersAction extends AddFromSelectionAction {
    16         private static final long serialVersionUID = 1L;
     16    private static final long serialVersionUID = 1L;
    1717
    1818    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java

    r14027 r14029  
    1818 */
    1919public class DeleteCurrentRelationAction extends AbstractRelationEditorAction implements PropertyChangeListener {
    20         private static final long serialVersionUID = 1L;
     20    private static final long serialVersionUID = 1L;
    2121
    2222    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadIncompleteMembersAction.java

    r14027 r14029  
    1919 */
    2020public class DownloadIncompleteMembersAction extends AbstractRelationEditorAction {
    21         private static final long serialVersionUID = 1L;
     21    private static final long serialVersionUID = 1L;
    2222
    2323    /**
     
    4545            return;
    4646        MainApplication.worker.submit(new DownloadRelationMemberTask(
    47                         getEditor().getRelation(),
     47                getEditor().getRelation(),
    4848                getMemberTableModel().getIncompleteMemberPrimitives(),
    4949                getLayer(),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadSelectedIncompleteMembersAction.java

    r14027 r14029  
    1616 */
    1717public class DownloadSelectedIncompleteMembersAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
     
    3939            return;
    4040        MainApplication.worker.submit(new DownloadRelationMemberTask(
    41                         getEditor().getRelation(),
     41                getEditor().getRelation(),
    4242                getMemberTableModel().getSelectedIncompleteMemberPrimitives(),
    4343                getLayer(),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DuplicateRelationAction.java

    r14027 r14029  
    1616 */
    1717public class DuplicateRelationAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/EditAction.java

    r14027 r14029  
    1919 */
    2020public class EditAction extends AbstractRelationEditorAction {
    21         private static final long serialVersionUID = 1L;
     21    private static final long serialVersionUID = 1L;
    2222
    2323    /**
     
    3737    protected void updateEnabledState() {
    3838        setEnabled(editorAccess.getMemberTable().getSelectedRowCount() == 1
    39                                 && editorAccess.getMemberTableModel()
    40                                                 .isEditableRelation(editorAccess.getMemberTable().getSelectedRow()));
     39                && editorAccess.getMemberTableModel()
     40                        .isEditableRelation(editorAccess.getMemberTable().getSelectedRow()));
    4141    }
    4242
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/IRelationEditorActionAccess.java

    r14027 r14029  
    2020public interface IRelationEditorActionAccess {
    2121
    22         /**
    23         * Adds a keyboard action to the member table.
    24         * @param actionMapKey The key to use
    25         * @param action The action to map for that key.
    26         */
    27         default void addMemberTableAction(String actionMapKey, Action action) {
    28                 getMemberTable().getActionMap().put(actionMapKey, action);
    29         }
     22    /**
     23    * Adds a keyboard action to the member table.
     24    * @param actionMapKey The key to use
     25    * @param action The action to map for that key.
     26    */
     27    default void addMemberTableAction(String actionMapKey, Action action) {
     28        getMemberTable().getActionMap().put(actionMapKey, action);
     29    }
    3030
    31         /**
    32         * Get the member table that is used by the dialog.
    33         * @return The member table
    34         */
    35         MemberTable getMemberTable();
    36        
    37         /**
    38         * Get the model the member table is using.
    39         * @return That model
    40         */
    41         MemberTableModel getMemberTableModel();
    42        
    43         /**
    44         * Get the table that displays the current user selection
    45         * @return That table
    46         */
    47         SelectionTable getSelectionTable();
    48        
    49         /**
    50         * Get the model that the selection table is based on.
    51         * @return The model
    52         */
     31    /**
     32    * Get the member table that is used by the dialog.
     33    * @return The member table
     34    */
     35    MemberTable getMemberTable();
     36   
     37    /**
     38    * Get the model the member table is using.
     39    * @return That model
     40    */
     41    MemberTableModel getMemberTableModel();
     42   
     43    /**
     44    * Get the table that displays the current user selection
     45    * @return That table
     46    */
     47    SelectionTable getSelectionTable();
     48   
     49    /**
     50    * Get the model that the selection table is based on.
     51    * @return The model
     52    */
    5353    SelectionTableModel getSelectionTableModel();
    5454   
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/IRelationEditorActionGroup.java

    r14027 r14029  
    1717public interface IRelationEditorActionGroup {
    1818
    19         /**
    20         * Get the position at which the action group should be added.
    21         *
    22         * @return The order index, default is to add at the end.
    23         */
    24         default int order() {
    25                 return 100;
    26         }
     19    /**
     20    * Get the position at which the action group should be added.
     21    *
     22    * @return The order index, default is to add at the end.
     23    */
     24    default int order() {
     25        return 100;
     26    }
    2727
    28         /**
    29         * Get the actions in this action group.
    30         *
    31         * @param editorAccess
    32         *            Methods to access the relation editor.
    33         * @return The actions
    34         */
    35         List<AbstractRelationEditorAction> getActions(IRelationEditorActionAccess editorAccess);
     28    /**
     29    * Get the actions in this action group.
     30    *
     31    * @param editorAccess
     32    *            Methods to access the relation editor.
     33    * @return The actions
     34    */
     35    List<AbstractRelationEditorAction> getActions(IRelationEditorActionAccess editorAccess);
    3636
    37         static void fillToolbar(JToolBar toolbar, List<IRelationEditorActionGroup> groups,
    38                         IRelationEditorActionAccess editorAccess) {
    39                 groups.stream().sorted(Comparator.comparingInt(IRelationEditorActionGroup::order)).forEach(group -> {
    40                         if (toolbar.getComponentCount() > 0) {
    41                                 toolbar.addSeparator();
    42                         }
     37    static void fillToolbar(JToolBar toolbar, List<IRelationEditorActionGroup> groups,
     38            IRelationEditorActionAccess editorAccess) {
     39        groups.stream().sorted(Comparator.comparingInt(IRelationEditorActionGroup::order)).forEach(group -> {
     40            if (toolbar.getComponentCount() > 0) {
     41                toolbar.addSeparator();
     42            }
    4343
    44                         for (AbstractRelationEditorAction action : group.getActions(editorAccess)) {
    45                                 JButton button = toolbar.add(action);
    46                                 if (action.isExpertOnly()) {
    47                                         ExpertToggleAction.addVisibilitySwitcher(button);
    48                                 }
    49                         }
    50                 });
    51         }
     44            for (AbstractRelationEditorAction action : group.getActions(editorAccess)) {
     45                JButton button = toolbar.add(action);
     46                if (action.isExpertOnly()) {
     47                    ExpertToggleAction.addVisibilitySwitcher(button);
     48                }
     49            }
     50        });
     51    }
    5252}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/IRelationEditorUpdateOn.java

    r14027 r14029  
    1212@FunctionalInterface
    1313public interface IRelationEditorUpdateOn {
    14         /**
    15         * Update when the member table contents change
    16         */
    17         IRelationEditorUpdateOn MEMBER_TABLE_CHANGE = (editor, action) -> editor.getMemberTableModel()
    18                         .addTableModelListener(action);
    19         /**
    20         * Update upon a member table selection change
    21         */
    22         IRelationEditorUpdateOn MEMBER_TABLE_SELECTION = (editor, action) -> editor.getMemberTable().getSelectionModel()
    23                         .addListSelectionListener(action);
     14    /**
     15    * Update when the member table contents change
     16    */
     17    IRelationEditorUpdateOn MEMBER_TABLE_CHANGE = (editor, action) -> editor.getMemberTableModel()
     18            .addTableModelListener(action);
     19    /**
     20    * Update upon a member table selection change
     21    */
     22    IRelationEditorUpdateOn MEMBER_TABLE_SELECTION = (editor, action) -> editor.getMemberTable().getSelectionModel()
     23            .addListSelectionListener(action);
    2424
    25         IRelationEditorUpdateOn TAG_CHANGE = (editor, action) -> editor.getTagModel().addPropertyChangeListener(action);
    26         IRelationEditorUpdateOn SELECTION_TABLE_CHANGE = (editor, action) -> editor.getSelectionTableModel()
    27                         .addTableModelListener(action);
     25    IRelationEditorUpdateOn TAG_CHANGE = (editor, action) -> editor.getTagModel().addPropertyChangeListener(action);
     26    IRelationEditorUpdateOn SELECTION_TABLE_CHANGE = (editor, action) -> editor.getSelectionTableModel()
     27            .addTableModelListener(action);
    2828
    29         void register(IRelationEditorActionAccess editor, AbstractRelationEditorAction action);
     29    void register(IRelationEditorActionAccess editor, AbstractRelationEditorAction action);
    3030}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveDownAction.java

    r14027 r14029  
    1616 */
    1717public class MoveDownAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
     
    3535    @Override
    3636    public void actionPerformed(ActionEvent e) {
    37         editorAccess.getMemberTableModel().moveDown(editorAccess.getMemberTable().getSelectedRows());
     37        editorAccess.getMemberTableModel().moveDown(editorAccess.getMemberTable().getSelectedRows());
    3838    }
    3939
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveUpAction.java

    r14027 r14029  
    1616 */
    1717public class MoveUpAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
     
    3535    @Override
    3636    public void actionPerformed(ActionEvent e) {
    37         editorAccess.getMemberTableModel().moveUp(editorAccess.getMemberTable().getSelectedRows());
     37        editorAccess.getMemberTableModel().moveUp(editorAccess.getMemberTable().getSelectedRows());
    3838    }
    3939
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/OKAction.java

    r14027 r14029  
    1313 */
    1414public class OKAction extends SavingAction {
    15         private static final long serialVersionUID = 1L;
     15    private static final long serialVersionUID = 1L;
    1616
    1717    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersAction.java

    r14027 r14029  
    1818 */
    1919public class PasteMembersAction extends AddFromSelectionAction implements FlavorListener {
    20         private static final long serialVersionUID = 1L;
     20    private static final long serialVersionUID = 1L;
    2121
    2222    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java

    r14027 r14029  
    2424 */
    2525public class RefreshAction extends SavingAction implements CommandQueueListener {
    26         private static final long serialVersionUID = 1L;
     26    private static final long serialVersionUID = 1L;
    2727
    2828    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RemoveAction.java

    r14027 r14029  
    1616 */
    1717public class RemoveAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RemoveSelectedAction.java

    r14027 r14029  
    1414 */
    1515public class RemoveSelectedAction extends AddFromSelectionAction {
    16         private static final long serialVersionUID = 1L;
     16    private static final long serialVersionUID = 1L;
    1717
    1818    /**
     
    4242    @Override
    4343    public void actionPerformed(ActionEvent e) {
    44         editorAccess.getMemberTableModel().removeMembersReferringTo(getSelectionTableModel().getSelection());
     44        editorAccess.getMemberTableModel().removeMembersReferringTo(getSelectionTableModel().getSelection());
    4545    }
    4646}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ReverseAction.java

    r14027 r14029  
    1313 */
    1414public class ReverseAction extends AbstractRelationEditorAction {
    15         private static final long serialVersionUID = 1L;
     15    private static final long serialVersionUID = 1L;
    1616
    1717    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r14027 r14029  
    3434 */
    3535abstract class SavingAction extends AbstractRelationEditorAction {
    36         private static final long serialVersionUID = 1L;
     36    private static final long serialVersionUID = 1L;
    3737
    3838    protected final AutoCompletingTextField tfRole;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectAction.java

    r14027 r14029  
    1414 */
    1515public class SelectAction extends AbstractRelationEditorAction {
    16         private static final long serialVersionUID = 1L;
     16    private static final long serialVersionUID = 1L;
    1717
    1818    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectPrimitivesForSelectedMembersAction.java

    r14027 r14029  
    1414 */
    1515public class SelectPrimitivesForSelectedMembersAction extends AbstractRelationEditorAction {
    16         private static final long serialVersionUID = 1L;
     16    private static final long serialVersionUID = 1L;
    1717
    1818    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectedMembersForSelectionAction.java

    r14027 r14029  
    1313 */
    1414public class SelectedMembersForSelectionAction extends AddFromSelectionAction {
    15         private static final long serialVersionUID = 1L;
     15    private static final long serialVersionUID = 1L;
    1616
    1717    /**
     
    3535        if (enabled) {
    3636            putValue(SHORT_DESCRIPTION, tr("Select relation members which refer to {0} objects in the current selection",
    37                         editorAccess.getMemberTableModel().getChildPrimitives(getLayer().data.getSelected()).size()));
     37                    editorAccess.getMemberTableModel().getChildPrimitives(getLayer().data.getSelected()).size()));
    3838        } else {
    3939            putValue(SHORT_DESCRIPTION, tr("Select relation members which refer to objects in the current selection"));
     
    4444    @Override
    4545    public void actionPerformed(ActionEvent e) {
    46         editorAccess.getMemberTableModel().selectMembersReferringTo(getLayer().data.getSelected());
     46        editorAccess.getMemberTableModel().selectMembersReferringTo(getLayer().data.getSelected());
    4747    }
    4848}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SetRoleAction.java

    r14027 r14029  
    2121 */
    2222public class SetRoleAction extends AbstractRelationEditorAction implements DocumentListener {
    23         private static final long serialVersionUID = 1L;
     23    private static final long serialVersionUID = 1L;
    2424
    2525    private final transient AutoCompletingTextField tfRole;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortAction.java

    r14027 r14029  
    1616 */
    1717public class SortAction extends AbstractRelationEditorAction {
    18         private static final long serialVersionUID = 1L;
     18    private static final long serialVersionUID = 1L;
    1919
    2020    /**
     
    3535    @Override
    3636    public void actionPerformed(ActionEvent e) {
    37         editorAccess.getMemberTableModel().sort();
     37        editorAccess.getMemberTableModel().sort();
    3838    }
    3939
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortBelowAction.java

    r14027 r14029  
    1313 */
    1414public class SortBelowAction extends AbstractRelationEditorAction {
    15         private static final long serialVersionUID = 1L;
     15    private static final long serialVersionUID = 1L;
    1616
    1717    /**
     
    3030    @Override
    3131    public void actionPerformed(ActionEvent e) {
    32         editorAccess.getMemberTableModel().sortBelow();
     32        editorAccess.getMemberTableModel().sortBelow();
    3333    }
    3434
     
    4040    @Override
    4141    public boolean isExpertOnly() {
    42         return true;
     42        return true;
    4343    }
    4444}
Note: See TracChangeset for help on using the changeset viewer.