- Timestamp:
- 2012-02-17T22:27:06+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 added
- 20 edited
- 13 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r4932 r4968 66 66 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 67 67 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; 68 import org.openstreetmap.josm.gui.preferences.ImageryPreference;69 import org.openstreetmap.josm.gui.preferences.MapPaintPreference;70 import org.openstreetmap.josm.gui.preferences.ProjectionPreference;71 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;72 68 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; 69 import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreference; 70 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 71 import org.openstreetmap.josm.gui.preferences.map.ProjectionPreference; 72 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 73 73 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; 74 74 import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor; -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r4874 r4968 18 18 import org.openstreetmap.josm.data.validation.Test; 19 19 import org.openstreetmap.josm.data.validation.TestError; 20 import org.openstreetmap.josm.gui.preferences. TaggingPresetPreference;20 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 21 21 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 22 22 import org.openstreetmap.josm.gui.tagging.TaggingPreset.PresetType; -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r4869 r4968 53 53 import org.openstreetmap.josm.data.validation.TestError; 54 54 import org.openstreetmap.josm.data.validation.util.Entities; 55 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;56 55 import org.openstreetmap.josm.gui.preferences.ValidatorPreference; 56 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 57 57 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 58 58 import org.openstreetmap.josm.gui.tagging.TaggingPreset; -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r4897 r4968 42 42 import org.openstreetmap.josm.data.projection.Projections; 43 43 import org.openstreetmap.josm.gui.help.Helpful; 44 import org.openstreetmap.josm.gui.preferences. ProjectionPreference;44 import org.openstreetmap.josm.gui.preferences.map.ProjectionPreference; 45 45 import org.openstreetmap.josm.tools.Predicate; 46 46 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PresetListPanel.java
r4407 r4968 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 23 import org.openstreetmap.josm.data.osm.Tag; 24 import org.openstreetmap.josm.gui.preferences. TaggingPresetPreference;24 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 25 25 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 26 26 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Check; -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r4872 r4968 89 89 import org.openstreetmap.josm.gui.layer.markerlayer.AudioMarker; 90 90 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 91 import org.openstreetmap.josm.gui.preferences. GPXSettingsPanel;91 import org.openstreetmap.josm.gui.preferences.display.GPXSettingsPanel; 92 92 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 93 93 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r4960 r4968 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Dimension;7 6 import java.io.IOException; 8 7 import java.io.InputStream; … … 22 21 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 23 22 import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource; 24 import org.openstreetmap.josm.gui.preferences. MapPaintPreference.MapPaintPrefHelper;23 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference.MapPaintPrefHelper; 25 24 import org.openstreetmap.josm.gui.preferences.SourceEntry; 26 25 import org.openstreetmap.josm.gui.progress.ProgressMonitor; -
trunk/src/org/openstreetmap/josm/gui/preferences/AudioPreference.java
r4282 r4968 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.PreferencePanel; 12 13 import org.openstreetmap.josm.tools.GBC; 13 14 … … 24 25 */ 25 26 26 public class AudioPreference implementsPreferenceSetting {27 public class AudioPreference extends DefaultTabPreferenceSetting { 27 28 28 29 public static class Factory implements PreferenceSettingFactory { … … 30 31 return new AudioPreference(); 31 32 } 33 } 34 35 private AudioPreference() { 36 super("audio", tr("Audio Settings"), tr("Settings for the audio player and audio markers.")); 32 37 } 33 38 … … 49 54 50 55 public void addGui(PreferenceTabbedPane gui) { 56 PreferencePanel audio = gui.createPreferenceTab(this); 57 51 58 // audioMenuVisible 52 59 audioMenuVisible.setSelected(! Main.pref.getBoolean("audio.menuinvisible")); 53 60 audioMenuVisible.setToolTipText(tr("Show or hide the audio menu entry on the main menu bar.")); 54 gui.audio.add(audioMenuVisible, GBC.eol().insets(0,0,0,0));61 audio.add(audioMenuVisible, GBC.eol().insets(0,0,0,0)); 55 62 56 63 // audioTraceVisible 57 64 markerAudioTraceVisible.setSelected(Main.pref.getBoolean("marker.traceaudio", true)); 58 65 markerAudioTraceVisible.setToolTipText(tr("Display a moving icon representing the point on the synchronized track where the audio currently playing was recorded.")); 59 gui.audio.add(markerAudioTraceVisible, GBC.eol().insets(0,0,0,0));66 audio.add(markerAudioTraceVisible, GBC.eol().insets(0,0,0,0)); 60 67 61 68 // buttonLabels 62 69 markerButtonLabels.setSelected(Main.pref.getBoolean("marker.buttonlabels", true)); 63 70 markerButtonLabels.setToolTipText(tr("Put text labels against audio (and image and web) markers as well as their button icons.")); 64 gui.audio.add(markerButtonLabels, GBC.eol().insets(0,0,0,0));71 audio.add(markerButtonLabels, GBC.eol().insets(0,0,0,0)); 65 72 66 gui.audio.add(new JLabel(tr("When importing audio, make markers from...")), GBC.eol());73 audio.add(new JLabel(tr("When importing audio, make markers from...")), GBC.eol()); 67 74 68 75 // audioMarkersFromExplicitWaypoints 69 76 audioMarkersFromExplicitWaypoints.setSelected(Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true)); 70 77 audioMarkersFromExplicitWaypoints.setToolTipText(tr("When importing audio, apply it to any waypoints in the GPX layer.")); 71 gui.audio.add(audioMarkersFromExplicitWaypoints, GBC.eol().insets(10,0,0,0));78 audio.add(audioMarkersFromExplicitWaypoints, GBC.eol().insets(10,0,0,0)); 72 79 73 80 // audioMarkersFromUntimedWaypoints 74 81 audioMarkersFromUntimedWaypoints.setSelected(Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true)); 75 82 audioMarkersFromUntimedWaypoints.setToolTipText(tr("When importing audio, apply it to any waypoints in the GPX layer.")); 76 gui.audio.add(audioMarkersFromUntimedWaypoints, GBC.eol().insets(10,0,0,0));83 audio.add(audioMarkersFromUntimedWaypoints, GBC.eol().insets(10,0,0,0)); 77 84 78 85 // audioMarkersFromNamedTrackpoints 79 86 audioMarkersFromNamedTrackpoints.setSelected(Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)); 80 87 audioMarkersFromNamedTrackpoints.setToolTipText(tr("Automatically create audio markers from trackpoints (rather than explicit waypoints) with names or descriptions.")); 81 gui.audio.add(audioMarkersFromNamedTrackpoints, GBC.eol().insets(10,0,0,0));88 audio.add(audioMarkersFromNamedTrackpoints, GBC.eol().insets(10,0,0,0)); 82 89 83 90 // audioMarkersFromWavTimestamps 84 91 audioMarkersFromWavTimestamps.setSelected(Main.pref.getBoolean("marker.audiofromwavtimestamps", false)); 85 92 audioMarkersFromWavTimestamps.setToolTipText(tr("Create audio markers at the position on the track corresponding to the modified time of each audio WAV file imported.")); 86 gui.audio.add(audioMarkersFromWavTimestamps, GBC.eol().insets(10,0,0,0));93 audio.add(audioMarkersFromWavTimestamps, GBC.eol().insets(10,0,0,0)); 87 94 88 95 // audioMarkersFromStart 89 96 audioMarkersFromStart.setSelected(Main.pref.getBoolean("marker.audiofromstart")); 90 97 audioMarkersFromStart.setToolTipText(tr("Automatically create audio markers from trackpoints (rather than explicit waypoints) with names or descriptions.")); 91 gui.audio.add(audioMarkersFromStart, GBC.eol().insets(10,0,0,0));98 audio.add(audioMarkersFromStart, GBC.eol().insets(10,0,0,0)); 92 99 93 100 audioForwardBackAmount.setText(Main.pref.get("audio.forwardbackamount", "10.0")); 94 101 audioForwardBackAmount.setToolTipText(tr("The number of seconds to jump forward or back when the relevant button is pressed")); 95 gui.audio.add(new JLabel(tr("Forward/back time (seconds)")), GBC.std());96 gui.audio.add(audioForwardBackAmount, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));102 audio.add(new JLabel(tr("Forward/back time (seconds)")), GBC.std()); 103 audio.add(audioForwardBackAmount, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 97 104 98 105 audioFastForwardMultiplier.setText(Main.pref.get("audio.fastfwdmultiplier", "1.3")); 99 106 audioFastForwardMultiplier.setToolTipText(tr("The amount by which the speed is multiplied for fast forwarding")); 100 gui.audio.add(new JLabel(tr("Fast forward multiplier")), GBC.std());101 gui.audio.add(audioFastForwardMultiplier, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));107 audio.add(new JLabel(tr("Fast forward multiplier")), GBC.std()); 108 audio.add(audioFastForwardMultiplier, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 102 109 103 110 audioLeadIn.setText(Main.pref.get("audio.leadin", "1.0")); 104 111 audioLeadIn.setToolTipText(tr("Playback starts this number of seconds before (or after, if negative) the audio track position requested")); 105 gui.audio.add(new JLabel(tr("Lead-in time (seconds)")), GBC.std());106 gui.audio.add(audioLeadIn, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));112 audio.add(new JLabel(tr("Lead-in time (seconds)")), GBC.std()); 113 audio.add(audioLeadIn, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 107 114 108 115 audioCalibration.setText(Main.pref.get("audio.calibration", "1.0")); 109 116 audioCalibration.setToolTipText(tr("The ratio of voice recorder elapsed time to true elapsed time")); 110 gui.audio.add(new JLabel(tr("Voice recorder calibration")), GBC.std());111 gui.audio.add(audioCalibration, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));117 audio.add(new JLabel(tr("Voice recorder calibration")), GBC.std()); 118 audio.add(audioCalibration, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 112 119 113 gui.audio.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));120 audio.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 114 121 } 115 122 -
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r4191 r4968 43 43 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 44 44 import org.openstreetmap.josm.gui.help.HelpUtil; 45 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.PreferencePanel; 45 46 import org.openstreetmap.josm.gui.preferences.plugin.PluginListPanel; 46 47 import org.openstreetmap.josm.gui.preferences.plugin.PluginPreferencesModel; … … 54 55 import org.openstreetmap.josm.tools.ImageProvider; 55 56 56 public class PluginPreference implementsPreferenceSetting {57 public class PluginPreference extends DefaultTabPreferenceSetting { 57 58 public static class Factory implements PreferenceSettingFactory { 58 59 public PreferenceSetting createPreferenceSetting() { 59 60 return new PluginPreference(); 60 61 } 62 } 63 64 private PluginPreference() { 65 super("plugin", tr("Plugins"), tr("Configure available plugins.")); 61 66 } 62 67 … … 178 183 gc.anchor = GridBagConstraints.NORTHWEST; 179 184 gc.fill = GridBagConstraints.BOTH; 180 gui.plugins.add(buildContentPanel(), gc); 185 PreferencePanel plugins = gui.createPreferenceTab(this); 186 plugins.add(buildContentPanel(), gc); 181 187 pnlPluginPreferences.refreshView(); 182 gui.addChangeListener(new PluginPreferenceActivationListener( gui.plugins));188 gui.addChangeListener(new PluginPreferenceActivationListener(plugins)); 183 189 } 184 190 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r4913 r4968 32 32 import org.openstreetmap.josm.gui.help.HelpUtil; 33 33 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener; 34 import org.openstreetmap.josm.gui.preferences.map.MapPreference; 34 35 import org.openstreetmap.josm.tools.GBC; 35 36 import org.openstreetmap.josm.tools.ImageProvider; … … 167 168 168 169 public void selectMapPaintPreferenceTab() { 169 tpPreferences.se tSelectedComponent(tpPreferences.map);170 tpPreferences. mapcontent.setSelectedIndex(1);170 tpPreferences.selectTabByPref(MapPreference.class); 171 tpPreferences.getMapPreference().mapcontent.setSelectedIndex(1); 171 172 } 172 173 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceSetting.java
r2745 r4968 14 14 */ 15 15 boolean ok(); 16 17 /** 18 * Called to know if the preferences tab has only to be displayed in expert mode. 19 * @return true if the tab has only to be displayed in expert mode, false otherwise. 20 */ 21 public boolean isExpert(); 16 22 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r4874 r4968 7 7 import java.awt.Font; 8 8 import java.awt.GridBagLayout; 9 import java.awt.ScrollPane;10 9 import java.awt.event.MouseWheelEvent; 11 10 import java.awt.event.MouseWheelListener; 12 11 import java.util.ArrayList; 13 12 import java.util.Collection; 14 import java.util.Iterator;15 13 import java.util.LinkedList; 16 14 import java.util.List; 17 15 18 16 import javax.swing.BorderFactory; 19 import javax.swing.JComponent; 17 import javax.swing.Icon; 18 import javax.swing.ImageIcon; 20 19 import javax.swing.JLabel; 21 20 import javax.swing.JOptionPane; … … 24 23 import javax.swing.JTabbedPane; 25 24 import javax.swing.SwingUtilities; 25 import javax.swing.event.ChangeEvent; 26 import javax.swing.event.ChangeListener; 26 27 27 28 import org.openstreetmap.josm.Main; … … 29 30 import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener; 30 31 import org.openstreetmap.josm.gui.preferences.advanced.AdvancedPreference; 32 import org.openstreetmap.josm.gui.preferences.display.ColorPreference; 33 import org.openstreetmap.josm.gui.preferences.display.DisplayPreference; 34 import org.openstreetmap.josm.gui.preferences.display.DrawingPreference; 35 import org.openstreetmap.josm.gui.preferences.display.LafPreference; 36 import org.openstreetmap.josm.gui.preferences.display.LanguagePreference; 37 import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreference; 38 import org.openstreetmap.josm.gui.preferences.map.BackupPreference; 39 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 40 import org.openstreetmap.josm.gui.preferences.map.MapPreference; 41 import org.openstreetmap.josm.gui.preferences.map.ProjectionPreference; 42 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 43 import org.openstreetmap.josm.gui.preferences.shortcut.ShortcutPreference; 31 44 import org.openstreetmap.josm.plugins.PluginDownloadTask; 32 45 import org.openstreetmap.josm.plugins.PluginHandler; 33 46 import org.openstreetmap.josm.plugins.PluginInformation; 34 47 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 48 import org.openstreetmap.josm.tools.CheckParameterUtil; 35 49 import org.openstreetmap.josm.tools.GBC; 36 import org.openstreetmap.josm.tools.I18n;37 50 import org.openstreetmap.josm.tools.ImageProvider; 38 51 … … 42 55 * @author imi 43 56 */ 44 public class PreferenceTabbedPane extends JTabbedPane implements MouseWheelListener, ExpertModeChangeListener {57 public class PreferenceTabbedPane extends JTabbedPane implements MouseWheelListener, ExpertModeChangeListener, ChangeListener { 45 58 /** 46 59 * Allows PreferenceSettings to do validation of entered values when ok was pressed. … … 55 68 boolean validatePreferences(); 56 69 } 57 58 private static class TabData { 59 public String icon; 60 public JComponent tab; 61 public String toolTip; 62 public boolean isExpert; 70 71 private static interface PreferenceTab { 72 public TabPreferenceSetting getTabPreferenceSetting(); 73 public Component getComponent(); 74 } 75 76 public static class PreferencePanel extends JPanel implements PreferenceTab { 77 private final TabPreferenceSetting preferenceSetting; 78 79 private PreferencePanel(TabPreferenceSetting preferenceSetting) { 80 super(new GridBagLayout()); 81 CheckParameterUtil.ensureParameterNotNull(preferenceSetting); 82 this.preferenceSetting = preferenceSetting; 83 buildPanel(); 84 } 85 86 protected void buildPanel() { 87 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 88 add(new JLabel(preferenceSetting.getTitle()), GBC.eol().insets(0,5,0,10).anchor(GBC.NORTHWEST)); 89 90 JLabel descLabel = new JLabel("<html>"+preferenceSetting.getDescription()+"</html>"); 91 descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC)); 92 add(descLabel, GBC.eol().insets(5,0,5,20).fill(GBC.HORIZONTAL)); 93 } 94 95 @Override 96 public final TabPreferenceSetting getTabPreferenceSetting() { 97 return preferenceSetting; 98 } 99 100 @Override 101 public Component getComponent() { 102 return this; 103 } 104 } 105 106 public static class PreferenceScrollPane extends JScrollPane implements PreferenceTab { 107 private final TabPreferenceSetting preferenceSetting; 108 109 private PreferenceScrollPane(Component view, TabPreferenceSetting preferenceSetting) { 110 super(view); 111 this.preferenceSetting = preferenceSetting; 112 } 113 114 private PreferenceScrollPane(PreferencePanel preferencePanel) { 115 super(preferencePanel.getComponent()); 116 this.preferenceSetting = preferencePanel.getTabPreferenceSetting(); 117 } 118 119 @Override 120 public final TabPreferenceSetting getTabPreferenceSetting() { 121 return preferenceSetting; 122 } 123 124 @Override 125 public Component getComponent() { 126 return this; 127 } 63 128 } 64 129 65 130 // all created tabs 66 private final List< TabData> tabs = new ArrayList<TabData>();131 private final List<PreferenceTab> tabs = new ArrayList<PreferenceTab>(); 67 132 private final static Collection<PreferenceSettingFactory> settingsFactory = new LinkedList<PreferenceSettingFactory>(); 68 133 private final List<PreferenceSetting> settings = new ArrayList<PreferenceSetting>(); 69 70 // some common tabs 71 public final JPanel display = createPreferenceTab("display", tr("Display Settings"), tr("Various settings that influence the visual representation of the whole program.")); 72 public final JPanel connection = createPreferenceTab("connection", I18n.tr("Connection Settings"), I18n.tr("Connection Settings for the OSM server."),false); 73 public final JPanel map = createPreferenceTab("map", I18n.tr("Map Settings"), I18n.tr("Settings for the map projection and data interpretation.")); 74 public final JPanel audio = createPreferenceTab("audio", I18n.tr("Audio Settings"), I18n.tr("Settings for the audio player and audio markers.")); 75 public final JPanel plugins = createPreferenceTab("plugin", tr("Plugins"), tr("Configure available plugins."), false); 76 77 public final javax.swing.JTabbedPane displaycontent = new javax.swing.JTabbedPane(); 78 public final javax.swing.JTabbedPane mapcontent = new javax.swing.JTabbedPane(); 134 135 // distinct list of tabs that have been initialized (we do not initialize tabs until they are displayed to speed up dialog startup) 136 private final List<PreferenceSetting> settingsInitialized = new ArrayList<PreferenceSetting>(); 79 137 80 138 List<ValidationListener> validationListeners = new ArrayList<ValidationListener>(); … … 90 148 91 149 /** 92 * Construct a JPanel for the preference settings. Layout is GridBagLayout 93 * and a centered title label and the description are added. The panel 94 * will be shown inside a {@link ScrollPane} 95 * @param icon The name of the icon. 96 * @param title The title of this preference tab. 97 * @param desc A description in one sentence for this tab. Will be displayed 98 * italic under the title. 150 * Construct a PreferencePanel for the preference settings. Layout is GridBagLayout 151 * and a centered title label and the description are added. 99 152 * @return The created panel ready to add other controls. 100 153 */ 101 public JPanel createPreferenceTab(String icon, String title, String desc) { 102 return createPreferenceTab(icon, title, desc, false); 103 } 104 105 public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane) { 106 return createPreferenceTab(icon, title, desc, inScrollPane, false); 107 } 108 109 /** 110 * Construct a JPanel for the preference settings. Layout is GridBagLayout 154 public PreferencePanel createPreferenceTab(TabPreferenceSetting caller) { 155 return createPreferenceTab(caller, false); 156 } 157 158 /** 159 * Construct a PreferencePanel for the preference settings. Layout is GridBagLayout 111 160 * and a centered title label and the description are added. 112 * @param icon The name of the icon.113 * @param title The title of this preference tab.114 * @param desc A description in one sentence for this tab. Will be displayed115 * italic under the title.116 161 * @param inScrollPane if <code>true</code> the added tab will show scroll bars 117 162 * if the panel content is larger than the available space 118 163 * @return The created panel ready to add other controls. 119 164 */ 120 public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane, boolean isExpert) { 121 JPanel p = new JPanel(new GridBagLayout()); 122 p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 123 p.add(new JLabel(title), GBC.eol().insets(0,5,0,10).anchor(GBC.NORTHWEST)); 124 125 JLabel descLabel = new JLabel("<html>"+desc+"</html>"); 126 descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC)); 127 p.add(descLabel, GBC.eol().insets(5,0,5,20).fill(GBC.HORIZONTAL)); 128 129 JComponent tab = p; 165 public PreferencePanel createPreferenceTab(TabPreferenceSetting caller, boolean inScrollPane) { 166 CheckParameterUtil.ensureParameterNotNull(caller); 167 PreferencePanel p = new PreferencePanel(caller); 168 169 PreferenceTab tab = p; 130 170 if (inScrollPane) { 131 JScrollPane sp = new JScrollPane(p);171 PreferenceScrollPane sp = new PreferenceScrollPane(p); 132 172 tab = sp; 133 173 } 134 TabData data = new TabData(); 135 data.icon = icon; 136 data.tab = tab; 137 data.isExpert = isExpert; 138 data.toolTip = "<html>"+desc+"</html>"; 139 tabs.add(data); 174 tabs.add(tab); 140 175 return p; 141 176 } 142 177 178 private static interface TabIdentifier { 179 public boolean identify(TabPreferenceSetting tps, Object param); 180 } 181 182 private void selectTabBy(TabIdentifier method, Object param) { 183 for (int i=0; i<getTabCount(); i++) { 184 Component c = getComponentAt(i); 185 if (c instanceof PreferenceTab) { 186 PreferenceTab tab = (PreferenceTab) c; 187 if (method.identify(tab.getTabPreferenceSetting(), param)) { 188 setSelectedIndex(i); 189 return; 190 } 191 } 192 } 193 } 194 143 195 public void selectTabByName(String name) { 144 for (TabData data : tabs) { 145 if (data.icon.equals(name)) { 146 Component c = data.tab; 147 if (c != null) { 148 setSelectedComponent(c); 149 } 150 return; 151 } 152 } 153 } 154 155 protected PluginPreference getPluginPreference() { 156 for (PreferenceSetting setting: settings) { 157 if (setting instanceof PluginPreference) 158 return (PluginPreference) setting; 159 } 160 return null; 196 selectTabBy(new TabIdentifier(){ 197 @Override 198 public boolean identify(TabPreferenceSetting tps, Object name) { 199 return tps.getIconName().equals(name); 200 }}, name); 201 } 202 203 public void selectTabByPref(Class<? extends TabPreferenceSetting> clazz) { 204 selectTabBy(new TabIdentifier(){ 205 @Override 206 public boolean identify(TabPreferenceSetting tps, Object clazz) { 207 return tps.getClass().isAssignableFrom((Class<?>) clazz); 208 }}, clazz); 209 } 210 211 public final DisplayPreference getDisplayPreference() { 212 return getSetting(DisplayPreference.class); 213 } 214 215 public final MapPreference getMapPreference() { 216 return getSetting(MapPreference.class); 217 } 218 219 public final PluginPreference getPluginPreference() { 220 return getSetting(PluginPreference.class); 161 221 } 162 222 … … 248 308 super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT); 249 309 super.addMouseWheelListener(this); 310 super.getModel().addChangeListener(this); 250 311 ExpertToggleAction.addExpertModeChangeListener(this); 251 312 } … … 258 319 } 259 320 } 260 261 display.add(displaycontent, GBC.eol().fill(GBC.BOTH)); 262 map.add(mapcontent, GBC.eol().fill(GBC.BOTH)); 321 /* 263 322 for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) { 264 323 try { 265 PreferenceSetting settings = it.next(); 266 settings.addGui(this); 324 PreferenceSetting ps = it.next(); 325 long start = System.currentTimeMillis(); 326 ps.addGui(this); 327 System.out.println(ps.getClass()+" -> "+(System.currentTimeMillis()-start)); 267 328 } catch (SecurityException e) { 268 329 it.remove(); 269 330 } catch (Throwable e) { 270 / * allow to change most settings even if e.g. a plugin fails */331 // allow to change most settings even if e.g. a plugin fails 271 332 BugReportExceptionHandler.handleException(e); 272 333 } 273 } 334 }*/ 274 335 addGUITabs(false); 275 336 } 276 337 338 private void addGUITabsForSetting(Icon icon, TabPreferenceSetting tps) { 339 for (PreferenceTab tab : tabs) { 340 if (tab.getTabPreferenceSetting().equals(tps)) { 341 insertGUITabsForSetting(icon, tps, getTabCount()); 342 } 343 } 344 } 345 346 private void insertGUITabsForSetting(Icon icon, TabPreferenceSetting tps, int index) { 347 int position = index; 348 for (PreferenceTab tab : tabs) { 349 if (tab.getTabPreferenceSetting().equals(tps)) { 350 insertTab(null, icon, tab.getComponent(), tps.getTooltip(), position++); 351 } 352 } 353 } 354 277 355 private void addGUITabs(boolean clear) { 278 356 boolean expert = ExpertToggleAction.isExpert(); … … 281 359 removeAll(); 282 360 } 283 for (TabData data : tabs) { 284 if (expert || !data.isExpert) { 285 addTab(null, ImageProvider.get("preferences", data.icon), data.tab, data.toolTip); 286 } 287 } 361 // Inspect each tab setting 362 for (PreferenceSetting setting : settings) { 363 if (setting instanceof TabPreferenceSetting) { 364 TabPreferenceSetting tps = (TabPreferenceSetting) setting; 365 if (expert || !tps.isExpert()) { 366 // Get icon 367 ImageIcon icon = ImageProvider.get("preferences", tps.getIconName()); 368 if (settingsInitialized.contains(tps)) { 369 // If it has been initialized, add corresponding tab(s) 370 addGUITabsForSetting(icon, tps); 371 } else { 372 // If it has not been initialized, create an empty tab with only icon and tooltip 373 addTab(null, icon, new PreferencePanel(tps), tps.getTooltip()); 374 } 375 } 376 } 377 } 378 /*for (PreferenceTab tab : tabs) { 379 TabPreferenceSetting s = tab.getTabPreferenceSetting(); 380 if (expert || !s.isExpert()) { 381 addTab(null, ImageProvider.get("preferences", s.getIconName()), tab.getComponent(), "<html>"+s.getTooltip()+"</html>"); 382 } 383 }*/ 288 384 try { 289 setSelectedComponent(sel); 385 if (sel != null) { 386 setSelectedComponent(sel); 387 } 290 388 } catch (IllegalArgumentException e) {} 291 389 } 292 390 293 391 @Override 294 392 public void expertChanged(boolean isExpert) { … … 311 409 static { 312 410 // order is important! 411 settingsFactory.add(new DisplayPreference.Factory()); 313 412 settingsFactory.add(new DrawingPreference.Factory()); 314 413 settingsFactory.add(new ColorPreference.Factory()); … … 316 415 settingsFactory.add(new LanguagePreference.Factory()); 317 416 settingsFactory.add(new ServerAccessPreference.Factory()); 417 settingsFactory.add(new MapPreference.Factory()); 318 418 settingsFactory.add(new ProjectionPreference.Factory()); 319 419 settingsFactory.add(new MapPaintPreference.Factory()); … … 355 455 super.setSelectedIndex(newTab); 356 456 } 457 458 @Override 459 public void stateChanged(ChangeEvent e) { 460 int index = getSelectedIndex(); 461 Component sel = getSelectedComponent(); 462 if (index > -1 && sel instanceof PreferenceTab) { 463 PreferenceTab tab = (PreferenceTab) sel; 464 TabPreferenceSetting preferenceSettings = tab.getTabPreferenceSetting(); 465 //System.out.println(preferenceSettings); 466 if (!settingsInitialized.contains(preferenceSettings)) { 467 try { 468 //System.out.println("adding GUI for "+preferenceSettings); 469 getModel().removeChangeListener(this); 470 preferenceSettings.addGui(this); 471 // Add GUI for sub preferences 472 for (PreferenceSetting setting : settings) { 473 if (setting instanceof SubPreferenceSetting) { 474 SubPreferenceSetting sps = (SubPreferenceSetting) setting; 475 if (sps.getTabPreferenceSetting(this) == preferenceSettings) { 476 //System.out.println("adding GUI for "+sps); 477 sps.addGui(this); 478 } 479 } 480 } 481 Icon icon = getIconAt(index); 482 remove(index); 483 insertGUITabsForSetting(icon, preferenceSettings, index); 484 setSelectedIndex(index); 485 } catch (SecurityException ex) { 486 ex.printStackTrace(); 487 } catch (Throwable ex) { 488 // allow to change most settings even if e.g. a plugin fails 489 BugReportExceptionHandler.handleException(ex); 490 } finally { 491 settingsInitialized.add(preferenceSettings); 492 getModel().addChangeListener(this); 493 } 494 } 495 } 496 } 357 497 } -
trunk/src/org/openstreetmap/josm/gui/preferences/RemoteControlPreference.java
r4883 r4968 34 34 * @author Frederik Ramm 35 35 */ 36 public class RemoteControlPreference implementsPreferenceSetting36 public class RemoteControlPreference extends DefaultTabPreferenceSetting 37 37 { 38 38 public static class Factory implements PreferenceSettingFactory { … … 41 41 return new RemoteControlPreference(); 42 42 } 43 } 44 45 private RemoteControlPreference() { 46 super("remotecontrol", tr("Remote Control"), tr("Settings for the remote control feature.")); 43 47 } 44 48 … … 57 61 public void addGui(final PreferenceTabbedPane gui) { 58 62 59 JPanel remote = gui.createPreferenceTab( "remotecontrol", tr("Remote Control"), tr("Settings for the remote control feature."));63 JPanel remote = gui.createPreferenceTab(this); 60 64 61 65 remote.add(enableRemoteControl = new JCheckBox(tr("Enable remote control"), RemoteControl.PROP_REMOTECONTROL_ENABLED.get()), GBC.eol()); -
trunk/src/org/openstreetmap/josm/gui/preferences/ServerAccessPreference.java
r3463 r4968 18 18 import org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel; 19 19 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 20 public class ServerAccessPreference implementsPreferenceSetting {20 public class ServerAccessPreference extends DefaultTabPreferenceSetting { 21 21 22 22 public static class Factory implements PreferenceSettingFactory { … … 24 24 return new ServerAccessPreference(); 25 25 } 26 } 27 28 private ServerAccessPreference() { 29 super("connection", tr("Connection Settings"), tr("Connection Settings for the OSM server.")); 26 30 } 27 31 … … 109 113 gc.weighty = 1.0; 110 114 gc.anchor = GridBagConstraints.NORTHWEST; 111 gui.c onnection.add(buildContentPanel(), gc);115 gui.createPreferenceTab(this).add(buildContentPanel(), gc); 112 116 113 117 initFromPreferences(); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r4936 r4968 32 32 import java.util.EventObject; 33 33 import java.util.Iterator; 34 import java.util.LinkedList;35 34 import java.util.List; 36 35 import java.util.concurrent.CopyOnWriteArrayList; … … 372 371 * Identifiers for strings that need to be provided. 373 372 */ 374 p rotectedenum I18nString { AVAILABLE_SOURCES, ACTIVE_SOURCES, NEW_SOURCE_ENTRY_TOOLTIP, NEW_SOURCE_ENTRY,373 public enum I18nString { AVAILABLE_SOURCES, ACTIVE_SOURCES, NEW_SOURCE_ENTRY_TOOLTIP, NEW_SOURCE_ENTRY, 375 374 REMOVE_SOURCE_TOOLTIP, EDIT_SOURCE_TOOLTIP, ACTIVATE_TOOLTIP, RELOAD_ALL_AVAILABLE, 376 375 LOADING_SOURCES_FROM, FAILED_TO_LOAD_SOURCES_FROM, FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC, -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r4613 r4968 410 410 } 411 411 412 public class Settings implementsPreferenceSetting {412 public class Settings extends DefaultTabPreferenceSetting { 413 413 414 414 private final class Move implements ActionListener { … … 497 497 498 498 public Settings(DefaultMutableTreeNode rootActionsNode) { 499 super("toolbar", tr("Toolbar customization"), tr("Customize the elements on the toolbar.")); 499 500 actionsTreeModel = new DefaultTreeModel(rootActionsNode); 500 501 actionsTree = new JTree(actionsTreeModel); … … 766 767 actionParametersPanel.setVisible(false); 767 768 768 JPanel panel = gui.createPreferenceTab("toolbar", tr("Toolbar customization"), 769 tr("Customize the elements on the toolbar."), false); 769 JPanel panel = gui.createPreferenceTab(this); 770 770 panel.add(p, GBC.eol().fill(GBC.BOTH)); 771 771 panel.add(actionParametersPanel, GBC.eol().fill(GBC.HORIZONTAL)); -
trunk/src/org/openstreetmap/josm/gui/preferences/ValidatorPreference.java
r3944 r4968 25 25 * @author frsantos 26 26 */ 27 public class ValidatorPreference implementsPreferenceSetting {27 public class ValidatorPreference extends DefaultTabPreferenceSetting { 28 28 29 29 public static class Factory implements PreferenceSettingFactory { … … 32 32 return new ValidatorPreference(); 33 33 } 34 } 35 36 private ValidatorPreference() { 37 super("validator", tr("Data validator"), 38 tr("An OSM data validator that checks for common errors made by users and editor programs.")); 34 39 } 35 40 … … 112 117 testPane.setBorder(null); 113 118 114 String description = tr("An OSM data validator that checks for common errors made by users and editor programs."); 115 JPanel tab = gui.createPreferenceTab("validator", tr("Data validator"), description); 119 JPanel tab = gui.createPreferenceTab(this); 116 120 tab.add(testPane, GBC.eol().fill(GBC.BOTH)); 117 121 tab.add(GBC.glue(0,10), a); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 41 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 42 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 43 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 44 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 45 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 46 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 47 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 43 48 import org.openstreetmap.josm.tools.ColorHelper; 44 49 import org.openstreetmap.josm.tools.GBC; 45 50 46 public class ColorPreference implements PreferenceSetting {51 public class ColorPreference implements SubPreferenceSetting { 47 52 48 53 public static class Factory implements PreferenceSettingFactory { … … 234 239 buttonPanel.add(defaultAll, GBC.std().insets(0,5,0,0)); 235 240 buttonPanel.add(remove, GBC.std().insets(0,5,0,0)); 236 gui. displaycontent.addTab(tr("Colors"), panel);241 gui.getDisplayPreference().displaycontent.addTab(tr("Colors"), panel); 237 242 } 238 243 … … 271 276 } 272 277 } 273 org.openstreetmap.josm.gui.layer.OsmDataLayer.createHatchTexture();278 OsmDataLayer.createHatchTexture(); 274 279 return ret; 275 280 } 281 282 @Override 283 public boolean isExpert() { 284 return false; 285 } 286 287 @Override 288 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 289 return gui.getDisplayPreference(); 290 } 276 291 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Dimension;7 6 import java.awt.GridBagLayout; 8 7 import java.awt.event.ActionEvent; … … 18 17 import org.openstreetmap.josm.Main; 19 18 import org.openstreetmap.josm.actions.ExpertToggleAction; 19 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 20 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 21 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 22 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 23 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 20 24 import org.openstreetmap.josm.tools.GBC; 21 25 22 public class DrawingPreference implements PreferenceSetting {26 public class DrawingPreference implements SubPreferenceSetting { 23 27 24 28 public static class Factory implements PreferenceSettingFactory { … … 44 48 45 49 public void addGui(PreferenceTabbedPane gui) { 46 gui.display.setPreferredSize(new Dimension(400,600));50 //gui.display.setPreferredSize(new Dimension(400,600)); 47 51 gpxPanel = new GPXSettingsPanel(); 48 52 gui.addValidationListener(gpxPanel); … … 51 55 JScrollPane scrollpane = new JScrollPane(panel); 52 56 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 53 gui. displaycontent.addTab(tr("GPS Points"), scrollpane);57 gui.getDisplayPreference().displaycontent.addTab(tr("GPS Points"), scrollpane); 54 58 panel = new JPanel(new GridBagLayout()); 55 59 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 131 135 scrollpane = new JScrollPane(panel); 132 136 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 133 gui. displaycontent.addTab(tr("OSM Data"), scrollpane);137 gui.getDisplayPreference().displaycontent.addTab(tr("OSM Data"), scrollpane); 134 138 } 135 139 … … 158 162 return false; 159 163 } 164 165 @Override 166 public boolean isExpert() { 167 return false; 168 } 169 170 @Override 171 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 172 return gui.getDisplayPreference(); 173 } 160 174 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r4965 r4968 1 package org.openstreetmap.josm.gui.preferences ;1 package org.openstreetmap.josm.gui.preferences.display; 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 22 22 import org.openstreetmap.josm.Main; 23 23 import org.openstreetmap.josm.actions.ExpertToggleAction; 24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 25 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 26 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 27 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 28 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 24 29 import org.openstreetmap.josm.tools.GBC; 25 30 26 public class LafPreference implements PreferenceSetting {31 public class LafPreference implements SubPreferenceSetting { 27 32 28 33 public static class Factory implements PreferenceSettingFactory { … … 111 116 JScrollPane scrollpane = new JScrollPane(panel); 112 117 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 113 gui. displaycontent.addTab(tr("Look and Feel"), scrollpane);118 gui.getDisplayPreference().displaycontent.addTab(tr("Look and Feel"), scrollpane); 114 119 } 115 120 … … 124 129 return mod; 125 130 } 131 132 @Override 133 public boolean isExpert() { 134 return false; 135 } 136 137 @Override 138 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 139 return gui.getDisplayPreference(); 140 } 126 141 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LanguagePreference.java
r4965 r4968 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.display; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 20 20 21 21 import org.openstreetmap.josm.Main; 22 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 23 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 24 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 25 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 26 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 22 27 import org.openstreetmap.josm.tools.GBC; 23 28 import org.openstreetmap.josm.tools.I18n; 24 29 25 public class LanguagePreference implements PreferenceSetting {30 public class LanguagePreference implements SubPreferenceSetting { 26 31 public static class Factory implements PreferenceSettingFactory { 27 32 public PreferenceSetting createPreferenceSetting() { … … 107 112 } 108 113 } 114 115 @Override 116 public boolean isExpert() { 117 return false; 118 } 119 120 @Override 121 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 122 return gui.getDisplayPreference(); 123 } 109 124 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r4965 r4968 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.imagery; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r4965 r4968 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.imagery; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; … … 76 76 import org.openstreetmap.josm.gui.layer.TMSLayer; 77 77 import org.openstreetmap.josm.gui.layer.WMSLayer; 78 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 79 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 80 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 81 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 78 82 import org.openstreetmap.josm.io.imagery.HTMLGrabber; 79 83 import org.openstreetmap.josm.io.imagery.OffsetServer; … … 83 87 import org.openstreetmap.josm.tools.ImageProvider; 84 88 85 public class ImageryPreference implementsPreferenceSetting {89 public class ImageryPreference extends DefaultTabPreferenceSetting { 86 90 public static class Factory implements PreferenceSettingFactory { 87 91 @Override … … 90 94 } 91 95 } 96 97 private ImageryPreference() { 98 super("imagery", tr("Imagery Preferences"), tr("Modify list of imagery layers displayed in the Imagery menu")); 99 } 100 92 101 private ImageryProvidersPanel imageryProviders; 93 102 private ImageryLayerInfo layerInfo; … … 269 278 @Override 270 279 public void addGui(final PreferenceTabbedPane gui) { 271 JPanel p = gui.createPreferenceTab( "imagery", tr("Imagery Preferences"), tr("Modify list of imagery layers displayed in the Imagery menu"));280 JPanel p = gui.createPreferenceTab(this); 272 281 JTabbedPane pane = new JTabbedPane(); 273 282 layerInfo = new ImageryLayerInfo(ImageryLayerInfo.instance); -
trunk/src/org/openstreetmap/josm/gui/preferences/map/BackupPreference.java
r4965 r4968 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 19 19 import org.openstreetmap.josm.data.AutosaveTask; 20 20 import org.openstreetmap.josm.data.preferences.BooleanProperty; 21 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 22 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 23 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 24 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 21 25 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 22 26 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 23 27 import org.openstreetmap.josm.tools.GBC; 24 28 25 public class BackupPreference implements PreferenceSetting {29 public class BackupPreference implements SubPreferenceSetting { 26 30 27 31 public static class Factory implements PreferenceSettingFactory { … … 97 101 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 98 102 99 gui. mapcontent.addTab(tr("File backup"), null, sp, tr("Configure whether to create backup files"));103 gui.getMapPreference().mapcontent.addTab(tr("File backup"), null, sp, tr("Configure whether to create backup files")); 100 104 } 101 105 … … 110 114 return restartRequired; 111 115 } 116 117 @Override 118 public boolean isExpert() { 119 return false; 120 } 121 122 @Override 123 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 124 return gui.getMapPreference(); 125 } 112 126 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; … … 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 22 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 23 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 24 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 25 import org.openstreetmap.josm.gui.preferences.SourceEditor; 26 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 22 27 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry; 28 import org.openstreetmap.josm.gui.preferences.SourceEntry; 29 import org.openstreetmap.josm.gui.preferences.SourceProvider; 30 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 23 31 import org.openstreetmap.josm.tools.GBC; 24 32 import org.openstreetmap.josm.tools.Predicate; 25 33 import org.openstreetmap.josm.tools.Utils; 26 34 27 public class MapPaintPreference implements PreferenceSetting {35 public class MapPaintPreference implements SubPreferenceSetting { 28 36 private SourceEditor sources; 29 37 private JCheckBox enableIconDefault; … … 55 63 panel.add(enableIconDefault, GBC.eol().insets(11,2,5,0)); 56 64 57 gui. mapcontent.addTab(tr("Map Paint Styles"), panel);65 gui.getMapPreference().mapcontent.addTab(tr("Map Paint Styles"), panel); 58 66 59 67 // this defers loading of style sources to the first time the tab 60 68 // with the map paint preferences is selected by the user 61 69 // 62 gui. mapcontent.addChangeListener(70 gui.getMapPreference().mapcontent.addChangeListener( 63 71 new ChangeListener() { 64 72 public void stateChanged(ChangeEvent e) { 65 if (gui. mapcontent.getSelectedComponent() == panel) {73 if (gui.getMapPreference().mapcontent.getSelectedComponent() == panel) { 66 74 sources.initiallyLoadAvailableSources(); 67 75 } … … 263 271 } 264 272 } 273 274 @Override 275 public boolean isExpert() { 276 return false; 277 } 278 279 @Override 280 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 281 return gui.getMapPreference(); 282 } 265 283 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/ProjectionPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 29 29 import org.openstreetmap.josm.data.projection.Projections; 30 30 import org.openstreetmap.josm.gui.NavigatableComponent; 31 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 32 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 33 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 34 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 35 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 31 36 import org.openstreetmap.josm.plugins.PluginHandler; 32 37 import org.openstreetmap.josm.tools.GBC; 33 38 34 public class ProjectionPreference implements PreferenceSetting {39 public class ProjectionPreference implements SubPreferenceSetting { 35 40 36 41 public static class Factory implements PreferenceSettingFactory { … … 136 141 137 142 JScrollPane scrollpane = new JScrollPane(projPanel); 138 gui. mapcontent.addTab(tr("Map Projection"), scrollpane);143 gui.getMapPreference().mapcontent.addTab(tr("Map Projection"), scrollpane); 139 144 140 145 updateMeta(Main.getProjection()); … … 288 293 }); 289 294 } 295 296 @Override 297 public boolean isExpert() { 298 return false; 299 } 300 301 @Override 302 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 303 return gui.getMapPreference(); 304 } 290 305 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.map; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; … … 12 12 import java.util.Collections; 13 13 import java.util.HashMap; 14 import java.util.Iterator;15 14 import java.util.List; 16 15 … … 28 27 import org.openstreetmap.josm.Main; 29 28 import org.openstreetmap.josm.gui.ExtendedDialog; 29 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 30 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 31 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 32 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 30 33 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener; 34 import org.openstreetmap.josm.gui.preferences.SourceEditor; 31 35 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry; 36 import org.openstreetmap.josm.gui.preferences.SourceEntry; 37 import org.openstreetmap.josm.gui.preferences.SourceProvider; 38 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 32 39 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 33 40 import org.openstreetmap.josm.gui.tagging.TaggingPresetMenu; … … 38 45 import org.xml.sax.SAXParseException; 39 46 40 public class TaggingPresetPreference implements PreferenceSetting {47 public class TaggingPresetPreference implements SubPreferenceSetting { 41 48 42 49 public static class Factory implements PreferenceSettingFactory { … … 44 51 return new TaggingPresetPreference(); 45 52 } 53 } 54 55 private TaggingPresetPreference() { 56 super(); 46 57 } 47 58 … … 152 163 sources = new TaggingPresetSourceEditor(); 153 164 panel.add(sources, GBC.eol().fill(GBC.BOTH)); 154 gui. mapcontent.addTab(tr("Tagging Presets"), panel);165 gui.getMapPreference().mapcontent.addTab(tr("Tagging Presets"), panel); 155 166 156 167 // this defers loading of tagging preset sources to the first time the tab 157 168 // with the tagging presets is selected by the user 158 169 // 159 gui. mapcontent.addChangeListener(170 gui.getMapPreference().mapcontent.addChangeListener( 160 171 new ChangeListener() { 161 172 public void stateChanged(ChangeEvent e) { 162 if (gui. mapcontent.getSelectedComponent() == panel) {173 if (gui.getMapPreference().mapcontent.getSelectedComponent() == panel) { 163 174 sources.initiallyLoadAvailableSources(); 164 175 } … … 327 338 } 328 339 } 340 341 @Override 342 public boolean isExpert() { 343 return false; 344 } 345 346 @Override 347 public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { 348 return gui.getMapPreference(); 349 } 329 350 } -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r4965 r4968 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.shortcut; 3 3 4 4 import java.awt.Dimension; -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreference.java
r4965 r4968 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.gui.preferences ;2 package org.openstreetmap.josm.gui.preferences.shortcut; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 9 9 import javax.swing.table.AbstractTableModel; 10 10 11 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 12 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 13 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 14 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 11 15 import org.openstreetmap.josm.tools.GBC; 12 16 import org.openstreetmap.josm.tools.Shortcut; 13 17 14 public class ShortcutPreference implementsPreferenceSetting {18 public class ShortcutPreference extends DefaultTabPreferenceSetting { 15 19 16 20 public static class Factory implements PreferenceSettingFactory { … … 19 23 } 20 24 } 21 22 p ublic void addGui(PreferenceTabbedPane gui) {25 26 private ShortcutPreference() { 23 27 // icon source: http://www.iconfinder.net/index.php?q=key&page=icondetails&iconid=8553&size=128&q=key&s12=on&s16=on&s22=on&s32=on&s48=on&s64=on&s128=on 24 28 // icon licence: GPL … … 27 31 // icon original size: 128x128 28 32 // modifications: icon was cropped, then resized 29 JPanel p = gui.createPreferenceTab("shortcuts", tr("Shortcut Preferences"), 30 tr("Changing keyboard shortcuts manually."), false); 33 super("shortcuts", tr("Shortcut Preferences"), tr("Changing keyboard shortcuts manually.")); 34 } 35 36 public void addGui(PreferenceTabbedPane gui) { 37 JPanel p = gui.createPreferenceTab(this); 31 38 32 39 PrefJPanel prefpanel = new PrefJPanel(new scListModel()); -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r4936 r4968 67 67 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 68 68 import org.openstreetmap.josm.gui.preferences.SourceEntry; 69 import org.openstreetmap.josm.gui.preferences. TaggingPresetPreference.PresetPrefHelper;69 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference.PresetPrefHelper; 70 70 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 71 71 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority; -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchDialog.java
r4286 r4968 42 42 import org.openstreetmap.josm.data.preferences.BooleanProperty; 43 43 import org.openstreetmap.josm.gui.ExtendedDialog; 44 import org.openstreetmap.josm.gui.preferences. TaggingPresetPreference;44 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 45 45 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Check; 46 46 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Combo; -
trunk/src/org/openstreetmap/josm/tools/TaggingPresetNameTemplateList.java
r4837 r4968 7 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; 8 8 import org.openstreetmap.josm.data.osm.Way; 9 import org.openstreetmap.josm.gui.preferences. TaggingPresetPreference;9 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 10 10 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 11 11 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Check;
Note:
See TracChangeset
for help on using the changeset viewer.