-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...penstreetmap/josm/plugins/austriaaddresshelper/AustriaAddressHelperPreferenceSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.openstreetmap.josm.plugins.austriaaddresshelper; | ||
|
||
import static org.openstreetmap.josm.tools.I18n.tr; | ||
|
||
import java.awt.GridBagLayout; | ||
|
||
import javax.swing.BorderFactory; | ||
import javax.swing.JCheckBox; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
import javax.swing.JTextField; | ||
|
||
import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; | ||
import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; | ||
import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; | ||
import org.openstreetmap.josm.tools.GBC; | ||
|
||
public class AustriaAddressHelperPreferenceSetting implements SubPreferenceSetting { | ||
|
||
private final JTextField url = new JTextField(); | ||
private final JCheckBox checkDuplicates = new JCheckBox(tr("Check existing addresses")); | ||
|
||
@Override | ||
public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui) { | ||
return gui.getPluginPreference(); | ||
} | ||
|
||
@Override | ||
public void addGui(PreferenceTabbedPane gui) { | ||
url.setText(AustriaAddressHelperAction.baseUrl.get()); | ||
checkDuplicates.setSelected(AustriaAddressHelperAction.checkDuplicates.get()); | ||
|
||
final JPanel panel = new JPanel(new GridBagLayout()); | ||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); | ||
panel.add(new JLabel(tr("Server URL:")), GBC.eol().fill(GBC.HORIZONTAL)); | ||
panel.add(url, GBC.eop().fill(GBC.HORIZONTAL)); | ||
panel.add(checkDuplicates, GBC.eop().fill(GBC.HORIZONTAL)); | ||
getTabPreferenceSetting(gui).addSubTab(this, tr("Austria Address Helper"), panel); | ||
} | ||
|
||
@Override | ||
public boolean ok() { | ||
AustriaAddressHelperAction.baseUrl.put(url.getText()); | ||
AustriaAddressHelperAction.checkDuplicates.put(checkDuplicates.isSelected()); | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isExpert() { | ||
return false; | ||
} | ||
} |