[7937] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.gui.preferences.imagery;
|
---|
| 3 |
|
---|
| 4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 5 |
|
---|
| 6 | import java.awt.Component;
|
---|
| 7 | import java.awt.Dimension;
|
---|
| 8 |
|
---|
| 9 | import org.openstreetmap.josm.gui.ExtendedDialog;
|
---|
| 10 | import org.openstreetmap.josm.gui.preferences.imagery.AddImageryPanel.ContentValidationListener;
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * Dialog shown to add a new imagery (WMS/TMS) source from imagery preferences.
|
---|
| 14 | * @since 5731
|
---|
| 15 | */
|
---|
| 16 | public class AddImageryDialog extends ExtendedDialog implements ContentValidationListener {
|
---|
| 17 |
|
---|
| 18 | /**
|
---|
| 19 | * Constructs a new AddImageryDialog.
|
---|
| 20 | * @param parent The parent element that will be used for position and maximum size
|
---|
| 21 | * @param panel The content that will be displayed in the message dialog
|
---|
| 22 | */
|
---|
| 23 | public AddImageryDialog(Component parent, AddImageryPanel panel) {
|
---|
| 24 | super(parent, tr("Add Imagery URL"), new String[] {tr("OK"), tr("Cancel")});
|
---|
| 25 | setButtonIcons(new String[] {"ok", "cancel"});
|
---|
| 26 | setCancelButton(2);
|
---|
| 27 | configureContextsensitiveHelp("/Dialog/AddImagery", true /* show help button */);
|
---|
| 28 | setContent(panel, false);
|
---|
| 29 | setMinimumSize(new Dimension(300, 400));
|
---|
| 30 | panel.addContentValidationListener(this);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @Override
|
---|
| 34 | public void setupDialog() {
|
---|
| 35 | super.setupDialog();
|
---|
| 36 | contentChanged(false);
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | @Override
|
---|
| 40 | public void contentChanged(boolean isValid) {
|
---|
| 41 | buttons.get(0).setEnabled(isValid);
|
---|
| 42 | }
|
---|
| 43 | }
|
---|