Changeset 16979 in josm
- Timestamp:
- 2020-08-30T10:03:00+02:00 (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r16966 r16979 45 45 import org.openstreetmap.josm.gui.preferences.display.DisplayPreference; 46 46 import org.openstreetmap.josm.gui.preferences.display.DrawingPreference; 47 import org.openstreetmap.josm.gui.preferences.display.GPXPreference; 47 48 import org.openstreetmap.josm.gui.preferences.display.LafPreference; 48 49 import org.openstreetmap.josm.gui.preferences.display.LanguagePreference; … … 572 573 SETTINGS_FACTORIES.add(new DisplayPreference.Factory()); 573 574 SETTINGS_FACTORIES.add(new DrawingPreference.Factory()); 575 SETTINGS_FACTORIES.add(new GPXPreference.Factory()); 574 576 SETTINGS_FACTORIES.add(new ColorPreference.Factory()); 575 577 SETTINGS_FACTORIES.add(new LafPreference.Factory()); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r15880 r16979 29 29 30 30 /** 31 * Mapdrawing preferences.31 * "OSM Data" drawing preferences. 32 32 */ 33 33 public class DrawingPreference implements SubPreferenceSetting { … … 49 49 public static final BooleanProperty SOURCE_BOUNDS_PROP = new BooleanProperty("draw.data.downloaded_area", true); 50 50 51 private GPXSettingsPanel gpxPanel;52 51 private final JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 53 52 private final JCheckBox headArrow = new JCheckBox(tr("Only on the head of a way.")); … … 74 73 @Override 75 74 public void addGui(PreferenceTabbedPane gui) { 76 addOsmPane(gui);77 addGpxPane(gui);78 }79 80 private void addGpxPane(PreferenceTabbedPane gui) {81 gpxPanel = new GPXSettingsPanel();82 gui.addValidationListener(gpxPanel);83 JPanel panel = gpxPanel;84 85 JScrollPane scrollpane = new JScrollPane(panel);86 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));87 GuiHelper.setDefaultIncrement(scrollpane);88 gui.getDisplayPreference().addSubTab(this, tr("GPS Points"), scrollpane);89 }90 91 private void addOsmPane(PreferenceTabbedPane gui) {92 75 JPanel panel = new JPanel(new GridBagLayout()); 93 76 panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); … … 217 200 @Override 218 201 public boolean ok() { 219 boolean restart = gpxPanel.savePreferences();220 202 OsmDataLayer.PROPERTY_HIDE_LABELS_WHILE_DRAGGING.put(hideLabelsWhileDragging.isSelected()); 221 203 Config.getPref().putBoolean("draw.data.area_outline_only", outlineOnly.isSelected()); … … 243 225 } 244 226 Config.getPref().putInt("mappaint.node.virtual-size", vn); 245 return restart;227 return false; 246 228 } 247 229 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/PreferencesTestUtils.java
r10098 r16979 20 20 public static void doTestPreferenceSettingAddGui( 21 21 PreferenceSettingFactory factory, Class<? extends DefaultTabPreferenceSetting> parentClass) { 22 doTestPreferenceSettingAddGui(factory, parentClass, 1);23 }24 25 /**26 * Generic test for {@link PreferenceSetting#addGui(PreferenceTabbedPane)}.27 * @param factory setting factory to test28 * @param parentClass optional parent setting, can be {@code null}29 * @param increment expected tab number increment30 */31 public static void doTestPreferenceSettingAddGui(32 PreferenceSettingFactory factory, Class<? extends DefaultTabPreferenceSetting> parentClass, int increment) {33 22 PreferenceSetting setting = factory.createPreferenceSetting(); 34 23 PreferenceTabbedPane tabPane = new PreferenceTabbedPane(); … … 37 26 setting.addGui(tabPane); 38 27 if (parentClass != null) { 39 assertEquals(tabs + increment, tabPane.getSetting(parentClass).getTabPane().getTabCount());28 assertEquals(tabs + 1, tabPane.getSetting(parentClass).getTabPane().getTabCount()); 40 29 assertEquals(tabPane.getSetting(parentClass), ((SubPreferenceSetting) setting).getTabPreferenceSetting(tabPane)); 41 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java
r10378 r16979 35 35 @Test 36 36 public void testAddGui() { 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new DrawingPreference.Factory(), DisplayPreference.class , 2);37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new DrawingPreference.Factory(), DisplayPreference.class); 38 38 } 39 39 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java
r16978 r16979 10 10 11 11 /** 12 * Unit tests of {@link DrawingPreference} class.12 * Unit tests of {@link GPXPreference} class. 13 13 */ 14 public class DrawingPreferenceTest {14 public class GPXPreferenceTest { 15 15 16 16 /** … … 23 23 24 24 /** 25 * Unit test of {@link DrawingPreference#DrawingPreference}.25 * Unit test of {@link GPXPreference.Factory}. 26 26 */ 27 27 @Test 28 public void test DrawingPreference() {29 assertNotNull(new DrawingPreference.Factory().createPreferenceSetting());28 public void testGPXPreference() { 29 assertNotNull(new GPXPreference.Factory().createPreferenceSetting()); 30 30 } 31 31 32 32 /** 33 * Unit test of {@link DrawingPreference#addGui}.33 * Unit test of {@link GPXPreference#addGui}. 34 34 */ 35 35 @Test 36 36 public void testAddGui() { 37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new DrawingPreference.Factory(), DisplayPreference.class, 2);37 PreferencesTestUtils.doTestPreferenceSettingAddGui(new GPXPreference.Factory(), DisplayPreference.class); 38 38 } 39 39 }
Note:
See TracChangeset
for help on using the changeset viewer.