Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
b28aaabc
by Tony Chemit at 2021-03-12T14:03:14+01:00
-
990796ec
by Tony Chemit at 2021-03-12T14:05:26+01:00
11 changed files:
- client/core/pom.xml
- client/core/src/main/java/fr/ird/observe/client/util/UIHelper.java
- client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java
- client/datasource/editor/ll/pom.xml
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripGearUseFeaturesUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetCatchUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIInitializer.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripGearUseFeaturesUIHandler.java
- pom.xml
Changes:
| ... | ... | @@ -271,10 +271,6 @@ |
| 271 | 271 |
<groupId>org.swinglabs.swingx</groupId>
|
| 272 | 272 |
<artifactId>swingx-painters</artifactId>
|
| 273 | 273 |
</dependency>
|
| 274 |
- <dependency>
|
|
| 275 |
- <groupId>org.swinglabs.swingx</groupId>
|
|
| 276 |
- <artifactId>swingx-autocomplete</artifactId>
|
|
| 277 |
- </dependency>
|
|
| 278 | 274 |
<dependency>
|
| 279 | 275 |
<groupId>org.swinglabs</groupId>
|
| 280 | 276 |
<artifactId>jxlayer</artifactId>
|
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 |
package fr.ird.observe.client.util;
|
| 23 | 23 |
|
| 24 | 24 |
import fr.ird.observe.client.ClientUIContextApplicationComponent;
|
| 25 |
+import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor;
|
|
| 25 | 26 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 26 | 27 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 27 | 28 |
import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
| ... | ... | @@ -29,19 +30,15 @@ import io.ultreia.java4all.jaxx.widgets.choice.BooleanTableCellRenderer; |
| 29 | 30 |
import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox;
|
| 30 | 31 |
import org.apache.logging.log4j.LogManager;
|
| 31 | 32 |
import org.apache.logging.log4j.Logger;
|
| 32 |
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
|
|
| 33 |
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
|
|
| 34 | 33 |
import org.nuiton.decorator.Decorator;
|
| 35 | 34 |
import org.nuiton.decorator.JXPathDecorator;
|
| 35 |
+import org.nuiton.decorator.MultiJXPathDecorator;
|
|
| 36 | 36 |
import org.nuiton.jaxx.runtime.JAXXObject;
|
| 37 | 37 |
import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
|
| 38 | 38 |
import org.nuiton.jaxx.runtime.swing.SwingUtil;
|
| 39 |
-import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
|
|
| 40 | 39 |
import org.nuiton.jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
|
| 41 |
-import org.nuiton.jaxx.widgets.BeanUIUtil;
|
|
| 42 | 40 |
import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
|
| 43 | 41 |
|
| 44 |
-import javax.swing.JComboBox;
|
|
| 45 | 42 |
import javax.swing.JTable;
|
| 46 | 43 |
import javax.swing.table.TableCellEditor;
|
| 47 | 44 |
import javax.swing.table.TableCellRenderer;
|
| ... | ... | @@ -51,7 +48,6 @@ import java.awt.datatransfer.Clipboard; |
| 51 | 48 |
import java.awt.datatransfer.StringSelection;
|
| 52 | 49 |
import java.beans.PropertyChangeEvent;
|
| 53 | 50 |
import java.beans.PropertyChangeListener;
|
| 54 |
-import java.util.ArrayList;
|
|
| 55 | 51 |
import java.util.List;
|
| 56 | 52 |
import java.util.Objects;
|
| 57 | 53 |
|
| ... | ... | @@ -70,6 +66,16 @@ public class UIHelper extends SwingUtil { |
| 70 | 66 |
|
| 71 | 67 |
static private final Logger log = LogManager.getLogger(UIHelper.class);
|
| 72 | 68 |
|
| 69 |
+ public static class LogPropertyChanged implements PropertyChangeListener {
|
|
| 70 |
+ @Override
|
|
| 71 |
+ public void propertyChange(PropertyChangeEvent evt) {
|
|
| 72 |
+ String name = evt.getPropertyName();
|
|
| 73 |
+ Object oldValue = evt.getOldValue();
|
|
| 74 |
+ Object newValue = evt.getNewValue();
|
|
| 75 |
+ log.debug(evt.getSource() + " - Property [" + name + "] has changed from " + oldValue + " to " + newValue);
|
|
| 76 |
+ }
|
|
| 77 |
+ }
|
|
| 78 |
+ |
|
| 73 | 79 |
public static void addApplicationIcon(Window window) {
|
| 74 | 80 |
window.setIconImage(createImageIcon("logo.png").getImage());
|
| 75 | 81 |
}
|
| ... | ... | @@ -152,35 +158,10 @@ public class UIHelper extends SwingUtil { |
| 152 | 158 |
return new JAXXInitialContext().add(model).add(ui);
|
| 153 | 159 |
}
|
| 154 | 160 |
|
| 155 |
- public static <B> ComboBoxCellEditor newDataColumnEditor(List<B> data, Decorator<B> decorator) {
|
|
| 156 |
- JComboBox<B> comboBox = new JComboBox<>();
|
|
| 157 |
- return newDataColumnEditor(comboBox, data, decorator);
|
|
| 158 |
- }
|
|
| 159 |
- |
|
| 160 |
- public static <B> ComboBoxCellEditor newDataColumnEditor(JComboBox<B> comboBox, List<B> data, Decorator<B> decorator) {
|
|
| 161 |
- comboBox.setRenderer(new DecoratorListCellRenderer<>(decorator));
|
|
| 162 |
- prepareComboBoxData(comboBox, data);
|
|
| 163 |
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
|
|
| 164 |
- BeanUIUtil.decorate(comboBox, converter);
|
|
| 165 |
- return new ComboBoxCellEditor(comboBox);
|
|
| 166 |
- }
|
|
| 167 |
- |
|
| 168 |
- public static <B> void prepareComboBoxData(JComboBox<B> comboBox, List<B> data) {
|
|
| 169 |
- List<B> dataToList = new ArrayList<>(data);
|
|
| 170 |
- // add a null value at first position
|
|
| 171 |
- if (!dataToList.isEmpty() && dataToList.get(0) != null) {
|
|
| 172 |
- dataToList.add(0, null);
|
|
| 173 |
- }
|
|
| 174 |
- fillComboBox(comboBox, dataToList, null);
|
|
| 175 |
- }
|
|
| 176 |
- |
|
| 177 |
- public static class LogPropertyChanged implements PropertyChangeListener {
|
|
| 178 |
- @Override
|
|
| 179 |
- public void propertyChange(PropertyChangeEvent evt) {
|
|
| 180 |
- String name = evt.getPropertyName();
|
|
| 181 |
- Object oldValue = evt.getOldValue();
|
|
| 182 |
- Object newValue = evt.getNewValue();
|
|
| 183 |
- log.debug(evt.getSource() + " - Property [" + name + "] has changed from " + oldValue + " to " + newValue);
|
|
| 184 |
- }
|
|
| 161 |
+ @SuppressWarnings({"unchecked", "rawtypes"})
|
|
| 162 |
+ public static <B> JaxxComboBoxCellEditor newDataColumnEditor(List<B> data, MultiJXPathDecorator<B> decorator) {
|
|
| 163 |
+ JaxxComboBoxCellEditor cellEditor = JaxxComboBoxCellEditor.newEditor(decorator.getType(), decorator);
|
|
| 164 |
+ cellEditor.getComponent().setData((List) data);
|
|
| 165 |
+ return cellEditor;
|
|
| 185 | 166 |
}
|
| 186 | 167 |
}
|
| ... | ... | @@ -46,9 +46,10 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { |
| 46 | 46 |
String entityLabel = ObserveI18nDecoratorHelper.getType(dataType);
|
| 47 | 47 |
editor.setPopupTitleText(t("observe.data.Data.type", entityLabel));
|
| 48 | 48 |
editor.setBeanType(dataType);
|
| 49 |
- editor.setMinimumSize(new Dimension(0, 24));
|
|
| 49 |
+ editor.setMinimumSize(new Dimension(0, 22));
|
|
| 50 | 50 |
editor.getConfig().setFilterable(false);
|
| 51 | 51 |
editor.getConfig().setTabToSelect(false);
|
| 52 |
+ editor.getConfig().setShowReset(true);
|
|
| 52 | 53 |
editor.init(decorator, Collections.emptyList());
|
| 53 | 54 |
return new JaxxComboBoxCellEditor(editor);
|
| 54 | 55 |
}
|
| ... | ... | @@ -263,7 +263,7 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien |
| 263 | 263 |
editorBuilder.add(this.booleanEditor = table.getDefaultEditor(Boolean.class));
|
| 264 | 264 |
|
| 265 | 265 |
editorBuilder.add(this.pairingEditor = JaxxComboBoxCellEditor.newEditor(ActivityPairingResultItem.class, decorator));
|
| 266 |
- pairingEditor.getComponent().setShowReset(true);
|
|
| 266 |
+// pairingEditor.getComponent().setShowReset(true);
|
|
| 267 | 267 |
|
| 268 | 268 |
this.editors = editorBuilder.build();
|
| 269 | 269 |
}
|
| ... | ... | @@ -202,10 +202,6 @@ |
| 202 | 202 |
<groupId>org.swinglabs.swingx</groupId>
|
| 203 | 203 |
<artifactId>swingx-core</artifactId>
|
| 204 | 204 |
</dependency>
|
| 205 |
- <dependency>
|
|
| 206 |
- <groupId>org.swinglabs.swingx</groupId>
|
|
| 207 |
- <artifactId>swingx-autocomplete</artifactId>
|
|
| 208 |
- </dependency>
|
|
| 209 | 205 |
|
| 210 | 206 |
<dependency>
|
| 211 | 207 |
<groupId>org.geotools</groupId>
|
| ... | ... | @@ -77,6 +77,7 @@ public class TripGearUseFeaturesUIHandler extends GeneratedTripGearUseFeaturesUI |
| 77 | 77 |
{ // init measurements table
|
| 78 | 78 |
|
| 79 | 79 |
JTable table = ui.getMeasurementsTable();
|
| 80 |
+ table.setRowHeight(22);
|
|
| 80 | 81 |
UIHelper.setI18nTableHeaderRenderer(table,
|
| 81 | 82 |
n("observe.data.common.GearUseFeatures.gearCharacteristic.short"),
|
| 82 | 83 |
n("observe.data.common.GearUseFeatures.gearCharacteristic"),
|
| ... | ... | @@ -118,7 +118,7 @@ public class SetCatchUIHandler extends GeneratedSetCatchUIHandler { |
| 118 | 118 |
{
|
| 119 | 119 |
// init size measures table
|
| 120 | 120 |
JTable table = ui.getSizeMeasuresTable();
|
| 121 |
- |
|
| 121 |
+ table.setRowHeight(22);
|
|
| 122 | 122 |
UIHelper.setI18nTableHeaderRenderer(table,
|
| 123 | 123 |
n("observe.data.ll.observation.SizeMeasure.sizeMeasureType.short"),
|
| 124 | 124 |
n("observe.data.ll.observation.SizeMeasure.sizeMeasureType"),
|
| ... | ... | @@ -146,6 +146,7 @@ public class SetCatchUIHandler extends GeneratedSetCatchUIHandler { |
| 146 | 146 |
{
|
| 147 | 147 |
// init weight measures table
|
| 148 | 148 |
JTable table = ui.getWeightMeasuresTable();
|
| 149 |
+ table.setRowHeight(22);
|
|
| 149 | 150 |
UIHelper.setI18nTableHeaderRenderer(table,
|
| 150 | 151 |
n("observe.data.ll.observation.WeightMeasure.weightMeasureType.short"),
|
| 151 | 152 |
n("observe.data.ll.observation.WeightMeasure.weightMeasureType"),
|
| ... | ... | @@ -38,6 +38,7 @@ import fr.ird.observe.dto.data.ll.observation.SectionWithTemplateDto; |
| 38 | 38 |
import fr.ird.observe.dto.data.ll.observation.SetDetailCompositionDto;
|
| 39 | 39 |
import fr.ird.observe.dto.form.Form;
|
| 40 | 40 |
import io.ultreia.java4all.i18n.I18n;
|
| 41 |
+import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox;
|
|
| 41 | 42 |
import org.apache.commons.lang3.StringUtils;
|
| 42 | 43 |
import org.apache.logging.log4j.LogManager;
|
| 43 | 44 |
import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -49,7 +50,6 @@ import org.jdesktop.swingx.renderer.StringValue; |
| 49 | 50 |
import org.nuiton.jaxx.runtime.swing.JVetoableTabbedPane;
|
| 50 | 51 |
import org.nuiton.jaxx.validator.swing.SwingValidator;
|
| 51 | 52 |
|
| 52 |
-import javax.swing.JComboBox;
|
|
| 53 | 53 |
import javax.swing.JOptionPane;
|
| 54 | 54 |
import java.awt.Color;
|
| 55 | 55 |
import java.beans.PropertyChangeListener;
|
| ... | ... | @@ -274,8 +274,8 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 274 | 274 |
if (getModel().getStates().isCanGenerate()) {
|
| 275 | 275 |
// update section templates list
|
| 276 | 276 |
List<SectionTemplateDto> sectionTemplates = getModel().getStates().getSectionTemplatesTableModel().getNotEmptyData();
|
| 277 |
- @SuppressWarnings("unchecked") JComboBox<SectionTemplateDto> comboBox = (JComboBox<SectionTemplateDto>) getUi().getSectionsTable().getClientProperty(SECTION_TEMPLATES_EDITOR);
|
|
| 278 |
- UIHelper.prepareComboBoxData(comboBox, sectionTemplates);
|
|
| 277 |
+ @SuppressWarnings("unchecked") JaxxComboBox<SectionTemplateDto> comboBox = (JaxxComboBox<SectionTemplateDto>) getUi().getSectionsTable().getClientProperty(SECTION_TEMPLATES_EDITOR);
|
|
| 278 |
+ comboBox.setData(sectionTemplates);
|
|
| 279 | 279 |
//2014-FIXME See why templates are not well reselect in cell editor
|
| 280 | 280 |
//2014-FIXME See cell editor does not loose focus and empty selection when losing focus
|
| 281 | 281 |
}
|
| ... | ... | @@ -45,16 +45,15 @@ import fr.ird.observe.client.datasource.editor.ll.data.observation.composition.t |
| 45 | 45 |
import fr.ird.observe.client.util.UIHelper;
|
| 46 | 46 |
import fr.ird.observe.client.util.init.DefaultUIInitializerResult;
|
| 47 | 47 |
import fr.ird.observe.client.util.init.UIInitHelper;
|
| 48 |
+import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor;
|
|
| 48 | 49 |
import fr.ird.observe.dto.data.ll.observation.BranchlineDto;
|
| 49 | 50 |
import fr.ird.observe.dto.data.ll.observation.SectionTemplateDto;
|
| 50 | 51 |
import fr.ird.observe.dto.decoration.DecoratorService;
|
| 51 | 52 |
import io.ultreia.java4all.jaxx.widgets.choice.BeanCheckBox;
|
| 52 |
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
|
|
| 53 |
-import org.nuiton.decorator.Decorator;
|
|
| 53 |
+import org.nuiton.decorator.MultiJXPathDecorator;
|
|
| 54 | 54 |
import org.nuiton.jaxx.widgets.number.NumberCellEditor;
|
| 55 | 55 |
|
| 56 | 56 |
import javax.swing.AbstractAction;
|
| 57 |
-import javax.swing.JComboBox;
|
|
| 58 | 57 |
import javax.swing.JTable;
|
| 59 | 58 |
import javax.swing.ListSelectionModel;
|
| 60 | 59 |
import javax.swing.table.TableCellRenderer;
|
| ... | ... | @@ -121,6 +120,7 @@ public class SetDetailCompositionUIInitializer extends ContentSimpleUIInitialize |
| 121 | 120 |
|
| 122 | 121 |
protected void initSections(SectionTableModel tableModel) {
|
| 123 | 122 |
JTable table = ui.getSectionsTable();
|
| 123 |
+ table.setRowHeight(22);
|
|
| 124 | 124 |
UIHelper.setI18nTableHeaderRenderer(table,
|
| 125 | 125 |
n("observe.data.ll.observation.Section.settingIdentifier"),
|
| 126 | 126 |
n("observe.data.ll.observation.Section.settingIdentifier"),
|
| ... | ... | @@ -137,10 +137,9 @@ public class SetDetailCompositionUIInitializer extends ContentSimpleUIInitialize |
| 137 | 137 |
UIHelper.setTableColumnEditor(table, 1, NumberCellEditor.newIntegerColumnEditor());
|
| 138 | 138 |
|
| 139 | 139 |
DecoratorService decoratorService = ui.getHandler().getDecoratorService();
|
| 140 |
- Decorator<SectionTemplateDto> sectionTemplateDecorator = decoratorService.getDecoratorByType(SectionTemplateDto.class);
|
|
| 141 |
- JComboBox<SectionTemplateDto> comboBox = new JComboBox<>();
|
|
| 142 |
- table.putClientProperty(SetDetailCompositionUIHandler.SECTION_TEMPLATES_EDITOR, comboBox);
|
|
| 143 |
- ComboBoxCellEditor editor = UIHelper.newDataColumnEditor(comboBox, Collections.emptyList(), sectionTemplateDecorator);
|
|
| 140 |
+ MultiJXPathDecorator<SectionTemplateDto> sectionTemplateDecorator = (MultiJXPathDecorator<SectionTemplateDto>) decoratorService.getDecoratorByType(SectionTemplateDto.class);
|
|
| 141 |
+ JaxxComboBoxCellEditor editor = UIHelper.newDataColumnEditor(Collections.emptyList(), sectionTemplateDecorator);
|
|
| 142 |
+ table.putClientProperty(SetDetailCompositionUIHandler.SECTION_TEMPLATES_EDITOR, editor.getComponent());
|
|
| 144 | 143 |
UIHelper.setTableColumnEditor(table, 2, editor);
|
| 145 | 144 |
|
| 146 | 145 |
tableModel.installTableKeyListener(table);
|
| ... | ... | @@ -77,6 +77,7 @@ public class TripGearUseFeaturesUIHandler extends GeneratedTripGearUseFeaturesUI |
| 77 | 77 |
{ // init measurements table
|
| 78 | 78 |
|
| 79 | 79 |
JTable table = ui.getMeasurementsTable();
|
| 80 |
+ table.setRowHeight(22);
|
|
| 80 | 81 |
UIHelper.setI18nTableHeaderRenderer(table,
|
| 81 | 82 |
n("observe.data.common.GearUseFeatures.gearCharacteristic.short"),
|
| 82 | 83 |
n("observe.data.common.GearUseFeatures.gearCharacteristic"),
|
| ... | ... | @@ -151,7 +151,7 @@ |
| 151 | 151 |
<maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 152 | 152 |
<buildDate>${maven.build.timestamp}</buildDate>
|
| 153 | 153 |
|
| 154 |
- <toolkit.version>5.0.8</toolkit.version>
|
|
| 154 |
+ <toolkit.version>5.0.9</toolkit.version>
|
|
| 155 | 155 |
|
| 156 | 156 |
<lib.version.ognl>3.1.28</lib.version.ognl>
|
| 157 | 157 |
<!--can't use 1.4.197 (date has changed + blob also)-->
|