Changeset 34726 in osm


Ignore:
Timestamp:
2018-11-18T20:27:55+01:00 (6 years ago)
Author:
bwr57
Message:

Fixed errors

Location:
applications/editors/josm/plugins/CustomizePublicTransportStop
Files:
8 added
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CreateStopAreaFromSelectedObjectOperation.java

    r34501 r34726  
    1010import org.openstreetmap.josm.data.osm.Relation;
    1111import org.openstreetmap.josm.data.osm.RelationMember;
     12import sun.security.provider.certpath.IndexedCollectionCertStore;
    1213
    1314/**
     
    9596     * Setting of stop area from selected josm object
    9697     *
    97      * @param selectedObject Selected josm object
     98     * @param stopArea Selected stop area
    9899     */
    99100    public void fromSelectedObject(StopArea stopArea) {
     
    156157        if (getCurrentDataSet() == null)
    157158            return null;
    158         OsmPrimitive selectedObject = getCurrentDataSet().getSelectedNodesAndWays().iterator().next();
     159        Collection<OsmPrimitive> selectedObjects = getCurrentDataSet().getSelectedNodesAndWays();
     160        if(!(null != selectedObjects && !selectedObjects.isEmpty()))
     161            return null;
     162        OsmPrimitive selectedObject = selectedObjects.iterator().next();
    159163        if (selectedObject == null)
    160164            return null;
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CustomizePublicTransportStopDialog.java

    r34501 r34726  
    88import java.awt.GridBagLayout;
    99import java.awt.Insets;
    10 import java.awt.event.ActionEvent;
    11 import java.awt.event.ActionListener;
    12 import java.awt.event.ItemEvent;
    13 import java.awt.event.ItemListener;
     10import java.awt.event.*;
    1411import java.util.HashMap;
    1512
     
    2522import org.openstreetmap.josm.gui.MainApplication;
    2623
     24
    2725/**
    2826 * Dialog for setting stop area properties
     
    3028 * @author Rodion Scherbakov
    3129 */
    32 public class CustomizePublicTransportStopDialog implements ActionListener, ItemListener {
     30public class CustomizePublicTransportStopDialog implements ActionListener, ItemListener, KeyListener {
    3331    private static final String CANCEL_COMMAND = "cancel";
    3432    private static final String SAVE_COMMAND = "save";
     
    3735    private static final String AREA_CAPTION = "Area";
    3836    private static final String COVER_CAPTION = "Cover";
    39     private static final String SHELDER_CAPTION = "Shelder";
     37    private static final String SHELTER_CAPTION = "Shelter";
    4038    private static final String BENCH_CAPTION = "Bench";
    4139    private static final String RAILWAY_STOP_CAPTION = "Railway stop";
     
    8078    private JCheckBox checkBoxIsTrainStop;
    8179    private JCheckBox checkBoxIsBench;
    82     private JCheckBox checkBoxIsShelder;
     80    private JCheckBox checkBoxIsShelter;
    8381    private JCheckBox checkBoxIsCover;
    8482    private JCheckBox checkBoxIsArea;
     
    152150        jDialog.pack();
    153151        jDialog.setLocationRelativeTo(frame);
     152
     153        jDialog.addKeyListener(this);
     154        contentPane.addKeyListener(this);
     155
    154156    }
    155157
     
    165167        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    166168        gridbag.setConstraints(label, layoutCons);
     169        label.addKeyListener(this);
    167170        contentPane.add(label);
    168171
     
    173176        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    174177        gridbag.setConstraints(textFieldName, layoutCons);
     178        textFieldName.addKeyListener(this);
    175179        contentPane.add(textFieldName);
    176180
     
    181185        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    182186        gridbag.setConstraints(labelNameEn, layoutCons);
     187        labelNameEn.addKeyListener(this);
    183188        contentPane.add(labelNameEn);
    184189
     
    189194        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    190195        gridbag.setConstraints(textFieldNameEn, layoutCons);
     196        textFieldNameEn.addKeyListener(this);
    191197        contentPane.add(textFieldNameEn);
    192198
     
    197203        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    198204        gridbag.setConstraints(labelNetwork, layoutCons);
     205        labelNetwork.addKeyListener(this);
    199206        contentPane.add(labelNetwork);
    200207
     
    205212        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    206213        gridbag.setConstraints(textFieldNetwork, layoutCons);
     214        textFieldNetwork.addKeyListener(this);
    207215        contentPane.add(textFieldNetwork);
    208216
     
    213221        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    214222        gridbag.setConstraints(labelOperator, layoutCons);
     223        labelOperator.addKeyListener(this);
    215224        contentPane.add(labelOperator);
    216225
     
    221230        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    222231        gridbag.setConstraints(textFieldOperator, layoutCons);
     232        textFieldOperator.addKeyListener(this);
    223233        contentPane.add(textFieldOperator);
    224234
     
    229239        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    230240        gridbag.setConstraints(labelService, layoutCons);
     241        labelService.addKeyListener(this);
    231242        contentPane.add(labelService);
    232243
     
    242253        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    243254        gridbag.setConstraints(comboBoxService, layoutCons);
     255        comboBoxService.addKeyListener(this);
    244256        contentPane.add(comboBoxService);
    245257
     
    251263        gridbag.setConstraints(checkBoxIsBus, layoutCons);
    252264        checkBoxIsBus.addItemListener(this);
     265        checkBoxIsBus.addKeyListener(this);
    253266        contentPane.add(checkBoxIsBus);
    254267
     
    260273        gridbag.setConstraints(checkBoxIsShareTaxi, layoutCons);
    261274        checkBoxIsShareTaxi.addItemListener(this);
     275        checkBoxIsShareTaxi.addKeyListener(this);
    262276        contentPane.add(checkBoxIsShareTaxi);
    263277
     
    269283        gridbag.setConstraints(checkBoxIsTrolleybus, layoutCons);
    270284        checkBoxIsTrolleybus.addItemListener(this);
     285        checkBoxIsTrolleybus.addKeyListener(this);
    271286        contentPane.add(checkBoxIsTrolleybus);
    272287
     
    278293        gridbag.setConstraints(checkBoxIsBusStation, layoutCons);
    279294        checkBoxIsBusStation.addItemListener(this);
     295        checkBoxIsBusStation.addKeyListener(this);
    280296        contentPane.add(checkBoxIsBusStation);
    281297
     
    287303        gridbag.setConstraints(checkBoxIsTram, layoutCons);
    288304        checkBoxIsTram.addItemListener(this);
     305        checkBoxIsTram.addKeyListener(this);
    289306        contentPane.add(checkBoxIsTram);
    290307
     
    296313        gridbag.setConstraints(checkBoxIsTrainStation, layoutCons);
    297314        checkBoxIsTrainStation.addItemListener(this);
     315        checkBoxIsTrainStation.addKeyListener(this);
    298316        contentPane.add(checkBoxIsTrainStation);
    299317
     
    305323        gridbag.setConstraints(checkBoxIsTrainStop, layoutCons);
    306324        checkBoxIsTrainStop.addItemListener(this);
     325        checkBoxIsTrainStop.addKeyListener(this);
    307326        contentPane.add(checkBoxIsTrainStop);
    308327
     
    314333        gridbag.setConstraints(checkBoxIsAssignTransportType, layoutCons);
    315334        checkBoxIsAssignTransportType.addItemListener(this);
     335        checkBoxIsAssignTransportType.addKeyListener(this);
    316336        contentPane.add(checkBoxIsAssignTransportType);
    317337
     
    323343        gridbag.setConstraints(checkBoxIsBench, layoutCons);
    324344        checkBoxIsBench.addItemListener(this);
     345        checkBoxIsBench.addKeyListener(this);
    325346        contentPane.add(checkBoxIsBench);
    326347
    327         checkBoxIsShelder = new JCheckBox(tr(SHELDER_CAPTION));
     348        checkBoxIsShelter = new JCheckBox(tr(SHELTER_CAPTION));
    328349        layoutCons.gridx = 1;
    329350        layoutCons.gridy = 10;
    330351        layoutCons.weightx = 0.5;
    331352        layoutCons.fill = GridBagConstraints.HORIZONTAL;
    332         gridbag.setConstraints(checkBoxIsShelder, layoutCons);
    333         checkBoxIsShelder.addItemListener(this);
    334         contentPane.add(checkBoxIsShelder);
     353        gridbag.setConstraints(checkBoxIsShelter, layoutCons);
     354        checkBoxIsShelter.addItemListener(this);
     355        checkBoxIsShelter.addKeyListener(this);
     356        contentPane.add(checkBoxIsShelter);
    335357
    336358        checkBoxIsCover = new JCheckBox(tr(COVER_CAPTION));
     
    341363        gridbag.setConstraints(checkBoxIsCover, layoutCons);
    342364        checkBoxIsCover.addItemListener(this);
     365        checkBoxIsCover.addKeyListener(this);
    343366        contentPane.add(checkBoxIsCover);
    344367
     
    350373        gridbag.setConstraints(checkBoxIsArea, layoutCons);
    351374        checkBoxIsArea.addItemListener(this);
     375        checkBoxIsArea.addKeyListener(this);
    352376        contentPane.add(checkBoxIsArea);
    353377
     
    361385        buttonSave.setActionCommand(SAVE_COMMAND);
    362386        buttonSave.addActionListener(this);
     387        buttonSave.addKeyListener(this);
    363388        contentPane.add(buttonSave);
    364389
     
    372397        buttonCancel.setActionCommand(CANCEL_COMMAND);
    373398        buttonCancel.addActionListener(this);
     399        buttonCancel.addKeyListener(this);
    374400        contentPane.add(buttonCancel);
    375401        return contentPane;
     
    528554        setCheckBoxValue(checkBoxIsTrainStop, stopArea.isTrainStop);
    529555        setCheckBoxValue(checkBoxIsBench, stopArea.isBench);
    530         setCheckBoxValue(checkBoxIsShelder, stopArea.isShelter);
     556        setCheckBoxValue(checkBoxIsShelter, stopArea.isShelter);
    531557        setCheckBoxValue(checkBoxIsCover, stopArea.isCovered);
    532558        setCheckBoxValue(checkBoxIsArea, stopArea.isArea);
     
    573599            stopArea.isTrainStop = getCheckBoxValue(checkBoxIsTrainStop);
    574600            stopArea.isBench = getCheckBoxValue(checkBoxIsBench);
    575             stopArea.isShelter = getCheckBoxValue(checkBoxIsShelder);
     601            stopArea.isShelter = getCheckBoxValue(checkBoxIsShelter);
    576602            stopArea.isCovered = getCheckBoxValue(checkBoxIsCover);
    577603            stopArea.isArea = getCheckBoxValue(checkBoxIsArea);
     
    598624    }
    599625
     626    @Override
     627    public void keyTyped(KeyEvent e) {
     628
     629    }
     630
     631    @Override
     632    public void keyPressed(KeyEvent e) {
     633        if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
     634            setVisible(false);
     635        }
     636   }
     637
     638    @Override
     639    public void keyReleased(KeyEvent e) {
     640
     641    }
    600642}
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAreaOperation.java

    r34501 r34726  
    149149                "".equals(stopArea.operator) ? null : stopArea.operator);
    150150        commands = assignTag(commands, target, OSMTags.SERVICE_TAG,
    151                 null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service) ? null
     151                null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service)
     152                        || OSMTags.CITY_NETWORK_TAG_VALUE_OLD.equals(stopArea.service) ? null
    152153                        : stopArea.service);
    153154
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/OSMTags.java

    r34501 r34726  
    5858    public static final String SERVICE_TAG = "service";
    5959
    60     public static final String CITY_NETWORK_TAG_VALUE = "city";
     60    public static final String CITY_NETWORK_TAG_VALUE_OLD = "city";
     61    public static final String CITY_NETWORK_TAG_VALUE = "urban";
    6162    public static final String COMMUTER_NETWORK_TAG_VALUE = "commuter";
    6263    public static final String LOCAL_NETWORK_TAG_VALUE = "local";
Note: See TracChangeset for help on using the changeset viewer.