Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
6314a2c5
by Tony CHEMIT at 2017-08-04T10:58:20+02:00
-
24b994c0
by Tony CHEMIT at 2017-08-04T10:58:23+02:00
-
a65fcbb3
by Tony CHEMIT at 2017-08-04T10:58:23+02:00
21 changed files:
- client-validation/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchReleaseDto-update-error-validation.xml
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIModel.java
- persistence/src/main/java/fr/ird/observe/entities/seine/NonTargetCatchReleaseImpl.java → client/src/main/java/fr/ird/observe/client/ui/content/UiToModelClassMapping.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/ContentTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/ContentTableUIModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchReleaseTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchReleaseUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchReleaseUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchReleaseUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchReleaseUIModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetCatchUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/NonTargetSampleUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/SchoolEstimateUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/TargetCatchUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/storage/tabs/ChooseDbModeUIHandler.java
- persistence/src/main/java/fr/ird/observe/entities/seine/ActivitySeineImpl.java
- persistence/src/main/java/fr/ird/observe/entities/seine/FloatingObjectImpl.java
- services/src/main/java/fr/ird/observe/services/dto/referential/seine/WeightCategoryHelper.java
- − services/src/main/java/fr/ird/observe/services/dto/seine/NonTargetCatchReleaseDto.java
Changes:
| ... | ... | @@ -119,7 +119,7 @@ |
| 119 | 119 |
|
| 120 | 120 |
<field-validator type="fieldexpression" short-circuit="true">
|
| 121 | 121 |
<param name="expression">
|
| 122 |
- <![CDATA[ currentSetSeine.endPursingTime.time < detectionTime.time ]]>
|
|
| 122 |
+ <![CDATA[ currentSetSeine.endPursingTimeStamp.time < detectionTime.time ]]>
|
|
| 123 | 123 |
</param>
|
| 124 | 124 |
<message>observe.validation.nonTargetCatchRelease.detectionTime.after.endPursingTimeStamp</message>
|
| 125 | 125 |
</field-validator>
|
| ... | ... | @@ -59,7 +59,6 @@ import java.awt.Dimension; |
| 59 | 59 |
import java.awt.FocusTraversalPolicy;
|
| 60 | 60 |
import java.awt.event.FocusEvent;
|
| 61 | 61 |
import java.awt.event.FocusListener;
|
| 62 |
-import java.util.ArrayList;
|
|
| 63 | 62 |
import java.util.Collection;
|
| 64 | 63 |
import java.util.Collections;
|
| 65 | 64 |
import java.util.LinkedList;
|
| ... | ... | @@ -901,8 +900,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 901 | 900 |
data = Collections.emptyList();
|
| 902 | 901 |
} else {
|
| 903 | 902 |
|
| 904 |
- Set<DataReference<R>> referenceSetDto = getModel().getDataReferences(list.getModel().getProperty());
|
|
| 905 |
- data = new ArrayList<>(referenceSetDto);
|
|
| 903 |
+ data = getModel().getDataReferences(list.getModel().getProperty());
|
|
| 906 | 904 |
|
| 907 | 905 |
}
|
| 908 | 906 |
|
| ... | ... | @@ -928,8 +926,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 928 | 926 |
data = Collections.emptyList();
|
| 929 | 927 |
} else {
|
| 930 | 928 |
|
| 931 |
- Set<ReferentialReference<R>> referenceSetDto = getModel().getReferentialReferences(list.getModel().getProperty());
|
|
| 932 |
- data = new ArrayList<>(referenceSetDto);
|
|
| 929 |
+ data = getModel().getReferentialReferences(list.getModel().getProperty());
|
|
| 933 | 930 |
|
| 934 | 931 |
}
|
| 935 | 932 |
|
| ... | ... | @@ -960,8 +957,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 960 | 957 |
|
| 961 | 958 |
} else {
|
| 962 | 959 |
|
| 963 |
- Set<ReferentialReference<R>> referenceSetDto = getModel().getReferentialReferences(propertyName);
|
|
| 964 |
- data = new ArrayList<>(referenceSetDto);
|
|
| 960 |
+ data = getModel().getReferentialReferences(propertyName);
|
|
| 965 | 961 |
|
| 966 | 962 |
}
|
| 967 | 963 |
|
| ... | ... | @@ -990,8 +986,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 990 | 986 |
|
| 991 | 987 |
} else {
|
| 992 | 988 |
|
| 993 |
- Set<DataReference<R>> referenceSetDto = getModel().getDataReferences(propertyName);
|
|
| 994 |
- data = new ArrayList<>(referenceSetDto);
|
|
| 989 |
+ data = getModel().getDataReferences(propertyName);
|
|
| 995 | 990 |
|
| 996 | 991 |
}
|
| 997 | 992 |
|
| ... | ... | @@ -1189,6 +1184,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 1189 | 1184 |
protected void openedUI() {
|
| 1190 | 1185 |
|
| 1191 | 1186 |
}
|
| 1187 |
+ |
|
| 1192 | 1188 |
protected ObserveServicesProvider getServicesProvider() {
|
| 1193 | 1189 |
return ObserveSwingDataSource.MAIN;
|
| 1194 | 1190 |
}
|
| ... | ... | @@ -31,6 +31,8 @@ import fr.ird.observe.services.dto.reference.DataReferenceSet; |
| 31 | 31 |
import fr.ird.observe.services.dto.reference.ReferentialReference;
|
| 32 | 32 |
import fr.ird.observe.services.dto.reference.ReferentialReferenceSet;
|
| 33 | 33 |
import fr.ird.observe.services.dto.referential.ReferentialDto;
|
| 34 |
+import java.util.LinkedList;
|
|
| 35 |
+import java.util.List;
|
|
| 34 | 36 |
import java.util.Objects;
|
| 35 | 37 |
import java.util.Optional;
|
| 36 | 38 |
import java.util.Set;
|
| ... | ... | @@ -46,36 +48,26 @@ import org.jdesktop.beans.AbstractSerializableBean; |
| 46 | 48 |
*/
|
| 47 | 49 |
public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializableBean {
|
| 48 | 50 |
|
| 49 |
- public static final String PROPERTY_EDIT_BEAN = "editBean";
|
|
| 50 |
- |
|
| 51 | 51 |
public static final String PROPERTY_MODE = "mode";
|
| 52 |
- |
|
| 53 |
- public static final String PROPERTY_READING_MODE = "readingMode";
|
|
| 54 |
- |
|
| 55 |
- public static final String PROPERTY_CREATING_MODE = "creatingMode";
|
|
| 56 |
- |
|
| 57 |
- public static final String PROPERTY_UPDATING_MODE = "updatingMode";
|
|
| 58 |
- |
|
| 59 |
- public static final String PROPERTY_ENABLED = "enabled";
|
|
| 60 |
- |
|
| 61 | 52 |
public static final String PROPERTY_MODIFIED = "modified";
|
| 62 |
- |
|
| 63 | 53 |
public static final String PROPERTY_EDITING = "editing";
|
| 64 |
- |
|
| 65 | 54 |
public static final String PROPERTY_EDITABLE = "editable";
|
| 66 |
- |
|
| 67 |
- public static final String PROPERTY_VALID = "valid";
|
|
| 68 |
- |
|
| 69 |
- public static final String PROPERTY_CAN_WRITE = "canWrite";
|
|
| 70 |
- |
|
| 71 | 55 |
public static final String PROPERTY_FORM = "form";
|
| 72 | 56 |
|
| 57 |
+ private static final String PROPERTY_EDIT_BEAN = "editBean";
|
|
| 58 |
+ private static final String PROPERTY_READING_MODE = "readingMode";
|
|
| 59 |
+ private static final String PROPERTY_CREATING_MODE = "creatingMode";
|
|
| 60 |
+ private static final String PROPERTY_UPDATING_MODE = "updatingMode";
|
|
| 61 |
+ private static final String PROPERTY_ENABLED = "enabled";
|
|
| 62 |
+ private static final String PROPERTY_VALID = "valid";
|
|
| 63 |
+ private static final String PROPERTY_CAN_WRITE = "canWrite";
|
|
| 64 |
+ |
|
| 73 | 65 |
/** Logger */
|
| 74 |
- static private final Log log = LogFactory.getLog(ContentUIModel.class);
|
|
| 66 |
+ private static final Log log = LogFactory.getLog(ContentUIModel.class);
|
|
| 75 | 67 |
|
| 76 | 68 |
private static final long serialVersionUID = 1L;
|
| 77 | 69 |
|
| 78 |
- protected final Class<E> beanType;
|
|
| 70 |
+ private final Class<E> beanType;
|
|
| 79 | 71 |
|
| 80 | 72 |
protected Form<E> form;
|
| 81 | 73 |
|
| ... | ... | @@ -93,7 +85,7 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 93 | 85 |
|
| 94 | 86 |
protected boolean editable;
|
| 95 | 87 |
|
| 96 |
- protected boolean canWrite;
|
|
| 88 |
+ private boolean canWrite;
|
|
| 97 | 89 |
|
| 98 | 90 |
/**
|
| 99 | 91 |
* Les référentiels qu'on peut utiliser, ils sont chargés depuis le cache des référentiels et peuvent être filtrés.
|
| ... | ... | @@ -105,14 +97,11 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 105 | 97 |
*/
|
| 106 | 98 |
protected ImmutableMap<String, DataReferenceSet<?>> dataReferenceSetsByPropertyName = ImmutableMap.of();
|
| 107 | 99 |
|
| 108 |
- public static <E extends IdDto, U extends ContentUI<E, U>> ContentUIModel<E> newModel(U ui) {
|
|
| 109 |
- |
|
| 110 |
- String uiName = ui.getClass().getName();
|
|
| 111 |
- String modelName = uiName + "Model";
|
|
| 100 |
+ static <E extends IdDto, U extends ContentUI<E, U>> ContentUIModel<E> newModel(U ui) {
|
|
| 112 | 101 |
|
| 113 | 102 |
try {
|
| 114 | 103 |
|
| 115 |
- Class<ContentUIModel<E>> modelClass = (Class) Class.forName(modelName);
|
|
| 104 |
+ Class<ContentUIModel<E>> modelClass = (Class) UiToModelClassMapping.get().getClass(ui.getClass());
|
|
| 116 | 105 |
return modelClass.newInstance();
|
| 117 | 106 |
|
| 118 | 107 |
} catch (Exception e) {
|
| ... | ... | @@ -246,7 +235,7 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 246 | 235 |
firePropertyChange(PROPERTY_MODIFIED, oldValue, modified);
|
| 247 | 236 |
}
|
| 248 | 237 |
|
| 249 |
- public boolean isCanWrite() {
|
|
| 238 |
+ boolean isCanWrite() {
|
|
| 250 | 239 |
return canWrite;
|
| 251 | 240 |
}
|
| 252 | 241 |
|
| ... | ... | @@ -256,17 +245,17 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 256 | 245 |
firePropertyChange(PROPERTY_CAN_WRITE, oldValue, canWrite);
|
| 257 | 246 |
}
|
| 258 | 247 |
|
| 259 |
- public <D extends ReferentialDto> Set<ReferentialReference<D>> getReferentialReferences(String name) {
|
|
| 248 |
+ public <D extends ReferentialDto> List<ReferentialReference<D>> getReferentialReferences(String name) {
|
|
| 260 | 249 |
|
| 261 | 250 |
ReferentialReferenceSet<D> referentialReferenceSet = getReferentialReferenceSet(name);
|
| 262 |
- return referentialReferenceSet.getReferences();
|
|
| 251 |
+ return new LinkedList<>(referentialReferenceSet.getReferences());
|
|
| 263 | 252 |
|
| 264 | 253 |
}
|
| 265 | 254 |
|
| 266 |
- public <D extends DataDto> Set<DataReference<D>> getDataReferences(String name) {
|
|
| 255 |
+ <D extends DataDto> List<DataReference<D>> getDataReferences(String name) {
|
|
| 267 | 256 |
|
| 268 | 257 |
DataReferenceSet<D> referentialReferenceSet = getDataReferenceSet(name);
|
| 269 |
- return referentialReferenceSet.getReferences();
|
|
| 258 |
+ return new LinkedList<>(referentialReferenceSet.getReferences());
|
|
| 270 | 259 |
|
| 271 | 260 |
}
|
| 272 | 261 |
|
| ... | ... | @@ -281,19 +270,11 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 281 | 270 |
this.referentialReferenceSetsByPropertyName = referentialReferenceSetsByPropertyName;
|
| 282 | 271 |
}
|
| 283 | 272 |
|
| 284 |
- public void setDataReferenceSetsByPropertyName(ImmutableMap<String, DataReferenceSet<?>> dataReferenceSetsByPropertyName) {
|
|
| 285 |
- this.dataReferenceSetsByPropertyName = dataReferenceSetsByPropertyName;
|
|
| 286 |
- }
|
|
| 287 |
- |
|
| 288 | 273 |
public ImmutableMap<String, ReferentialReferenceSet<?>> getReferentialReferenceSets() {
|
| 289 | 274 |
return referentialReferenceSetsByPropertyName;
|
| 290 | 275 |
}
|
| 291 | 276 |
|
| 292 |
- public ImmutableMap<String, DataReferenceSet<?>> getDataReferenceSets() {
|
|
| 293 |
- return dataReferenceSetsByPropertyName;
|
|
| 294 |
- }
|
|
| 295 |
- |
|
| 296 |
- protected <R extends DataDto> Optional<Set<DataReference<R>>> tryToGetDataReferenceSet(String propertyName) {
|
|
| 277 |
+ <R extends DataDto> Optional<Set<DataReference<R>>> tryToGetDataReferenceSet(String propertyName) {
|
|
| 297 | 278 |
DataReferenceSet<R> referenceSet = getDataReferenceSet(propertyName);
|
| 298 | 279 |
Set<DataReference<R>> references = null;
|
| 299 | 280 |
if (referenceSet != null) {
|
| ... | ... | @@ -316,12 +297,12 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab |
| 316 | 297 |
}
|
| 317 | 298 |
|
| 318 | 299 |
private <R extends ReferentialDto> ReferentialReferenceSet<R> getReferentialReferenceSet(String propertyName) {
|
| 319 |
- ReferentialReferenceSet<?> referenceSet = this.referentialReferenceSetsByPropertyName.get(propertyName);
|
|
| 320 |
- Objects.requireNonNull(referenceSet, "Could not find referantialRefenceSet named " + propertyName);
|
|
| 300 |
+ ReferentialReferenceSet<?> referenceSet = referentialReferenceSetsByPropertyName.get(propertyName);
|
|
| 301 |
+ Objects.requireNonNull(referenceSet, "Could not find referentialRefenceSet named " + propertyName);
|
|
| 321 | 302 |
return (ReferentialReferenceSet<R>) referenceSet;
|
| 322 | 303 |
}
|
| 323 | 304 |
|
| 324 |
- public <R extends DataDto> DataReferenceSet<R> getDataReferenceSet(String propertyName) {
|
|
| 305 |
+ private <R extends DataDto> DataReferenceSet<R> getDataReferenceSet(String propertyName) {
|
|
| 325 | 306 |
DataReferenceSet<?> referenceSet = dataReferenceSetsByPropertyName.get(propertyName);
|
| 326 | 307 |
Objects.requireNonNull(referenceSet, "Could not find dataReferenceSet named " + propertyName);
|
| 327 | 308 |
return (DataReferenceSet<R>) referenceSet;
|
| 1 |
-package fr.ird.observe.entities.seine;
|
|
| 1 |
+package fr.ird.observe.client.ui.content;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| 5 |
- * ObServe :: Persistence
|
|
| 5 |
+ * ObServe :: Client
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
| 8 | 8 |
* %%
|
| ... | ... | @@ -22,21 +22,24 @@ package fr.ird.observe.entities.seine; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import java.util.Date;
|
|
| 26 |
-import org.nuiton.util.DateUtil;
|
|
| 27 |
- |
|
| 28 |
-public class NonTargetCatchReleaseImpl extends NonTargetCatchReleaseAbstract {
|
|
| 25 |
+import io.ultreia.java4all.http.ClassMapping;
|
|
| 29 | 26 |
|
| 27 |
+/**
|
|
| 28 |
+ * Created by tchemit on 04/08/17.
|
|
| 29 |
+ *
|
|
| 30 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
+ * @since 7.0
|
|
| 32 |
+ */
|
|
| 33 |
+public class UiToModelClassMapping extends ClassMapping<ContentUI, ContentUIModel> {
|
|
| 30 | 34 |
|
| 31 |
- private static final long serialVersionUID = 1L;
|
|
| 35 |
+ private static UiToModelClassMapping INSTANCE = new UiToModelClassMapping();
|
|
| 32 | 36 |
|
| 33 |
- @Override
|
|
| 34 |
- public void setDetectionTime(Date detectionTime) {
|
|
| 35 |
- super.setDetectionTime(detectionTime == null ? null : DateUtil.getTime(detectionTime, false, false));
|
|
| 37 |
+ public static UiToModelClassMapping get() {
|
|
| 38 |
+ return INSTANCE;
|
|
| 36 | 39 |
}
|
| 37 | 40 |
|
| 38 |
- @Override
|
|
| 39 |
- public void setReleaseTime(Date releaseTime) {
|
|
| 40 |
- super.setReleaseTime(releaseTime == null ? null : DateUtil.getTime(releaseTime, false, false));
|
|
| 41 |
+ private UiToModelClassMapping() {
|
|
| 42 |
+ super(ContentUI.class.getPackage(), ContentUIModel.class.getPackage(), "Model");
|
|
| 41 | 43 |
}
|
| 44 |
+ |
|
| 42 | 45 |
}
|
| ... | ... | @@ -71,13 +71,13 @@ import org.nuiton.jaxx.validator.swing.SwingValidator; |
| 71 | 71 |
public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extends AbstractTableModel {
|
| 72 | 72 |
|
| 73 | 73 |
/** Le nom de la propriété de la ligne en cours d'édition */
|
| 74 |
- public static final String SELECTED_ROW_PROPERTY = "selectedRow";
|
|
| 74 |
+ static final String SELECTED_ROW_PROPERTY = "selectedRow";
|
|
| 75 | 75 |
|
| 76 | 76 |
/** Le nom de la propriété modifié du modèle */
|
| 77 |
- public static final String MODIFIED_PROPERTY = "modified";
|
|
| 77 |
+ private static final String MODIFIED_PROPERTY = "modified";
|
|
| 78 | 78 |
|
| 79 | 79 |
/** Le nom de la propriété pour editer le modele */
|
| 80 |
- public static final String EDITABLE_PROPERTY = "editable";
|
|
| 80 |
+ private static final String EDITABLE_PROPERTY = "editable";
|
|
| 81 | 81 |
|
| 82 | 82 |
/**
|
| 83 | 83 |
* Le nom de la propriété pour indiquer que l'entrée en cours d'édition est
|
| ... | ... | @@ -86,7 +86,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 86 | 86 |
public static final String CREATE_PROPERTY = "create";
|
| 87 | 87 |
|
| 88 | 88 |
/** Le nom de la propriété pour savoir si le modèle est vide */
|
| 89 |
- public static final String EMPTY_PROPERTY = "empty";
|
|
| 89 |
+ private static final String EMPTY_PROPERTY = "empty";
|
|
| 90 | 90 |
|
| 91 | 91 |
private static final long serialVersionUID = 1L;
|
| 92 | 92 |
|
| ... | ... | @@ -97,7 +97,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 97 | 97 |
protected final List<ContentTableMeta<B>> metas;
|
| 98 | 98 |
|
| 99 | 99 |
/** pour la propagation des modifications d'états */
|
| 100 |
- protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
|
| 100 |
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
|
| 101 | 101 |
|
| 102 | 102 |
/** la liste des données du modèle */
|
| 103 | 103 |
protected List<B> data = new ArrayList<>();
|
| ... | ... | @@ -115,7 +115,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 115 | 115 |
* un drapeau pour modifier la selection de la ligne en cours sans aucune
|
| 116 | 116 |
* verification.
|
| 117 | 117 |
*/
|
| 118 |
- protected boolean valueAdjusting;
|
|
| 118 |
+ private boolean valueAdjusting;
|
|
| 119 | 119 |
|
| 120 | 120 |
/** l'entrée sélectionnée (-1 quand pas de sélection) */
|
| 121 | 121 |
protected int selectedRow = -1;
|
| ... | ... | @@ -143,8 +143,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 143 | 143 |
String property,
|
| 144 | 144 |
boolean unmodiableWhenExisting) {
|
| 145 | 145 |
|
| 146 |
- return new ContentTableMeta<>(childType,
|
|
| 147 |
- property, unmodiableWhenExisting);
|
|
| 146 |
+ return new ContentTableMeta<>(childType, property, unmodiableWhenExisting);
|
|
| 148 | 147 |
}
|
| 149 | 148 |
|
| 150 | 149 |
/**
|
| ... | ... | @@ -152,7 +151,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 152 | 151 |
* <p>
|
| 153 | 152 |
* Cela va initialiser la liste à utiliser.
|
| 154 | 153 |
*/
|
| 155 |
- public void attachModel() {
|
|
| 154 |
+ void attachModel() {
|
|
| 156 | 155 |
// pas de ligne selectionne
|
| 157 | 156 |
setSelectedRow(-1);
|
| 158 | 157 |
|
| ... | ... | @@ -172,7 +171,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 172 | 171 |
fireTableDataChanged();
|
| 173 | 172 |
}
|
| 174 | 173 |
|
| 175 |
- public void dettachModel() {
|
|
| 174 |
+ void dettachModel() {
|
|
| 176 | 175 |
setModified(false);
|
| 177 | 176 |
int size = getRowCount();
|
| 178 | 177 |
// on indique que le modele n'est plus lie au bean
|
| ... | ... | @@ -255,7 +254,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 255 | 254 |
}
|
| 256 | 255 |
}
|
| 257 | 256 |
|
| 258 |
- public boolean isCanQuitEditingRow() {
|
|
| 257 |
+ boolean isCanQuitEditingRow() {
|
|
| 259 | 258 |
if (selectedRow == -1) {
|
| 260 | 259 |
// aucune ligne selectionne
|
| 261 | 260 |
// on peut changer la ligne sans verification
|
| ... | ... | @@ -359,7 +358,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 359 | 358 |
*
|
| 360 | 359 |
* @param row l'index de la nouvelle ligne a editer
|
| 361 | 360 |
*/
|
| 362 |
- public void changeSelectedRow(int row) {
|
|
| 361 |
+ void changeSelectedRow(int row) {
|
|
| 363 | 362 |
|
| 364 | 363 |
if (log.isDebugEnabled()) {
|
| 365 | 364 |
log.debug("row : " + row);
|
| ... | ... | @@ -517,7 +516,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 517 | 516 |
firePropertyChange(EDITABLE_PROPERTY, oldModified, editable);
|
| 518 | 517 |
}
|
| 519 | 518 |
|
| 520 |
- public boolean isValueAdjusting() {
|
|
| 519 |
+ boolean isValueAdjusting() {
|
|
| 521 | 520 |
return valueAdjusting;
|
| 522 | 521 |
}
|
| 523 | 522 |
|
| ... | ... | @@ -581,7 +580,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 581 | 580 |
return metas.get(columnIndex).getType();
|
| 582 | 581 |
}
|
| 583 | 582 |
|
| 584 |
- public ContentTableMeta<B> getColumnMeta(int columnIndex) {
|
|
| 583 |
+ private ContentTableMeta<B> getColumnMeta(int columnIndex) {
|
|
| 585 | 584 |
ensureColumnIndex(columnIndex);
|
| 586 | 585 |
return metas.get(columnIndex);
|
| 587 | 586 |
}
|
| ... | ... | @@ -606,7 +605,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 606 | 605 |
return list == null ? null : list.get(row);
|
| 607 | 606 |
}
|
| 608 | 607 |
|
| 609 |
- public void updateEmpty() {
|
|
| 608 |
+ private void updateEmpty() {
|
|
| 610 | 609 |
firePropertyChange(EMPTY_PROPERTY, null, isEmpty());
|
| 611 | 610 |
}
|
| 612 | 611 |
|
| ... | ... | @@ -656,7 +655,7 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 656 | 655 |
}
|
| 657 | 656 |
|
| 658 | 657 |
@SuppressWarnings("unchecked")
|
| 659 |
- protected SwingValidator<P> getParentValidator() {
|
|
| 658 |
+ private SwingValidator<P> getParentValidator() {
|
|
| 660 | 659 |
return context == null ? null : context.getValidator();
|
| 661 | 660 |
}
|
| 662 | 661 |
|
| ... | ... | @@ -690,20 +689,20 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 690 | 689 |
return meta.setValue(this, bean, aValue, row);
|
| 691 | 690 |
}
|
| 692 | 691 |
|
| 693 |
- protected void ensureColumnIndex(int columnIndex) throws ArrayIndexOutOfBoundsException {
|
|
| 692 |
+ private void ensureColumnIndex(int columnIndex) throws ArrayIndexOutOfBoundsException {
|
|
| 694 | 693 |
if (columnIndex < 0 || columnIndex >= metas.size()) {
|
| 695 | 694 |
throw new ArrayIndexOutOfBoundsException("column index should be in [0," + metas.size() + "], but was " + columnIndex);
|
| 696 | 695 |
}
|
| 697 | 696 |
}
|
| 698 | 697 |
|
| 699 |
- protected void ensureRowIndex(int rowIndex) throws ArrayIndexOutOfBoundsException {
|
|
| 698 |
+ private void ensureRowIndex(int rowIndex) throws ArrayIndexOutOfBoundsException {
|
|
| 700 | 699 |
int size = getRowCount();
|
| 701 | 700 |
if (rowIndex < 0 || rowIndex >= size) {
|
| 702 | 701 |
throw new ArrayIndexOutOfBoundsException("row index should be in [0," + (getRowCount() - 1) + "], but was " + rowIndex);
|
| 703 | 702 |
}
|
| 704 | 703 |
}
|
| 705 | 704 |
|
| 706 |
- protected void ensureEditable() throws IllegalStateException {
|
|
| 705 |
+ private void ensureEditable() throws IllegalStateException {
|
|
| 707 | 706 |
if (!editable) {
|
| 708 | 707 |
throw new IllegalStateException("can not edit this model since it is marked as none editable " + this);
|
| 709 | 708 |
}
|
| ... | ... | @@ -715,11 +714,11 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 715 | 714 |
clearCache();
|
| 716 | 715 |
}
|
| 717 | 716 |
|
| 718 |
- protected void clearCache() {
|
|
| 717 |
+ private void clearCache() {
|
|
| 719 | 718 |
data = null;
|
| 720 | 719 |
}
|
| 721 | 720 |
|
| 722 |
- protected void updateBeanList(boolean shouldChanged) {
|
|
| 721 |
+ private void updateBeanList(boolean shouldChanged) {
|
|
| 723 | 722 |
SwingValidator<P> parentValidator = getParentValidator();
|
| 724 | 723 |
boolean wasChanged = parentValidator.isChanged();
|
| 725 | 724 |
|
| ... | ... | @@ -735,11 +734,11 @@ public abstract class ContentTableModel<P extends IdDto, B extends IdDto> extend |
| 735 | 734 |
|
| 736 | 735 |
protected abstract void setChilds(P parent, List<B> childs);
|
| 737 | 736 |
|
| 738 |
- protected boolean isModelModified() {
|
|
| 737 |
+ private boolean isModelModified() {
|
|
| 739 | 738 |
return getValidator().isChanged();
|
| 740 | 739 |
}
|
| 741 | 740 |
|
| 742 |
- protected boolean isModelValid() {
|
|
| 741 |
+ private boolean isModelValid() {
|
|
| 743 | 742 |
return getValidator().isValid();
|
| 744 | 743 |
}
|
| 745 | 744 |
}
|
| ... | ... | @@ -153,7 +153,7 @@ public abstract class ContentTableUIModel<E extends IdDto, D extends IdDto> exte |
| 153 | 153 |
return tableEditBean;
|
| 154 | 154 |
}
|
| 155 | 155 |
|
| 156 |
- public final D newTableEditBean() {
|
|
| 156 |
+ public D newTableEditBean() {
|
|
| 157 | 157 |
try {
|
| 158 | 158 |
|
| 159 | 159 |
return getChildType().getConstructor().newInstance();
|
| ... | ... | @@ -30,25 +30,20 @@ import fr.ird.observe.services.dto.seine.NonTargetCatchReleaseHelper; |
| 30 | 30 |
import fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchReleaseDto;
|
| 31 | 31 |
import java.util.Collection;
|
| 32 | 32 |
import java.util.List;
|
| 33 |
-import org.apache.commons.logging.Log;
|
|
| 34 |
-import org.apache.commons.logging.LogFactory;
|
|
| 35 | 33 |
|
| 36 | 34 |
/**
|
| 37 | 35 |
* Created on 12/4/14.
|
| 38 | 36 |
*
|
| 39 | 37 |
* @author Tony Chemit - dev@tchemit.fr
|
| 40 |
- * @since 3.8
|
|
| 38 |
+ * @since 7.0
|
|
| 41 | 39 |
*/
|
| 42 | 40 |
public class NonTargetCatchReleaseTableModel extends ContentTableModel<SetSeineNonTargetCatchReleaseDto, NonTargetCatchReleaseDto> {
|
| 43 | 41 |
|
| 44 |
- /** Logger. */
|
|
| 45 |
- private static final Log log = LogFactory.getLog(NonTargetCatchReleaseTableModel.class);
|
|
| 46 |
- |
|
| 47 | 42 |
private static final long serialVersionUID = 1L;
|
| 48 | 43 |
private boolean adjusting;
|
| 49 | 44 |
|
| 50 |
- public NonTargetCatchReleaseTableModel(ObserveContentTableUI<SetSeineNonTargetCatchReleaseDto, NonTargetCatchReleaseDto, ?> context,
|
|
| 51 |
- List<ContentTableMeta<NonTargetCatchReleaseDto>> contentTableMetas) {
|
|
| 45 |
+ NonTargetCatchReleaseTableModel(ObserveContentTableUI<SetSeineNonTargetCatchReleaseDto, NonTargetCatchReleaseDto, ?> context,
|
|
| 46 |
+ List<ContentTableMeta<NonTargetCatchReleaseDto>> contentTableMetas) {
|
|
| 52 | 47 |
super(context, contentTableMetas);
|
| 53 | 48 |
}
|
| 54 | 49 |
|
| ... | ... | @@ -77,7 +72,7 @@ public class NonTargetCatchReleaseTableModel extends ContentTableModel<SetSeineN |
| 77 | 72 |
return bean.getNonTargetCatchRelease();
|
| 78 | 73 |
}
|
| 79 | 74 |
|
| 80 |
- public void moveUp(int selectedRow) {
|
|
| 75 |
+ void moveUp(int selectedRow) {
|
|
| 81 | 76 |
NonTargetCatchReleaseDto remove = data.remove(selectedRow);
|
| 82 | 77 |
data.add(selectedRow - 1, remove);
|
| 83 | 78 |
fireTableRowsUpdated(selectedRow - 1, selectedRow);
|
| ... | ... | @@ -87,7 +82,7 @@ public class NonTargetCatchReleaseTableModel extends ContentTableModel<SetSeineN |
| 87 | 82 |
getModel().setModified(true);
|
| 88 | 83 |
}
|
| 89 | 84 |
|
| 90 |
- public void moveDown(int selectedRow) {
|
|
| 85 |
+ void moveDown(int selectedRow) {
|
|
| 91 | 86 |
NonTargetCatchReleaseDto remove = data.remove(selectedRow);
|
| 92 | 87 |
data.add(selectedRow + 1, remove);
|
| 93 | 88 |
fireTableRowsUpdated(selectedRow, selectedRow + 1);
|
| ... | ... | @@ -97,7 +92,7 @@ public class NonTargetCatchReleaseTableModel extends ContentTableModel<SetSeineN |
| 97 | 92 |
getModel().setModified(true);
|
| 98 | 93 |
}
|
| 99 | 94 |
|
| 100 |
- public boolean isAdjusting() {
|
|
| 95 |
+ boolean isAdjusting() {
|
|
| 101 | 96 |
return adjusting;
|
| 102 | 97 |
}
|
| 103 | 98 |
}
|
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 |
fr.ird.observe.client.validation.ObserveSwingValidator
|
| 42 | 42 |
fr.ird.observe.client.ui.content.table.impl.seine.ModeSaisieEchantillonEnum
|
| 43 | 43 |
|
| 44 |
- org.nuiton.jaxx.widgets.datetime.TimeEditor
|
|
| 44 |
+ org.nuiton.jaxx.widgets.datetime.DateTimeEditor
|
|
| 45 | 45 |
org.nuiton.jaxx.widgets.number.NumberEditor
|
| 46 | 46 |
org.nuiton.jaxx.widgets.select.BeanComboBox
|
| 47 | 47 |
|
| ... | ... | @@ -150,13 +150,16 @@ |
| 150 | 150 |
</cell>
|
| 151 | 151 |
</row>
|
| 152 | 152 |
|
| 153 |
- <!-- detection time / release time -->
|
|
| 153 |
+ <!-- detection time -->
|
|
| 154 | 154 |
<row>
|
| 155 | 155 |
<cell columns="2" weightx="1">
|
| 156 |
- <JPanel layout='{new GridLayout(1,0)}'>
|
|
| 157 |
- <TimeEditor id='detectionTime' constructorParams='this'/>
|
|
| 158 |
- <TimeEditor id='releaseTime' constructorParams='this'/>
|
|
| 159 |
- </JPanel>
|
|
| 156 |
+ <DateTimeEditor id='detectionTime' constructorParams='this'/>
|
|
| 157 |
+ </cell>
|
|
| 158 |
+ </row>
|
|
| 159 |
+ <!-- release time -->
|
|
| 160 |
+ <row>
|
|
| 161 |
+ <cell columns="2" weightx="1">
|
|
| 162 |
+ <DateTimeEditor id='releaseTime' constructorParams='this'/>
|
|
| 160 | 163 |
</cell>
|
| 161 | 164 |
</row>
|
| 162 | 165 |
|
| ... | ... | @@ -124,19 +124,19 @@ |
| 124 | 124 |
}
|
| 125 | 125 |
|
| 126 | 126 |
#detectionTime {
|
| 127 |
- propertyTime:{NonTargetCatchReleaseDto.PROPERTY_DETECTION_TIME};
|
|
| 127 |
+ propertyDate:{NonTargetCatchReleaseDto.PROPERTY_DETECTION_TIME};
|
|
| 128 | 128 |
bean:{tableEditBean};
|
| 129 | 129 |
label:{t("observe.common.detectionTime")};
|
| 130 |
- time:{tableEditBean.getDetectionTime()};
|
|
| 130 |
+ date:{tableEditBean.getDetectionTime()};
|
|
| 131 |
+ dateEditable:false;
|
|
| 131 | 132 |
_validatorLabel:{t("observe.common.detectionTime")};
|
| 132 | 133 |
showTimeEditorSlider: false;
|
| 133 | 134 |
}
|
| 134 | 135 |
|
| 135 | 136 |
#releaseTime {
|
| 136 |
- propertyTime:{NonTargetCatchReleaseDto.PROPERTY_RELEASE_TIME};
|
|
| 137 |
+ propertyDate:{NonTargetCatchReleaseDto.PROPERTY_RELEASE_TIME};
|
|
| 137 | 138 |
bean:{tableEditBean};
|
| 138 | 139 |
label:{t("observe.common.releaseTime")};
|
| 139 |
- time:{tableEditBean.getReleaseTime()};
|
|
| 140 |
- _validatorLabel:{t("observe.common.releaseTime")};
|
|
| 140 |
+ date:{tableEditBean.getReleaseTime()};
|
|
| 141 | 141 |
showTimeEditorSlider: false;
|
| 142 | 142 |
}
|
| ... | ... | @@ -21,7 +21,6 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.client.ui.content.table.impl.seine;
|
| 23 | 23 |
|
| 24 |
-import com.google.common.collect.Lists;
|
|
| 25 | 24 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 26 | 25 |
import fr.ird.observe.client.ui.UIHelper;
|
| 27 | 26 |
import fr.ird.observe.client.ui.content.table.ContentTableUIHandler;
|
| ... | ... | @@ -49,7 +48,6 @@ import java.util.LinkedList; |
| 49 | 48 |
import java.util.List;
|
| 50 | 49 |
import java.util.Map;
|
| 51 | 50 |
import java.util.Objects;
|
| 52 |
-import java.util.Set;
|
|
| 53 | 51 |
import java.util.TreeMap;
|
| 54 | 52 |
import javax.swing.JComponent;
|
| 55 | 53 |
import javax.swing.JPopupMenu;
|
| ... | ... | @@ -130,8 +128,6 @@ public class NonTargetCatchReleaseUIHandler extends ContentTableUIHandler<SetSei |
| 130 | 128 |
NonTargetCatchReleaseTableModel model = getTableModel();
|
| 131 | 129 |
|
| 132 | 130 |
if (!model.isEditable()) {
|
| 133 |
- |
|
| 134 |
- // rien a faire
|
|
| 135 | 131 |
return;
|
| 136 | 132 |
}
|
| 137 | 133 |
|
| ... | ... | @@ -139,47 +135,36 @@ public class NonTargetCatchReleaseUIHandler extends ContentTableUIHandler<SetSei |
| 139 | 135 |
JComponent requestFocus;
|
| 140 | 136 |
|
| 141 | 137 |
if (create) {
|
| 142 |
- Set<ReferentialReference<SpeciesDto>> speciesSet = getModel().getReferentialReferences(NonTargetCatchReleaseDto.PROPERTY_SPECIES);
|
|
| 143 |
- availableEspeces = Lists.newArrayList(speciesSet);
|
|
| 138 |
+ |
|
| 139 |
+ availableEspeces = getModel().getReferentialReferences(NonTargetCatchReleaseDto.PROPERTY_SPECIES);
|
|
| 144 | 140 |
|
| 145 | 141 |
requestFocus = ui.getSpecies();
|
| 146 | 142 |
|
| 147 | 143 |
if (model.isCreate()) {
|
| 148 | 144 |
|
| 149 |
- // on passe le mode de saisie en count
|
|
| 150 |
- ui.getAcquisitionModeGroup().setSelectedValue(null);
|
|
| 151 |
- ui.getAcquisitionModeGroup().setSelectedValue(ModeSaisieEchantillonEnum.byEffectif);
|
|
| 152 |
- |
|
| 153 | 145 |
ui.getStatus().init(null);
|
| 154 | 146 |
}
|
| 155 | 147 |
|
| 156 | 148 |
} else {
|
| 149 |
+ |
|
| 157 | 150 |
ReferentialReference<SpeciesDto> species = bean.getSpecies();
|
| 158 | 151 |
availableEspeces = new ArrayList<>();
|
| 159 | 152 |
availableEspeces.add(species);
|
| 160 | 153 |
requestFocus = ui.getSex();
|
| 161 | 154 |
|
| 162 |
- int acquisitionMode = bean.getAcquisitionMode();
|
|
| 163 |
- ModeSaisieEchantillonEnum enumValue = ModeSaisieEchantillonEnum.valueOf(acquisitionMode);
|
|
| 164 |
- ui.getAcquisitionModeGroup().setSelectedValue(null);
|
|
| 165 |
- ui.getAcquisitionModeGroup().setSelectedValue(enumValue);
|
|
| 166 | 155 |
}
|
| 167 | 156 |
|
| 157 |
+ int acquisitionMode = bean.getAcquisitionMode();
|
|
| 158 |
+ ModeSaisieEchantillonEnum enumValue = ModeSaisieEchantillonEnum.valueOf(acquisitionMode);
|
|
| 159 |
+ ui.getAcquisitionModeGroup().setSelectedValue(null);
|
|
| 160 |
+ ui.getAcquisitionModeGroup().setSelectedValue(enumValue);
|
|
| 161 |
+ |
|
| 168 | 162 |
ui.getSpecies().setData(availableEspeces);
|
| 169 | 163 |
|
| 170 |
- Date releaseTime;
|
|
| 171 |
- Date detectionTime;
|
|
| 172 |
- NonTargetCatchReleaseStatus status;
|
|
| 173 |
- if (create) {
|
|
| 164 |
+ Date releaseTime = bean.getReleaseTime();
|
|
| 165 |
+ Date detectionTime = bean.getDetectionTime();
|
|
| 166 |
+ NonTargetCatchReleaseStatus status = bean.getStatus();
|
|
| 174 | 167 |
|
| 175 |
- releaseTime = getModel().getForm().getObject().getEndPursingTimeStamp();
|
|
| 176 |
- detectionTime = getModel().getForm().getObject().getEndPursingTimeStamp();
|
|
| 177 |
- status = null;
|
|
| 178 |
- } else {
|
|
| 179 |
- releaseTime = bean.getReleaseTime();
|
|
| 180 |
- detectionTime = bean.getDetectionTime();
|
|
| 181 |
- status = bean.getStatus();
|
|
| 182 |
- }
|
|
| 183 | 168 |
updateSpecies(bean.getSpecies());
|
| 184 | 169 |
|
| 185 | 170 |
getModel().setDetectionTime(detectionTime);
|
| ... | ... | @@ -71,6 +71,17 @@ public class NonTargetCatchReleaseUIModel extends ContentTableUIModel<SetSeineNo |
| 71 | 71 |
initModel(ui, metas);
|
| 72 | 72 |
}
|
| 73 | 73 |
|
| 74 |
+ |
|
| 75 |
+ @Override
|
|
| 76 |
+ public NonTargetCatchReleaseDto newTableEditBean() {
|
|
| 77 |
+ NonTargetCatchReleaseDto result = super.newTableEditBean();
|
|
| 78 |
+ Date endPursingTimeStamp = getBean().getEndPursingTimeStamp();
|
|
| 79 |
+ result.setDetectionTime(endPursingTimeStamp);
|
|
| 80 |
+ result.setReleaseTime(endPursingTimeStamp);
|
|
| 81 |
+ result.setAcquisitionMode(ModeSaisieEchantillonEnum.byIndividu.ordinal());
|
|
| 82 |
+ return result;
|
|
| 83 |
+ }
|
|
| 84 |
+ |
|
| 74 | 85 |
@Override
|
| 75 | 86 |
protected NonTargetCatchReleaseTableModel createTableModel(
|
| 76 | 87 |
ObserveContentTableUI<SetSeineNonTargetCatchReleaseDto, NonTargetCatchReleaseDto, ?> ui,
|
| ... | ... | @@ -22,7 +22,6 @@ |
| 22 | 22 |
package fr.ird.observe.client.ui.content.table.impl.seine;
|
| 23 | 23 |
|
| 24 | 24 |
import com.google.common.collect.Iterables;
|
| 25 |
-import com.google.common.collect.Lists;
|
|
| 26 | 25 |
import com.google.common.collect.Sets;
|
| 27 | 26 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 28 | 27 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| ... | ... | @@ -214,8 +213,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa |
| 214 | 213 |
JComponent requestFocus;
|
| 215 | 214 |
|
| 216 | 215 |
if (create) {
|
| 217 |
- Set<ReferentialReference<SpeciesDto>> speciesSet = getModel().getReferentialReferences(NonTargetCatchDto.PROPERTY_SPECIES);
|
|
| 218 |
- availableEspeces = Lists.newArrayList(speciesSet);
|
|
| 216 |
+ availableEspeces = getModel().getReferentialReferences(NonTargetCatchDto.PROPERTY_SPECIES);
|
|
| 219 | 217 |
|
| 220 | 218 |
requestFocus = ui.getSpecies();
|
| 221 | 219 |
} else {
|
| ... | ... | @@ -43,7 +43,6 @@ import java.util.Collection; |
| 43 | 43 |
import java.util.LinkedList;
|
| 44 | 44 |
import java.util.List;
|
| 45 | 45 |
import java.util.Optional;
|
| 46 |
-import java.util.Set;
|
|
| 47 | 46 |
import javax.swing.JComponent;
|
| 48 | 47 |
import javax.swing.JTable;
|
| 49 | 48 |
import javax.swing.table.DefaultTableCellRenderer;
|
| ... | ... | @@ -137,8 +136,7 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS |
| 137 | 136 |
ui.getAcquisitionModeGroup().setSelectedValue(ModeSaisieEchantillonEnum.byEffectif);
|
| 138 | 137 |
}
|
| 139 | 138 |
|
| 140 |
- Set<ReferentialReference<SpeciesDto>> speciesReferences = getModel().getReferentialReferences(NonTargetLengthDto.PROPERTY_SPECIES);
|
|
| 141 |
- availableEspeces = Lists.newArrayList(speciesReferences);
|
|
| 139 |
+ availableEspeces = getModel().getReferentialReferences(NonTargetLengthDto.PROPERTY_SPECIES);
|
|
| 142 | 140 |
|
| 143 | 141 |
// on utilise le code par defaut de l'espèce
|
| 144 | 142 |
sizeMeasureType = getSpeciesDefaultSizeMeasureType(species);
|
| ... | ... | @@ -88,7 +88,7 @@ public class SchoolEstimateUIHandler extends ContentTableUIHandler<SetSeineSchoo |
| 88 | 88 |
JComponent requestFocus;
|
| 89 | 89 |
|
| 90 | 90 |
if (create) {
|
| 91 |
- Set<ReferentialReference<SpeciesDto>> references = getModel().getReferentialReferences(SchoolEstimateDto.PROPERTY_SPECIES);
|
|
| 91 |
+ List<ReferentialReference<SpeciesDto>> references = getModel().getReferentialReferences(SchoolEstimateDto.PROPERTY_SPECIES);
|
|
| 92 | 92 |
|
| 93 | 93 |
List<ReferentialReference<SpeciesDto>> listSpeciesUsed = model.getColumnValues(0);
|
| 94 | 94 |
|
| ... | ... | @@ -258,7 +258,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa |
| 258 | 258 |
|
| 259 | 259 |
// un espèce est selectionnee, on calcule les categories pour cette espèce
|
| 260 | 260 |
// on ne conserve que les categories de l'espèce
|
| 261 |
- Set<ReferentialReference<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 261 |
+ List<ReferentialReference<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 262 | 262 |
availableCategories = WeightCategoryHelper.filterSpeciesWeightCategories(allCategories, species.getId());
|
| 263 | 263 |
|
| 264 | 264 |
}
|
| ... | ... | @@ -386,24 +386,18 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT |
| 386 | 386 |
|
| 387 | 387 |
private List<ReferentialReference<WeightCategoryDto>> buildWeightCategoryList(ReferentialReference<SpeciesDto> species) {
|
| 388 | 388 |
|
| 389 |
- Set<ReferentialReference<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 389 |
+ List<ReferentialReference<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 390 | 390 |
return WeightCategoryHelper.filterSpeciesWeightCategories(allCategories, species.getId());
|
| 391 | 391 |
|
| 392 | 392 |
}
|
| 393 | 393 |
|
| 394 | 394 |
@SuppressWarnings("unchecked")
|
| 395 | 395 |
private List<ReferentialReference<ReasonForDiscardDto>> buildReasonFordiscardList() {
|
| 396 |
- |
|
| 397 |
- Set<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardSet = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_REASON_FOR_DISCARD);
|
|
| 398 |
- return new ArrayList<>(reasonForDiscardSet);
|
|
| 399 |
- |
|
| 396 |
+ return getModel().getReferentialReferences(TargetCatchDto.PROPERTY_REASON_FOR_DISCARD);
|
|
| 400 | 397 |
}
|
| 401 | 398 |
|
| 402 | 399 |
private List<ReferentialReference<WeightCategoryDto>> getAllWeightCategories() {
|
| 403 |
- |
|
| 404 |
- Set<ReferentialReference<WeightCategoryDto>> weightCategorySet = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 405 |
- return new ArrayList<>(weightCategorySet);
|
|
| 406 |
- |
|
| 400 |
+ return getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY);
|
|
| 407 | 401 |
}
|
| 408 | 402 |
|
| 409 | 403 |
@Override
|
| ... | ... | @@ -44,6 +44,7 @@ import javax.swing.JComponent; |
| 44 | 44 |
import javax.swing.JPanel;
|
| 45 | 45 |
import javax.swing.JRadioButton;
|
| 46 | 46 |
import javax.swing.KeyStroke;
|
| 47 |
+import javax.swing.SwingUtilities;
|
|
| 47 | 48 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 48 | 49 |
import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup;
|
| 49 | 50 |
|
| ... | ... | @@ -95,12 +96,14 @@ public class ChooseDbModeUIHandler extends StorageTabUIHandler<ChooseDbModeUI> i |
| 95 | 96 |
Boolean changeStep = (Boolean) abstractButton.getClientProperty("changeStep");
|
| 96 | 97 |
if (changeStep != null && changeStep) {
|
| 97 | 98 |
StorageUI parentContainer = ui.getParentContainer(StorageUI.class);
|
| 98 |
- parentContainer.getNextAction().doClick();
|
|
| 99 |
+ SwingUtilities.invokeLater(parentContainer.getNextAction()::doClick);
|
|
| 100 |
+ return;
|
|
| 99 | 101 |
}
|
| 100 | 102 |
Boolean apply = (Boolean) abstractButton.getClientProperty("apply");
|
| 101 | 103 |
if (apply != null && apply) {
|
| 102 | 104 |
StorageUI parentContainer = ui.getParentContainer(StorageUI.class);
|
| 103 |
- parentContainer.getApplyAction().doClick();
|
|
| 105 |
+ SwingUtilities.invokeLater(parentContainer.getNextAction()::doClick);
|
|
| 106 |
+ SwingUtilities.invokeLater(parentContainer.getApplyAction()::doClick);
|
|
| 104 | 107 |
}
|
| 105 | 108 |
}
|
| 106 | 109 |
});
|
| ... | ... | @@ -30,25 +30,20 @@ import java.util.Arrays; |
| 30 | 30 |
import java.util.Collections;
|
| 31 | 31 |
import java.util.List;
|
| 32 | 32 |
import java.util.Objects;
|
| 33 |
-import org.apache.commons.logging.Log;
|
|
| 34 |
-import org.apache.commons.logging.LogFactory;
|
|
| 35 | 33 |
import org.nuiton.util.NumberUtil;
|
| 36 | 34 |
|
| 37 | 35 |
/** @author Tony Chemit - dev@tchemit.fr */
|
| 38 | 36 |
public class ActivitySeineImpl extends ActivitySeineAbstract {
|
| 39 | 37 |
|
| 40 |
- /** Logger. */
|
|
| 41 |
- private static final Log log = LogFactory.getLog(ActivitySeineImpl.class);
|
|
| 42 |
- |
|
| 43 | 38 |
private static final long serialVersionUID = 2L;
|
| 44 | 39 |
|
| 45 | 40 |
public static final String ACTIVITY_FIN_DE_VEILLE = "16";
|
| 46 | 41 |
|
| 47 |
- public static final String ACTIVITY_DEBUT_DE_PECHE = "7";
|
|
| 42 |
+ private static final String ACTIVITY_DEBUT_DE_PECHE = "7";
|
|
| 48 | 43 |
|
| 49 |
- public static final String ACTIVITY_FIN_DE_PECHE = "6";
|
|
| 44 |
+ private static final String ACTIVITY_FIN_DE_PECHE = "6";
|
|
| 50 | 45 |
|
| 51 |
- public static final String ACTIVITY_CHANGED_ZONE = "21";
|
|
| 46 |
+ private static final String ACTIVITY_CHANGED_ZONE = "21";
|
|
| 52 | 47 |
|
| 53 | 48 |
private static final List<String> CALEE_OPERATIONS = Collections.singletonList(ACTIVITY_FIN_DE_PECHE);
|
| 54 | 49 |
|
| ... | ... | @@ -56,41 +51,23 @@ public class ActivitySeineImpl extends ActivitySeineAbstract { |
| 56 | 51 |
|
| 57 | 52 |
private static final List<String> SYSTEM_OPERATIONS = Arrays.asList("0", "11", "11", ACTIVITY_FIN_DE_VEILLE);
|
| 58 | 53 |
|
| 59 |
- public static final String PROPERTY_CHANGED_ZONE_OPERATION = "changedZoneOperation";
|
|
| 60 |
- |
|
| 61 |
- public static final String PROPERTY_SET_OPERATION = "setOperation";
|
|
| 62 |
- |
|
| 63 |
-// @Override
|
|
| 64 |
-// public OpenableEntity getOpenChild() {
|
|
| 65 |
-// // sur une activity, pas d'enfant OpenableEntity
|
|
| 66 |
-// return null;
|
|
| 67 |
-// }
|
|
| 68 |
-//
|
|
| 69 |
-// @Override
|
|
| 70 |
-// public List<?> getOpenableChilds() {
|
|
| 71 |
-// // sur une activity, pas d'enfant OpenableEntity
|
|
| 72 |
-// return null;
|
|
| 73 |
-// }
|
|
| 54 |
+ private static final String PROPERTY_CHANGED_ZONE_OPERATION = "changedZoneOperation";
|
|
| 74 | 55 |
|
| 75 |
- /** @return {@code true} si l'activite concerne un DCP */
|
|
| 76 | 56 |
@Override
|
| 77 | 57 |
public boolean isDCPOperation() {
|
| 78 | 58 |
return vesselActivitySeine != null && DCP_OPERATIONS.contains(vesselActivitySeine.getCode());
|
| 79 | 59 |
}
|
| 80 | 60 |
|
| 81 |
- /** @return {@code true} si l'activite concerne une calée */
|
|
| 82 | 61 |
@Override
|
| 83 | 62 |
public boolean isSetOperation() {
|
| 84 | 63 |
return vesselActivitySeine != null && CALEE_OPERATIONS.contains(vesselActivitySeine.getCode());
|
| 85 | 64 |
}
|
| 86 | 65 |
|
| 87 |
- /** @return {@code true} si l'activite concerne un système observé */
|
|
| 88 | 66 |
@Override
|
| 89 | 67 |
public boolean isObservedSystemOperation() {
|
| 90 | 68 |
return vesselActivitySeine != null && SYSTEM_OPERATIONS.contains(vesselActivitySeine.getCode());
|
| 91 | 69 |
}
|
| 92 | 70 |
|
| 93 |
- /** @return {@code true} si l'activite concerne un changement de zone */
|
|
| 94 | 71 |
@Override
|
| 95 | 72 |
public boolean isChangedZoneOperation() {
|
| 96 | 73 |
return vesselActivitySeine != null && ACTIVITY_CHANGED_ZONE.equals(vesselActivitySeine.getCode());
|
| ... | ... | @@ -101,17 +78,6 @@ public class ActivitySeineImpl extends ActivitySeineAbstract { |
| 101 | 78 |
return CoordinateHelper.getQuadrant(longitude, latitude);
|
| 102 | 79 |
}
|
| 103 | 80 |
|
| 104 |
-// @Override
|
|
| 105 |
-// public void setQuadrant(Integer quadrant) {
|
|
| 106 |
-// if (!Objects.equals(this.quadrant, quadrant)) {
|
|
| 107 |
-// Entities.printDebugInformations(PROPERTY_QUADRANT, this, quadrant);
|
|
| 108 |
-// }
|
|
| 109 |
-// Integer old = this.quadrant;
|
|
| 110 |
-//// fireOnPreWrite(PROPERTY_QUADRANT, old, quadrant);
|
|
| 111 |
-// this.quadrant = quadrant;
|
|
| 112 |
-// fireOnPostWrite(PROPERTY_QUADRANT, old, quadrant);
|
|
| 113 |
-// }
|
|
| 114 |
- |
|
| 115 | 81 |
@Override
|
| 116 | 82 |
public SchoolType getSchoolType() {
|
| 117 | 83 |
return ActivitySeines.getSchoolType(this);
|
| ... | ... | @@ -136,9 +102,7 @@ public class ActivitySeineImpl extends ActivitySeineAbstract { |
| 136 | 102 |
public void setObservedSystemDistance(Float observedSystemDistance) {
|
| 137 | 103 |
if (observedSystemDistance != null) {
|
| 138 | 104 |
|
| 139 |
- // on arrondit à 2 décimales
|
|
| 140 |
- observedSystemDistance =
|
|
| 141 |
- NumberUtil.roundTwoDigits(observedSystemDistance);
|
|
| 105 |
+ observedSystemDistance = NumberUtil.roundTwoDigits(observedSystemDistance);
|
|
| 142 | 106 |
}
|
| 143 | 107 |
super.setObservedSystemDistance(observedSystemDistance);
|
| 144 | 108 |
}
|
| ... | ... | @@ -25,7 +25,6 @@ import com.google.common.collect.Iterables; |
| 25 | 25 |
import fr.ird.observe.common.constants.seine.TypeTransmittingBuoyOperation;
|
| 26 | 26 |
import fr.ird.observe.entities.referentiel.seine.TransmittingBuoyOperation;
|
| 27 | 27 |
|
| 28 |
-/** Implantation des objectOperations pour l'entité FloatingObject. */
|
|
| 29 | 28 |
public class FloatingObjectImpl extends FloatingObjectAbstract {
|
| 30 | 29 |
|
| 31 | 30 |
private static final long serialVersionUID = 1L;
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.services.dto.referential.seine; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.services.dto.reference.ReferentialReference;
|
| 26 |
+import java.util.Collection;
|
|
| 26 | 27 |
import java.util.List;
|
| 27 | 28 |
import java.util.Set;
|
| 28 | 29 |
import java.util.function.Predicate;
|
| ... | ... | @@ -39,7 +40,7 @@ public class WeightCategoryHelper extends GeneratedWeightCategoryHelper { |
| 39 | 40 |
* @param speciesId l'identifiant de l'espèce
|
| 40 | 41 |
* @return la liste de toutes les catégories de poids de l'espèce
|
| 41 | 42 |
*/
|
| 42 |
- public static List<ReferentialReference<WeightCategoryDto>> filterSpeciesWeightCategories(Set<ReferentialReference<WeightCategoryDto>> weightCategoryReferences, String speciesId) {
|
|
| 43 |
+ public static List<ReferentialReference<WeightCategoryDto>> filterSpeciesWeightCategories(Collection<ReferentialReference<WeightCategoryDto>> weightCategoryReferences, String speciesId) {
|
|
| 43 | 44 |
|
| 44 | 45 |
List<ReferentialReference<WeightCategoryDto>> references = weightCategoryReferences.stream().filter(new WeightCategorySpeciesPredicate(speciesId)).collect(Collectors.toList());
|
| 45 | 46 |
|
| 1 |
-package fr.ird.observe.services.dto.seine;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe :: Services
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, 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 java.util.Date;
|
|
| 26 |
-import org.nuiton.util.DateUtil;
|
|
| 27 |
- |
|
| 28 |
-public class NonTargetCatchReleaseDto extends GeneratedNonTargetCatchReleaseDto {
|
|
| 29 |
- |
|
| 30 |
- private static final long serialVersionUID = 1L;
|
|
| 31 |
- |
|
| 32 |
- @Override
|
|
| 33 |
- public void setDetectionTime(Date detectionTime) {
|
|
| 34 |
- super.setDetectionTime(detectionTime == null ? null : DateUtil.getTime(detectionTime, false, false));
|
|
| 35 |
- }
|
|
| 36 |
- |
|
| 37 |
- @Override
|
|
| 38 |
- public void setReleaseTime(Date releaseTime) {
|
|
| 39 |
- super.setReleaseTime(releaseTime == null ? null : DateUtil.getTime(releaseTime, false, false));
|
|
| 40 |
- }
|
|
| 41 |
-}
|