Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- 7199 discussions
[Git][ultreiaio/ird-observe][develop] 2 commits: Détail ergonomique sur l'arbre - Closes #1723
by Tony CHEMIT 04 Jan '21
by Tony CHEMIT 04 Jan '21
04 Jan '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
342a2670 by Tony Chemit at 2021-01-04T11:21:21+01:00
Détail ergonomique sur l'arbre - Closes #1723
- - - - -
18699c34 by Tony Chemit at 2021-01-04T11:21:21+01:00
Les marées sont mal classées dans la fenêtre de droite - Closes #1726
- - - - -
10 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTree.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeSelectionListenerImpl.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeShowPopupHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationUIInitializer.java
- models/dto/src/main/java/fr/ird/observe/dto/data/ll/common/TripDto.java
- models/dto/src/main/java/fr/ird/observe/dto/data/ps/common/TripDto.java
- models/dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java
- toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/I18nDecoratorHelper.java
- toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/DataReferenceDecorator.java
- toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObserveDecorator.java
Changes:
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTree.java
=====================================
@@ -32,6 +32,7 @@ import org.jdesktop.swingx.JXTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import java.util.Arrays;
/**
* Created on 14/11/16.
@@ -77,7 +78,7 @@ public class NavigationTree extends JXTree {
* @param node the node to select
*/
public void selectSafeNode(TreeNode node) {
- log.info("try to select node [" + node + "]");
+ log.info(String.format("try to select safe node [%s]", node));
TreePath path = new TreePath(getModel().getPathToRoot(node));
getSelectionModel().setSkipCheckPreviousContent(true);
try {
@@ -89,7 +90,7 @@ public class NavigationTree extends JXTree {
}
public void reSelectSafeNode(TreeNode node) {
- log.info("try to select node [" + node + "]");
+ log.info(String.format("try to reselect safe node [%s]", node));
TreePath path = new TreePath(getModel().getPathToRoot(node));
getSelectionModel().clearSelection();
getSelectionModel().setSkipCheckPreviousContent(true);
@@ -101,6 +102,14 @@ public class NavigationTree extends JXTree {
SwingUtilities.invokeLater(() -> scrollPathToVisible(path));
}
+ public boolean isRowSelected(int requiredRow) {
+ int[] selectedRows = getSelectionRows();
+ if (selectedRows != null) {
+ return Arrays.stream(selectedRows).anyMatch(selectedRow -> requiredRow == selectedRow);
+ }
+ return false;
+ }
+
/**
* Selects the given {@code node} in the registered tree.
*
@@ -111,7 +120,7 @@ public class NavigationTree extends JXTree {
log.error("Can't load null node.", new NullPointerException());
return;
}
- log.info("try to select node [" + node + "]");
+ log.info(String.format("try to select node [%s]", node));
TreePath path = new TreePath(getModel().getPathToRoot(node));
setSelectionPath(path);
SwingUtilities.invokeLater(() -> scrollPathToVisible(path));
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeSelectionListenerImpl.java
=====================================
@@ -34,16 +34,21 @@ import fr.ird.observe.dto.ObserveUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import javax.swing.SwingUtilities;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreePath;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
import java.util.Objects;
import static io.ultreia.java4all.i18n.I18n.t;
-class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datasource.editor.api.navigation.event.NavigationTreeSelectionListener, TreeSelectionListener {
+class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datasource.editor.api.navigation.event.NavigationTreeSelectionListener, TreeSelectionListener, MouseListener {
private static final Logger log = LogManager.getLogger(NavigationTreeSelectionListenerImpl.class);
private final ClientUIContext clientUIContext;
@@ -51,6 +56,7 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas
private final NavigationUI ui;
private final DataSourceEditorModel dataSourceEditorModel;
private final NavigationTree tree;
+ private int rowToSelect;
NavigationTreeSelectionListenerImpl(DataSourceEditorModel dataSourceEditorModel, ContentUIManager contentUIManager, NavigationUI ui, NavigationTree tree) {
this.dataSourceEditorModel = Objects.requireNonNull(dataSourceEditorModel);
@@ -160,4 +166,108 @@ class NavigationTreeSelectionListenerImpl implements fr.ird.observe.client.datas
ObserveUtil.cleanMemory();
}
+
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (!tree.isEnabled()) {
+ return;
+ }
+ if (e.isConsumed()) {
+ return;
+ }
+ boolean rightClick = SwingUtilities.isRightMouseButton(e);
+
+ boolean doubleClick = e.getClickCount() == 2;
+ // get the coordinates of the mouse click
+ Point p = e.getPoint();
+
+ int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY());
+
+ log.info(String.format("Click on navigation tree: (rightClick? %b, doubleClick? %b) - at row %s (point %s)", rightClick, doubleClick, closestRowForLocation, p));
+
+ if (e.getClickCount() == 1) {
+ // need to compute row to select
+ rowToSelect = -1;
+ if (tree.isRowSelected(closestRowForLocation)) {
+ rowToSelect = closestRowForLocation;
+ } else {
+
+ // try to change selection
+
+ TreePath pathForRow = tree.getPathForRow(closestRowForLocation);
+ if (pathForRow == null) {
+ e.consume();
+ return;
+ }
+ Rectangle pathBounds = tree.getPathBounds(pathForRow);
+ if (pathBounds != null && pathBounds.getX() > p.getX()) {
+ // we never acts when point is before the rectangle, because the arrow button may be used for this...
+ log.info("Cancel click on tree navigation (before path rectangle (probably on arrow button)");
+ e.consume();
+ return;
+ }
+ log.info(String.format("Do select row: %d", closestRowForLocation));
+ tree.setSelectionPath(pathForRow);
+
+ if (tree.isRowSelected(closestRowForLocation)) {
+ rowToSelect = closestRowForLocation;
+ }
+ }
+ } else {
+
+ // re-use previous rowToSelect
+ if (rowToSelect == -1) {
+ log.info("Cancel double-click, no previous rowToSelect");
+ e.consume();
+ return;
+ }
+ }
+
+ if (rowToSelect == -1) {
+ e.consume();
+ return;
+ }
+
+ // Never apply double click, go instable behaviour with existing code
+// if (doubleClick) {
+// TreePath pathForRow = tree.getPathForRow(rowToSelect);
+// Rectangle pathBounds = tree.getPathBounds(pathForRow);
+// if (pathBounds != null && pathBounds.getX() < p.getX() && !pathBounds.contains(p)) {
+// // when after the rectangle of the path, then do the collapse/expand action (tree does not manage this cas)
+// // we never acts when point is before the rectangle, because the arrow button may be used for this...
+// boolean expanded = tree.isExpanded(pathForRow);
+// SwingUtilities.invokeLater(() -> {
+// if (expanded) {
+// log.info(String.format("do collapse row: %s", pathBounds));
+// tree.collapsePath(pathForRow);
+// } else {
+// log.info(String.format("do expand row: %s", pathBounds));
+// tree.expandPath(pathForRow);
+// }
+// });
+// e.consume();
+// }
+// }
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ // do nothing
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ // do nothing
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ // do nothing
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ // do nothing
+ }
}
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeShowPopupHandler.java
=====================================
@@ -33,7 +33,6 @@ import javax.swing.AbstractButton;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
-import javax.swing.tree.TreePath;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
@@ -68,11 +67,11 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene
private void showPopup(int row, Point p) {
- log.info("Will show popup from row: " + row);
+ log.info(String.format("Will show popup from row: %d", row));
NavigationNode selectedNode = tree.getNodeForRow(row);
- log.info("Found selected node: " + selectedNode);
+ log.info(String.format("Found selected node: %s", selectedNode));
SwingUtilities.invokeLater(() -> {
beforeOpenPopup(selectedNode);
@@ -97,7 +96,6 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene
Arrays.stream(selectedContentUI.getInsertPopup().getSubElements()).forEach(a -> new ContentUIMenuAction(popup, (AbstractButton) a).init());
if (popup.getSubElements().length > length) {
popup.addSeparator();
-// length = popup.getSubElements().length;
}
Arrays.stream(selectedContentUI.getConfigurePopup().getSubElements()).forEach(a -> new ContentUIMenuAction(popup, (AbstractButton) a).init());
length = popup.getSubElements().length;
@@ -106,22 +104,6 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene
}
}
- private boolean isRowSelected(int requiredRow) {
- boolean result = false;
- int[] selectedRows = tree.getSelectionRows();
- if (selectedRows != null) {
- for (int selectedRow : selectedRows) {
- if (requiredRow == selectedRow) {
-
- // match
- result = true;
- break;
- }
- }
- }
- return result;
- }
-
private int getLowestSelectedRowCount() {
if (tree.isSelectionEmpty()) {
throw new IllegalStateException("Can't have empty selection");
@@ -141,24 +123,18 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene
if (!tree.isEnabled()) {
return;
}
-
+ if (e.isConsumed()) {
+ return;
+ }
if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU && !tree.isSelectionEmpty()) {
-
// get the lowest selected row
int lowestRow = getLowestSelectedRowCount();
-
// get the selected column
Rectangle r = tree.getRowBounds(lowestRow);
-
// get the point in the middle lower of the cell
Point p = new Point(r.x + r.width / 2, r.y + r.height);
-
- if (log.isDebugEnabled()) {
- log.debug("Row " + lowestRow + " found t point [" + p + "]");
- }
-
+ log.debug(String.format("Row %d found t point [%s]", lowestRow, p));
showPopup(lowestRow, p);
-
}
}
@@ -167,60 +143,33 @@ public class NavigationTreeShowPopupHandler implements KeyListener, MouseListene
if (!tree.isEnabled()) {
return;
}
-
+ if (e.isConsumed()) {
+ return;
+ }
boolean rightClick = SwingUtilities.isRightMouseButton(e);
-
+ if (!rightClick) {
+ return;
+ }
+ boolean doubleClick = e.getClickCount() == 2;
+ if (doubleClick) {
+ return;
+ }
// get the coordinates of the mouse click
Point p = e.getPoint();
-
int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY());
+ log.info(String.format("Point of click: (rightClick? %b, doubleClick? %b) - at row %s (point %s)", true, false, closestRowForLocation, p));
int rowToSelect = -1;
- if (isRowSelected(closestRowForLocation)) {
-
+ if (tree.isRowSelected(closestRowForLocation)) {
rowToSelect = closestRowForLocation;
}
- if (rowToSelect == -1) {
-
- // try to change selection
-
- TreePath pathForRow = tree.getPathForRow(closestRowForLocation);
- if (pathForRow == null) {
- e.consume();
- return;
- }
- tree.setSelectionPath(pathForRow);
-
- if (isRowSelected(closestRowForLocation)) {
- rowToSelect = closestRowForLocation;
- }
-
- } else {
- TreePath pathForRow = tree.getPathForRow(rowToSelect);
-
- Rectangle pathBounds = tree.getPathBounds(pathForRow);
- if (e.getClickCount() == 2 && pathBounds != null && !pathBounds.contains(e.getPoint())) {
- SwingUtilities.invokeLater(() -> {
- if (tree.isExpanded(pathForRow)) {
- tree.collapsePath(pathForRow);
- } else {
- tree.expandPath(pathForRow);
- }
- });
- e.consume();
- return;
- }
-
- }
if (rowToSelect == -1) {
return;
}
-
- if (rightClick) {
- showPopup(rowToSelect, p);
- }
+ showPopup(rowToSelect, p);
+ e.consume();
}
@Override
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationUIInitializer.java
=====================================
@@ -123,5 +123,6 @@ class NavigationUIInitializer extends UIInitializerSupport<NavigationUI, UIIniti
editor.addNavigationTreeSelectionListener(selectionListener);
editor.addTreeWillExpandListener(selectionListener);
editor.addTreeSelectionListener(selectionListener);
+ editor.addMouseListener(selectionListener);
}
}
=====================================
models/dto/src/main/java/fr/ird/observe/dto/data/ll/common/TripDto.java
=====================================
@@ -22,7 +22,6 @@ package fr.ird.observe.dto.data.ll.common;
* #L%
*/
-import fr.ird.observe.dto.decoration.I18nDecoratorHelper;
import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
import org.nuiton.util.DateUtil;
@@ -47,11 +46,6 @@ public class TripDto extends GeneratedTripDto {
setNoOfDays(TripDto.createNoOfDay(startDate, endDate));
}
- @Override
- public String getStartEndDateLabel() {
- return I18nDecoratorHelper.getStartEndDateLabel(getStartDate(), getEndDate());
- }
-
@Override
public void setStartDate(Date startDate) {
super.setStartDate(startDate == null ? null : DateUtil.getDay(startDate));
=====================================
models/dto/src/main/java/fr/ird/observe/dto/data/ps/common/TripDto.java
=====================================
@@ -55,6 +55,6 @@ public class TripDto extends GeneratedTripDto {
boolean oldValue = isRouteEmpty();
super.setRoute(route);
//FIXME:Dto should be generated by dto template
- firePropertyChange("routeEmpty",oldValue, isRouteEmpty());
+ firePropertyChange("routeEmpty", oldValue, isRouteEmpty());
}
}
=====================================
models/dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java
=====================================
@@ -147,6 +147,15 @@ public class ObserveI18nLabelsBuilder extends BeanPropertyI18nKeyProducerSupport
.build();
}
+ @Override
+ public String getI18nPropertyKey(Class type, String property) {
+ int i = property.indexOf("::");
+ if (i>-1) {
+ property = property.substring(0, i);
+ }
+ return super.getI18nPropertyKey(type, property);
+ }
+
@Override
protected Map<String, String> createMapping() {
String idDtoPrefix = "Id.";
=====================================
toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/I18nDecoratorHelper.java
=====================================
@@ -25,6 +25,8 @@ package fr.ird.observe.dto.decoration;
import io.ultreia.java4all.i18n.I18n;
import io.ultreia.java4all.i18n.spi.bean.BeanPropertyI18nKeyProducerProvider;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -100,6 +102,13 @@ public abstract class I18nDecoratorHelper extends BeanPropertyI18nKeyProducerPro
public static String getDateLabel(Date date) {
return String.format("%1$td/%1$tm/%1$tY", date);
}
+ public static Date getDate(String date) {
+ try {
+ return new SimpleDateFormat("dd/MM:yy").parse( date);
+ } catch (ParseException e) {
+ return null;
+ }
+ }
public static String getTimestampLabel(Date date) {
return String.format("%1$td/%1$tm/%1$tY %1$tH:%1$tM", date);
=====================================
toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/DataReferenceDecorator.java
=====================================
@@ -23,7 +23,6 @@ package fr.ird.observe.dto.decoration.decorators;
*/
-import fr.ird.observe.dto.WithStartEndDate;
import fr.ird.observe.dto.decoration.I18nDecoratorHelper;
import fr.ird.observe.dto.reference.DataDtoReference;
import fr.ird.observe.dto.reference.DtoReference;
@@ -51,13 +50,15 @@ public class DataReferenceDecorator<R extends DataDtoReference> extends ObserveD
return (Comparable) I18nDecoratorHelper.getDateLabel((Date) value2);
}
return value2;
- }if (token.endsWith(FORMATTER_TIME)) {
+ }
+ if (token.endsWith(FORMATTER_TIME)) {
Comparable value2 = getTokenValue(jxcontext, token.substring(0, token.length() - FORMATTER_TIME.length()));
if (value2 != null && Date.class.isAssignableFrom(value2.getClass())) {
return (Comparable) I18nDecoratorHelper.getTimeLabel((Date) value2);
}
return value2;
- }if (token.endsWith(FORMATTER_TIMESTAMP)) {
+ }
+ if (token.endsWith(FORMATTER_TIMESTAMP)) {
Comparable value2 = getTokenValue(jxcontext, token.substring(0, token.length() - FORMATTER_TIMESTAMP.length()));
if (value2 != null && Date.class.isAssignableFrom(value2.getClass())) {
return (Comparable) I18nDecoratorHelper.getTimestampLabel((Date) value2);
@@ -66,27 +67,17 @@ public class DataReferenceDecorator<R extends DataDtoReference> extends ObserveD
}
// assume all values are comparable
Comparable<Comparable<?>> value;
-
Object contextBean = jxcontext.getContextBean();
-
if (contextBean instanceof DtoReference) {
-
String[] tokens = token.split("/");
-
value = getValueFromReference(tokens, (DtoReference) contextBean, 0);
-
if (value == null) {
value = (Comparable<Comparable<?>>) getDefaultNullValue(tokens[0]);
}
-
} else {
value = super.getTokenValue(jxcontext, token);
}
- if (token.equals(WithStartEndDate.PROPERTY_START_END_DATE_LABEL)) {
- value = super.getTokenValue(jxcontext, token);
- }
return value;
-
}
@Override
@@ -94,4 +85,4 @@ public class DataReferenceDecorator<R extends DataDtoReference> extends ObserveD
String result = super.toString(bean);
return result == null ? null : result.trim();
}
-}
+}
\ No newline at end of file
=====================================
toolkit/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/ObserveDecorator.java
=====================================
@@ -52,11 +52,46 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon
private static final Logger log = LogManager.getLogger(ObserveDecorator.class);
public ObserveDecorator(Class<E> internalClass, String expression) {
- super(internalClass, expression, DEFAULT_SEPARATOR, DEFAULT_SEPARATOR_REPLACEMENT);
+ this(internalClass, expression, DEFAULT_SEPARATOR_REPLACEMENT);
}
public ObserveDecorator(Class<E> internalClass, String expression, String separator) {
super(internalClass, expression, DEFAULT_SEPARATOR, separator);
+ if (getNbToken() == 0) {
+ return;
+ }
+ int nbContext = getNbContext();
+ for (int i = 0; i < nbContext; i++) {
+ Context<E> context = contexts[i];
+ String token = context.getFirstProperty();
+ if (token.endsWith("::date") || token.endsWith("::time")) {
+ context.setComparator((o1, o2) -> {
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ String s1 = o1.toString();
+ String s2 = o2.toString();
+ Date d1 = I18nDecoratorHelper.getDate(s1);
+ Date d2 = I18nDecoratorHelper.getDate(s2);
+ if (d1 == null && d2 == null) {
+ return 0;
+ }
+ if (d1 == null) {
+ return -1;
+ }
+ if (d2 == null) {
+ return 1;
+ }
+ return d1.compareTo(d2);
+ });
+ }
+ }
}
@Override
@@ -73,13 +108,15 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon
return (Comparable) I18nDecoratorHelper.getDateLabel((Date) value2);
}
return value2;
- }if (token.endsWith(FORMATTER_TIME)) {
+ }
+ if (token.endsWith(FORMATTER_TIME)) {
Comparable value2 = getTokenValue(jxcontext, token.substring(0, token.length() - FORMATTER_TIME.length()));
if (value2 != null && Date.class.isAssignableFrom(value2.getClass())) {
return (Comparable) I18nDecoratorHelper.getTimeLabel((Date) value2);
}
return value2;
- }if (token.endsWith(FORMATTER_TIMESTAMP)) {
+ }
+ if (token.endsWith(FORMATTER_TIMESTAMP)) {
Comparable value2 = getTokenValue(jxcontext, token.substring(0, token.length() - FORMATTER_TIMESTAMP.length()));
if (value2 != null && Date.class.isAssignableFrom(value2.getClass())) {
return (Comparable) I18nDecoratorHelper.getTimestampLabel((Date) value2);
@@ -89,58 +126,39 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon
// assume all values are comparable
Comparable<Comparable<?>> value;
try {
-
String[] tokens = token.split("/");
-
Object value0 = jxcontext.getValue(tokens[0]);
-
if (value0 instanceof DtoReference) {
-
value = getValueFromReference(tokens, (DtoReference) value0, 1);
-
} else {
-
value = (Comparable<Comparable<?>>) jxcontext.getValue(token);
}
-
if (value == null) {
value = (Comparable<Comparable<?>>) getDefaultNullValue(token);
}
-
} catch (Exception e) {
value = (Comparable<Comparable<?>>) getDefaultUndefinedValue(token);
}
-
return value;
}
protected Comparable<Comparable<?>> getValueFromReference(String[] tokens, DtoReference referenceBean, int startIndex) {
-
for (int i = startIndex, max = tokens.length - 1; i < max; i++) {
-
if (referenceBean.getPropertyNames().contains(tokens[i])) {
-
Serializable propertyValue = referenceBean.getPropertyValue(tokens[i]);
-
if (!(propertyValue instanceof DtoReference)) {
-
return (Comparable<Comparable<?>>) getDefaultUndefinedValue(StringUtils.join(tokens, "/"));
-
}
-
referenceBean = (DtoReference) propertyValue;
}
}
-
- Comparable<Comparable<?>> value = null;
-
+ Comparable<Comparable<?>> value;
String lastToken = tokens[tokens.length - 1];
if (referenceBean.getPropertyNames().contains(lastToken)) {
value = referenceBean.getPropertyValue(lastToken);
} else {
value = referenceBean.get(lastToken);
}
-
return value;
}
@@ -157,6 +175,4 @@ public class ObserveDecorator<E> extends MultiJXPathDecorator<E> implements Clon
}
return t("observe.common.none");
}
-
-
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/964a7953db1d31bda68fe9d8…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/964a7953db1d31bda68fe9d8…
You're receiving this email because of your account on gitlab.com.
1
0
04 Jan '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
b9fda780 by Tony Chemit at 2021-01-03T22:58:13+01:00
remove unused methods
- - - - -
bb74c8a1 by Tony Chemit at 2021-01-03T22:58:40+01:00
Introduce new strong dto types
- - - - -
fb9261c4 by Tony Chemit at 2021-01-03T22:59:17+01:00
Fix how to get references from spi (always use reference type of it instead of the one of the entity)
- - - - -
a6d69783 by Tony Chemit at 2021-01-03T22:59:45+01:00
Update pom (last topia-extension stable)
- - - - -
bd980cc8 by Tony Chemit at 2021-01-03T23:00:18+01:00
be able to generate generated dto classes if object marked as skip
- - - - -
a37a0393 by Tony Chemit at 2021-01-03T23:00:50+01:00
Do not set back data reference collections to entity
- - - - -
14fe62cc by Tony Chemit at 2021-01-03T23:05:16+01:00
LL Fix not-null constraint Sample.trip (can be null if sample is attached to activity)
- - - - -
e77aed08 by Tony Chemit at 2021-01-03T23:12:22+01:00
Introduce ActivitySampleDto and then remove all hacks around it.
- - - - -
d0271c59 by Tony Chemit at 2021-01-03T23:14:17+01:00
Remove bean from constructo in cotentTableUIModel
- - - - -
feda57f7 by Tony Chemit at 2021-01-03T23:16:24+01:00
Introduce models-dto-definition maven module with the dto model.
- - - - -
76ca4c4f by Tony Chemit at 2021-01-03T23:17:19+01:00
Little improvements of LL dto
- - - - -
bbc06fb1 by Tony Chemit at 2021-01-03T23:17:41+01:00
remove unused method
- - - - -
a56089d6 by Tony Chemit at 2021-01-03T23:18:14+01:00
Make EditableDataServiceLocalSupport works with more than one dto from same entity ^^
- - - - -
398bd122 by Tony Chemit at 2021-01-03T23:18:47+01:00
Fix how to get references from spi (always use reference type of it instead of the one of the entity)
- - - - -
964a7953 by Tony Chemit at 2021-01-04T10:27:18+01:00
Détail ergonomique sur l'arbre - Closes #1723
- - - - -
30 changed files:
- + client/core/.mvn/models-dto
- client/core/pom.xml
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTree.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeSelectionListenerImpl.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTreeShowPopupHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationUIInitializer.java
- client/datasource/editor/ll/src/main/i18n/getters/jaxx.getter
- client/datasource/editor/ll/src/main/i18n/getters/navigation.getter
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/landing/LandingPartUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUI.jaxx
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUI.jcss
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivityUI.jaxx
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivityUI.jcss
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SamplePartUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SampleUI.jcss
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetBaitsCompositionUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetBranchlinesCompositionUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetFloatlinesCompositionUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetHooksCompositionUIModel.java
- client/datasource/editor/ll/src/main/resources/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUINavigationNode.scope
- client/datasource/editor/ll/src/test/java/fr/ird/observe/client/datasource/editor/ll/LlNavigationModelNodeTest.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/CapacityNodeType.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/ContentNodeType.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/NavigationScopeBuilder.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/edit/GenerateContentEditUINavigationScope.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/edit/GenerateContentEditUISupport.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/table/GenerateContentTableUIModel.java
- client/i18n/src/main/i18n/translations/observe_en_GB.properties
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/fcd9cf26ae5bc3bb7168e4d6…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/fcd9cf26ae5bc3bb7168e4d6…
You're receiving this email because of your account on gitlab.com.
1
0
02 Jan '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
fcd9cf26 by Tony Chemit at 2021-01-02T12:18:40+01:00
Clean reset action - See #1665
- - - - -
30 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUI.jaxx
- 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/EditableContentUI.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/open/ContentOpen.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/reset/DefaultResetAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/ResetForm.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/reset/ResetAction.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/reset/ResetExecutor.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUI.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/ContentOpenableUI.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/ContentOpenableUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUI.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUI.jcss
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/actions/SaveContentSimpleUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUI.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveContentTableUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/ContentReferentialUI.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/ContentReferentialUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/ReferentialResetAdapter.java
- 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/common/TripGearUseFeaturesUITableModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetGlobalCompositionUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/BranchlineUIHandler.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/SetCatchUITableModel.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/SetGlobalCompositionUIHandler.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/fcd9cf26ae5bc3bb7168e4d62…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/fcd9cf26ae5bc3bb7168e4d62…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Validateur needcomment récalcitrant - Closes #1714
by Tony CHEMIT 01 Jan '21
by Tony CHEMIT 01 Jan '21
01 Jan '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
dc340121 by Tony Chemit at 2021-01-01T11:14:06+01:00
Validateur needcomment récalcitrant - Closes #1714
- - - - -
18 changed files:
- client/i18n/src/main/i18n/translations/observe_en_GB.properties
- client/i18n/src/main/i18n/translations/observe_es_ES.properties
- client/i18n/src/main/i18n/translations/observe_fr_FR.properties
- models/dto/src/main/models/Observe-00-common.model
- models/dto/src/main/models/Observe-01-referential-common.model
- models/dto/src/main/models/Observe-20-data-ps-observation.model
- models/dto/src/main/models/Observe-25-data-ps.model
- models/dto/src/main/models/Observe-30-data-ll-observation.model
- models/dto/src/main/models/Observe-31-data-ll-logbook.model
- models/dto/src/main/models/Observe-32-data-ll-landing.model
- models/dto/src/main/models/Observe-35-data-ll.model
- services/i18n/src/main/i18n/translations/services_en_GB.properties
- services/i18n/src/main/i18n/translations/services_es_ES.properties
- services/i18n/src/main/i18n/translations/services_fr_FR.properties
- services/validation/src/main/i18n/getters/validation-fields.getter
- services/validation/src/main/resources/fr/ird/observe/dto/data/ll/common/TripDto-create-error-validation.xml
- services/validation/src/main/resources/fr/ird/observe/dto/data/ll/common/TripDto-update-error-validation.xml
- − toolkit/dto/src/main/java/fr/ird/observe/dto/WithComment.java
Changes:
=====================================
client/i18n/src/main/i18n/translations/observe_en_GB.properties
=====================================
@@ -374,14 +374,12 @@ observe.data.ll.common.Trip.associatedActivityCount=Number of activities matched
observe.data.ll.common.Trip.associatedFishingOperationCount=Number of fishing operations matched
observe.data.ll.common.Trip.availableData=Available data
observe.data.ll.common.Trip.ersId=Id ERS
-observe.data.ll.common.Trip.generalComment=Comment
observe.data.ll.common.Trip.generalTab=Common characteristics
observe.data.ll.common.Trip.list.message.none=No trip for current program
observe.data.ll.common.Trip.list.navigation.node=Trip
observe.data.ll.common.Trip.list.title=List of trips
observe.data.ll.common.Trip.logbookActivityCount=Number of activities
observe.data.ll.common.Trip.logbookAvailability=Logbook and associated data
-observe.data.ll.common.Trip.logbookComment=Comment
observe.data.ll.common.Trip.logbookFishingOperationCount=Number of fishing operations
observe.data.ll.common.Trip.logbookTab=Logbook and associated data
observe.data.ll.common.Trip.mapTab=Map
@@ -391,7 +389,6 @@ observe.data.ll.common.Trip.noOfCrewMembers=Number of crew
observe.data.ll.common.Trip.noOfDays=Duration (days)
observe.data.ll.common.Trip.observationsActivityCount=Number of activities
observe.data.ll.common.Trip.observationsAvailability=Observations
-observe.data.ll.common.Trip.observationsComment=Comment
observe.data.ll.common.Trip.observationsFishingOperationCount=Number of fishing operations
observe.data.ll.common.Trip.observationsTab=Observations
observe.data.ll.common.Trip.species=Target species
=====================================
client/i18n/src/main/i18n/translations/observe_es_ES.properties
=====================================
@@ -374,14 +374,12 @@ observe.data.ll.common.Trip.associatedActivityCount=Número de actividades coinc
observe.data.ll.common.Trip.associatedFishingOperationCount=Número de operaciones de pesca coincidentes
observe.data.ll.common.Trip.availableData=Données disponibles
observe.data.ll.common.Trip.ersId=Id ERS
-observe.data.ll.common.Trip.generalComment=Comentarios
observe.data.ll.common.Trip.generalTab=General características
observe.data.ll.common.Trip.list.message.none=Ninguna marea para el programa actual
observe.data.ll.common.Trip.list.navigation.node=Marea
observe.data.ll.common.Trip.list.title=List of trips
observe.data.ll.common.Trip.logbookActivityCount=Número de actividades
observe.data.ll.common.Trip.logbookAvailability=Diario de pesca y datos asociados
-observe.data.ll.common.Trip.logbookComment=Comentarios
observe.data.ll.common.Trip.logbookFishingOperationCount=Número de operaciones de pesca
observe.data.ll.common.Trip.logbookTab=Diario de pesca y datos asociados
observe.data.ll.common.Trip.mapTab=Mapa
@@ -391,7 +389,6 @@ observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage
observe.data.ll.common.Trip.noOfDays=Duración (días)
observe.data.ll.common.Trip.observationsActivityCount=Número de actividades
observe.data.ll.common.Trip.observationsAvailability=Observaciones
-observe.data.ll.common.Trip.observationsComment=Comentarios
observe.data.ll.common.Trip.observationsFishingOperationCount=Número de operaciones de pesca
observe.data.ll.common.Trip.observationsTab=Observaciones
observe.data.ll.common.Trip.species=Especie objetivo
=====================================
client/i18n/src/main/i18n/translations/observe_fr_FR.properties
=====================================
@@ -374,14 +374,12 @@ observe.data.ll.common.Trip.associatedActivityCount=Nombres d'activités associ
observe.data.ll.common.Trip.associatedFishingOperationCount=Nombre d'opérations de pêche associées
observe.data.ll.common.Trip.availableData=Données disponibles
observe.data.ll.common.Trip.ersId=Id ERS
-observe.data.ll.common.Trip.generalComment=Commentaire
observe.data.ll.common.Trip.generalTab=Caractéristiques communes
observe.data.ll.common.Trip.list.message.none=Aucune marée pour le programme courant
observe.data.ll.common.Trip.list.navigation.node=Marée
observe.data.ll.common.Trip.list.title=Liste de marées
observe.data.ll.common.Trip.logbookActivityCount=Nombres d'activités
observe.data.ll.common.Trip.logbookAvailability=Livre de bord et données associées
-observe.data.ll.common.Trip.logbookComment=Commentaire
observe.data.ll.common.Trip.logbookFishingOperationCount=Nombre d'opérations de pêche
observe.data.ll.common.Trip.logbookTab=Livre de bord et données associées
observe.data.ll.common.Trip.mapTab=Carte
@@ -391,7 +389,6 @@ observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage
observe.data.ll.common.Trip.noOfDays=Durée (jours)
observe.data.ll.common.Trip.observationsActivityCount=Nombres d'activités
observe.data.ll.common.Trip.observationsAvailability=Données d'observation
-observe.data.ll.common.Trip.observationsComment=Commentaire
observe.data.ll.common.Trip.observationsFishingOperationCount=Nombre d'opérations de pêche
observe.data.ll.common.Trip.observationsTab=Données d'observation
observe.data.ll.common.Trip.species=Espèces ciblées
=====================================
models/dto/src/main/models/Observe-00-common.model
=====================================
@@ -25,10 +25,6 @@ interface data.ActivityAware > DtoAndReferenceAware
interface DtoParentAware > DtoAndReferenceAware
-interface WithComment
-getComment() String
-setComment(comment String)
-
interface reference.DataReference > fr.ird.observe.dto.ObserveDto
interface reference.ReferentialReference > fr.ird.observe.dto.ObserveDto
@@ -40,14 +36,13 @@ lastUpdateDate + {*:1} Date
abstract data.Data > Id | skip
homeId + {*:1} String
-abstract data.Commentable > data.Data >> WithComment
-comment + {*:1} String
-
-abstract data.Openable > data.Commentable
+abstract data.Openable > data.Data
-abstract data.Editable > data.Commentable
+abstract data.Editable > data.Data
+comment + {*:1} String
-abstract data.Simple > data.Commentable
+abstract data.Simple > data.Data
+comment + {*:1} String
data.DataFile >> ObserveDto | skip
content + {*:1} !byte[]
=====================================
models/dto/src/main/models/Observe-01-referential-common.model
=====================================
@@ -94,7 +94,7 @@ dataEntryOperator + {*:1} boolean
dataSource + {*:1} boolean
country {*:0..1} fr.ird.observe.dto.referential.common.CountryReference | notNull
-referential.common.Program > referential.I18nReferential >> WithComment WithStartEndDate | references=code,label,uri,gearType,gearTypePrefix,tripCount,startDate,endDate NavigationEntryPoint
+referential.common.Program > referential.I18nReferential >> WithStartEndDate | references=code,label,uri,gearType,gearTypePrefix,tripCount,startDate,endDate NavigationEntryPoint
nonTargetObservation + {*:1} int
targetDiscardsObservation + {*:1} int
samplesObservation + {*:1} int
=====================================
models/dto/src/main/models/Observe-20-data-ps-observation.model
=====================================
@@ -3,6 +3,7 @@ package fr.ird.observe.dto.data.ps.observation | form=self packagePriority=20
interface data.ps.observation.TargetSampleAware
data.ps.observation.Activity > data.Openable >> data.ActivityAware | references=time,latitude,longitude,vesselActivity,set comparator=time navigationParent=data.ps.observation.Route
+comment + {*:1} String
time + {*:1} Date | notNull
latitude + {*:1} Float | notNull
longitude + {*:1} Float | notNull
@@ -56,7 +57,8 @@ objectMaterial {*:1} fr.ird.observe.dto.referential.ps.common.ObjectMaterialRefe
data.ps.observation.FloatingObjectSchoolEstimate > data.Simple | form=data.ps.observation.ObjectSchoolEstimate mainDto=data.ps.observation.FloatingObject
objectSchoolEstimate {*} data.ps.observation.ObjectSchoolEstimate
-data.ps.observation.NonTargetCatch > data.Commentable | references=speciesLabel,speciesFateLabel
+data.ps.observation.NonTargetCatch > data.Data | references=speciesLabel,speciesFateLabel
+comment + {*:1} String
catchWeight + {*:1} Float | positiveNumber
catchWeightComputedSource + {*:1} !fr.ird.observe.dto.data.ps.NonTargetCatchComputedValueSource
meanWeight + {*:1} Float | positiveNumber
@@ -74,7 +76,8 @@ species {*:1} fr.ird.observe.dto.referential.common.SpeciesReference | notNull
weightMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasureMethodReference
lengthMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.LengthMeasureMethodReference
-data.ps.observation.NonTargetCatchRelease > data.Commentable | references=speciesLabel,speciesGroupReleaseModeLabel,statusLabel,conformityLabel,releasingTimeLabel,length
+data.ps.observation.NonTargetCatchRelease > data.Data | references=speciesLabel,speciesGroupReleaseModeLabel,statusLabel,conformityLabel,releasingTimeLabel,length
+comment + {*:1} String
length + {*:1} Float | positiveNumber
count + {*:1} Integer | notNull strictlyPositiveNumber
acquisitionMode + {*:1} int
@@ -119,6 +122,7 @@ species {*:1} fr.ird.observe.dto.referential.common.SpeciesReference | notNull
weightMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasureMethodReference
data.ps.observation.Route > data.Openable | references=date,comment comparator=date navigationParent=data.ps.common.Trip
+comment + {*:1} String
date + {*:1} Date | notNull
startLogValue + {*:1} Float | positiveNumber
endLogValue + {*:1} Float | positiveNumber
@@ -176,10 +180,12 @@ data.ps.observation.SetDiscardedTargetCatch > data.Simple | form=data.ps.observa
targetDiscardCatchCompositionEstimatedByObserver + {*:1} boolean
targetCatch {*} data.ps.observation.DiscardedTargetCatch | ordered
-data.ps.observation.TargetCatch > data.Commentable | references=well
+data.ps.observation.TargetCatch > data.Data | references=well
+comment + {*:1} String
well + {*:1} String
-data.ps.observation.KeptTargetCatch > data.Commentable | references=speciesLabel,well,catchWeight mainDto=data.ps.observation.TargetCatch
+data.ps.observation.KeptTargetCatch > data.Data | references=speciesLabel,well,catchWeight mainDto=data.ps.observation.TargetCatch
+comment + {*:1} String
catchWeight + {*:1} Float | notNull positiveNumber
hasSample + {*:1} boolean
well + {*:1} String
@@ -187,7 +193,8 @@ weightCategory {*:1} fr.ird.observe.dto.referential.ps.observation.WeightCategor
species {*:1} fr.ird.observe.dto.referential.common.SpeciesReference | notNull
weightMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasureMethodReference
-data.ps.observation.DiscardedTargetCatch > data.Commentable | references=speciesLabel,catchWeight mainDto=data.ps.observation.TargetCatch
+data.ps.observation.DiscardedTargetCatch > data.Data | references=speciesLabel,catchWeight mainDto=data.ps.observation.TargetCatch
+comment + {*:1} String
catchWeight + {*:1} Float | notNull positiveNumber
hasSample + {*:1} boolean
broughtOnDeck + {*:1} Boolean
@@ -229,7 +236,8 @@ discarded + {*:1} Boolean
targetLength + {*} data.ps.observation.TargetLength | ordered
availableSpeciesIds + {*} String | unique
-data.ps.observation.TransmittingBuoy > data.Commentable | references=code,comment,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel
+data.ps.observation.TransmittingBuoy > data.Data | references=code,comment,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel
+comment + {*:1} String
code + {*:1} String | mayNotNull
transmittingBuoyOwnership + {*:1} fr.ird.observe.dto.referential.ps.common.TransmittingBuoyOwnershipReference
transmittingBuoyType {*:1} fr.ird.observe.dto.referential.ps.common.TransmittingBuoyTypeReference | notNull
=====================================
models/dto/src/main/models/Observe-25-data-ps.model
=====================================
@@ -1,6 +1,7 @@
package fr.ird.observe.dto.data.ps.common | form=self packagePriority=25
-data.ps.common.GearUseFeatures > data.Commentable | references=gearLabel,number,usedInTrip
+data.ps.common.GearUseFeatures > data.Data | references=gearLabel,number,usedInTrip
+comment + {*:1} String
number + {*:1} Integer | notNull positiveNumber
usedInTrip + {*:1} Boolean
gearUseFeaturesMeasurement + {*} data.ps.common.GearUseFeaturesMeasurement | ordered
@@ -11,6 +12,7 @@ measurementValue + {*:1} String
gearCharacteristic {*:1} fr.ird.observe.dto.referential.common.GearCharacteristicReference
data.ps.common.Trip > data.Openable >> data.TripAware | references=startDate,endDate,program,routeSize,vessel,observerLabel comparator=startDate navigationParent=referential.common.Program
+comment + {*:1} String
startDate + {*:1} Date | notNull
endDate + {*:1} Date | notNull
checkLevel + {*:1} int
=====================================
models/dto/src/main/models/Observe-30-data-ll-observation.model
=====================================
@@ -4,7 +4,8 @@ interface data.ll.observation.LonglineElementAware > DtoParentAware
interface data.ll.observation.LonglinePositionAware
-abstract data.ll.observation.LonglinePosition > data.Commentable >> data.ll.observation.LonglinePositionAware
+abstract data.ll.observation.LonglinePosition > data.Data >> data.ll.observation.LonglinePositionAware
+comment + {*:1} String
section {*:0..1} fr.ird.observe.dto.data.ll.observation.SectionReference
basket {*:0..1} fr.ird.observe.dto.data.ll.observation.BasketReference
branchline {*:0..1} fr.ird.observe.dto.data.ll.observation.BranchlineReference
@@ -17,6 +18,7 @@ baskets {*:*} fr.ird.observe.dto.data.ll.observation.BasketReference
branchlines {*:*} fr.ird.observe.dto.data.ll.observation.BranchlineReference
data.ll.observation.Activity > data.Openable >> data.ActivityAware | references=timeStamp,latitude,longitude,vesselActivity,set comparator=timeStamp navigationParent=data.ll.common.Trip
+comment + {*:1} String
timeStamp + {*:1} Date
latitude + {*:1} Float | notNull
longitude + {*:1} Float | notNull
=====================================
models/dto/src/main/models/Observe-31-data-ll-logbook.model
=====================================
@@ -14,6 +14,7 @@ weightMeasureType {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasureTy
weightMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasureMethodReference
data.ll.logbook.Sample > data.Openable | references=timeStamp,latitude,longitude comparator=timeStamp EditableService=ActivitySampleService navigationParent=data.ll.common.Trip navigationExtraParent=data.ll.logbook.Activity
+comment + {*:1} String
timeStamp + {*:1} Date | notNull
latitude + {*:1} Float
longitude + {*:1} Float
@@ -21,6 +22,7 @@ quadrant + {*:1} Integer
samplePart + {*} fr.ird.observe.dto.data.ll.logbook.SamplePartDto | ordered
data.ll.logbook.Activity > data.Openable >> data.ActivityAware | references=startTimeStamp,endTimeStamp,latitude,longitude,vesselActivity,set,sample,relatedObservedActivity comparator=startTimeStamp navigationParent=data.ll.common.Trip
+comment + {*:1} String
startTimeStamp + {*:1} Date | notNull
endTimeStamp + {*:1} Date | mayNotNull
latitude + {*:1} Float | mayNotNull
@@ -128,7 +130,8 @@ hookOffset + {*:1} Integer | positiveNumber
hookType {*:1} fr.ird.observe.dto.referential.ll.common.HookTypeReference | notNull
hookSize {*:1} fr.ird.observe.dto.referential.ll.common.HookSizeReference
-data.ll.logbook.Catch > data.Commentable | references=homeId
+data.ll.logbook.Catch > data.Data | references=homeId
+comment + {*:1} String
count + {*:1} Integer | positiveNumber
totalWeight + {*:1} Float | positiveNumber
hookWhenDiscarded + {*:1} Boolean
=====================================
models/dto/src/main/models/Observe-32-data-ll-landing.model
=====================================
@@ -12,6 +12,7 @@ weightMeasureMethod {*:0..1} fr.ird.observe.dto.referential.common.WeightMeasure
dataQuality {*:0..1} fr.ird.observe.dto.referential.common.DataQualityReference
data.ll.landing.Landing > data.Openable | references=startDate,harbourLabel,vesselLabel comparator=startDate navigationParent=data.ll.common.Trip
+comment + {*:1} String
startDate + {*:1} Date
endDate + {*:1} Date
dataSource {*:1} fr.ird.observe.dto.referential.ll.landing.DataSourceReference
=====================================
models/dto/src/main/models/Observe-35-data-ll.model
=====================================
@@ -1,6 +1,7 @@
package fr.ird.observe.dto.data.ll.common | form=self packagePriority=35
-data.ll.common.GearUseFeatures > data.Commentable | references=gearLabel,number,usedInTrip
+data.ll.common.GearUseFeatures > data.Data | references=gearLabel,number,usedInTrip
+comment + {*:1} String
number + {*:1} Integer | notNull positiveNumber
usedInTrip + {*:1} Boolean
gearUseFeaturesMeasurement + {*} data.ll.common.GearUseFeaturesMeasurement | ordered
=====================================
services/i18n/src/main/i18n/translations/services_en_GB.properties
=====================================
@@ -174,9 +174,12 @@ observe.data.ll.common.GearUseFeatures.type=Gear uses features
observe.data.ll.common.GearUseFeaturesMeasurement.gearCharacteristic=Gear caracteristic
observe.data.ll.common.GearUseFeaturesMeasurement.type=Measurement type
observe.data.ll.common.Trip.activityObs=Activity
+observe.data.ll.common.Trip.generalComment=General comment
+observe.data.ll.common.Trip.logbookComment=Logbook comment
observe.data.ll.common.Trip.logbookDataEntryOperator=Data entry operator
observe.data.ll.common.Trip.logbookDataQuality=Data quality
observe.data.ll.common.Trip.observationMethod=Observations method
+observe.data.ll.common.Trip.observationsComment=Observations comment
observe.data.ll.common.Trip.observationsDataEntryOperator=Data entry operator
observe.data.ll.common.Trip.observationsDataQuality=Data quality
observe.data.ll.common.Trip.tripType=Trip type
=====================================
services/i18n/src/main/i18n/translations/services_es_ES.properties
=====================================
@@ -174,9 +174,12 @@ observe.data.ll.common.GearUseFeatures.type=Equipamiento
observe.data.ll.common.GearUseFeaturesMeasurement.gearCharacteristic=Característica
observe.data.ll.common.GearUseFeaturesMeasurement.type=Tipo
observe.data.ll.common.Trip.activityObs=Actividad
+observe.data.ll.common.Trip.generalComment=General Comentarios
+observe.data.ll.common.Trip.logbookComment=Logbook Comentarios
observe.data.ll.common.Trip.logbookDataEntryOperator=Operador de captación de datos
observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée \#TODO
observe.data.ll.common.Trip.observationMethod=Observations method \#TODO
+observe.data.ll.common.Trip.observationsComment=Observations Comentarios
observe.data.ll.common.Trip.observationsDataEntryOperator=Operador de captación de datos
observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée \#TODO
observe.data.ll.common.Trip.tripType=Tipo de marea
=====================================
services/i18n/src/main/i18n/translations/services_fr_FR.properties
=====================================
@@ -174,9 +174,12 @@ observe.data.ll.common.GearUseFeatures.type=Équipement
observe.data.ll.common.GearUseFeaturesMeasurement.gearCharacteristic=Caractéristique
observe.data.ll.common.GearUseFeaturesMeasurement.type=Type de mesure
observe.data.ll.common.Trip.activityObs=Activité
+observe.data.ll.common.Trip.generalComment=Commentaire générale
+observe.data.ll.common.Trip.logbookComment=Commentaire Livre de bord
observe.data.ll.common.Trip.logbookDataEntryOperator=Opérateur de saisie
observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée
observe.data.ll.common.Trip.observationMethod=Méthode d'observations
+observe.data.ll.common.Trip.observationsComment=Commentaire Observations
observe.data.ll.common.Trip.observationsDataEntryOperator=Opérateur de saisie
observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée
observe.data.ll.common.Trip.tripType=Type de marée
=====================================
services/validation/src/main/i18n/getters/validation-fields.getter
=====================================
@@ -30,9 +30,12 @@ observe.data.ll.common.GearUseFeatures.gear
observe.data.ll.common.GearUseFeatures.number
observe.data.ll.common.GearUseFeaturesMeasurement.gearCharacteristic
observe.data.ll.common.Trip.activityObs
+observe.data.ll.common.Trip.generalComment
+observe.data.ll.common.Trip.logbookComment
observe.data.ll.common.Trip.logbookDataEntryOperator
observe.data.ll.common.Trip.logbookDataQuality
observe.data.ll.common.Trip.observationMethod
+observe.data.ll.common.Trip.observationsComment
observe.data.ll.common.Trip.observationsDataEntryOperator
observe.data.ll.common.Trip.observationsDataQuality
observe.data.ll.common.Trip.tripType
=====================================
services/validation/src/main/resources/fr/ird/observe/dto/data/ll/common/TripDto-create-error-validation.xml
=====================================
@@ -67,4 +67,37 @@
<message/>
</field-validator>
</field>
+ <field name="generalComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">captain,departureHarbour,landingHarbour,ocean,program,species,tripType,vessel</param>
+ <message/>
+ </field-validator>
+ </field>
+ <field name="observationsComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">observationMethod,observationsDataEntryOperator,observationsDataQuality,observer</param>
+ <message/>
+ </field-validator>
+ </field>
+ <field name="logbookComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">logbookDataEntryOperator,logbookDataQuality</param>
+ <message/>
+ </field-validator>
+ </field>
</validators>
=====================================
services/validation/src/main/resources/fr/ird/observe/dto/data/ll/common/TripDto-update-error-validation.xml
=====================================
@@ -105,4 +105,37 @@
<message/>
</field-validator>
</field>
+ <field name="generalComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">captain,departureHarbour,landingHarbour,ocean,program,species,tripType,vessel</param>
+ <message/>
+ </field-validator>
+ </field>
+ <field name="observationsComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">observationMethod,observationsDataEntryOperator,observationsDataQuality,observer</param>
+ <message/>
+ </field-validator>
+ </field>
+ <field name="logbookComment">
+ <!-- comment length -->
+ <field-validator type="commentLengthFieldDto">
+ <message/>
+ </field-validator>
+ <!-- comment needed from one of the selected referential -->
+ <field-validator type="commentNeeded" short-circuit="true">
+ <param name="propertyNames">logbookDataEntryOperator,logbookDataQuality</param>
+ <message/>
+ </field-validator>
+ </field>
</validators>
=====================================
toolkit/dto/src/main/java/fr/ird/observe/dto/WithComment.java deleted
=====================================
@@ -1,49 +0,0 @@
-package fr.ird.observe.dto;
-
-/*-
- * #%L
- * ObServe Toolkit :: Dto
- * %%
- * Copyright (C) 2008 - 2020 IRD, Code Lutin, 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 java.beans.PropertyChangeListener;
-
-/**
- * Created on 21/12/16.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 6.0
- */
-public interface WithComment {
-
- String PROPERTY_COMMENT = "comment";
-
- String getComment();
-
- void setComment(String comment);
-
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
-
- void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
-
-}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/dc3401215eabecfe1d3e4b9ea…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/dc3401215eabecfe1d3e4b9ea…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Meilleure disposition pour l'onglet carte - closes #1721
by Tony CHEMIT 31 Dec '20
by Tony CHEMIT 31 Dec '20
31 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
9c8ca5a9 by Tony Chemit at 2020-12-31T10:26:13+01:00
Meilleure disposition pour l'onglet carte - closes #1721
Plus nettoyage code sur TripUIModel (suppression états inutiles).
Debut de correction de #1654
- - - - -
9 changed files:
- 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/actions/mode/ChangeMode.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/TripUIHelper.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIModel.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jcss
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIHandler.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModel.java
- models/dto/src/main/java/fr/ird/observe/dto/data/ps/common/TripDto.java
Changes:
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIHandler.java
=====================================
@@ -319,6 +319,7 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe
public final void fixFormSize() {
// we want to see the hole form on screen
ui.setMinimumSize(ui.getPreferredSize());
+ getDataSourceEditor().updateContentSize();
}
/**
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/mode/ChangeMode.java
=====================================
@@ -46,7 +46,6 @@ import org.apache.logging.log4j.Logger;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
import javax.swing.tree.TreeNode;
import java.awt.event.ActionEvent;
import java.util.Objects;
@@ -253,15 +252,12 @@ public class ChangeMode<U extends ContentUI> extends ContentUIActionSupport<U> {
public void rebuildEditableZone(U ui) {
ui.getHandler().getDataSourceEditor().getMessageView().setVisible(true);
- SwingUtilities.invokeLater(ui.getHandler()::fixFormSize);
- getDataSourceEditor().updateContentSize();
+ ui.getHandler().fixFormSize();
}
protected void rebuildNotEditableZone(U ui) {
ui.getHandler().getDataSourceEditor().getMessageView().setVisible(false);
ui.getHandler().fixFormSize();
- getDataSourceEditor().updateContentSize();
- SwingUtilities.invokeLater(ui.getHandler()::fixFormSize);
}
protected void rebuildFocus(U ui, ContentMode mode) {
=====================================
client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/TripUIHelper.java
=====================================
@@ -116,6 +116,7 @@ public class TripUIHelper<D extends DataDto, U extends ContentOpenableUI<D, U> &
TripMapUI tripMap1 = ui.getTripMap();
if (selectedComponent.getSelectedComponent().equals(tripMap1)) {
ui.getActions().setVisible(false);
+ ui.getHandler().getDataSourceEditor().getMessageView().setVisible(false);
if (ui.isBuildMap()) {
try {
buildTripMap();
@@ -125,6 +126,9 @@ public class TripUIHelper<D extends DataDto, U extends ContentOpenableUI<D, U> &
}
} else {
ui.getActions().setVisible(true);
+ ui.getHandler().getDataSourceEditor().getMessageView().setVisible(true);
+ ui.getHandler().fixFormSize();
+
}
}
=====================================
client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIHandler.java
=====================================
@@ -37,6 +37,7 @@ import java.util.Objects;
import static io.ultreia.java4all.i18n.I18n.t;
/**
+ * FIXME:Focus tab0 ui.getTripType(), tab1 ui.getTripMap().getZoomIt()
* Created on 8/27/14.
*
* @author Tony Chemit - dev(a)tchemit.fr
@@ -74,38 +75,6 @@ class TripUIHandler extends GeneratedTripUIHandler {
.install(ui.getSave());
}
- // @Override
-// protected ContentOpenableUILayoutFocusTraversalPolicy<TripUI> createFocusTraversalPolicy() {
-// return new ContentOpenableUILayoutFocusTraversalPolicy<TripUI>() {
-//
-//// @Override
-//// protected Component getFirstComponentForEdit(Container aContainer) {
-//// TripUI ui = getUi();
-//// switch (ui.getMainTabbedPane().getSelectedIndex()) {
-//// case 0:
-//// return ui.getTripType();
-//// case 1:
-//// return ui.getTripMap().getZoomIt();
-//// }
-//// return ui.getTripType();
-//// }
-//
-// @Override
-// protected Component getLastComponentForEdit(Container aContainer) {
-// TripUI ui = getUi();
-// switch (ui.getMainTabbedPane().getSelectedIndex()) {
-// case 0:
-// return ui.getToggleConfigure();
-// case 1:
-// return ui.getTripMap().getExportPng();
-// }
-// //TODO-Focus
-// return null;
-// }
-//
-// };
-// }
-
@Override
public void onOpenForm(Form<?> form) {
tripUIHelper.onOpenModel(getModel().getStates().getSelectedId());
=====================================
client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIModel.java
=====================================
@@ -31,8 +31,6 @@ import fr.ird.observe.dto.data.ll.common.TripDto;
import fr.ird.observe.dto.form.Form;
import fr.ird.observe.services.ObserveServicesProvider;
import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
@@ -47,8 +45,6 @@ import java.beans.PropertyVetoException;
@GenerateJavaBeanDefinition
public class TripUIModel extends GeneratedTripUIModel {
- private static final Logger log = LogManager.getLogger(TripUIModel.class);
-
public TripUIModel(TripUINavigationNode source) {
super(source);
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jcss
=====================================
@@ -21,7 +21,7 @@
*/
#ocean {
- enabled:{!states.isUpdatingMode() || model.isRouteEmpty()};
+ enabled:{!states.isUpdatingMode() || bean.isRouteEmpty()};
}
#formsUrl {
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIHandler.java
=====================================
@@ -21,20 +21,13 @@
*/
package fr.ird.observe.client.datasource.editor.ps.data.common;
-import fr.ird.observe.client.datasource.editor.api.content.actions.create.CreateNewOpenableUI;
import fr.ird.observe.client.datasource.editor.api.content.data.TripUIHelper;
-import fr.ird.observe.client.datasource.editor.api.content.data.open.ContentOpenableUIModelStates;
-import fr.ird.observe.client.datasource.editor.ps.data.PsTripActionHelper;
-import fr.ird.observe.client.datasource.editor.ps.data.observation.ActivityListUINavigationNode;
import fr.ird.observe.dto.data.ps.common.TripDto;
-import fr.ird.observe.dto.data.ps.observation.ActivityDto;
import fr.ird.observe.dto.form.Form;
-import javax.swing.JMenuItem;
-
-import static fr.ird.observe.client.datasource.editor.api.content.actions.InsertMenuAction.PROPERTY_NAME_UPDATING_MODE_AND_NOT_MODIFIED;
-
/**
+ * FIXME:Focus tab0 ui.getCaptain(), tab1 ui.getTripMap().getZoomIt()
+ *
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
@@ -53,59 +46,6 @@ class TripUIHandler extends GeneratedTripUIHandler {
ui.getLandingHarbour().getIndexes().setSelectedButton(1);
}
- @Override
- protected void installCreateNewAction() {
- super.installCreateNewAction();
- JMenuItem editor = CreateNewOpenableUI.installAction(ui,
- ActivityListUINavigationNode.class,
- n -> ((TripUINavigationNode) n).getRouteListUINavigationNode().getRouteUINavigationNode(ui.getModel().getClientUIContext().getObserveEditModel().getPs().getObservationRoute().getId()).getActivityListUINavigationNode(),
- PsTripActionHelper.createNewObservationActionPredicate(ui, ActivityDto.class));
- ui.getModel().addPropertyChangeListener("routeOpen", evt -> {
- if (!evt.getPropertyName().equals("routeOpen") || !evt.getPropertyName().equals(PROPERTY_NAME_UPDATING_MODE_AND_NOT_MODIFIED)) {
- return;
- }
- TripUIModel source = (TripUIModel) evt.getSource();
- editor.setEnabled(source.isRouteOpen() && source.getStates().isUpdatingMode() && !source.getStates().isModified());
- });
-
- ui.getModel().getStates().addPropertyChangeListener(PROPERTY_NAME_UPDATING_MODE_AND_NOT_MODIFIED, evt -> {
- ContentOpenableUIModelStates<?> source = (ContentOpenableUIModelStates<?>) evt.getSource();
- editor.setEnabled(getModel().isRouteOpen() && source.isUpdatingMode() && !source.isModified());
- });
- }
-
-// @Override
-// protected ContentOpenableUILayoutFocusTraversalPolicy<TripUI> createFocusTraversalPolicy() {
-// return new ContentOpenableUILayoutFocusTraversalPolicy<TripUI>() {
-//
-//// @Override
-//// protected Component getFirstComponentForEdit(Container aContainer) {
-//// switch (ui.getMainTabbedPane().getSelectedIndex()) {
-//// case 0:
-//// return ui.getCaptain();
-//// case 1:
-//// return ui.getTripMap().getZoomIt();
-//// }
-//// return null;
-//// }
-//
-// @Override
-// protected Component getLastComponentForEdit(Container aContainer) {
-// TripUI ui = getUi();
-// if (!ui.getCreate().isEnabled()) {
-// return ui.getDelete();
-// }
-// return ui.getCreate();
-// }
-// };
-// }
-
-// @Override
-// protected Form<TripDto> onOpenForm() {
-// tripUIHelper.onOpenModel(getModel().getStates().getSelectedId());
-// return super.onOpenForm();
-// }
-
@Override
public void onOpenForm(Form<?> form) {
tripUIHelper.onOpenModel(getModel().getStates().getSelectedId());
@@ -117,18 +57,5 @@ class TripUIHandler extends GeneratedTripUIHandler {
super.onOpenAfterOpenModel();
tripUIHelper.onOpenAfterOpenModel();
}
-
-// @Override
-// public void startEditUI() {
-// super.startEditUI();
-// ui.getOcean().setEnabled(getModel().getStates().getBean().getRouteSize() == 0);
-// ui.getAddActivity().setEnabled(ui.getAddRoute().isEnabled() && ui.getModel().getClientUIContext().getObserveEditModel().getPs().getObservationRoute().isEnabled());
-// }
-
-// @Override
-// public void stopEditUI() {
-// super.stopEditUI();
-// ui.getAddActivity().setEnabled(false);
-// }
}
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModel.java
=====================================
@@ -29,8 +29,6 @@ import fr.ird.observe.dto.data.ps.common.TripDto;
import fr.ird.observe.dto.form.Form;
import fr.ird.observe.services.ObserveServicesProvider;
import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.nuiton.util.DateUtil;
import java.util.Date;
@@ -44,12 +42,6 @@ import java.util.Date;
@GenerateJavaBeanDefinition
public class TripUIModel extends GeneratedTripUIModel {
- public static final String PROPERTY_ROUTE_OPEN = "routeOpen";
- public static final String PROPERTY_ROUTE_EMPTY = "routeEmpty";
- private static final Logger log = LogManager.getLogger(TripUIModel.class);
- private boolean routeOpen;
- private boolean routeEmpty;
-
public TripUIModel(TripUINavigationNode source) {
super(source);
}
@@ -62,28 +54,6 @@ public class TripUIModel extends GeneratedTripUIModel {
referenceCache.addReferentialFilter(TripDto.PROPERTY_VESSEL, ReferencesFilterHelper.newSubVesselList(clientConfig.getVesselTypeSeineCommonTripId()));
}
- public boolean isRouteOpen() {
- return routeOpen;
- }
-
- public void setRouteOpen(boolean routeOpen) {
- this.routeOpen = routeOpen;
- firePropertyChange(PROPERTY_ROUTE_OPEN, routeOpen);
- }
-
- public boolean isRouteEmpty() {
- return routeEmpty;
- }
-
- public void setRouteEmpty(boolean routeEmpty) {
- this.routeEmpty = routeEmpty;
- firePropertyChange(PROPERTY_ROUTE_EMPTY, routeEmpty);
- }
-
- // FIXME in context
-// public String getText(TripUINavigationNode node) {
-// return super.getText(node) + (node.isPersisted() ? String.format(" (%d)", node.getData().getRouteSize()) : "");
-// }
@Override
public void openForm(Form<TripDto> form) {
super.openForm(form);
@@ -91,23 +61,16 @@ public class TripUIModel extends GeneratedTripUIModel {
if (getStates().isUpdatingMode() && getStates().getBean().getEndDate() == null) {
Date date = DateUtil.getEndOfDay(new Date());
getStates().getBean().setEndDate(date);
- log.debug(getPrefix() + "date fin " + date);
}
- setRouteOpen(getClientUIContext().getObserveEditModel().getPs().getObservationRoute().isEnabled());
- setRouteEmpty(getStates().getBean().isRouteEmpty());
}
@Override
public TripDto getBeanToSave() {
TripDto bean = super.getBeanToSave();
- // on force toujours la date a etre sans heure, minute,...
+ // on force toujours la date a être sans heure, minute,...
Date startDate = DateUtil.getDay(bean.getStartDate());
- log.debug("startDate = " + startDate);
bean.setStartDate(startDate);
-
- Date endDate = bean.getEndDate();
- log.debug("endDate = " + endDate);
return bean;
}
}
=====================================
models/dto/src/main/java/fr/ird/observe/dto/data/ps/common/TripDto.java
=====================================
@@ -27,6 +27,7 @@ import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
import org.nuiton.util.DateUtil;
import java.util.Date;
+import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Optional;
@@ -41,11 +42,19 @@ public class TripDto extends GeneratedTripDto {
Optional<RouteStubDto> optional = getRoute().stream()
.filter(r -> Objects.equals(r.getDate(), date) && !Objects.equals(r.getId(), routeId))
.findFirst();
- return !optional.isPresent();
+ return optional.isEmpty();
}
@Override
public void setStartDate(Date startDate) {
super.setStartDate(startDate == null ? null : DateUtil.getDay(startDate));
}
+
+ @Override
+ public void setRoute(LinkedHashSet<RouteStubDto> route) {
+ boolean oldValue = isRouteEmpty();
+ super.setRoute(route);
+ //FIXME:Dto should be generated by dto template
+ firePropertyChange("routeEmpty",oldValue, isRouteEmpty());
+ }
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/9c8ca5a91d9d3d5cffb90df4c…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/9c8ca5a91d9d3d5cffb90df4c…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 3 commits: La dernière SNAPSHOT 8.0.3 semble instable - closes #1718
by Tony CHEMIT 31 Dec '20
by Tony CHEMIT 31 Dec '20
31 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
bab39d40 by Tony Chemit at 2020-12-31T09:48:48+01:00
La dernière SNAPSHOT 8.0.3 semble instable - closes #1718
- - - - -
e9fc2489 by Tony Chemit at 2020-12-31T09:48:48+01:00
Remontée des messages d'erreur serveur vers le client - closes #1637
- - - - -
8debafba by Tony Chemit at 2020-12-31T09:48:48+01:00
fix trip vessel validator on create mode
- - - - -
6 changed files:
- client/core/src/main/java/fr/ird/observe/client/datasource/api/DataSourceReferenceProvider.java
- pom.xml
- server/core/src/main/filtered-resources/mapping
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/ReferenceServiceLocalSupport.java
- services/validation-spi/src/main/java/fr/ird/observe/validation/validators/TripVesselDtoValidator.java
- toolkit/service/src/main/java/fr/ird/observe/services/service/ReferenceService.java
Changes:
=====================================
client/core/src/main/java/fr/ird/observe/client/datasource/api/DataSourceReferenceProvider.java
=====================================
@@ -101,11 +101,11 @@ public class DataSourceReferenceProvider {
}
public final <R extends DataDtoReference> DataDtoReferenceSet<R> getDataReferences(Class<R> referenceType) {
- return dataSource.getReferenceService().loadData(referenceType);
+ return dataSource.getReferenceService().loadAllData(referenceType);
}
public final <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> getReferentialReferences(Class<R> referenceType) {
- return dataSource.getReferenceService().loadReferential(referenceType);
+ return dataSource.getReferenceService().loadAllReferential(referenceType);
}
public <R extends ReferentialDtoReference> R loadOrCreateReferentialReference(Class<R> referenceType, String id) {
=====================================
pom.xml
=====================================
@@ -162,7 +162,7 @@
<!--<lib.version.java4all.config>1.0.8-SNAPSHOT</lib.version.java4all.config>-->
<!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>-->
<!-- <lib.version.java4all.java-bean>0.1.2</lib.version.java4all.java-bean>-->
-<!-- <lib.version.java4all.http>1.0.24</lib.version.java4all.http>-->
+ <lib.version.java4all.http>1.0.25</lib.version.java4all.http>
<!-- license header configuration -->
<license.licenseName>gpl_v3</license.licenseName>
=====================================
server/core/src/main/filtered-resources/mapping
=====================================
@@ -69,12 +69,12 @@ POST /api/v1/LastUpdateDateService/updateDataLastUpdateDates
POST /api/v1/LastUpdateDateService/updateReferentialLastUpdateDates v1.LastUpdateDateServiceRestApi.updateReferentialLastUpdateDates
GET /api/v1/PingService/getModelVersion v1.PingServiceRestApi.getModelVersion
GET /api/v1/PingService/getServerVersion v1.PingServiceRestApi.getServerVersion
-GET /api/v1/ReferenceService/loadData v1.ReferenceServiceRestApi.loadData
+GET /api/v1/ReferenceService/loadAllData v1.ReferenceServiceRestApi.loadAllData
+GET /api/v1/ReferenceService/loadAllReferential v1.ReferenceServiceRestApi.loadAllReferential
GET /api/v1/ReferenceService/loadData v1.ReferenceServiceRestApi.loadData
GET /api/v1/ReferenceService/loadOrCreateData v1.ReferenceServiceRestApi.loadOrCreateData
GET /api/v1/ReferenceService/loadOrCreateReferential v1.ReferenceServiceRestApi.loadOrCreateReferential
GET /api/v1/ReferenceService/loadReferential v1.ReferenceServiceRestApi.loadReferential
-GET /api/v1/ReferenceService/loadReferential v1.ReferenceServiceRestApi.loadReferential
POST /api/v1/actions/report/ReportService/executeReport v1.actions.report.ReportServiceRestApi.executeReport
POST /api/v1/actions/report/ReportService/populateVariables v1.actions.report.ReportServiceRestApi.populateVariables
POST /api/v1/actions/synchro/referential/legacy/UnidirectionalReferentialSynchronizeLocalService/applySqlRequests v1.actions.synchro.referential.legacy.UnidirectionalReferentialSynchronizeLocalServiceRestApi.applySqlRequests
=====================================
services/local-impl/src/main/java/fr/ird/observe/services/local/service/ReferenceServiceLocalSupport.java
=====================================
@@ -57,13 +57,12 @@ class ReferenceServiceLocalSupport extends ObserveServiceLocal implements Refere
}
@Override
- public <R extends DataDtoReference> DataDtoReferenceSet<R> loadData(Class<R> type) {
-
+ public <R extends DataDtoReference> DataDtoReferenceSet<R> loadAllData(Class<R> type) {
return loadData0(type);
}
@Override
- public <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadReferential(Class<R> type) {
+ public <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadAllReferential(Class<R> type) {
return loadReferential0(type);
}
=====================================
services/validation-spi/src/main/java/fr/ird/observe/validation/validators/TripVesselDtoValidator.java
=====================================
@@ -70,6 +70,10 @@ public class TripVesselDtoValidator extends FieldValidatorSupport {
Date startDate = (Date) getFieldValue("startDate", object);
Date endDate = (Date) getFieldValue("endDate", object);
String id = (String) getFieldValue("id", object);
+ if (id==null) {
+ // object not persisted, no ide, can't do the math
+ return;
+ }
validate(object, id, vessel, startDate, endDate);
}
@@ -80,7 +84,6 @@ public class TripVesselDtoValidator extends FieldValidatorSupport {
vessel.getId(),
startDate,
endDate);
-
if (matchingTrips.size() > 0) {
addFieldError(getFieldName(), object);
}
=====================================
toolkit/service/src/main/java/fr/ird/observe/services/service/ReferenceService.java
=====================================
@@ -49,7 +49,7 @@ public interface ReferenceService extends ObserveService {
@Get
@MethodCredential(Permission.READ_DATA)
- <R extends DataDtoReference> DataDtoReferenceSet<R> loadData(Class<R> type);
+ <R extends DataDtoReference> DataDtoReferenceSet<R> loadAllData(Class<R> type);
@Get
@MethodCredential(Permission.READ_REFERENTIAL)
@@ -61,6 +61,6 @@ public interface ReferenceService extends ObserveService {
@Get
@MethodCredential(Permission.READ_REFERENTIAL)
- <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadReferential(Class<R> type);
+ <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadAllReferential(Class<R> type);
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/462cfa41a16f96b86cceb02f…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/462cfa41a16f96b86cceb02f…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 3 commits: La carto ne tolère pas le 'Port à corriger' - closes #1719
by Tony CHEMIT 31 Dec '20
by Tony CHEMIT 31 Dec '20
31 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
e54f4ddf by Tony Chemit at 2020-12-31T09:01:59+01:00
La carto ne tolère pas le 'Port à corriger' - closes #1719
- - - - -
146c5eba by Tony Chemit at 2020-12-31T09:03:11+01:00
La dernière SNAPSHOT 8.0.3 semble instable - closes #1718
- - - - -
462cfa41 by Tony Chemit at 2020-12-31T09:11:18+01:00
Remontée des messages d'erreur serveur vers le client - closes #1637
- - - - -
5 changed files:
- client/core/src/main/java/fr/ird/observe/client/datasource/api/DataSourceReferenceProvider.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java
- pom.xml
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/ReferenceServiceLocalSupport.java
- toolkit/service/src/main/java/fr/ird/observe/services/service/ReferenceService.java
Changes:
=====================================
client/core/src/main/java/fr/ird/observe/client/datasource/api/DataSourceReferenceProvider.java
=====================================
@@ -101,11 +101,11 @@ public class DataSourceReferenceProvider {
}
public final <R extends DataDtoReference> DataDtoReferenceSet<R> getDataReferences(Class<R> referenceType) {
- return dataSource.getReferenceService().loadData(referenceType);
+ return dataSource.getReferenceService().loadAllData(referenceType);
}
public final <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> getReferentialReferences(Class<R> referenceType) {
- return dataSource.getReferenceService().loadReferential(referenceType);
+ return dataSource.getReferenceService().loadAllReferential(referenceType);
}
public <R extends ReferentialDtoReference> R loadOrCreateReferentialReference(Class<R> referenceType, String id) {
=====================================
client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java
=====================================
@@ -92,6 +92,9 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
List<Coordinate> coordinatesByDay = new LinkedList<>();
TripMapPoint previousPoint = null;
for (TripMapPoint point : tripMapPoints) {
+ if (!point.isValid()) {
+ continue;
+ }
Coordinate coordinate = create(point);
if (previousPoint != null && !DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) {
// changing day
=====================================
pom.xml
=====================================
@@ -162,7 +162,7 @@
<!--<lib.version.java4all.config>1.0.8-SNAPSHOT</lib.version.java4all.config>-->
<!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>-->
<!-- <lib.version.java4all.java-bean>0.1.2</lib.version.java4all.java-bean>-->
-<!-- <lib.version.java4all.http>1.0.24</lib.version.java4all.http>-->
+ <lib.version.java4all.http>1.0.25</lib.version.java4all.http>
<!-- license header configuration -->
<license.licenseName>gpl_v3</license.licenseName>
=====================================
services/local-impl/src/main/java/fr/ird/observe/services/local/service/ReferenceServiceLocalSupport.java
=====================================
@@ -57,13 +57,12 @@ class ReferenceServiceLocalSupport extends ObserveServiceLocal implements Refere
}
@Override
- public <R extends DataDtoReference> DataDtoReferenceSet<R> loadData(Class<R> type) {
-
+ public <R extends DataDtoReference> DataDtoReferenceSet<R> loadAllData(Class<R> type) {
return loadData0(type);
}
@Override
- public <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadReferential(Class<R> type) {
+ public <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadAllReferential(Class<R> type) {
return loadReferential0(type);
}
=====================================
toolkit/service/src/main/java/fr/ird/observe/services/service/ReferenceService.java
=====================================
@@ -49,7 +49,7 @@ public interface ReferenceService extends ObserveService {
@Get
@MethodCredential(Permission.READ_DATA)
- <R extends DataDtoReference> DataDtoReferenceSet<R> loadData(Class<R> type);
+ <R extends DataDtoReference> DataDtoReferenceSet<R> loadAllData(Class<R> type);
@Get
@MethodCredential(Permission.READ_REFERENTIAL)
@@ -61,6 +61,6 @@ public interface ReferenceService extends ObserveService {
@Get
@MethodCredential(Permission.READ_REFERENTIAL)
- <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadReferential(Class<R> type);
+ <R extends ReferentialDtoReference> ReferentialDtoReferenceSet<R> loadAllReferential(Class<R> type);
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8784925f1a42b43f81a41a5b…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8784925f1a42b43f81a41a5b…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Fix NavigationService Rest APi . be better to use
by Tony CHEMIT 30 Dec '20
by Tony CHEMIT 30 Dec '20
30 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
8784925f by Tony Chemit at 2020-12-30T22:23:57+01:00
Fix NavigationService Rest APi . be better to use
- - - - -
8 changed files:
- models/dto/src/main/java/fr/ird/observe/dto/data/TripAware.java
- server/core/src/main/java/fr/ird/observe/server/ObserveWebApplicationContext.java
- server/core/src/main/java/fr/ird/observe/server/injector/DateInjector.java
- services/client-impl/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java
- toolkit/dto/src/main/java/fr/ird/observe/gson/DtoReferenceAdapter.java
- + toolkit/dto/src/main/java/fr/ird/observe/gson/GSonTypedContract.java
- + toolkit/dto/src/main/java/fr/ird/observe/gson/GSonTypedContractAdapter.java
- toolkit/dto/src/main/java/fr/ird/observe/gson/MultimapAdapterSupport.java
Changes:
=====================================
models/dto/src/main/java/fr/ird/observe/dto/data/TripAware.java
=====================================
@@ -25,6 +25,7 @@ package fr.ird.observe.dto.data;
import fr.ird.observe.dto.WithStartEndDate;
import fr.ird.observe.dto.referential.common.ProgramReference;
import fr.ird.observe.dto.referential.common.VesselReference;
+import fr.ird.observe.gson.GSonTypedContract;
import java.util.Comparator;
import java.util.Date;
@@ -37,10 +38,9 @@ import java.util.stream.Collectors;
*
* @author Tony Chemit - dev(a)tchemit.fr
*/
-public interface TripAware extends WithStartEndDate {
+public interface TripAware extends WithStartEndDate, GSonTypedContract {
String PROPERTY_OBSERVATIONS_AVAILABILITY = "observationsAvailability";
-
String PROPERTY_LOGBOOK_AVAILABILITY = "logbookAvailability";
Predicate<String> IS_SEINE_ID = TripAware::isSeineId;
Predicate<String> IS_LONGLINE_ID = TripAware::isLonglineId;
=====================================
server/core/src/main/java/fr/ird/observe/server/ObserveWebApplicationContext.java
=====================================
@@ -24,6 +24,8 @@ package fr.ird.observe.server;
import com.google.common.collect.ImmutableList;
import com.google.gson.GsonBuilder;
+import fr.ird.observe.dto.data.TripAware;
+import fr.ird.observe.gson.GSonTypedContractAdapter;
import fr.ird.observe.gson.ObserveDataSourceConfigurationAdapter;
import fr.ird.observe.gson.ObserveDtoGsonSupplier;
import fr.ird.observe.server.configuration.ServerConfig;
@@ -149,7 +151,10 @@ public class ObserveWebApplicationContext extends ApplicationContext {
@Override
protected GsonBuilder getGsonBuilder(boolean prettyPrint) {
return super.getGsonBuilder(prettyPrint)
- .registerTypeAdapter(ObserveDataSourceConfiguration.class, new ObserveDataSourceConfigurationAdapter());
+ .registerTypeAdapter(ObserveDataSourceConfiguration.class, new ObserveDataSourceConfigurationAdapter())
+ .registerTypeAdapter(TripAware.class, new GSonTypedContractAdapter<TripAware>(){
+
+ });
}
};
=====================================
server/core/src/main/java/fr/ird/observe/server/injector/DateInjector.java
=====================================
@@ -51,7 +51,7 @@ public class DateInjector implements ExecutorParametersInjectorHandler.Injector
public Object getValue(Mapping mapping, Call call, String name, Class<?> type, Type generic) {
Date result = null;
- if (type.equals(Date.class)) {
+ if (type.equals(Date.class) && call.getParameterTree().getObject()!=null) {
Call.ParameterTree parameterTree = call.getParameterTree().getObject().get(name);
=====================================
services/client-impl/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java
=====================================
@@ -23,6 +23,8 @@ package fr.ird.observe.services.client;
*/
import com.google.gson.GsonBuilder;
+import fr.ird.observe.dto.data.TripAware;
+import fr.ird.observe.gson.GSonTypedContractAdapter;
import fr.ird.observe.gson.ObserveDataSourceConfigurationAdapter;
import fr.ird.observe.gson.ObserveDataSourceConnectionAdapter;
import fr.ird.observe.gson.ObserveDtoGsonSupplier;
@@ -59,7 +61,8 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im
return super.getGsonBuilder(prettyPrint)
.registerTypeAdapter(ObserveDataSourceConnection.class, new ObserveDataSourceConnectionAdapter())
- .registerTypeAdapter(ObserveDataSourceConfiguration.class, new ObserveDataSourceConfigurationAdapter());
+ .registerTypeAdapter(ObserveDataSourceConfiguration.class, new ObserveDataSourceConfigurationAdapter())
+ .registerTypeAdapter(TripAware.class, new GSonTypedContractAdapter<>());
}
});
=====================================
toolkit/dto/src/main/java/fr/ird/observe/gson/DtoReferenceAdapter.java
=====================================
@@ -34,6 +34,7 @@ import fr.ird.observe.dto.reference.DtoReference;
import java.lang.reflect.Type;
/**
+ * FIXME Replace this by {@link GSonTypedContract}
* Created on 06/09/2020.
*
* @author Tony Chemit - dev(a)tchemit.fr
=====================================
toolkit/dto/src/main/java/fr/ird/observe/gson/GSonTypedContract.java
=====================================
@@ -0,0 +1,34 @@
+package fr.ird.observe.gson;
+
+/*-
+ * #%L
+ * ObServe Toolkit :: Dto
+ * %%
+ * Copyright (C) 2008 - 2020 IRD, Code Lutin, 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%
+ */
+
+/**
+ * Add this contract on any contract to be able to serialize and deserialize with Gson, the adapter will do the math.
+ * <p>
+ * Created on 30/12/2020.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 8.0.3
+ */
+public interface GSonTypedContract {
+}
=====================================
toolkit/dto/src/main/java/fr/ird/observe/gson/GSonTypedContractAdapter.java
=====================================
@@ -0,0 +1,59 @@
+package fr.ird.observe.gson;
+
+/*-
+ * #%L
+ * ObServe Toolkit :: Dto
+ * %%
+ * Copyright (C) 2008 - 2020 IRD, Code Lutin, 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 com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+
+/**
+ * Created on 30/12/2020.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 8.0.3
+ */
+public class GSonTypedContractAdapter<O extends GSonTypedContract> implements JsonSerializer<O>, JsonDeserializer<O> {
+
+ @Override
+ public JsonElement serialize(O src, Type typeOfSrc, JsonSerializationContext context) {
+ JsonObject result = new JsonObject();
+ result.add("type", context.serialize(src.getClass()));
+ result.add("data", context.serialize(src));
+ return result;
+ }
+
+ @Override
+ public O deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
+ JsonObject jsonObject = json.getAsJsonObject();
+ Class<O> type = context.deserialize(jsonObject.get("type"), Class.class);
+ return context.deserialize(jsonObject.get("data"), type);
+ }
+
+}
=====================================
toolkit/dto/src/main/java/fr/ird/observe/gson/MultimapAdapterSupport.java
=====================================
@@ -25,9 +25,11 @@ package fr.ird.observe.gson;
import com.google.common.collect.Multimap;
import com.google.common.reflect.TypeParameter;
import com.google.common.reflect.TypeToken;
+import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
@@ -35,6 +37,8 @@ import com.google.gson.JsonSerializer;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -63,18 +67,56 @@ public abstract class MultimapAdapterSupport<M extends Multimap> implements Json
Type valueType = actualTypeArguments[1];
Type type2 = multimapOf(TypeToken.of(keyType), TypeToken.of(valueType)).getType();
- Map map = context.deserialize(json, type2);
M result = createMultimap();
- for (Object key : map.keySet()) {
- List multimapValues = (List) map.get(key);
- result.putAll(key, multimapValues);
+ if (!json.isJsonArray()) {
+
+ Map map = context.deserialize(json, type2);
+
+ for (Object key : map.keySet()) {
+ List multimapValues = (List) map.get(key);
+ result.putAll(key, multimapValues);
+ }
+ } else {
+ JsonArray asJsonArray = json.getAsJsonArray();
+ Iterator<JsonElement> iterator = asJsonArray.iterator();
+ while (iterator.hasNext()) {
+ JsonObject entryObject = (JsonObject) iterator.next();
+ Object key = context.deserialize(entryObject.get("key"), keyType);
+ JsonArray valuesArray = (JsonArray) entryObject.get("value");
+ Iterator<JsonElement> valuesIterator = valuesArray.iterator();
+ List entryValues = new LinkedList();
+ while (valuesIterator.hasNext()) {
+ JsonElement value = valuesIterator.next();
+ entryValues.add(context.deserialize(value, valueType));
+ }
+ result.putAll(key, entryValues);
+ }
}
return result;
}
@Override
- public JsonElement serialize(M src, Type typeOfSrc, JsonSerializationContext context) {
- return context.serialize(src.asMap());
+ public JsonElement serialize(M src, Type type, JsonSerializationContext context) {
+ Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
+ Type keyType = actualTypeArguments[0];
+ Type valueType = actualTypeArguments[1];
+
+ JsonArray result = new JsonArray();
+ for (Object o : src.asMap().entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ Object key = entry.getKey();
+ Collection<?> value = (Collection<?>) entry.getValue();
+ JsonObject entryObject = new JsonObject();
+ entryObject.add("key", context.serialize(key));
+ JsonArray valuesObject = new JsonArray();
+ for (Object o1 : value) {
+ valuesObject.add(context.serialize(o1, valueType));
+ }
+ entryObject.add("value", valuesObject);
+ result.add(entryObject);
+ }
+
+ return result;
}
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/8784925f1a42b43f81a41a5b6…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/8784925f1a42b43f81a41a5b6…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] LL Trip : erreur d'enregistrement - Closes #1715
by Tony CHEMIT 30 Dec '20
by Tony CHEMIT 30 Dec '20
30 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
44aee866 by Tony Chemit at 2020-12-30T19:06:51+01:00
LL Trip : erreur d'enregistrement - Closes #1715
* Revue de l'API de sauvegarde
* Génération de l'action de sauvegarde
- - - - -
30 changed files:
- client/datasource/editor/api/src/main/i18n/getters/java.getter
- + client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveAction.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveConsumer.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveExecutor.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveRequest.java
- + client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/save/SaveUIAdapter.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUIModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/actions/SaveEditUIAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/actions/SaveContentEditUIAdapter.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/actions/SaveEdit.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/ContentOpenableUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/ContentOpenableUIModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/actions/SaveOpenableUIAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/actions/SaveContentOpenableUIAdapter.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/open/actions/SaveOpenable.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/ContentSimpleUIModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/actions/SaveSimpleUIAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/actions/SaveContentSimpleUIAdapter.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/simple/actions/SaveSimple.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveTableUIAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveContentTableUIAdapter.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/actions/SaveTable.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/ContentReferentialUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/ReferentialSaveAdapter.java → client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/SaveContentReferentialUIAdapter.java
- − client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/referential/actions/SaveReferential.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivityUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/ActivityUIHandler.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/ActivityUIHandler.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/CapabilityDescriptor.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/44aee866e7648eaf785bdaf51…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/44aee866e7648eaf785bdaf51…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Peaufinage de la table common.program - Closes #1712
by Tony CHEMIT 30 Dec '20
by Tony CHEMIT 30 Dec '20
30 Dec '20
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
4a856a8b by Tony Chemit at 2020-12-30T11:22:13+01:00
Peaufinage de la table common.program - Closes #1712
- - - - -
7 changed files:
- models/persistence/src/main/resources/db/migration/8.0/30_common_fill-common.sql
- models/persistence/src/test/resources/fixtures/persistence/count-referential-common.properties
- models/persistence/src/test/resources/fixtures/persistence/entity-tables-count-referential.properties
- tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz
- tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz
- tests/test/src/main/resources/db/8.0/referentiel.sql.gz
- tests/test/src/main/resources/fixtures/global.properties
Changes:
=====================================
models/persistence/src/main/resources/db/migration/8.0/30_common_fill-common.sql
=====================================
@@ -110,6 +110,8 @@ INSERT INTO common.Person(topiaId, topiaVersion, topiaCreateDate, lastUpdateDate
INSERT INTO common.Person(topiaId, topiaVersion, topiaCreateDate, lastUpdateDate, status, needComment, dataSource, lastname, firstname, country) values ('fr.ird.referential.common.Person#666#24' , 0, ${CURRENT_DATE}, ${CURRENT_TIMESTAMP}, 1, false, true, 'Savy', 'Vincent', 'fr.ird.referential.common.Country#1239832675593#0.3601938043845213');
INSERT INTO common.Person(topiaId, topiaVersion, topiaCreateDate, lastUpdateDate, status, needComment, dataSource, lastname, firstname, country) values ('fr.ird.referential.common.Person#666#25' , 0, ${CURRENT_DATE}, ${CURRENT_TIMESTAMP}, 1, false, true, 'Perikanan', 'Pengawas', 'fr.ird.referential.common.Country#1239832675593#0.3601938043845213');
+INSERT INTO common.program(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, uri, homeid, needcomment, status, label1, label2, label3, label4, label5, label6, label7, label8, organism, nontargetobservation, targetdiscardsobservation, samplesobservation, objectsobservation, detailedactivitiesobservation, mammalsobservation, birdsobservation, baitobservation, startdate, enddate, comment, geartype) VALUES ('fr.ird.referential.common.Program#1609292987444#0.2779633795557708', 1, '2020-12-30 01:41:23.965', '2020-12-30 01:49:47.515', '50', null, null, FALSE, 1, 'FINSS', 'FINSS', 'FINSS', null, null, null, null, null, 'fr.ird.referential.common.Organism#1267835067241#0.06632537553306939', 1, 1, 1, 0, 0, 0, 0, 0, '2020-05-17 00:00:00', '2021-12-31 00:00:00', null, 1);
+
UPDATE common.Wind SET LABEL2='Calme (Calme)', LABEL1='Calm', LABEL3='Calma (Despejado)' WHERE CODE='0';
UPDATE common.Wind SET LABEL2='Très légère brise (Calme, ridée)', LABEL1='Light air',LABEL3='Ventolina (Pequeñas olas, pero sin espuma)' WHERE CODE='1';
UPDATE common.Wind SET LABEL2='Légère brise (Belle, vaguelettes)', LABEL1='Light breeze', LABEL3='Flojito (Crestas de apariencia vítrea, sin romper)' WHERE CODE='2';
=====================================
models/persistence/src/test/resources/fixtures/persistence/count-referential-common.properties
=====================================
@@ -36,7 +36,7 @@ common.ocean=3
common.ocean_species=500
common.organism=9
common.person=537
-common.program=27
+common.program=28
common.shipowner=27
common.sex=5
common.sizemeasuretype=16
=====================================
models/persistence/src/test/resources/fixtures/persistence/entity-tables-count-referential.properties
=====================================
@@ -32,7 +32,7 @@ fr.ird.observe.entities.referential.common.LengthWeightParameter=361
fr.ird.observe.entities.referential.common.Ocean=3
fr.ird.observe.entities.referential.common.Organism=9
fr.ird.observe.entities.referential.common.Person=537
-fr.ird.observe.entities.referential.common.Program=27
+fr.ird.observe.entities.referential.common.Program=28
fr.ird.observe.entities.referential.common.Sex=5
fr.ird.observe.entities.referential.common.ShipOwner=27
fr.ird.observe.entities.referential.common.SizeMeasureType=16
=====================================
tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz
=====================================
Binary files a/tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz and b/tests/test/src/main/resources/db/8.0/dataForTestLongline.sql.gz differ
=====================================
tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz
=====================================
Binary files a/tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz and b/tests/test/src/main/resources/db/8.0/dataForTestSeine.sql.gz differ
=====================================
tests/test/src/main/resources/db/8.0/referentiel.sql.gz
=====================================
Binary files a/tests/test/src/main/resources/db/8.0/referentiel.sql.gz and b/tests/test/src/main/resources/db/8.0/referentiel.sql.gz differ
=====================================
tests/test/src/main/resources/fixtures/global.properties
=====================================
@@ -35,5 +35,5 @@ SPECIES_GROUP_ID=fr.ird.referential.common.SpeciesGroup#1239832683689#0.71201161
# for fr.ird.observe.spi.DbModelHelperTest
REFERENCE_DATA_COUNT=52
# for fr.ird.observe.services.local.service.referential.differential.DifferentialModelTest
-REFERENTIAL_COUNT=3030
+REFERENTIAL_COUNT=3031
ENTITIES_LIMIT_SIZE=100
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/4a856a8bf5393c39badea40bb…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/4a856a8bf5393c39badea40bb…
You're receiving this email because of your account on gitlab.com.
1
0