Changeset 17159 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-10-11T10:30:14+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterButton.java
r15818 r17159 73 73 @Override 74 74 public void actionPerformed(ActionEvent e) { 75 PreferencesAction.forPreference SubTab("", "null", DrawingPreference.class).actionPerformed(e);75 PreferencesAction.forPreferenceTab("", "null", DrawingPreference.class).actionPerformed(e); 76 76 } 77 77 }); -
trunk/src/org/openstreetmap/josm/gui/preferences/DefaultTabPreferenceSetting.java
r16966 r17159 91 91 a.anchor = GBC.EAST; 92 92 93 JScrollPane scrollPane = new JScrollPane(panel); 94 scrollPane.setBorder(null); 95 96 JPanel tab = gui.createPreferenceTab(this); 97 tab.add(scrollPane, GBC.eol().fill(GBC.BOTH)); 93 JPanel tab = gui.createPreferenceTab(this, true); 94 tab.add(panel, GBC.eol().fill(GBC.BOTH)); 98 95 tab.add(GBC.glue(0, 10), a); 99 96 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r16979 r17159 162 162 } 163 163 } 164 // check if plugin dependences can also be loaded 164 // check if plugin dependencies can also be loaded 165 165 Collection<PluginInformation> allPlugins = new HashSet<>(toLoad); 166 166 allPlugins.addAll(PluginHandler.getPlugins()); … … 253 253 private PreferenceScrollPane(PreferencePanel preferencePanel) { 254 254 this(preferencePanel.getComponent(), preferencePanel.getTabPreferenceSetting()); 255 GuiHelper.setDefaultIncrement(this); 255 256 } 256 257 … … 500 501 int position = index; 501 502 for (PreferenceTab tab : tabs) { 502 if (tab.getTabPreferenceSetting().equals(tps)) { 503 if (tab.getTabPreferenceSetting().equals(tps) && tps.getIconName() != null) { 503 504 insertTab(null, icon, tab.getComponent(), tps.getTooltip(), position++); 505 } else if (tab.getTabPreferenceSetting().equals(tps)) { 506 insertTab(tps.getTitle(), null, tab.getComponent(), tps.getTooltip(), position++); 504 507 } 505 508 } … … 528 531 // If it has been initialized, add corresponding tab(s) 529 532 addGUITabsForSetting(icon, tps); 530 } else { 533 } else if (tps.getIconName() != null) { 531 534 // If it has not been initialized, create an empty tab with only icon and tooltip 532 535 addTab(null, icon, new PreferencePanel(tps), tps.getTooltip()); 536 } else { 537 addTab(tps.getTitle(), null, new PreferencePanel(tps), tps.getTooltip()); 533 538 } 534 539 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r17060 r17159 48 48 import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper; 49 49 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 50 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 50 51 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 51 52 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 52 53 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 53 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;54 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;55 54 import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable; 56 55 import org.openstreetmap.josm.gui.util.GuiHelper; … … 69 68 * @see NamedColorProperty 70 69 */ 71 public class ColorPreference implements SubPreferenceSetting,ListSelectionListener, TableModelListener {70 public class ColorPreference extends DefaultTabPreferenceSetting implements ListSelectionListener, TableModelListener { 72 71 73 72 /** … … 79 78 return new ColorPreference(); 80 79 } 80 } 81 82 ColorPreference() { 83 super(null, tr("Colors"), tr("Change colors used in program dialogs and in map paint styles.")); 81 84 } 82 85 … … 377 380 buttonPanel.add(defaultAll, GBC.std().insets(0, 5, 0, 0)); 378 381 buttonPanel.add(remove, GBC.std().insets(0, 5, 0, 0)); 379 gui.getDisplayPreference().addSubTab(this, tr("Colors"), panel); 382 383 createPreferenceTabWithScrollPane(gui, panel); 380 384 } 381 385 … … 423 427 424 428 @Override 425 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {426 return gui.getDisplayPreference();427 }428 429 @Override430 429 public void valueChanged(ListSelectionEvent e) { 431 430 updateEnabledState(); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r16979 r17159 11 11 import javax.swing.JLabel; 12 12 import javax.swing.JPanel; 13 import javax.swing.JScrollPane;14 13 15 14 import org.openstreetmap.josm.actions.ExpertToggleAction; … … 18 17 import org.openstreetmap.josm.gui.autofilter.AutoFilterRule; 19 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 19 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 20 20 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 21 21 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 22 22 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 23 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;24 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;25 import org.openstreetmap.josm.gui.util.GuiHelper;26 23 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 27 24 import org.openstreetmap.josm.spi.preferences.Config; … … 31 28 * "OSM Data" drawing preferences. 32 29 */ 33 public class DrawingPreference implements SubPreferenceSetting {30 public class DrawingPreference extends DefaultTabPreferenceSetting { 34 31 35 32 /** … … 71 68 private final JCheckBox hideLabelsWhileDragging = new JCheckBox(tr("Hide labels while dragging the map")); 72 69 70 DrawingPreference() { 71 super(null, tr("OSM Data"), tr("Settings that control the drawing of OSM data.")); 72 } 73 73 74 @Override 74 75 public void addGui(PreferenceTabbedPane gui) { … … 192 193 193 194 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 194 JScrollPane scrollpane = new JScrollPane(panel); 195 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 196 GuiHelper.setDefaultIncrement(scrollpane); 197 gui.getDisplayPreference().addSubTab(this, tr("OSM Data"), scrollpane); 195 createPreferenceTabWithScrollPane(gui, panel); 198 196 } 199 197 … … 233 231 } 234 232 235 @Override236 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {237 return gui.getDisplayPreference();238 }239 233 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXPreference.java
r16979 r17159 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import javax.swing.BorderFactory; 7 import javax.swing.JPanel; 8 import javax.swing.JScrollPane; 9 6 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 10 7 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 11 8 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 12 9 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 13 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;14 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;15 import org.openstreetmap.josm.gui.util.GuiHelper;16 10 17 11 /** 18 12 * "GPS Points" drawing preferences. 19 13 */ 20 public class GPXPreference implements SubPreferenceSetting {14 public class GPXPreference extends DefaultTabPreferenceSetting { 21 15 22 16 /** … … 30 24 } 31 25 26 GPXPreference() { 27 super(null, tr("GPS Points"), tr("Settings that control the drawing of GPS tracks.")); 28 } 29 32 30 private GPXSettingsPanel gpxPanel; 33 31 … … 36 34 gpxPanel = new GPXSettingsPanel(); 37 35 gui.addValidationListener(gpxPanel); 38 JPanel panel = gpxPanel; 39 40 JScrollPane scrollpane = new JScrollPane(panel); 41 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 42 GuiHelper.setDefaultIncrement(scrollpane); 43 gui.getDisplayPreference().addSubTab(this, tr("GPS Points"), scrollpane); 36 createPreferenceTabWithScrollPane(gui, gpxPanel); 44 37 } 45 38 … … 54 47 } 55 48 56 @Override57 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {58 return gui.getDisplayPreference();59 }60 49 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r15725 r17159 16 16 import javax.swing.JLabel; 17 17 import javax.swing.JList; 18 import javax.swing.JScrollPane;19 18 import javax.swing.JSpinner; 20 19 import javax.swing.ListCellRenderer; … … 30 29 import org.openstreetmap.josm.gui.NavigatableComponent; 31 30 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 31 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 32 32 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 33 33 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 34 34 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 35 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;36 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;37 35 import org.openstreetmap.josm.gui.widgets.FileChooserManager; 38 36 import org.openstreetmap.josm.gui.widgets.JosmComboBox; … … 47 45 * Look-and-feel preferences. 48 46 */ 49 public class LafPreference implements SubPreferenceSetting {47 public class LafPreference extends DefaultTabPreferenceSetting { 50 48 51 49 /** … … 73 71 return new LafPreference(); 74 72 } 73 } 74 75 LafPreference() { 76 super(null, tr("Look and Feel"), tr("Change the Look and Feel of the program")); 75 77 } 76 78 … … 212 214 panel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL)); 213 215 panel.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL)); 214 215 JScrollPane scrollpane = panel.getVerticalScrollPane(); 216 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 217 gui.getDisplayPreference().addSubTab(this, tr("Look and Feel"), scrollpane); 216 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 217 218 createPreferenceTabWithScrollPane(gui, panel); 218 219 } 219 220 … … 243 244 } 244 245 245 @Override246 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {247 return gui.getDisplayPreference();248 }249 246 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LanguagePreference.java
r16660 r17159 5 5 6 6 import java.awt.Component; 7 import java.awt.GridBagLayout; 7 8 import java.util.ArrayList; 8 9 import java.util.Comparator; … … 18 19 import javax.swing.ListCellRenderer; 19 20 21 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 20 22 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 21 23 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 22 24 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 23 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;24 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;25 25 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 26 26 import org.openstreetmap.josm.spi.preferences.Config; … … 33 33 * @since 1065 34 34 */ 35 public class LanguagePreference implements SubPreferenceSetting {35 public class LanguagePreference extends DefaultTabPreferenceSetting { 36 36 37 37 private static final String LANGUAGE = "language"; … … 45 45 return new LanguagePreference(); 46 46 } 47 } 48 49 LanguagePreference() { 50 super(null, tr("Language"), tr("Change the language of JOSM.")); 47 51 } 48 52 … … 59 63 langCombo.setRenderer(new LanguageCellRenderer()); 60 64 61 LafPreference lafPreference = gui.getSetting(LafPreference.class); 62 final JPanel panel = lafPreference.panel; 65 final JPanel panel = new JPanel(new GridBagLayout()); 63 66 panel.add(new JLabel(tr("Language")), GBC.std().insets(20, 0, 0, 0)); 64 67 panel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL)); … … 66 69 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 67 70 68 TabPreferenceSetting tabPref = lafPreference.getTabPreferenceSetting(gui); 69 tabPref.registerSubTab(this, tabPref.getSubTab(lafPreference)); 71 createPreferenceTabWithScrollPane(gui, panel); 70 72 } 71 73 … … 137 139 } 138 140 139 @Override140 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {141 return gui.getSetting(LafPreference.class).getTabPreferenceSetting(gui);142 }143 141 }
Note:
See TracChangeset
for help on using the changeset viewer.