source: josm/trunk/src/org/openstreetmap/josm/spi/preferences/DefaultPreferenceChangeEvent.java@ 14977

Last change on this file since 14977 was 14977, checked in by Don-vip, 5 years ago

ensures consistency of upload comment:

  • fix #11168 - ctrl-z/undo could reset unwanted old changeset comment
  • fix #13474 - selecting "new changeset" after having entered a changeset comment did reset it to the previous value
  • fix #17452 - ctrl-enter while typing a changeset comment did upload with the previous value
  • fix behaviour of upload.comment.max-age: values were reset after 5 months instead of intended 4 hours because seconds were compared to milliseconds
  • avoid creation of unneeded undo/redo internal classes for non-editable text fields
  • ensures consistency of upload dialog if upload.comment properties are modified manually from advanced preferences
  • add a source attribute to preference events to know which class modified the preference entry
  • refactor reflection utils
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.spi.preferences;
3
4import java.util.EventObject;
5
6/**
7 * Default implementation of the {@link PreferenceChangeEvent} interface.
8 * @since 12881
9 */
10public class DefaultPreferenceChangeEvent extends EventObject implements PreferenceChangeEvent {
11
12 private final String key;
13 private final Setting<?> oldValue;
14 private final Setting<?> newValue;
15
16 /**
17 * Constructs a new {@code DefaultPreferenceChangeEvent}.
18 * @param source the class source of this event
19 * @param key preference key
20 * @param oldValue preference old value
21 * @param newValue preference new value
22 * @since 14977
23 */
24 public DefaultPreferenceChangeEvent(Class<?> source, String key, Setting<?> oldValue, Setting<?> newValue) {
25 super(source);
26 this.key = key;
27 this.oldValue = oldValue;
28 this.newValue = newValue;
29 }
30
31 @Override
32 public Class<?> getSource() {
33 return (Class<?>) super.getSource();
34 }
35
36 @Override
37 public String getKey() {
38 return key;
39 }
40
41 @Override
42 public Setting<?> getOldValue() {
43 return oldValue;
44 }
45
46 @Override
47 public Setting<?> getNewValue() {
48 return newValue;
49 }
50
51}
Note: See TracBrowser for help on using the repository browser.