Package org.openstreetmap.josm.gui

Examples of org.openstreetmap.josm.gui.ExtendedDialog$HelpAction


        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();
View Full Code Here


            int rowCount = membershipTable.getRowCount();
            if (rowCount > 1) {
                nextRelation = (Relation)membershipData.getValueAt((row + 1 < rowCount ? row + 1 : row - 1), 0);
            }

            ExtendedDialog ed = new ExtendedDialog(Main.parent,
                    tr("Change relation"),
                    new String[] {tr("Delete from relation"), tr("Cancel")});
            ed.setButtonIcons(new String[] {"dialogs/delete.png", "cancel.png"});
            ed.setContent(tr("Really delete selection from relation {0}?", cur.getDisplayName(DefaultNameFormatter.getInstance())));
            ed.toggleEnable(DELETE_FROM_RELATION_PREF);
            ed.showDialog();

            if(ed.getValue() != 1)
                return;

            Relation rel = new Relation(cur);
            for (OsmPrimitive primitive: Main.main.getInProgressSelection()) {
                rel.removeMembersFor(primitive);
View Full Code Here

        layerList.setRenderer(new LayerListCellRenderer());
        layerList.setSelectedIndex(0);
        JPanel pnl = new JPanel(new GridBagLayout());
        pnl.add(new JLabel(tr("Please select the imagery layer.")), GBC.eol());
        pnl.add(layerList, GBC.eol());
        ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Select imagery layer"), new String[]{tr("Download"), tr("Cancel")});
        ed.setButtonIcons(new String[]{"dialogs/down", "cancel"});
        ed.setContent(pnl);
        ed.showDialog();
        if (ed.getValue() != 1) {
            return null;
        }
        return (WMSLayer) layerList.getSelectedItem();
    }
View Full Code Here

        // make the table scrollable
        JScrollPane scrollPane = new JScrollPane(table);
        msg.add(scrollPane, GBC.eol().fill(GBC.BOTH));

        // build dialog
        ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Set track visibility for {0}", layer.getName()), new String[]{tr("Show all"), tr("Show selected only"), tr("Cancel")});
        ed.setButtonIcons(new String[]{"dialogs/layerlist/eye", "dialogs/filter", "cancel"});
        ed.setContent(msg, false);
        ed.setDefaultButton(2);
        ed.setCancelButton(3);
        ed.configureContextsensitiveHelp("/Action/ChooseTrackVisibility", true);
        ed.setRememberWindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(Main.parent, new Dimension(1000, 500)));
        ed.showDialog();
        dateFilter.saveInPrefs();
        int v = ed.getValue();
        // cancel for unknown buttons and copy back original settings
        if (v != 1 && v != 2) {
            layer.trackVisibility = Arrays.copyOf(trackVisibilityBackup, layer.trackVisibility.length);
            Main.map.repaint();
            return;
View Full Code Here

        }
        return true;
    }

    private static int warning(String text, String data, String code) {
        ExtendedDialog ed = new ExtendedDialog(
                    Main.parent,
                    tr("Do you want to paste these tags?"),
                    new String[]{tr("Ok"), tr("Cancel"), tr("Clear buffer"), tr("Ignore warnings")});
        ed.setButtonIcons(new String[]{"ok.png", "cancel.png", "dialogs/delete.png", "pastetags.png"});
        ed.setContent("<html><b>"+text + "</b><br/><br/><div width=\"300px\">"+XmlWriter.encode(data,true)+"</html>");
        ed.setDefaultButton(2);
        ed.setCancelButton(2);
        ed.setIcon(JOptionPane.WARNING_MESSAGE);
        ed.toggleEnable(code);
        ed.showDialog();
        int r = ed.getValue();
        if (r==0) r = 2;
        // clean clipboard if user asked
        if (r==3) Utils.copyToClipboard("");
        return r;
    }
View Full Code Here

        String helpUrl = HelpUtil.getHelpTopicUrl(HelpUtil.buildAbsoluteHelpTopic(helpTopic, LocaleType.DEFAULT));
        if (helpUrl != null) {
            p.add(new UrlLabel(helpUrl), GBC.eop());
        }

        ExtendedDialog ed = new ExtendedDialog(
                    Main.parent,
                    tr("Warning"),
                    new String[]{tr("Ok"), tr("Clear buffer")});

        ed.setButtonIcons(new String[]{"ok.png", "dialogs/delete.png"});

        ed.setContent(p);
        ed.setDefaultButton(1);
        ed.setCancelButton(1);
        ed.setIcon(JOptionPane.WARNING_MESSAGE);
        ed.toggleEnable("tags.paste.cleanbadbuffer");
        ed.showDialog();

        int r = ed.getValue();
        // clean clipboard if user asked
        if (r==2) Utils.copyToClipboard("");
    }
View Full Code Here

        return file;
    }

    public static boolean confirmOverwrite(File file) {
        if (file == null || (file.exists())) {
            ExtendedDialog dialog = new ExtendedDialog(
                    Main.parent,
                    tr("Overwrite"),
                    new String[] {tr("Overwrite"), tr("Cancel")}
            );
            dialog.setContent(tr("File exists. Overwrite?"));
            dialog.setButtonIcons(new String[] {"save_as.png", "cancel.png"});
            dialog.showDialog();
            return (dialog.getValue() == 1);
        }
        return true;
    }
View Full Code Here

        );
        pnlMessage.setPreferredSize(new Dimension(500, 150));
        p.add(pnlMessage, GBC.eol().fill(GBC.HORIZONTAL));
        p.add(new JScrollPane(errorPanel), GBC.eol().fill(GBC.BOTH));

        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Suspicious data found. Upload anyway?"),
                new String[] {tr("Continue upload"), tr("Cancel")});
        ed.setButtonIcons(new String[] {"ok.png", "cancel.png"});
        ed.setContent(p);
        ed.showDialog();

        if (ed.getValue() != 1) {
            OsmValidator.initializeTests();
            OsmValidator.initializeErrorLayer();
            Main.map.validatorDialog.unfurlDialog();
            Main.main.getCurrentDataSet().fireSelectionChanged();
            return false;
View Full Code Here

            } else {
                break;
            }
        }
        JPanel pnl = buildWarningPanel(dep);
        ExtendedDialog dialog = new ExtendedDialog(
                Main.parent,
                tr("Cycling dependencies"),
                new String[] {tr("OK")}
        );
        dialog.setContent(pnl, false /* don't embed in scroll pane */);
        dialog.setButtonIcons(new String[] {"ok"});
        dialog.setRememberWindowGeometry(
                getClass().getName() + ".geometry",
                WindowGeometry.centerInWindow(Main.parent, new Dimension(300, 300))
        );
        dialog.showDialog();
    }
View Full Code Here

        }

        panel.add(new JLabel(tr("WMS URL or Image ID:")), GBC.eol());
        panel.add(tfWmsUrl, GBC.eol().fill(GridBagConstraints.HORIZONTAL));

        ExtendedDialog diag = new ExtendedDialog(Main.parent,
                tr("Add Rectified Image"),

                new String[] {tr("Add Rectified Image"), tr("Cancel")});
        diag.setContent(panel);
        diag.setButtonIcons(new String[] {"OLmarker.png", "cancel.png"});

        // This repeatedly shows the dialog in case there has been an error.
        // The loop is break;-ed if the users cancels
        outer: while(true) {
            diag.showDialog();
            int answer = diag.getValue();
            // Break loop when the user cancels
            if(answer != 1) {
                break;
            }

            String text = tfWmsUrl.getText().trim();
            // Loop all services until we find the selected one
            for(RectifierService s : services) {
                if(!s.isSelected()) {
                    continue;
                }

                // We've reached the custom WMS URL service
                // Just set the URL and hope everything works out
                if(s.wmsUrl.isEmpty()) {
                    addWMSLayer(s.name + " (" + text + ")", text);
                    break outer;
                }

                // First try to match if the entered string as an URL
                Matcher m = s.urlRegEx.matcher(text);
                if(m.find()) {
                    String id = m.group(1);
                    String newURL = s.wmsUrl.replaceAll("__s__", id);
                    String title = s.name + " (" + id + ")";
                    addWMSLayer(title, newURL);
                    break outer;
                }
                // If not, look if it's a valid ID for the selected service
                if(s.idValidator.matcher(text).matches()) {
                    String newURL = s.wmsUrl.replaceAll("__s__", text);
                    String title = s.name + " (" + text + ")";
                    addWMSLayer(title, newURL);
                    break outer;
                }

                // We've found the selected service, but the entered string isn't suitable for
                // it. So quit checking the other radio buttons
                break;
            }

            // and display an error message. The while(true) ensures that the dialog pops up again
            JOptionPane.showMessageDialog(Main.parent,
                    tr("Couldn''t match the entered link or id to the selected service. Please try again."),
                    tr("No valid WMS URL or id"),
                    JOptionPane.ERROR_MESSAGE);
            diag.setVisible(true);
        }
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.ExtendedDialog$HelpAction

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.