Changeset 6767 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-01-29T16:18:16+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences/advanced
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r6578 r6767 48 48 import org.openstreetmap.josm.tools.GBC; 49 49 50 /** 51 * Advanced preferences, allowing to set preference entries directly. 52 */ 50 53 public final class AdvancedPreference extends DefaultTabPreferenceSetting { 51 54 -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java
r6316 r6767 29 29 private final Preferences prefs; 30 30 31 /** 32 * Constructs a new {@code ExportProfileAction}. 33 */ 31 34 public ExportProfileAction(Preferences prefs, String schemaKey, String prefPattern) { 32 35 super(tr("Save {0} profile", tr(schemaKey))); … … 35 38 this.schemaKey = schemaKey; 36 39 } 37 40 38 41 @Override 39 42 public void actionPerformed(ActionEvent ae) { … … 54 57 CustomConfigurator.exportPreferencesKeysToFile(f.getAbsolutePath(), false, keys); 55 58 } 56 59 57 60 private File askUserForCustomSettingsFile() { 58 61 String title = tr("Choose profile file"); 59 62 60 63 FileFilter filter = new FileFilter() { 61 64 @Override … … 76 79 } 77 80 return sel; 78 } 81 } 79 82 return null; 80 83 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r6452 r6767 25 25 import org.openstreetmap.josm.tools.WindowGeometry; 26 26 27 /** 28 * Editor for List preference entries. 29 */ 27 30 public class ListEditor extends ExtendedDialog { 28 31 … … 32 35 /** 33 36 * Constructs a new {@code ListEditor}. 37 * @param gui The parent component 34 38 */ 35 39 public ListEditor(final JComponent gui, PrefEntry entry, ListSetting setting) { -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListListEditor.java
r6084 r6767 33 33 import org.openstreetmap.josm.tools.WindowGeometry; 34 34 35 /** 36 * Editor for List of Lists preference entries. 37 */ 35 38 public class ListListEditor extends ExtendedDialog { 36 39 … … 45 48 ListTableModel tableModel; 46 49 50 /** 51 * Constructs a new {@code ListListEditor}. 52 * @param gui The parent component 53 */ 47 54 public ListListEditor(final JComponent gui, PrefEntry entry, ListListSetting setting) { 48 55 super(gui, tr("Change list of lists setting"), new String[] {tr("OK"), tr("Cancel")}); … … 60 67 } 61 68 69 /** 70 * Returns the data. 71 * @return the preference data 72 */ 62 73 public List<List<String>> getData() { 63 74 return data; … … 220 231 } 221 232 } 222 223 233 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java
r6084 r6767 37 37 import org.openstreetmap.josm.tools.WindowGeometry; 38 38 39 /** 40 * Editor for List of Maps preference entries. 41 */ 39 42 public class MapListEditor extends ExtendedDialog { 40 43 … … 74 77 } 75 78 79 /** 80 * Returns the data. 81 * @return the preference data 82 */ 76 83 public List<Map<String,String>> getData() { 77 84 List<Map<String,String>> data = new ArrayList<Map<String,String>>(); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PrefEntry.java
r6022 r6767 6 6 7 7 /** 8 * Class to store single preference line for the table 9 * @since 6021 : extracted from AdvancedPreference class8 * Class to store single preference line for the table. 9 * @since 6021 10 10 */ 11 11 public class PrefEntry implements Comparable<PrefEntry> { … … 16 16 private boolean changed; 17 17 18 /** 19 * Constructs a new {@code PrefEntry}. 20 * @param key The preference key 21 * @param value The preference value 22 * @param defaultValue The preference default value 23 * @param isDefault determines if the current value is the default value 24 */ 18 25 public PrefEntry(String key, Preferences.Setting value, Preferences.Setting defaultValue, boolean isDefault) { 19 26 CheckParameterUtil.ensureParameterNotNull(key); … … 26 33 } 27 34 35 /** 36 * Returns the preference key. 37 * @return the preference key 38 */ 28 39 public String getKey() { 29 40 return key; 30 41 } 31 42 43 /** 44 * Returns the preference value. 45 * @return the preference value 46 */ 32 47 public Preferences.Setting getValue() { 33 48 return value; 34 49 } 35 50 51 /** 52 * Returns the preference default value. 53 * @return the preference default value 54 */ 36 55 public Preferences.Setting getDefaultValue() { 37 56 return defaultValue; 38 57 } 39 58 59 /** 60 * Sets the preference value. 61 * @param value the preference value 62 */ 40 63 public void setValue(Preferences.Setting value) { 41 64 this.value = value; … … 44 67 } 45 68 69 /** 70 * Determines if the current value is the default value. 71 * @return {@code true} if the current value is the default value, {@code false} otherwise 72 */ 46 73 public boolean isDefault() { 47 74 return isDefault; 48 75 } 49 76 77 /** 78 * Determines if this preference entry has been modified. 79 * @return {@code true} if this preference entry has been modified, {@code false} otherwise 80 */ 50 81 public boolean isChanged() { 51 82 return changed; 52 83 } 53 84 85 /** 86 * Marks this preference entry as modified. 87 */ 54 88 public void markAsChanged() { 55 89 changed = true; 56 90 } 57 91 92 /** 93 * Resets this preference entry to default state. 94 */ 58 95 public void reset() { 59 96 value = defaultValue; -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r6603 r6767 34 34 35 35 /** 36 * Component for editing list of preferences as a table 37 * @since 6021 : extracted from AdvancedPreference class36 * Component for editing list of preferences as a table. 37 * @since 6021 38 38 */ 39 39 public class PreferencesTable extends JTable { … … 41 41 private final List<PrefEntry> displayData; 42 42 43 /** 44 * Constructs a new {@code PreferencesTable}. 45 * @param displayData The list of preferences entries to display 46 */ 43 47 public PreferencesTable(List<PrefEntry> displayData) { 44 48 this.displayData = displayData; … … 48 52 getColumnModel().getColumn(1).setCellRenderer(new SettingCellRenderer()); 49 53 getColumnModel().getColumn(1).setCellEditor(new SettingCellEditor()); 50 51 addMouseListener(new MouseAdapter() {54 55 addMouseListener(new MouseAdapter() { 52 56 @Override public void mouseClicked(MouseEvent e) { 53 57 if (e.getClickCount() == 2) { … … 57 61 }); 58 62 } 59 63 60 64 /** 61 65 * This method should be called when displayed data was changed form external code … … 64 68 model.fireTableDataChanged(); 65 69 } 66 67 70 68 71 /** 69 72 * The list of currently selected rows … … 78 81 return entries; 79 82 } 80 83 81 84 /** 82 85 * Call this to edit selected row in preferences table … … 138 141 return false; 139 142 } 140 143 141 144 /** 142 145 * Add new preference to the table … … 228 231 } 229 232 } 230 if (ok) 231 return pe; 232 else 233 if (ok) 234 return pe; 235 else 233 236 return null; 234 237 } … … 254 257 fireDataChanged(); 255 258 } 256 259 257 260 private class AllSettingsTableModel extends DefaultTableModel { 258 261 … … 299 302 marktr("Advanced Background: NonDefault"), 300 303 new Color(255,255,200)); 301 304 302 305 @Override 303 306 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { … … 308 311 Object val = setting.getValue(); 309 312 String display = val != null ? val.toString() : "<html><i><"+tr("unset")+"></i></html>"; 310 313 311 314 JLabel label = (JLabel)super.getTableCellRendererComponent(table, 312 315 display, isSelected, hasFocus, row, column); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/StringEditor.java
r6021 r6767 5 5 6 6 import java.awt.GridBagLayout; 7 7 8 import javax.swing.JComponent; 8 9 9 import javax.swing.JLabel; 10 10 import javax.swing.JPanel; … … 15 15 import org.openstreetmap.josm.tools.GBC; 16 16 17 /** 18 * Editor for String preference entries. 19 */ 17 20 public class StringEditor extends ExtendedDialog { 18 21 … … 20 23 JosmTextField tvalue; 21 24 25 /** 26 * Constructs a new {@code StringEditor}. 27 * @param gui The parent component 28 */ 22 29 public StringEditor(final JComponent gui, PrefEntry entry, StringSetting setting) { 23 30 super(gui, tr("Change string setting"), new String[] {tr("OK"), tr("Cancel")}); … … 27 34 } 28 35 36 /** 37 * Returns the data. 38 * @return the preference data 39 */ 29 40 public String getData() { 30 41 return tvalue.getText();
Note:
See TracChangeset
for help on using the changeset viewer.