Package org.openstreetmap.josm.gui.widgets

Examples of org.openstreetmap.josm.gui.widgets.JosmTextField


            gc.weightx = 0.0;
            add(new JLabel(tr("Access Token Key:")), gc);

            gc.gridx = 1;
            gc.weightx = 1.0;
            add(tfAccessTokenKey = new JosmTextField(), gc);
            tfAccessTokenKey.setEditable(false);

            // -- access token secret
            gc.gridy = 2;
            gc.gridx = 0;
            gc.gridwidth = 1;
            gc.weightx = 0.0;
            add(new JLabel(tr("Access Token Secret:")), gc);

            gc.gridx = 1;
            gc.weightx = 1.0;
            add(tfAccessTokenSecret = new JosmTextField(), gc);
            tfAccessTokenSecret.setEditable(false);

            // -- access token secret
            gc.gridy = 3;
            gc.gridx = 0;
View Full Code Here


        tableModel = new ListTableModel();
        table = new JTable(tableModel);
        table.putClientProperty("terminateEditOnFocusLost", true);
        table.setTableHeader(null);

        DefaultCellEditor editor = new DefaultCellEditor(new JosmTextField());
        editor.setClickCountToStart(1);
        table.setDefaultEditor(table.getColumnClass(0), editor);

        JScrollPane pane = new JScrollPane(table);
        pane.setPreferredSize(new Dimension(140, 0));
View Full Code Here

        gc.insets = new Insets(0,0,0,3);
        add(lblApiUrl = new JLabel(tr("OSM Server URL:")), gc);

        gc.gridx = 1;
        gc.weightx = 1.0;
        add(tfOsmServerUrl = new JosmTextField(), gc);
        SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl);
        valOsmServerUrl = new ApiUrlValidator(tfOsmServerUrl);
        valOsmServerUrl.validate();
        propagator = new ApiUrlPropagator();
        tfOsmServerUrl.addActionListener(propagator);
View Full Code Here

    }

    protected void buildDownloadAreaInputFields() {
        latlon = new JosmTextField[4];
        for(int i=0; i< 4; i++) {
            latlon[i] = new JosmTextField(11);
            latlon[i].setMinimumSize(new Dimension(100,new JosmTextField().getMinimumSize().height));
            latlon[i].addFocusListener(new SelectAllOnFocusHandler(latlon[i]));
        }
        LatValueChecker latChecker = new LatValueChecker(latlon[0]);
        latlon[0].addFocusListener(latChecker);
        latlon[0].addActionListener(latChecker);
View Full Code Here

        tableModel = new MapTableModel();
        table = new JTable(tableModel);
        table.putClientProperty("terminateEditOnFocusLost", true);
        table.getTableHeader().getColumnModel().getColumn(0).setHeaderValue(tr("Key"));
        table.getTableHeader().getColumnModel().getColumn(1).setHeaderValue(tr("Value"));
        DefaultCellEditor editor = new DefaultCellEditor(new JosmTextField());
        editor.setClickCountToStart(1);
        table.setDefaultEditor(table.getColumnClass(0), editor);

        JScrollPane pane = new JScrollPane(table);
        pane.setPreferredSize(new Dimension(140, 0));
View Full Code Here

            pnl.add(new JLabel("X:"), gc);


            gc.gridx = 1;
            gc.weightx = 0.5;
            pnl.add(tfMinX = new JosmTextField(), gc);
            valMinX = new TileCoordinateValidator(tfMinX);
            SelectAllOnFocusGainedDecorator.decorate(tfMinX);
            tfMinX.addActionListener(tileBoundsBuilder);
            tfMinX.addFocusListener(tileBoundsBuilder);

            gc.gridx = 2;
            gc.weightx = 0.5;
            pnl.add(tfMaxX = new JosmTextField(), gc);
            valMaxX = new TileCoordinateValidator(tfMaxX);
            SelectAllOnFocusGainedDecorator.decorate(tfMaxX);
            tfMaxX.addActionListener(tileBoundsBuilder);
            tfMaxX.addFocusListener(tileBoundsBuilder);

            gc.gridx = 0;
            gc.gridy = 3;
            gc.weightx = 0.0;
            pnl.add(new JLabel("Y:"), gc);

            gc.gridx = 1;
            gc.weightx = 0.5;
            pnl.add(tfMinY = new JosmTextField(), gc);
            valMinY = new TileCoordinateValidator(tfMinY);
            SelectAllOnFocusGainedDecorator.decorate(tfMinY);
            tfMinY.addActionListener(tileBoundsBuilder);
            tfMinY.addFocusListener(tileBoundsBuilder);

            gc.gridx = 2;
            gc.weightx = 0.5;
            pnl.add(tfMaxY = new JosmTextField(), gc);
            valMaxY = new TileCoordinateValidator(tfMaxY);
            SelectAllOnFocusGainedDecorator.decorate(tfMaxY);
            tfMaxY.addActionListener(tileBoundsBuilder);
            tfMaxY.addFocusListener(tileBoundsBuilder);
View Full Code Here

            gc.insets = new Insets(0,0,2,2);
            pnl.add(new JLabel(tr("Tile address:")), gc);

            gc.weightx = 1.0;
            gc.gridx = 1;
            pnl.add(tfTileAddress = new JosmTextField(), gc);
            valTileAddress = new TileAddressValidator(tfTileAddress);
            SelectAllOnFocusGainedDecorator.decorate(tfTileAddress);

            gc.weightx = 0.0;
            gc.gridx = 2;
View Full Code Here

     * @return newly created entry or null if adding was cancelled
     */
    public PrefEntry addPreference(final JComponent gui) {
        JPanel p = new JPanel(new GridBagLayout());
        p.add(new JLabel(tr("Key")), GBC.std().insets(0,0,5,0));
        JosmTextField tkey = new JosmTextField("", 50);
        p.add(tkey, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));

        p.add(new JLabel(tr("Select Setting Type:")), GBC.eol().insets(5,15,5,0));

        JRadioButton rbString = new JRadioButton(tr("Simple"));
        JRadioButton rbList = new JRadioButton(tr("List"));
        JRadioButton rbListList = new JRadioButton(tr("List of lists"));
        JRadioButton rbMapList = new JRadioButton(tr("List of maps"));

        ButtonGroup group = new ButtonGroup();
        group.add(rbString);
        group.add(rbList);
        group.add(rbListList);
        group.add(rbMapList);

        p.add(rbString, GBC.eol());
        p.add(rbList, GBC.eol());
        p.add(rbListList, GBC.eol());
        p.add(rbMapList, GBC.eol());

        rbString.setSelected(true);

        ExtendedDialog dlg = new ExtendedDialog(gui, tr("Add setting"), new String[] {tr("OK"), tr("Cancel")});
        dlg.setButtonIcons(new String[] {"ok.png", "cancel.png"});
        dlg.setContent(p);
        dlg.showDialog();

        PrefEntry pe = null;
        boolean ok = false;
        if (dlg.getValue() == 1) {
            if (rbString.isSelected()) {
                StringSetting sSetting = new StringSetting(null);
                pe = new PrefEntry(tkey.getText(), sSetting, sSetting, false);
                StringEditor sEditor = new StringEditor(gui, pe, sSetting);
                sEditor.showDialog();
                if (sEditor.getValue() == 1) {
                    String data = sEditor.getData();
                    if (!Objects.equals(sSetting.getValue(), data)) {
                        pe.setValue(new StringSetting(data));
                        ok = true;
                    }
                }
            } else if (rbList.isSelected()) {
                ListSetting lSetting = new ListSetting(null);
                pe = new PrefEntry(tkey.getText(), lSetting, lSetting, false);
                ListEditor lEditor = new ListEditor(gui, pe, lSetting);
                lEditor.showDialog();
                if (lEditor.getValue() == 1) {
                    List<String> data = lEditor.getData();
                    if (!lSetting.equalVal(data)) {
                        pe.setValue(new ListSetting(data));
                        ok = true;
                    }
                }
            } else if (rbListList.isSelected()) {
                ListListSetting llSetting = new ListListSetting(null);
                pe = new PrefEntry(tkey.getText(), llSetting, llSetting, false);
                ListListEditor llEditor = new ListListEditor(gui, pe, llSetting);
                llEditor.showDialog();
                if (llEditor.getValue() == 1) {
                    List<List<String>> data = llEditor.getData();
                    if (!llSetting.equalVal(data)) {
                        pe.setValue(new ListListSetting(data));
                        ok = true;
                    }
                }
            } else if (rbMapList.isSelected()) {
                MapListSetting mlSetting = new MapListSetting(null);
                pe = new PrefEntry(tkey.getText(), mlSetting, mlSetting, false);
                MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting);
                mlEditor.showDialog();
                if (mlEditor.getValue() == 1) {
                    List<Map<String, String>> data = mlEditor.getData();
                    if (!mlSetting.equalVal(data)) {
View Full Code Here

        }
    }

    private static class SettingCellEditor extends DefaultCellEditor {
        public SettingCellEditor() {
            super(new JosmTextField());
        }
View Full Code Here

        JPanel cardLink = new JPanel(new GridBagLayout());
        final File file = layer.getAssociatedFile();
        final LayerSaveAction saveAction = new LayerSaveAction();
        final JButton save = new JButton(saveAction);
        if (file != null) {
            JosmTextField tf = new JosmTextField();
            tf.setText(file.getPath());
            tf.setEditable(false);
            cardLink.add(tf, GBC.std());
            save.setMargin(new Insets(0,0,0,0));
            cardLink.add(save, GBC.eol().insets(2,0,0,0));
        } else {
            cardLink.add(new JLabel(tr("No file association")), GBC.eol());
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.widgets.JosmTextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.