Package org.openstreetmap.josm.gui

Examples of org.openstreetmap.josm.gui.ExtendedDialog


      }
      if (modified) {
        final String msg = uploadedModified ? "\n"
            + tr("Hint: Some changes came from uploading new data to the server.")
            : "";
        int result = new ExtendedDialog(
            parent,
            tr("Unsaved Changes"),
            new javax.swing.JLabel(
                tr("There are unsaved changes. Discard the changes and continue?")
                    + msg), new String[] {
View Full Code Here


                                Integer.toString(josmVersion))
                        );
                    }
                }
                if (!messages.isEmpty()) {
                    ExtendedDialog dlg = new ExtendedDialog(Main.parent, tr("Warning"), new String [] { tr("Cancel"), tr("Continue anyway") });
                    dlg.setButtonIcons(new Icon[] {
                        ImageProvider.get("cancel"),
                        ImageProvider.overlay(
                            ImageProvider.get("ok"),
                            new ImageIcon(ImageProvider.get("warning-small").getImage().getScaledInstance(12 , 12, Image.SCALE_SMOOTH)),
                            ImageProvider.OverlayPosition.SOUTHEAST)
                    });
                    dlg.setToolTipTexts(new String[] {
                        tr("Cancel and return to the previous dialog"),
                        tr("Ignore warning and install style anyway")});
                    dlg.setContent("<html>" + tr("Some entries have unmet dependencies:") +
                            "<br>" + Utils.join("<br>", messages) + "</html>");
                    dlg.setIcon(JOptionPane.WARNING_MESSAGE);
                    if (dlg.showDialog().getValue() != 2)
                        return;
                }
            }
            activeSourcesModel.addExtendedSourceEntries(sources);
        }
View Full Code Here

    // Method kept because strings have already been translated. To enable for Java 8 migration somewhere in 2016
    protected void askUpdateJava(final String version, final String url) {
        GuiHelper.runInEDTAndWait(new Runnable() {
            @Override
            public void run() {
                ExtendedDialog ed = new ExtendedDialog(
                        Main.parent,
                        tr("Outdated Java version"),
                        new String[]{tr("Update Java"), tr("Cancel")});
                // Check if the dialog has not already been permanently hidden by user
                if (!ed.toggleEnable("askUpdateJava8").toggleCheckState()) {
                    ed.setButtonIcons(new String[]{"java.png", "cancel.png"}).setCancelButton(2);
                    ed.setMinimumSize(new Dimension(480, 300));
                    ed.setIcon(JOptionPane.WARNING_MESSAGE);
                    String content = tr("You are running version {0} of Java.", "<b>"+version+"</b>")+"<br><br>";
                    if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor")) && !isOpenJDK()) {
                        content += "<b>"+tr("This version is no longer supported by {0} since {1} and is not recommended for use.",
                                "Oracle", tr("April 2015"))+"</b><br><br>";
                    }
                    content += "<b>"+tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "8")+"</b><br><br>"+
                            tr("Would you like to update now ?");
                    ed.setContent(content);

                    if (ed.showDialog().getValue() == 1) {
                        try {
                            openUrl(url);
                        } catch (IOException e) {
                            Main.warn(e);
                        }
View Full Code Here

        JPanel pnl = new JPanel(new GridBagLayout());
        pnl.add(new JLabel(tr("Please select the target layer.")), GBC.eol());
        pnl.add(layerList, GBC.eol());

        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Select target layer"),
                new String[] { tr("Merge"), tr("Cancel") });
        ed.setButtonIcons(new String[] { "dialogs/mergedown", "cancel" });
        ed.setContent(pnl);
        ed.showDialog();
        if (ed.getValue() != 1)
            return null;

        return (Layer) layerList.getSelectedItem();
    }
View Full Code Here

        txt.setRows(1);
        txt.setText(Utils.join(", ", errs));
        JScrollPane scroll = new JScrollPane(txt);
        p.add(scroll, GBC.eop().weight(1.0, 0.0).fill(GBC.HORIZONTAL));

        return new ExtendedDialog(
                Main.parent,
                title,
                new String[] { tr("Ok") })
        .setButtonIcons(new String[] { "ok" })
        .setIcon(msgType)
View Full Code Here

        Main.main.undoRedo.add(new AddPrimitivesCommand(bufferCopy, toSelect));
        Main.map.mapView.repaint();
    }

    protected boolean confirmDeleteIncomplete() {
        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Delete incomplete members?"),
                new String[] {tr("Paste without incomplete members"), tr("Cancel")});
        ed.setButtonIcons(new String[] {"dialogs/relation/deletemembers.png", "cancel.png"});
        ed.setContent(tr("The copied data contains incomplete objects.  "
                + "When pasting the incomplete objects are removed.  "
                + "Do you want to paste the data without the incomplete objects?"));
        ed.showDialog();
        return ed.getValue() == 1;
    }
View Full Code Here

        all.add(uploadAddresses, gc);
        gc.gridy = 2;
        gc.fill = GridBagConstraints.BOTH;
        gc.weighty = 1.0;
        all.add(layer, gc);
        ExtendedDialog dialog = new ExtendedDialog(Main.parent,
                tr("Download Location"),
                new String[] {tr("Download URL"), tr("Cancel")}
        );
        dialog.setContent(all, false /* don't embedded content in JScrollpane  */);
        dialog.setButtonIcons(new String[] {"download.png", "cancel.png"});
        dialog.setToolTipTexts(new String[] {
                tr("Start downloading data"),
                tr("Close dialog and cancel downloading")
        });
        dialog.configureContextsensitiveHelp("/Action/OpenLocation", true /* show help button */);
        dialog.showDialog();
        if (dialog.getValue() != 1) return;
        remindUploadAddressHistory(uploadAddresses);
        openUrl(layer.isSelected(), Utils.strip(uploadAddresses.getText()));
    }
View Full Code Here

                    "upload_source_is_empty"
            );
        }

        protected boolean warnUploadTag(final String title, final String message, final String togglePref) {
            ExtendedDialog dlg = new ExtendedDialog(UploadDialog.this,
                    title,
                    new String[] {tr("Revise"), tr("Cancel"), tr("Continue as is")});
            dlg.setContent("<html>" + message + "</html>");
            dlg.setButtonIcons(new Icon[] {
                    ImageProvider.get("ok"),
                    ImageProvider.get("cancel"),
                    ImageProvider.overlay(
                            ImageProvider.get("upload"),
                            new ImageIcon(ImageProvider.get("warning-small").getImage().getScaledInstance(10 , 10, Image.SCALE_SMOOTH)),
                            ImageProvider.OverlayPosition.SOUTHEAST)});
            dlg.setToolTipTexts(new String[] {
                    tr("Return to the previous dialog to enter a more descriptive comment"),
                    tr("Cancel and return to the previous dialog"),
                    tr("Ignore this hint and upload anyway")});
            dlg.setIcon(JOptionPane.WARNING_MESSAGE);
            dlg.toggleEnable(togglePref);
            dlg.setCancelButton(1, 2);
            return dlg.showDialog().getValue() != 3;
        }
View Full Code Here

            tree.updateTree(wms);
            final JComboBox<String> formats = new JComboBox<>(wms.getFormats().toArray(new String[0]));
            formats.setSelectedItem(wms.getPreferredFormats());
            formats.setToolTipText(tr("Select image format for WMS layer"));

            if (1 != new ExtendedDialog(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")}) {{
                final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
                scrollPane.setPreferredSize(new Dimension(400, 400));
                final JPanel panel = new JPanel(new GridBagLayout());
                panel.add(scrollPane, GBC.eol().fill());
                panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
View Full Code Here

       
        @Override
        public void actionPerformed(ActionEvent e) {
            Object object = layer.getInfoComponent();
            if (object instanceof Component) {
                ExtendedDialog ed = new ExtendedDialog(
                        Main.parent, tr("Information about layer"),
                        new String[] {tr("OK")});
                ed.setButtonIcons(new String[] {"ok"});
                ed.setIcon(JOptionPane.INFORMATION_MESSAGE);
                ed.setContent((Component) object);
                ed.setResizable(layer.isInfoResizable());
                ed.setMinimumSize(new Dimension(270, 170));
                ed.showDialog();
            } else {
                JOptionPane.showMessageDialog(
                        Main.parent, object,
                        tr("Information about layer"),
                        JOptionPane.INFORMATION_MESSAGE
View Full Code Here

TOP

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

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.