Changeset 17161 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-10-11T11:46:46+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r16932 r17161 105 105 * Action that opens the map paint preferences. 106 106 */ 107 public static final JosmAction PREFERENCE_ACTION = PreferencesAction.forPreference SubTab(107 public static final JosmAction PREFERENCE_ACTION = PreferencesAction.forPreferenceTab( 108 108 tr("Map paint preferences..."), null, MapPaintPreference.class, /* ICON */ "dialogs/mappaintpreference"); 109 109 -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r17099 r17161 54 54 import javax.swing.JScrollPane; 55 55 import javax.swing.JSeparator; 56 import javax.swing.JTabbedPane; 56 57 import javax.swing.JTable; 57 58 import javax.swing.JToolBar; … … 1658 1659 */ 1659 1660 public final void deferLoading(final DefaultTabPreferenceSetting tab, final Component component) { 1660 tab.getTabPane().addChangeListener(e -> { 1661 if (tab.getTabPane().getSelectedComponent() == component) { 1661 deferLoading(tab.getTabPane(), component); 1662 } 1663 1664 /** 1665 * Defers loading of sources to the first time the adequate tab is selected. 1666 * @param tab The tabbed pane 1667 * @param component The tab component 1668 * @since 17161 1669 */ 1670 public final void deferLoading(final JTabbedPane tab, final Component component) { 1671 tab.addChangeListener(e -> { 1672 if (tab.getSelectedComponent() == component) { 1662 1673 initiallyLoadAvailableSources(); 1663 1674 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/BackupPreference.java
r12634 r17161 12 12 import javax.swing.JLabel; 13 13 import javax.swing.JPanel; 14 import javax.swing.JScrollPane;15 14 import javax.swing.JSeparator; 16 15 17 16 import org.openstreetmap.josm.data.preferences.BooleanProperty; 18 17 import org.openstreetmap.josm.gui.layer.AutosaveTask; 18 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 19 19 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 20 20 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 21 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;22 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;23 import org.openstreetmap.josm.gui.util.GuiHelper;24 21 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 25 22 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 30 27 * Preference settings for data layer autosave. 31 28 */ 32 public class BackupPreference implements SubPreferenceSetting {29 public class BackupPreference extends DefaultTabPreferenceSetting { 33 30 34 31 /** … … 48 45 private final JosmTextField autosaveInterval = new JosmTextField(8); 49 46 private final JosmTextField backupPerLayer = new JosmTextField(8); 47 48 BackupPreference() { 49 super(null, tr("File backup"), tr("Configure whether to create backup files")); 50 } 50 51 51 52 @Override … … 111 112 112 113 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 113 JScrollPane sp = GuiHelper.embedInVerticalScrollPane(panel); 114 115 gui.getMapPreference().addSubTab(this, tr("File backup"), sp, tr("Configure whether to create backup files")); 114 gui.createPreferenceTab(this).add(panel, GBC.eol().fill(GBC.BOTH)); 116 115 } 117 116 … … 133 132 } 134 133 135 @Override136 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {137 return gui.getMapPreference();138 }139 134 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r14119 r17161 22 22 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 23 23 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 24 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 24 25 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 25 26 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 26 27 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 28 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.PreferencePanel; 27 29 import org.openstreetmap.josm.gui.preferences.SourceEditor; 28 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;29 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;30 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.GBC; … … 35 35 * Preference settings for map paint styles. 36 36 */ 37 public class MapPaintPreference implements SubPreferenceSetting {37 public class MapPaintPreference extends DefaultTabPreferenceSetting { 38 38 private SourceEditor sources; 39 39 private JCheckBox enableIconDefault; 40 41 MapPaintPreference() { 42 super(null, tr("Map Paint Styles"), tr("Map Paint Styles")); 43 } 40 44 41 45 private static final List<SourceProvider> styleSourceProviders = new ArrayList<>(); … … 75 79 panel.add(enableIconDefault, GBC.eol().insets(11, 2, 5, 0)); 76 80 77 final MapPreference mapPref = gui.getMapPreference();78 mapPref.addSubTab(this, tr("Map Paint Styles"), panel);79 sources.deferLoading( mapPref, panel);81 PreferencePanel preferencePanel = gui.createPreferenceTab(this); 82 preferencePanel.add(panel, GBC.std().fill()); 83 sources.deferLoading(gui, preferencePanel); 80 84 } 81 85 … … 193 197 } 194 198 195 @Override196 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {197 return gui.getMapPreference();198 }199 199 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r15582 r17161 24 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 25 import org.openstreetmap.josm.gui.MainApplication; 26 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 26 27 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 27 28 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 28 29 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 30 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.PreferencePanel; 29 31 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener; 30 32 import org.openstreetmap.josm.gui.preferences.SourceEditor; 31 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;32 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;33 33 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 34 34 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; … … 43 43 * Preference settings for tagging presets. 44 44 */ 45 public final class TaggingPresetPreference implements SubPreferenceSetting {45 public final class TaggingPresetPreference extends DefaultTabPreferenceSetting { 46 46 47 47 private final class TaggingPresetValidationListener implements ValidationListener { … … 146 146 147 147 private TaggingPresetPreference() { 148 super( );148 super(null, tr("Tagging Presets"), tr("Tagging Presets")); 149 149 } 150 150 … … 177 177 sources = new TaggingPresetSourceEditor(); 178 178 panel.add(sources, GBC.eol().fill(GBC.BOTH)); 179 final MapPreference mapPref = gui.getMapPreference();180 mapPref.addSubTab(this, tr("Tagging Presets"), panel);181 sources.deferLoading( mapPref, panel);179 PreferencePanel preferencePanel = gui.createPreferenceTab(this); 180 preferencePanel.add(panel, GBC.eol().fill(GBC.BOTH)); 181 sources.deferLoading(gui, preferencePanel); 182 182 gui.addValidationListener(validationListener); 183 183 } … … 262 262 } 263 263 264 @Override265 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {266 return gui.getMapPreference();267 }268 264 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r16985 r17161 36 36 import org.openstreetmap.josm.gui.ExtendedDialog; 37 37 import org.openstreetmap.josm.gui.MainApplication; 38 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 38 39 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 39 40 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 40 41 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 41 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;42 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;43 42 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 44 43 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; … … 64 63 * if possible. 65 64 */ 66 public class ProjectionPreference implements SubPreferenceSetting {65 public class ProjectionPreference extends DefaultTabPreferenceSetting { 67 66 68 67 /** … … 344 343 345 344 public ProjectionPreference() { 345 super(null, tr("Map Projection"), tr("Map Projection")); 346 346 this.projectionCombo = new JosmComboBox<>( 347 347 projectionChoices.toArray(new ProjectionChoice[0])); … … 404 404 projPanel.add(GBC.glue(1, 1), GBC.std().fill(GBC.HORIZONTAL).weight(1.0, 1.0)); 405 405 406 gui. getMapPreference().addSubTab(this, tr("Map Projection"), projPanel.getVerticalScrollPane());406 gui.createPreferenceTab(this).add(projPanel.getVerticalScrollPane(), GBC.std().fill()); 407 407 408 408 selectedProjectionChanged(pc); … … 562 562 } 563 563 564 @Override565 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {566 return gui.getMapPreference();567 }568 569 564 /** 570 565 * Selects the given projection. -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r16304 r17161 71 71 MainMenu.add(presetsMenu, mainMenu.presetSearchAction); 72 72 MainMenu.add(presetsMenu, mainMenu.presetSearchPrimitiveAction); 73 MainMenu.add(presetsMenu, PreferencesAction.forPreference SubTab(tr("Preset preferences..."),73 MainMenu.add(presetsMenu, PreferencesAction.forPreferenceTab(tr("Preset preferences..."), 74 74 tr("Click to open the tagging presets tab in the preferences"), TaggingPresetPreference.class)); 75 75 presetsMenu.addSeparator();
Note:
See TracChangeset
for help on using the changeset viewer.