Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 631e84a7 by Tony Chemit at 2024-08-31T10:30:23+02:00 Add more SwingSession states for some widgets - Closes ultreiaio/jaxx#849 - - - - - 6e294852 by Tony Chemit at 2024-08-31T13:25:04+02:00 Update jaxx version - Closes #2928 - - - - - 7 changed files: - − client/configuration/src/main/java/fr/ird/observe/client/CoordinatesEditorState.java - − client/configuration/src/main/java/fr/ird/observe/client/FilterableComboBoxState.java - − client/configuration/src/main/java/fr/ird/observe/client/ListHeaderState.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 - pom.xml Changes: ===================================== client/configuration/src/main/java/fr/ird/observe/client/CoordinatesEditorState.java deleted ===================================== @@ -1,83 +0,0 @@ -package fr.ird.observe.client; - -/*- - * #%L - * ObServe Client :: Configuration - * %% - * Copyright (C) 2008 - 2024 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.jaxx.runtime.swing.session.State; -import org.nuiton.jaxx.widgets.gis.CoordinateFormat; -import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor; - -/** - * All states to persist on a {@link CoordinatesEditor}. - * <p> - * Created at 30/08/2024. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 9.3.7 - * <p> - * FIXME Move this back to JAXX - */ -public class CoordinatesEditorState implements State { - - protected CoordinateFormat format; - - public CoordinatesEditorState() { - } - - public CoordinatesEditorState(CoordinateFormat format) { - this.format = format; - } - - public CoordinateFormat getFormat() { - return format; - } - - public void setFormat(CoordinateFormat format) { - this.format = format; - } - - protected CoordinatesEditor checkComponent(Object o) { - if (o == null) { - throw new IllegalArgumentException("null component"); - } - if (!(o instanceof CoordinatesEditor)) { - throw new IllegalArgumentException("invalid component"); - } - return (CoordinatesEditor) o; - } - - @Override - public State getState(Object o) { - CoordinatesEditor ui = checkComponent(o); - return new CoordinatesEditorState(ui.getModel().getFormat()); - } - - @Override - public void setState(Object o, State state) { - if (!(state instanceof CoordinatesEditorState)) { - throw new IllegalArgumentException("invalid state"); - } - CoordinatesEditor ui = checkComponent(o); - CoordinatesEditorState typedState = (CoordinatesEditorState) state; - ui.getModel().setFormat(typedState.getFormat()); - } -} ===================================== client/configuration/src/main/java/fr/ird/observe/client/FilterableComboBoxState.java deleted ===================================== @@ -1,97 +0,0 @@ -package fr.ird.observe.client; - -/*- - * #%L - * ObServe Client :: Configuration - * %% - * Copyright (C) 2008 - 2024 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox; -import org.nuiton.jaxx.runtime.swing.session.State; - -/** - * All states to persist on a {@link FilterableComboBox}. - * <p> - * Created at 30/08/2024. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 9.3.7 - * <p> - * FIXME Move this back to JAXX - */ -public class FilterableComboBoxState implements State { - - protected int index = 0; - - protected boolean reverseSort = false; - - public FilterableComboBoxState() { - } - - public FilterableComboBoxState(int index, boolean reverseSort) { - this.index = index; - this.reverseSort = reverseSort; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public boolean isReverseSort() { - return reverseSort; - } - - public void setReverseSort(boolean reverseSort) { - this.reverseSort = reverseSort; - } - - protected FilterableComboBox<?> checkComponent(Object o) { - if (o == null) { - throw new IllegalArgumentException("null component"); - } - if (!(o instanceof FilterableComboBox)) { - throw new IllegalArgumentException("invalid component"); - } - return (FilterableComboBox<?>) o; - } - - @Override - public State getState(Object o) { - FilterableComboBox<?> combo = checkComponent(o); - return new FilterableComboBoxState(combo.getModel().getIndex(), combo.getModel().getReverseSort()); - } - - @Override - public void setState(Object o, State state) { - if (!(state instanceof FilterableComboBoxState)) { - throw new IllegalArgumentException("invalid state"); - } - FilterableComboBox<?> ui = checkComponent(o); - FilterableComboBoxState typedState = (FilterableComboBoxState) state; - ui.getModel().setIndex(typedState.getIndex()); - ui.getModel().setReverseSort(typedState.isReverseSort()); - } - - -} - ===================================== client/configuration/src/main/java/fr/ird/observe/client/ListHeaderState.java deleted ===================================== @@ -1,99 +0,0 @@ -package fr.ird.observe.client; - -/*- - * #%L - * ObServe Client :: Configuration - * %% - * Copyright (C) 2008 - 2024 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import io.ultreia.java4all.jaxx.widgets.list.ListHeader; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; -import org.nuiton.jaxx.runtime.swing.session.State; - -/** - * All states to persist on a {@link ListHeader}. - * <p> - * Created at 30/08/2024. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 9.3.7 - * <p> - * FIXME Move this back to JAXX - */ -public class ListHeaderState implements State { - - protected int index = 0; - - protected boolean reverseSort = false; - - public ListHeaderState() { - } - - public ListHeaderState(int index, boolean reverseSort) { - this.index = index; - this.reverseSort = reverseSort; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public boolean isReverseSort() { - return reverseSort; - } - - public void setReverseSort(boolean reverseSort) { - this.reverseSort = reverseSort; - } - - protected ListHeader<?> checkComponent(Object o) { - if (o == null) { - throw new IllegalArgumentException("null component"); - } - if (!(o instanceof ListHeader)) { - throw new IllegalArgumentException("invalid component"); - } - return (ListHeader<?>) o; - } - - @Override - public State getState(Object o) { - ListHeader<?> combo = checkComponent(o); - return new ListHeaderState(combo.getIndex(), combo.getReverseSort()); - } - - @Override - public void setState(Object o, State state) { - if (!(state instanceof ListHeaderState)) { - throw new IllegalArgumentException("invalid state"); - } - ListHeader<?> ui = checkComponent(o); - ListHeaderState typedState = (ListHeaderState) state; - ui.setIndex(typedState.getIndex()); - ui.setReverseSort(typedState.isReverseSort()); - //FIXME Move this back to JListHeader.setIndex method - JAXXButtonGroup indexes = ui.getIndexes(); - indexes.setSelectedButton(ui.getIndex()); - } - -} ===================================== client/configuration/src/main/java/fr/ird/observe/client/NauticalLengthEditorState.java deleted ===================================== @@ -1,83 +0,0 @@ -package fr.ird.observe.client; - -/*- - * #%L - * ObServe Client :: Configuration - * %% - * Copyright (C) 2008 - 2024 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor; -import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthFormat; -import org.nuiton.jaxx.runtime.swing.session.State; - -/** - * All states to persist on a {@link NauticalLengthEditor}. - * <p> - * Created at 30/08/2024. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 9.3.7 - * <p> - * FIXME Move this back to JAXX - */ -public class NauticalLengthEditorState implements State { - - protected NauticalLengthFormat format; - - public NauticalLengthEditorState() { - } - - public NauticalLengthEditorState(NauticalLengthFormat format) { - this.format = format; - } - - public NauticalLengthFormat getFormat() { - return format; - } - - public void setFormat(NauticalLengthFormat format) { - this.format = format; - } - - protected NauticalLengthEditor checkComponent(Object o) { - if (o == null) { - throw new IllegalArgumentException("null component"); - } - if (!(o instanceof NauticalLengthEditor)) { - throw new IllegalArgumentException("invalid component"); - } - return (NauticalLengthEditor) o; - } - - @Override - public State getState(Object o) { - NauticalLengthEditor ui = checkComponent(o); - return new NauticalLengthEditorState(ui.getModel().getFormat()); - } - - @Override - public void setState(Object o, State state) { - if (!(state instanceof NauticalLengthEditorState)) { - throw new IllegalArgumentException("invalid state"); - } - NauticalLengthEditor ui = checkComponent(o); - NauticalLengthEditorState typedState = (NauticalLengthEditorState) state; - ui.getModel().setFormat(typedState.getFormat()); - } -} ===================================== client/configuration/src/main/java/fr/ird/observe/client/ObserveSwingSession.java ===================================== @@ -23,15 +23,20 @@ package fr.ird.observe.client; */ import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox; +import io.ultreia.java4all.jaxx.widgets.combobox.session.FilterableComboBoxState; import io.ultreia.java4all.jaxx.widgets.length.nautical.NauticalLengthEditor; +import io.ultreia.java4all.jaxx.widgets.length.nautical.session.NauticalLengthEditorState; import io.ultreia.java4all.jaxx.widgets.list.DoubleList; import io.ultreia.java4all.jaxx.widgets.list.ListHeader; import io.ultreia.java4all.jaxx.widgets.list.session.DoubleListState; +import io.ultreia.java4all.jaxx.widgets.list.session.ListHeaderState; import io.ultreia.java4all.util.SortedProperties; import org.nuiton.jaxx.runtime.swing.session.State; import org.nuiton.jaxx.runtime.swing.session.SwingSession; import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor; +import org.nuiton.jaxx.widgets.gis.absolute.session.CoordinatesEditorState; import org.nuiton.jaxx.widgets.temperature.TemperatureEditor; +import org.nuiton.jaxx.widgets.temperature.session.TemperatureEditorState; import java.io.BufferedReader; import java.io.File; ===================================== client/configuration/src/main/java/fr/ird/observe/client/TemperatureEditorState.java deleted ===================================== @@ -1,83 +0,0 @@ -package fr.ird.observe.client; - -/*- - * #%L - * ObServe Client :: Configuration - * %% - * Copyright (C) 2008 - 2024 IRD, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.jaxx.runtime.swing.session.State; -import org.nuiton.jaxx.widgets.temperature.TemperatureEditor; -import org.nuiton.jaxx.widgets.temperature.TemperatureFormat; - -/** - * All states to persist on a {@link TemperatureEditor}. - * <p> - * Created at 30/08/2024. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 9.3.7 - * <p> - * FIXME Move this back to JAXX - */ -public class TemperatureEditorState implements State { - - protected TemperatureFormat format; - - public TemperatureEditorState() { - } - - public TemperatureEditorState(TemperatureFormat format) { - this.format = format; - } - - public TemperatureFormat getFormat() { - return format; - } - - public void setFormat(TemperatureFormat format) { - this.format = format; - } - - protected TemperatureEditor checkComponent(Object o) { - if (o == null) { - throw new IllegalArgumentException("null component"); - } - if (!(o instanceof TemperatureEditor)) { - throw new IllegalArgumentException("invalid component"); - } - return (TemperatureEditor) o; - } - - @Override - public State getState(Object o) { - TemperatureEditor ui = checkComponent(o); - return new TemperatureEditorState(ui.getModel().getFormat()); - } - - @Override - public void setState(Object o, State state) { - if (!(state instanceof TemperatureEditorState)) { - throw new IllegalArgumentException("invalid state"); - } - TemperatureEditor ui = checkComponent(o); - TemperatureEditorState typedState = (TemperatureEditorState) state; - ui.getModel().setFormat(typedState.getFormat()); - } -} ===================================== pom.xml ===================================== @@ -113,7 +113,7 @@ <buildDate>${maven.build.timestamp}</buildDate> <!-- >>> Sealed version --> <plugin.version.site>4.0.0-M13</plugin.version.site> - <lib.version.java4all.jaxx>3.0.25</lib.version.java4all.jaxx> + <lib.version.java4all.jaxx>3.0.26</lib.version.java4all.jaxx> <lib.version.java4all.validation>1.0.3</lib.version.java4all.validation> <lib.version.java4all.i18n>4.0-beta-26</lib.version.java4all.i18n> <lib.version.ognl>3.1.29</lib.version.ognl> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df95fe00ec265cd24c6ef9fd8... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df95fe00ec265cd24c6ef9fd8... You're receiving this email because of your account on gitlab.com.