Ignore:
Timestamp:
2017-09-26T21:52:28+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #15267 - fix various usability problems with new download dialog

File:
1 edited

Legend:

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

    r12900 r12903  
    88import java.awt.GridBagLayout;
    99import java.awt.event.ActionEvent;
     10import java.awt.event.FocusAdapter;
    1011import java.awt.event.FocusEvent;
    11 import java.awt.event.FocusListener;
    1212import java.util.Collection;
    1313import java.util.concurrent.Future;
     
    1515
    1616import javax.swing.AbstractAction;
    17 import javax.swing.Action;
    1817import javax.swing.Icon;
    1918import javax.swing.JButton;
     
    3231import org.openstreetmap.josm.data.preferences.BooleanProperty;
    3332import org.openstreetmap.josm.data.preferences.IntegerProperty;
     33import org.openstreetmap.josm.data.preferences.StringProperty;
    3434import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    3535import org.openstreetmap.josm.gui.MainApplication;
     
    9090        private static final String ACTION_IMG_SUBDIR = "dialogs";
    9191
     92        private static final StringProperty DOWNLOAD_QUERY = new StringProperty("download.overpass.query",
     93                "/*\n" + tr("Place your Overpass query below or generate one using the Overpass Turbo Query Wizard") + "\n*/");
     94
    9295        private final JosmTextArea overpassQuery;
    9396        private final UserQueryList overpassQueryList;
     
    102105
    103106            String tooltip = tr("Build an Overpass query using the Overpass Turbo Query Wizard tool");
    104             Action queryWizardAction = new AbstractAction() {
     107
     108            JButton openQueryWizard = new JButton(tr("Query Wizard"));
     109            openQueryWizard.setToolTipText(tooltip);
     110            openQueryWizard.addActionListener(new AbstractAction() {
    105111                @Override
    106112                public void actionPerformed(ActionEvent e) {
    107113                    new OverpassQueryWizardDialog(OverpassDownloadSourcePanel.this).showDialog();
    108114                }
    109             };
    110 
    111             JButton openQueryWizard = new JButton(tr("Query Wizard"));
    112             openQueryWizard.setToolTipText(tooltip);
    113             openQueryWizard.addActionListener(queryWizardAction);
    114 
    115             // CHECKSTYLE.OFF: LineLength
    116             this.overpassQuery = new JosmTextArea(
    117                     "/*\n" +
    118                             tr("Place your Overpass query below or generate one using the Overpass Turbo Query Wizard")
    119                             + "\n*/",
    120                     8, 80);
    121             // CHECKSTYLE.ON: LineLength
     115            });
     116
     117            this.overpassQuery = new JosmTextArea(DOWNLOAD_QUERY.get(), 8, 80);
    122118            this.overpassQuery.setFont(GuiHelper.getMonospacedFont(overpassQuery));
    123             this.overpassQuery.addFocusListener(new FocusListener() {
     119            this.overpassQuery.addFocusListener(new FocusAdapter() {
    124120                @Override
    125121                public void focusGained(FocusEvent e) {
    126122                    overpassQuery.selectAll();
    127123                }
    128 
    129                 @Override
    130                 public void focusLost(FocusEvent e) {
    131                     // ignored
    132                 }
    133124            });
    134 
    135125
    136126            this.overpassQueryList = new UserQueryList(this, this.overpassQuery, "download.overpass.query");
     
    207197        @Override
    208198        public void rememberSettings() {
    209             // nothing
     199            DOWNLOAD_QUERY.put(overpassQuery.getText());
    210200        }
    211201
    212202        @Override
    213203        public void restoreSettings() {
    214             // nothing
     204            overpassQuery.setText(DOWNLOAD_QUERY.get());
    215205        }
    216206
Note: See TracChangeset for help on using the changeset viewer.