Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
585e7e3c
by Tony Chemit at 2024-08-30T13:13:46+02:00
-
338b09b9
by Tony Chemit at 2024-08-30T13:13:46+02:00
-
fb1673ec
by Tony Chemit at 2024-08-30T13:14:02+02:00
-
7e46fe94
by Tony Chemit at 2024-08-30T13:14:02+02:00
-
f6dc862f
by Tony Chemit at 2024-08-30T13:14:02+02:00
-
b0b52a85
by Tony Chemit at 2024-08-30T13:14:02+02:00
-
bd320372
by Tony Chemit at 2024-08-30T13:14:02+02:00
-
df95fe00
by Tony Chemit at 2024-08-30T13:14:10+02:00
8 changed files:
- + client/configuration/src/main/java/fr/ird/observe/client/CoordinatesEditorState.java
- + client/configuration/src/main/java/fr/ird/observe/client/NauticalLengthEditorState.java
- client/configuration/src/main/java/fr/ird/observe/client/ObserveSwingSession.java
- + client/configuration/src/main/java/fr/ird/observe/client/TemperatureEditorState.java
- client/core/src/main/java/fr/ird/observe/client/util/init/UIInitHelper.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIInitializer.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/open/ContentOpen.java
Changes:
| 1 | +package fr.ird.observe.client;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Client :: Configuration
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2024 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import org.nuiton.jaxx.runtime.swing.session.State;
|
|
| 26 | +import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
|
|
| 27 | +import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor;
|
|
| 28 | + |
|
| 29 | +/**
|
|
| 30 | + * All states to persist on a {@link CoordinatesEditor}.
|
|
| 31 | + * <p>
|
|
| 32 | + * Created at 30/08/2024.
|
|
| 33 | + *
|
|
| 34 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 35 | + * @since 9.3.7
|
|
| 36 | + * <p>
|
|
| 37 | + * FIXME Move this back to JAXX
|
|
| 38 | + */
|
|
| 39 | +public class CoordinatesEditorState implements State {
|
|
| 40 | + |
|
| 41 | + protected CoordinateFormat format;
|
|
| 42 | + |
|
| 43 | + public CoordinatesEditorState() {
|
|
| 44 | + }
|
|
| 45 | + |
|
| 46 | + public CoordinatesEditorState(CoordinateFormat format) {
|
|
| 47 | + this.format = format;
|
|
| 48 | + }
|
|
| 49 | + |
|
| 50 | + public CoordinateFormat getFormat() {
|
|
| 51 | + return format;
|
|
| 52 | + }
|
|
| 53 | + |
|
| 54 | + public void setFormat(CoordinateFormat format) {
|
|
| 55 | + this.format = format;
|
|
| 56 | + }
|
|
| 57 | + |
|
| 58 | + protected CoordinatesEditor checkComponent(Object o) {
|
|
| 59 | + if (o == null) {
|
|
| 60 | + throw new IllegalArgumentException("null component");
|
|
| 61 | + }
|
|
| 62 | + if (!(o instanceof CoordinatesEditor)) {
|
|
| 63 | + throw new IllegalArgumentException("invalid component");
|
|
| 64 | + }
|
|
| 65 | + return (CoordinatesEditor) o;
|
|
| 66 | + }
|
|
| 67 | + |
|
| 68 | + @Override
|
|
| 69 | + public State getState(Object o) {
|
|
| 70 | + CoordinatesEditor ui = checkComponent(o);
|
|
| 71 | + return new CoordinatesEditorState(ui.getModel().getFormat());
|
|
| 72 | + }
|
|
| 73 | + |
|
| 74 | + @Override
|
|
| 75 | + public void setState(Object o, State state) {
|
|
| 76 | + if (!(state instanceof CoordinatesEditorState)) {
|
|
| 77 | + throw new IllegalArgumentException("invalid state");
|
|
| 78 | + }
|
|
| 79 | + CoordinatesEditor ui = checkComponent(o);
|
|
| 80 | + CoordinatesEditorState typedState = (CoordinatesEditorState) state;
|
|
| 81 | + ui.getModel().setFormat(typedState.getFormat());
|
|
| 82 | + }
|
|
| 83 | +} |
| 1 | +package fr.ird.observe.client;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Client :: Configuration
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2024 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor;
|
|
| 26 | +import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthFormat;
|
|
| 27 | +import org.nuiton.jaxx.runtime.swing.session.State;
|
|
| 28 | + |
|
| 29 | +/**
|
|
| 30 | + * All states to persist on a {@link NauticalLengthEditor}.
|
|
| 31 | + * <p>
|
|
| 32 | + * Created at 30/08/2024.
|
|
| 33 | + *
|
|
| 34 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 35 | + * @since 9.3.7
|
|
| 36 | + * <p>
|
|
| 37 | + * FIXME Move this back to JAXX
|
|
| 38 | + */
|
|
| 39 | +public class NauticalLengthEditorState implements State {
|
|
| 40 | + |
|
| 41 | + protected NauticalLengthFormat format;
|
|
| 42 | + |
|
| 43 | + public NauticalLengthEditorState() {
|
|
| 44 | + }
|
|
| 45 | + |
|
| 46 | + public NauticalLengthEditorState(NauticalLengthFormat format) {
|
|
| 47 | + this.format = format;
|
|
| 48 | + }
|
|
| 49 | + |
|
| 50 | + public NauticalLengthFormat getFormat() {
|
|
| 51 | + return format;
|
|
| 52 | + }
|
|
| 53 | + |
|
| 54 | + public void setFormat(NauticalLengthFormat format) {
|
|
| 55 | + this.format = format;
|
|
| 56 | + }
|
|
| 57 | + |
|
| 58 | + protected NauticalLengthEditor checkComponent(Object o) {
|
|
| 59 | + if (o == null) {
|
|
| 60 | + throw new IllegalArgumentException("null component");
|
|
| 61 | + }
|
|
| 62 | + if (!(o instanceof NauticalLengthEditor)) {
|
|
| 63 | + throw new IllegalArgumentException("invalid component");
|
|
| 64 | + }
|
|
| 65 | + return (NauticalLengthEditor) o;
|
|
| 66 | + }
|
|
| 67 | + |
|
| 68 | + @Override
|
|
| 69 | + public State getState(Object o) {
|
|
| 70 | + NauticalLengthEditor ui = checkComponent(o);
|
|
| 71 | + return new NauticalLengthEditorState(ui.getModel().getFormat());
|
|
| 72 | + }
|
|
| 73 | + |
|
| 74 | + @Override
|
|
| 75 | + public void setState(Object o, State state) {
|
|
| 76 | + if (!(state instanceof NauticalLengthEditorState)) {
|
|
| 77 | + throw new IllegalArgumentException("invalid state");
|
|
| 78 | + }
|
|
| 79 | + NauticalLengthEditor ui = checkComponent(o);
|
|
| 80 | + NauticalLengthEditorState typedState = (NauticalLengthEditorState) state;
|
|
| 81 | + ui.getModel().setFormat(typedState.getFormat());
|
|
| 82 | + }
|
|
| 83 | +} |
| ... | ... | @@ -23,12 +23,15 @@ package fr.ird.observe.client; |
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | 25 | import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
|
| 26 | +import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor;
|
|
| 26 | 27 | import io.ultreia.java4all.jaxx.widgets.list.DoubleList;
|
| 27 | 28 | import io.ultreia.java4all.jaxx.widgets.list.ListHeader;
|
| 28 | 29 | import io.ultreia.java4all.jaxx.widgets.list.session.DoubleListState;
|
| 29 | 30 | import io.ultreia.java4all.util.SortedProperties;
|
| 30 | 31 | import org.nuiton.jaxx.runtime.swing.session.State;
|
| 31 | 32 | import org.nuiton.jaxx.runtime.swing.session.SwingSession;
|
| 33 | +import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor;
|
|
| 34 | +import org.nuiton.jaxx.widgets.temperature.TemperatureEditor;
|
|
| 32 | 35 | |
| 33 | 36 | import java.io.BufferedReader;
|
| 34 | 37 | import java.io.File;
|
| ... | ... | @@ -54,7 +57,10 @@ public class ObserveSwingSession extends SwingSession { |
| 54 | 57 | public ObserveSwingSession(File file, boolean autoSave, File preferencesFile) {
|
| 55 | 58 | super(file, autoSave, Map.of(FilterableComboBox.class, new FilterableComboBoxState(),
|
| 56 | 59 | DoubleList.class, new DoubleListState(),
|
| 57 | - ListHeader.class, new ListHeaderState()
|
|
| 60 | + ListHeader.class, new ListHeaderState(),
|
|
| 61 | + TemperatureEditor.class, new TemperatureEditorState(),
|
|
| 62 | + NauticalLengthEditor.class, new NauticalLengthEditorState(),
|
|
| 63 | + CoordinatesEditor.class, new CoordinatesEditorState()
|
|
| 58 | 64 | ));
|
| 59 | 65 | this.preferencesFile = preferencesFile;
|
| 60 | 66 | this.preferences = new SortedProperties();
|
| 1 | +package fr.ird.observe.client;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Client :: Configuration
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2024 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import org.nuiton.jaxx.runtime.swing.session.State;
|
|
| 26 | +import org.nuiton.jaxx.widgets.temperature.TemperatureEditor;
|
|
| 27 | +import org.nuiton.jaxx.widgets.temperature.TemperatureFormat;
|
|
| 28 | + |
|
| 29 | +/**
|
|
| 30 | + * All states to persist on a {@link TemperatureEditor}.
|
|
| 31 | + * <p>
|
|
| 32 | + * Created at 30/08/2024.
|
|
| 33 | + *
|
|
| 34 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 35 | + * @since 9.3.7
|
|
| 36 | + * <p>
|
|
| 37 | + * FIXME Move this back to JAXX
|
|
| 38 | + */
|
|
| 39 | +public class TemperatureEditorState implements State {
|
|
| 40 | + |
|
| 41 | + protected TemperatureFormat format;
|
|
| 42 | + |
|
| 43 | + public TemperatureEditorState() {
|
|
| 44 | + }
|
|
| 45 | + |
|
| 46 | + public TemperatureEditorState(TemperatureFormat format) {
|
|
| 47 | + this.format = format;
|
|
| 48 | + }
|
|
| 49 | + |
|
| 50 | + public TemperatureFormat getFormat() {
|
|
| 51 | + return format;
|
|
| 52 | + }
|
|
| 53 | + |
|
| 54 | + public void setFormat(TemperatureFormat format) {
|
|
| 55 | + this.format = format;
|
|
| 56 | + }
|
|
| 57 | + |
|
| 58 | + protected TemperatureEditor checkComponent(Object o) {
|
|
| 59 | + if (o == null) {
|
|
| 60 | + throw new IllegalArgumentException("null component");
|
|
| 61 | + }
|
|
| 62 | + if (!(o instanceof TemperatureEditor)) {
|
|
| 63 | + throw new IllegalArgumentException("invalid component");
|
|
| 64 | + }
|
|
| 65 | + return (TemperatureEditor) o;
|
|
| 66 | + }
|
|
| 67 | + |
|
| 68 | + @Override
|
|
| 69 | + public State getState(Object o) {
|
|
| 70 | + TemperatureEditor ui = checkComponent(o);
|
|
| 71 | + return new TemperatureEditorState(ui.getModel().getFormat());
|
|
| 72 | + }
|
|
| 73 | + |
|
| 74 | + @Override
|
|
| 75 | + public void setState(Object o, State state) {
|
|
| 76 | + if (!(state instanceof TemperatureEditorState)) {
|
|
| 77 | + throw new IllegalArgumentException("invalid state");
|
|
| 78 | + }
|
|
| 79 | + TemperatureEditor ui = checkComponent(o);
|
|
| 80 | + TemperatureEditorState typedState = (TemperatureEditorState) state;
|
|
| 81 | + ui.getModel().setFormat(typedState.getFormat());
|
|
| 82 | + }
|
|
| 83 | +} |
| ... | ... | @@ -23,13 +23,11 @@ package fr.ird.observe.client.util.init; |
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.datasource.validation.ContentMessageTableRenderer;
|
| 26 | -import fr.ird.observe.client.datasource.validation.ObserveSwingValidator;
|
|
| 27 | 26 | import fr.ird.observe.client.datasource.validation.ObserveValidatorMessageMouseListener;
|
| 28 | 27 | import io.ultreia.java4all.jaxx.widgets.combobox.BeanEnumEditor;
|
| 29 | 28 | import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
|
| 30 | 29 | import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor;
|
| 31 | 30 | import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditorConfig;
|
| 32 | -import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditorModel;
|
|
| 33 | 31 | import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthFormat;
|
| 34 | 32 | import io.ultreia.java4all.jaxx.widgets.list.DoubleList;
|
| 35 | 33 | import io.ultreia.java4all.jaxx.widgets.list.ListHeader;
|
| ... | ... | @@ -197,7 +195,7 @@ public class UIInitHelper { |
| 197 | 195 | editor.init();
|
| 198 | 196 | }
|
| 199 | 197 | |
| 200 | - public static void init(JAXXObject ui, ObserveSwingValidator<?> validator, TemperatureEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton, TemperatureFormat defaultFormat) {
|
|
| 198 | + public static void init(JAXXObject ui, TemperatureEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton, TemperatureFormat defaultFormat) {
|
|
| 201 | 199 | NumberEditor numberEditor = editor.getEditor();
|
| 202 | 200 | numberEditor.setShowReset(true);
|
| 203 | 201 | numberEditor.setAutoPopup(autoPopupNumberEditor);
|
| ... | ... | @@ -207,14 +205,9 @@ public class UIInitHelper { |
| 207 | 205 | Objects.requireNonNull(label, "can't find label for temperature editor " + editor);
|
| 208 | 206 | editor.setConfig(new TemperatureEditorConfig(defaultFormat, label.getText(), propertyName));
|
| 209 | 207 | editor.init(label);
|
| 210 | - editor.getModel().addPropertyChangeListener("format", e -> {
|
|
| 211 | - if (validator.getBean() != null) {
|
|
| 212 | - validator.doValidate();
|
|
| 213 | - }
|
|
| 214 | - });
|
|
| 215 | 208 | }
|
| 216 | 209 | |
| 217 | - public static void init(JAXXObject ui, ObserveSwingValidator<?> validator, NauticalLengthEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton,NauticalLengthFormat defaultFormat) {
|
|
| 210 | + public static void init(JAXXObject ui, NauticalLengthEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton, NauticalLengthFormat defaultFormat) {
|
|
| 218 | 211 | NumberEditor numberEditor = editor.getEditor();
|
| 219 | 212 | numberEditor.setShowReset(true);
|
| 220 | 213 | numberEditor.setAutoPopup(autoPopupNumberEditor);
|
| ... | ... | @@ -224,11 +217,7 @@ public class UIInitHelper { |
| 224 | 217 | Objects.requireNonNull(label, "can't find label for nautical length editor " + editor);
|
| 225 | 218 | editor.setConfig(new NauticalLengthEditorConfig(defaultFormat, label.getText(), propertyName));
|
| 226 | 219 | editor.init(label);
|
| 227 | - editor.getModel().addPropertyChangeListener(NauticalLengthEditorModel.PROPERTY_FORMAT, e -> {
|
|
| 228 | - if (validator.getBean() != null) {
|
|
| 229 | - validator.doValidate();
|
|
| 230 | - }
|
|
| 231 | - });
|
|
| 220 | + |
|
| 232 | 221 | }
|
| 233 | 222 | |
| 234 | 223 | public static void init(NumberEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton) {
|
| ... | ... | @@ -257,6 +257,11 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 257 | 257 | }
|
| 258 | 258 | |
| 259 | 259 | public void onEndOpenUI() {
|
| 260 | + //FIXME We should remove this code when issue #2928 is fixed
|
|
| 261 | + ContentUIModelStates states = ui.getModel().getStates();
|
|
| 262 | + if (!states.isReadingMode()) {
|
|
| 263 | + states.setModified(states.isCreatingMode());
|
|
| 264 | + }
|
|
| 260 | 265 | }
|
| 261 | 266 | |
| 262 | 267 | public void startEditUI() {
|
| ... | ... | @@ -44,6 +44,7 @@ import io.ultreia.java4all.jaxx.widgets.choice.BooleanEditor; |
| 44 | 44 | import io.ultreia.java4all.jaxx.widgets.combobox.BeanEnumEditor;
|
| 45 | 45 | import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
|
| 46 | 46 | import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor;
|
| 47 | +import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditorModel;
|
|
| 47 | 48 | import io.ultreia.java4all.jaxx.widgets.list.DoubleList;
|
| 48 | 49 | import io.ultreia.java4all.jaxx.widgets.list.ListHeader;
|
| 49 | 50 | import org.jdesktop.swingx.JXTable;
|
| ... | ... | @@ -234,20 +235,41 @@ public class ContentUIInitializer<UI extends ContentUI> extends UIInitializerSup |
| 234 | 235 | |
| 235 | 236 | protected void init(TemperatureEditor editor) {
|
| 236 | 237 | initializerContext.checkFirstPass();
|
| 237 | - ObserveSwingValidator<?> validator = null;
|
|
| 238 | + ObserveSwingValidator<?> validator;
|
|
| 238 | 239 | if (ui instanceof EditableContentUI) {
|
| 239 | 240 | validator = ((EditableContentUI<?>) ui).getValidator();
|
| 241 | + } else {
|
|
| 242 | + validator = null;
|
|
| 243 | + }
|
|
| 244 | + UIInitHelper.init(ui, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton(), getClientConfig().getTemperatureFormat());
|
|
| 245 | + if (validator != null) {
|
|
| 246 | + editor.getModel().addPropertyChangeListener("format"/*FIXME make TemperatureEditorModel.PROPERTY_FORMAT public*/, e -> onFormatChanged(validator));
|
|
| 240 | 247 | }
|
| 241 | - UIInitHelper.init(ui, validator, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton(), getClientConfig().getTemperatureFormat());
|
|
| 242 | 248 | }
|
| 243 | 249 | |
| 244 | 250 | protected void init(NauticalLengthEditor editor) {
|
| 245 | 251 | initializerContext.checkFirstPass();
|
| 246 | - ObserveSwingValidator<?> validator = null;
|
|
| 252 | + ObserveSwingValidator<?> validator;
|
|
| 247 | 253 | if (ui instanceof EditableContentUI) {
|
| 248 | 254 | validator = ((EditableContentUI<?>) ui).getValidator();
|
| 255 | + } else {
|
|
| 256 | + validator = null;
|
|
| 257 | + }
|
|
| 258 | + UIInitHelper.init(ui, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton(), getClientConfig().getNauticalLengthFormat());
|
|
| 259 | + if (validator != null) {
|
|
| 260 | + editor.getModel().addPropertyChangeListener(NauticalLengthEditorModel.PROPERTY_FORMAT, e -> onFormatChanged(validator));
|
|
| 261 | + }
|
|
| 262 | + }
|
|
| 263 | + |
|
| 264 | + private void onFormatChanged(ObserveSwingValidator<?> validator) {
|
|
| 265 | + if (validator.getBean() != null) {
|
|
| 266 | + ContentUIModelStates states = ui.getModel().getStates();
|
|
| 267 | + boolean modified = states.isModified();
|
|
| 268 | + validator.doValidate();
|
|
| 269 | + if (!modified) {
|
|
| 270 | + states.setModified(false);
|
|
| 271 | + }
|
|
| 249 | 272 | }
|
| 250 | - UIInitHelper.init(ui, validator, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton(), getClientConfig().getNauticalLengthFormat());
|
|
| 251 | 273 | }
|
| 252 | 274 | |
| 253 | 275 | protected void init(JToolBar editor) {
|
| ... | ... | @@ -655,10 +655,14 @@ public class ContentOpen<U extends ContentUI> { |
| 655 | 655 | private synchronized void onCoordinateFormatChanged(CoordinateFormat newValue) {
|
| 656 | 656 | if (!coordinateFormatChangedIsChanging) {
|
| 657 | 657 | coordinateFormatChangedIsChanging = true;
|
| 658 | + boolean modified = ui.getModel().getStates().isModified();
|
|
| 658 | 659 | try {
|
| 659 | 660 | coordinateEditors.forEach(e -> e.setFormat(newValue));
|
| 660 | 661 | } finally {
|
| 661 | 662 | coordinateFormatChangedIsChanging = false;
|
| 663 | + if (!modified) {
|
|
| 664 | + ui.getModel().getStates().setModified(false);
|
|
| 665 | + }
|
|
| 662 | 666 | }
|
| 663 | 667 | }
|
| 664 | 668 | }
|