Tony CHEMIT pushed to branch feature/refactor_ui at ultreiaio / ird-observe
Commits:
-
3df6c1b4
by Tony CHEMIT at 2017-09-27T15:41:04+02:00
23 changed files:
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineObsUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineObsUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglineDetailCompositionObsUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglineGlobalCompositionObsUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineObsUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineObsUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/ActivitySeineUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/ActivitySeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/NonTargetCatchReleaseUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/NonTargetSampleUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/RouteUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/SetSeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TargetSampleUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/spi/ContentUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/spi/action/OpenAction.java
- client/src/main/java/fr/ird/observe/client/ui/content/spi/init/CoordinatesEditorInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/content/spi/referential/ContentReferentialUIOpenAction.java
- client/src/main/java/fr/ird/observe/client/ui/content/spi/table/ContentTableUIOpenAction.java
Changes:
| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 |
propertyLatitude:{ActivityLonglineObsDto.PROPERTY_LATITUDE};
|
| 46 | 46 |
propertyLongitude:{ActivityLonglineObsDto.PROPERTY_LONGITUDE};
|
| 47 | 47 |
propertyQuadrant:{ActivityLonglineObsDto.PROPERTY_QUADRANT};
|
| 48 |
+ _validationContext:{"coordinate"};
|
|
| 48 | 49 |
}
|
| 49 | 50 |
|
| 50 | 51 |
#vesselActivityLongline {
|
| ... | ... | @@ -90,5 +91,4 @@ |
| 90 | 91 |
toolTipText:"observe.common.ActivityLonglineObsDto.action.addSet.tip";
|
| 91 | 92 |
enabled:{!model.isModified() && model.isValid() && model.isSetOperation() && ! bean.isHasSetLongline()};
|
| 92 | 93 |
_observeAction:{AddActivityLonglineSetUIAction.ACTION_NAME};
|
| 93 |
- |
|
| 94 | 94 |
}
|
| ... | ... | @@ -22,14 +22,12 @@ package fr.ird.observe.client.ui.content.data.longline; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import fr.ird.observe.client.ObserveClientApplicationContext;
|
|
| 26 | 25 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 27 | 26 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 28 | 27 |
import fr.ird.observe.client.ui.content.spi.ContentUIMode;
|
| 29 | 28 |
import fr.ird.observe.client.ui.content.spi.action.OpenAction;
|
| 30 | 29 |
import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIHandler;
|
| 31 | 30 |
import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIOpenAction;
|
| 32 |
-import fr.ird.observe.client.validation.ClientValidationContext;
|
|
| 33 | 31 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
| 34 | 32 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsHelper;
|
| 35 | 33 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| ... | ... | @@ -41,7 +39,6 @@ import fr.ird.observe.services.action.SaveServiceAction; |
| 41 | 39 |
import java.util.Optional;
|
| 42 | 40 |
import javax.swing.SwingUtilities;
|
| 43 | 41 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 44 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 45 | 42 |
|
| 46 | 43 |
|
| 47 | 44 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -93,22 +90,19 @@ class ActivityLonglineObsUIHandler extends ContentOpenableUIHandler<ActivityLong |
| 93 | 90 |
protected void computeDefaultMessages() {
|
| 94 | 91 |
switch (getModel().getContentMode()) {
|
| 95 | 92 |
case CREATE:
|
| 96 |
- addMessage(ui,
|
|
| 97 |
- NuitonValidatorScope.INFO,
|
|
| 98 |
- getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 93 |
+ addInfoMessage(
|
|
| 94 |
+ ActivityLonglineObsDto.class,
|
|
| 99 | 95 |
t("observe.common.ActivityLonglineObsDto.message.creating"));
|
| 100 | 96 |
break;
|
| 101 | 97 |
case UPDATE:
|
| 102 |
- addMessage(ui,
|
|
| 103 |
- NuitonValidatorScope.INFO,
|
|
| 104 |
- getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 98 |
+ addInfoMessage(
|
|
| 99 |
+ ActivityLonglineObsDto.class,
|
|
| 105 | 100 |
t("observe.common.ActivityLonglineObsDto.message.updating"));
|
| 106 | 101 |
break;
|
| 107 | 102 |
case READ:
|
| 108 | 103 |
if (!getOpenDataManager().isOpenTripLongline(getSelectedParentId())) {
|
| 109 |
- addMessage(ui,
|
|
| 110 |
- NuitonValidatorScope.INFO,
|
|
| 111 |
- getTypeI18nKey(TripLonglineDto.class),
|
|
| 104 |
+ addInfoMessage(
|
|
| 105 |
+ TripLonglineDto.class,
|
|
| 112 | 106 |
t("observe.common.TripLonglineDto.message.not.open"));
|
| 113 | 107 |
|
| 114 | 108 |
if (getModel().isHistoricalData()) {
|
| ... | ... | @@ -138,16 +132,6 @@ class ActivityLonglineObsUIHandler extends ContentOpenableUIHandler<ActivityLong |
| 138 | 132 |
return getOpenDataManager().canOpenActivityLongline(getSelectedParentId());
|
| 139 | 133 |
}
|
| 140 | 134 |
|
| 141 |
- @Override
|
|
| 142 |
- protected void prepareValidationContext() {
|
|
| 143 |
- super.prepareValidationContext();
|
|
| 144 |
- |
|
| 145 |
- ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 146 |
- validationContext.setCoordinatesEditor("coordinate", getUi().getCoordinatesEditor());
|
|
| 147 |
- |
|
| 148 |
- setValidatorContext(ui.getValidator());
|
|
| 149 |
- }
|
|
| 150 |
- |
|
| 151 | 135 |
};
|
| 152 | 136 |
}
|
| 153 | 137 |
|
| ... | ... | @@ -57,7 +57,6 @@ import javax.swing.JOptionPane; |
| 57 | 57 |
import javax.swing.JTable;
|
| 58 | 58 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 59 | 59 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 60 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 61 | 60 |
|
| 62 | 61 |
|
| 63 | 62 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -196,9 +195,8 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip |
| 196 | 195 |
|
| 197 | 196 |
// mode read : la marée n'est pas ouverte
|
| 198 | 197 |
|
| 199 |
- addMessage(getUi(),
|
|
| 200 |
- NuitonValidatorScope.INFO,
|
|
| 201 |
- getTypeI18nKey(TripLonglineDto.class),
|
|
| 198 |
+ addInfoMessage(
|
|
| 199 |
+ TripLonglineDto.class,
|
|
| 202 | 200 |
t("observe.common.TripLonglineDto.message.not.open"));
|
| 203 | 201 |
|
| 204 | 202 |
return ContentUIMode.READ;
|
| ... | ... | @@ -59,7 +59,6 @@ import javax.swing.event.TableModelListener; |
| 59 | 59 |
import org.apache.commons.lang3.BooleanUtils;
|
| 60 | 60 |
import org.nuiton.decorator.Decorator;
|
| 61 | 61 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 62 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 63 | 62 |
|
| 64 | 63 |
|
| 65 | 64 |
import static com.google.common.collect.Lists.newArrayList;
|
| ... | ... | @@ -327,12 +326,11 @@ public class LonglineDetailCompositionObsUIHandler extends ContentUIHandler<SetL |
| 327 | 326 |
case CREATE:
|
| 328 | 327 |
break;
|
| 329 | 328 |
case UPDATE:
|
| 330 |
- addInfoMessage(t("observe.common.LonglineDetailCompositionObsDto.message.updating"));
|
|
| 329 |
+ addTitleInfoMessage(t("observe.common.LonglineDetailCompositionObsDto.message.updating"));
|
|
| 331 | 330 |
break;
|
| 332 | 331 |
case READ:
|
| 333 |
- addMessage(getUi(),
|
|
| 334 |
- NuitonValidatorScope.INFO,
|
|
| 335 |
- getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 332 |
+ addInfoMessage(
|
|
| 333 |
+ ActivityLonglineObsDto.class,
|
|
| 336 | 334 |
t("observe.common.ActivityLonglineObsDto.message.not.open"));
|
| 337 | 335 |
break;
|
| 338 | 336 |
}
|
| ... | ... | @@ -35,7 +35,6 @@ import fr.ird.observe.services.action.LoadFormServiceActionFactory; |
| 35 | 35 |
import fr.ird.observe.services.action.SaveServiceAction;
|
| 36 | 36 |
import fr.ird.observe.services.action.SaveServiceActionFactory;
|
| 37 | 37 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 38 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 39 | 38 |
|
| 40 | 39 |
|
| 41 | 40 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -110,12 +109,11 @@ public class LonglineGlobalCompositionObsUIHandler extends ContentUIHandler<SetL |
| 110 | 109 |
case CREATE:
|
| 111 | 110 |
break;
|
| 112 | 111 |
case UPDATE:
|
| 113 |
- addInfoMessage(t("observe.common.LonglineGlobalCompositionDto.message.updating"));
|
|
| 112 |
+ addTitleInfoMessage(t("observe.common.LonglineGlobalCompositionDto.message.updating"));
|
|
| 114 | 113 |
break;
|
| 115 | 114 |
case READ:
|
| 116 |
- addMessage(getUi(),
|
|
| 117 |
- NuitonValidatorScope.INFO,
|
|
| 118 |
- getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 115 |
+ addInfoMessage(
|
|
| 116 |
+ ActivityLonglineObsDto.class,
|
|
| 119 | 117 |
t("observe.common.ActivityLonglineObsDto.message.not.open"));
|
| 120 | 118 |
|
| 121 | 119 |
break;
|
| ... | ... | @@ -150,12 +148,6 @@ public class LonglineGlobalCompositionObsUIHandler extends ContentUIHandler<SetL |
| 150 | 148 |
}
|
| 151 | 149 |
|
| 152 | 150 |
@Override
|
| 153 |
- protected void prepareValidationContext() {
|
|
| 154 |
- super.prepareValidationContext();
|
|
| 155 |
- setValidatorContext(ui.getValidator());
|
|
| 156 |
- }
|
|
| 157 |
- |
|
| 158 |
- @Override
|
|
| 159 | 151 |
protected void updateExtra() {
|
| 160 | 152 |
getUi().getFloatlinesCompositionUI().open();
|
| 161 | 153 |
getUi().getBranchlinesCompositionUI().open();
|
| ... | ... | @@ -62,6 +62,7 @@ |
| 62 | 62 |
latitude:{bean.getSettingStartLatitude()};
|
| 63 | 63 |
longitude:{bean.getSettingStartLongitude()};
|
| 64 | 64 |
quadrant:{bean.getSettingStartQuadrant()};
|
| 65 |
+ _validationContext:{"settingStart"};
|
|
| 65 | 66 |
}
|
| 66 | 67 |
|
| 67 | 68 |
#settingEndTimeStamp {
|
| ... | ... | @@ -76,6 +77,7 @@ |
| 76 | 77 |
latitude:{bean.getSettingEndLatitude()};
|
| 77 | 78 |
longitude:{bean.getSettingEndLongitude()};
|
| 78 | 79 |
quadrant:{bean.getSettingEndQuadrant()};
|
| 80 |
+ _validationContext:{"settingEnd"};
|
|
| 79 | 81 |
}
|
| 80 | 82 |
|
| 81 | 83 |
/* ***************************************************************************** */
|
| ... | ... | @@ -220,6 +222,7 @@ |
| 220 | 222 |
latitude:{bean.getHaulingStartLatitude()};
|
| 221 | 223 |
longitude:{bean.getHaulingStartLongitude()};
|
| 222 | 224 |
quadrant:{bean.getHaulingStartQuadrant()};
|
| 225 |
+ _validationContext:{"haulingStart"};
|
|
| 223 | 226 |
}
|
| 224 | 227 |
|
| 225 | 228 |
#haulingEndTimeStamp {
|
| ... | ... | @@ -234,6 +237,7 @@ |
| 234 | 237 |
latitude:{bean.getHaulingEndLatitude()};
|
| 235 | 238 |
longitude:{bean.getHaulingEndLongitude()};
|
| 236 | 239 |
quadrant:{bean.getHaulingEndQuadrant()};
|
| 240 |
+ _validationContext:{"haulingEnd"};
|
|
| 237 | 241 |
}
|
| 238 | 242 |
|
| 239 | 243 |
#haulingBreaks {
|
| ... | ... | @@ -22,7 +22,6 @@ package fr.ird.observe.client.ui.content.data.longline; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import fr.ird.observe.client.ObserveClientApplicationContext;
|
|
| 26 | 25 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 27 | 26 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 28 | 27 |
import fr.ird.observe.client.ui.content.spi.ContentUIHandler;
|
| ... | ... | @@ -30,7 +29,6 @@ import fr.ird.observe.client.ui.content.spi.ContentUIMode; |
| 30 | 29 |
import fr.ird.observe.client.ui.content.spi.action.OpenAction;
|
| 31 | 30 |
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
| 32 | 31 |
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 33 |
-import fr.ird.observe.client.validation.ClientValidationContext;
|
|
| 34 | 32 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
| 35 | 33 |
import fr.ird.observe.dto.data.longline.SetLonglineObsDto;
|
| 36 | 34 |
import fr.ird.observe.dto.data.longline.SetLonglineObsReference;
|
| ... | ... | @@ -42,7 +40,6 @@ import fr.ird.observe.services.action.SaveServiceAction; |
| 42 | 40 |
import fr.ird.observe.services.action.SaveServiceActionFactory;
|
| 43 | 41 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 44 | 42 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| 45 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 46 | 43 |
|
| 47 | 44 |
|
| 48 | 45 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -100,9 +97,8 @@ public class SetLonglineObsUIHandler extends ContentUIHandler<SetLonglineObsDto, |
| 100 | 97 |
addInfoMessage(t("observe.common.SetLonglineObsDto.message.updating"));
|
| 101 | 98 |
break;
|
| 102 | 99 |
case READ:
|
| 103 |
- addMessage(getUi(),
|
|
| 104 |
- NuitonValidatorScope.INFO,
|
|
| 105 |
- getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 100 |
+ addInfoMessage(
|
|
| 101 |
+ ActivityLonglineObsDto.class,
|
|
| 106 | 102 |
t("observe.common.ActivityLonglineObsDto.message.not.open"));
|
| 107 | 103 |
break;
|
| 108 | 104 |
}
|
| ... | ... | @@ -120,17 +116,6 @@ public class SetLonglineObsUIHandler extends ContentUIHandler<SetLonglineObsDto, |
| 120 | 116 |
loadOrPreCreateForm(activityId, setId);
|
| 121 | 117 |
}
|
| 122 | 118 |
|
| 123 |
- @Override
|
|
| 124 |
- protected void prepareValidationContext() {
|
|
| 125 |
- super.prepareValidationContext();
|
|
| 126 |
- |
|
| 127 |
- ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 128 |
- validationContext.setCoordinatesEditor("haulingStart", getUi().getHaulingStartCoordinates());
|
|
| 129 |
- validationContext.setCoordinatesEditor("haulingEnd", getUi().getHaulingEndCoordinates());
|
|
| 130 |
- validationContext.setCoordinatesEditor("settingStart", getUi().getSettingStartCoordinates());
|
|
| 131 |
- validationContext.setCoordinatesEditor("settingEnd", getUi().getSettingEndCoordinates());
|
|
| 132 |
- setValidatorContext(ui.getValidator());
|
|
| 133 |
- }
|
|
| 134 | 119 |
};
|
| 135 | 120 |
}
|
| 136 | 121 |
|
| ... | ... | @@ -44,6 +44,7 @@ |
| 44 | 44 |
propertyLatitude:{ActivitySeineDto.PROPERTY_LATITUDE};
|
| 45 | 45 |
propertyLongitude:{ActivitySeineDto.PROPERTY_LONGITUDE};
|
| 46 | 46 |
propertyQuadrant:{ActivitySeineDto.PROPERTY_QUADRANT};
|
| 47 |
+ _validationContext:{"coordinate"};
|
|
| 47 | 48 |
}
|
| 48 | 49 |
|
| 49 | 50 |
#generalTab {
|
| ... | ... | @@ -21,14 +21,12 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.client.ui.content.data.seine;
|
| 23 | 23 |
|
| 24 |
-import fr.ird.observe.client.ObserveClientApplicationContext;
|
|
| 25 | 24 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 26 | 25 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 27 | 26 |
import fr.ird.observe.client.ui.content.spi.ContentUIMode;
|
| 28 |
-import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIOpenAction;
|
|
| 29 | 27 |
import fr.ird.observe.client.ui.content.spi.action.OpenAction;
|
| 30 | 28 |
import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIHandler;
|
| 31 |
-import fr.ird.observe.client.validation.ClientValidationContext;
|
|
| 29 |
+import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIOpenAction;
|
|
| 32 | 30 |
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
| 33 | 31 |
import fr.ird.observe.dto.data.seine.RouteDto;
|
| 34 | 32 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| ... | ... | @@ -42,7 +40,6 @@ import java.util.List; |
| 42 | 40 |
import java.util.Optional;
|
| 43 | 41 |
import javax.swing.SwingUtilities;
|
| 44 | 42 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 45 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 46 | 43 |
|
| 47 | 44 |
|
| 48 | 45 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -107,29 +104,25 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 107 | 104 |
protected void computeDefaultMessages() {
|
| 108 | 105 |
switch (model.getContentMode()) {
|
| 109 | 106 |
case CREATE:
|
| 110 |
- addMessage(ui,
|
|
| 111 |
- NuitonValidatorScope.INFO,
|
|
| 112 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 107 |
+ addInfoMessage(
|
|
| 108 |
+ ActivitySeineDto.class,
|
|
| 113 | 109 |
t("observe.common.ActivitySeineDto.message.creating"));
|
| 114 | 110 |
break;
|
| 115 | 111 |
case UPDATE:
|
| 116 |
- addMessage(ui,
|
|
| 117 |
- NuitonValidatorScope.INFO,
|
|
| 118 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 112 |
+ addInfoMessage(
|
|
| 113 |
+ ActivitySeineDto.class,
|
|
| 119 | 114 |
t("observe.common.ActivitySeineDto.message.updating"));
|
| 120 | 115 |
break;
|
| 121 | 116 |
case READ:
|
| 122 | 117 |
if (!getOpenDataManager().isOpenRoute(getSelectedParentId())) {
|
| 123 |
- addMessage(ui,
|
|
| 124 |
- NuitonValidatorScope.INFO,
|
|
| 125 |
- getTypeI18nKey(RouteDto.class),
|
|
| 118 |
+ addInfoMessage(
|
|
| 119 |
+ RouteDto.class,
|
|
| 126 | 120 |
t("observe.common.RouteDto.message.not.open"));
|
| 127 | 121 |
break;
|
| 128 | 122 |
}
|
| 129 | 123 |
if (!getOpenDataManager().isOpenTripSeine(getDataContext().getSelectedTripSeineId())) {
|
| 130 |
- addMessage(ui,
|
|
| 131 |
- NuitonValidatorScope.INFO,
|
|
| 132 |
- getTypeI18nKey(TripSeineDto.class),
|
|
| 124 |
+ addInfoMessage(
|
|
| 125 |
+ TripSeineDto.class,
|
|
| 133 | 126 |
t("observe.common.TripSeineDto.message.not.open"));
|
| 134 | 127 |
if (getModel().isHistoricalData()) {
|
| 135 | 128 |
addInfoMessage(t("observe.common.DataDto.message.historical.data"));
|
| ... | ... | @@ -160,15 +153,6 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 160 | 153 |
}
|
| 161 | 154 |
|
| 162 | 155 |
@Override
|
| 163 |
- protected void prepareValidationContext() {
|
|
| 164 |
- super.prepareValidationContext();
|
|
| 165 |
- |
|
| 166 |
- ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 167 |
- validationContext.setCoordinatesEditor("coordinate", getUi().getCoordinatesEditor());
|
|
| 168 |
- setValidatorContext(ui.getValidator());
|
|
| 169 |
- }
|
|
| 170 |
- |
|
| 171 |
- @Override
|
|
| 172 | 156 |
protected boolean computeCanReopen() {
|
| 173 | 157 |
return getOpenDataManager().canOpenActivitySeine(getSelectedParentId());
|
| 174 | 158 |
}
|
| ... | ... | @@ -48,7 +48,6 @@ import javax.swing.JComponent; |
| 48 | 48 |
import javax.swing.JPanel;
|
| 49 | 49 |
import javax.swing.SwingUtilities;
|
| 50 | 50 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 51 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 52 | 51 |
|
| 53 | 52 |
|
| 54 | 53 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -95,15 +94,13 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH |
| 95 | 94 |
case CREATE:
|
| 96 | 95 |
break;
|
| 97 | 96 |
case UPDATE:
|
| 98 |
- addMessage(getUi(),
|
|
| 99 |
- NuitonValidatorScope.INFO,
|
|
| 100 |
- getTypeI18nKey(FloatingObjectDto.class),
|
|
| 97 |
+ addInfoMessage(
|
|
| 98 |
+ FloatingObjectDto.class,
|
|
| 101 | 99 |
t("observe.message.updating.floatingObject"));
|
| 102 | 100 |
break;
|
| 103 | 101 |
case READ:
|
| 104 |
- addMessage(getUi(),
|
|
| 105 |
- NuitonValidatorScope.INFO,
|
|
| 106 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 102 |
+ addInfoMessage(
|
|
| 103 |
+ ActivitySeineDto.class,
|
|
| 107 | 104 |
t("observe.common.ActivitySeineDto.message.not.open"));
|
| 108 | 105 |
break;
|
| 109 | 106 |
}
|
| ... | ... | @@ -137,12 +134,6 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH |
| 137 | 134 |
}
|
| 138 | 135 |
|
| 139 | 136 |
@Override
|
| 140 |
- protected void prepareValidationContext() {
|
|
| 141 |
- super.prepareValidationContext();
|
|
| 142 |
- setValidatorContext(ui.getValidator());
|
|
| 143 |
- }
|
|
| 144 |
- |
|
| 145 |
- @Override
|
|
| 146 | 137 |
protected void attachValidators(FloatingObjectTransmittingBuoyDto bean) {
|
| 147 | 138 |
super.attachValidators(bean);
|
| 148 | 139 |
Collection<TransmittingBuoyDto> transmittingBuoy = bean.getTransmittingBuoy();
|
| ... | ... | @@ -69,7 +69,6 @@ import org.jdesktop.swingx.table.ColumnFactory; |
| 69 | 69 |
import org.jdesktop.swingx.table.TableColumnExt;
|
| 70 | 70 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 71 | 71 |
import org.nuiton.jaxx.runtime.swing.SwingUtil;
|
| 72 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 73 | 72 |
|
| 74 | 73 |
|
| 75 | 74 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -175,23 +174,19 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, |
| 175 | 174 |
protected void computeDefaultMessages() {
|
| 176 | 175 |
switch (getModel().getContentMode()) {
|
| 177 | 176 |
case CREATE:
|
| 178 |
- addMessage(getUi(),
|
|
| 179 |
- NuitonValidatorScope.INFO,
|
|
| 180 |
- getTypeI18nKey(FloatingObjectDto.class),
|
|
| 177 |
+ addInfoMessage(
|
|
| 178 |
+ FloatingObjectDto.class,
|
|
| 181 | 179 |
t("observe.common.FloatingObjectDto.message.creating"));
|
| 182 | 180 |
break;
|
| 183 | 181 |
case UPDATE:
|
| 184 |
- addMessage(getUi(),
|
|
| 185 |
- NuitonValidatorScope.INFO,
|
|
| 186 |
- getTypeI18nKey(FloatingObjectDto.class),
|
|
| 182 |
+ addInfoMessage(
|
|
| 183 |
+ FloatingObjectDto.class,
|
|
| 187 | 184 |
t("observe.common.FloatingObjectDto.message.updating"));
|
| 188 | 185 |
break;
|
| 189 | 186 |
case READ:
|
| 190 |
- addMessage(
|
|
| 191 |
- getUi(),
|
|
| 192 |
- NuitonValidatorScope.INFO,
|
|
| 193 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 194 |
- t("observe.common.ActivitySeineDto.message.not.open"));
|
|
| 187 |
+ addInfoMessage(
|
|
| 188 |
+ ActivitySeineDto.class,
|
|
| 189 |
+ t("observe.common.ActivitySeineDto.message.not.open"));
|
|
| 195 | 190 |
break;
|
| 196 | 191 |
}
|
| 197 | 192 |
}
|
| ... | ... | @@ -57,7 +57,6 @@ import javax.swing.JOptionPane; |
| 57 | 57 |
import javax.swing.JTable;
|
| 58 | 58 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 59 | 59 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 60 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 61 | 60 |
|
| 62 | 61 |
|
| 63 | 62 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -195,9 +194,8 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei |
| 195 | 194 |
|
| 196 | 195 |
// mode read
|
| 197 | 196 |
|
| 198 |
- addMessage(getUi(),
|
|
| 199 |
- NuitonValidatorScope.INFO,
|
|
| 200 |
- getTypeI18nKey(TripSeineDto.class),
|
|
| 197 |
+ addInfoMessage(
|
|
| 198 |
+ TripSeineDto.class,
|
|
| 201 | 199 |
t("observe.common.TripSeineDto.message.not.open"));
|
| 202 | 200 |
|
| 203 | 201 |
return ContentUIMode.READ;
|
| ... | ... | @@ -55,7 +55,6 @@ import javax.swing.JTable; |
| 55 | 55 |
import javax.swing.SwingUtilities;
|
| 56 | 56 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 57 | 57 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 58 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 59 | 58 |
|
| 60 | 59 |
|
| 61 | 60 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -189,9 +188,8 @@ public class NonTargetCatchReleaseUIHandler extends ContentTableUIHandler<SetSei |
| 189 | 188 |
|
| 190 | 189 |
removeAllMessages(ui);
|
| 191 | 190 |
|
| 192 |
- addMessage(getUi(),
|
|
| 193 |
- NuitonValidatorScope.INFO,
|
|
| 194 |
- getTypeI18nKey(SetSeineDto.class),
|
|
| 191 |
+ addInfoMessage(
|
|
| 192 |
+ SetSeineDto.class,
|
|
| 195 | 193 |
t("observe.common.SetSeineDto.message.no.nonTargetCatchRelease"));
|
| 196 | 194 |
}
|
| 197 | 195 |
}
|
| ... | ... | @@ -46,7 +46,6 @@ import javax.swing.JComponent; |
| 46 | 46 |
import javax.swing.JTable;
|
| 47 | 47 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 48 | 48 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 49 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 50 | 49 |
|
| 51 | 50 |
|
| 52 | 51 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -144,10 +143,8 @@ public class NonTargetSampleUIHandler extends AbstractSampleUIHandler<NonTargetS |
| 144 | 143 |
// on repasse en mode resteint car on ne peut pas éditer l'écran
|
| 145 | 144 |
mode = ContentUIMode.READ;
|
| 146 | 145 |
|
| 147 |
- addMessage(getUi(),
|
|
| 148 |
- NuitonValidatorScope.INFO,
|
|
| 149 |
- getTypeI18nKey(SetSeineDto.class),
|
|
| 150 |
- t("observe.common.SetSeineDto.message.no.nonTargetDiscarded"));
|
|
| 146 |
+ addInfoMessage(SetSeineDto.class,
|
|
| 147 |
+ t("observe.common.SetSeineDto.message.no.nonTargetDiscarded"));
|
|
| 151 | 148 |
}
|
| 152 | 149 |
return mode;
|
| 153 | 150 |
}
|
| ... | ... | @@ -25,9 +25,9 @@ import fr.ird.observe.client.ObserveClientApplicationContext; |
| 25 | 25 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 26 | 26 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 27 | 27 |
import fr.ird.observe.client.ui.content.spi.ContentUIMode;
|
| 28 |
-import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIOpenAction;
|
|
| 29 | 28 |
import fr.ird.observe.client.ui.content.spi.action.OpenAction;
|
| 30 | 29 |
import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIHandler;
|
| 30 |
+import fr.ird.observe.client.ui.content.spi.open.ContentOpenableUIOpenAction;
|
|
| 31 | 31 |
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
| 32 | 32 |
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 33 | 33 |
import fr.ird.observe.client.ui.util.UIHelper;
|
| ... | ... | @@ -44,7 +44,6 @@ import java.util.Date; |
| 44 | 44 |
import javax.swing.JOptionPane;
|
| 45 | 45 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 46 | 46 |
import org.nuiton.util.DateUtil;
|
| 47 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 48 | 47 |
|
| 49 | 48 |
|
| 50 | 49 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -93,15 +92,13 @@ class RouteUIHandler extends ContentOpenableUIHandler<RouteDto, RouteUI> impleme |
| 93 | 92 |
protected void computeDefaultMessages() {
|
| 94 | 93 |
switch (getModel().getContentMode()) {
|
| 95 | 94 |
case CREATE:
|
| 96 |
- addMessage(ui,
|
|
| 97 |
- NuitonValidatorScope.INFO,
|
|
| 98 |
- getTypeI18nKey(RouteDto.class),
|
|
| 95 |
+ addInfoMessage(
|
|
| 96 |
+ RouteDto.class,
|
|
| 99 | 97 |
t("observe.common.RouteDto.message.creating"));
|
| 100 | 98 |
break;
|
| 101 | 99 |
case UPDATE:
|
| 102 |
- addMessage(ui,
|
|
| 103 |
- NuitonValidatorScope.INFO,
|
|
| 104 |
- getTypeI18nKey(RouteDto.class),
|
|
| 100 |
+ addInfoMessage(
|
|
| 101 |
+ RouteDto.class,
|
|
| 105 | 102 |
t("observe.common.RouteDto.message.updating"));
|
| 106 | 103 |
|
| 107 | 104 |
if (getModel().isHistoricalData()) {
|
| ... | ... | @@ -111,12 +108,12 @@ class RouteUIHandler extends ContentOpenableUIHandler<RouteDto, RouteUI> impleme |
| 111 | 108 |
break;
|
| 112 | 109 |
case READ:
|
| 113 | 110 |
if (!getDataContext().isSelectedOpen(TripSeineDto.class)) {
|
| 114 |
- addMessage(ui, NuitonValidatorScope.INFO,
|
|
| 115 |
- getTypeI18nKey(TripSeineDto.class),
|
|
| 111 |
+ addInfoMessage(
|
|
| 112 |
+ TripSeineDto.class,
|
|
| 116 | 113 |
t("observe.common.TripSeineDto.message.not.open"));
|
| 117 | 114 |
|
| 118 | 115 |
} else {
|
| 119 |
- addMessage(ui, NuitonValidatorScope.INFO, getTypeI18nKey(RouteDto.class), t("observe.common.RouteDto.message.not.open"));
|
|
| 116 |
+ addInfoMessage(RouteDto.class, t("observe.common.RouteDto.message.not.open"));
|
|
| 120 | 117 |
}
|
| 121 | 118 |
break;
|
| 122 | 119 |
}
|
| ... | ... | @@ -133,13 +130,6 @@ class RouteUIHandler extends ContentOpenableUIHandler<RouteDto, RouteUI> impleme |
| 133 | 130 |
}
|
| 134 | 131 |
|
| 135 | 132 |
@Override
|
| 136 |
- protected void prepareValidationContext() {
|
|
| 137 |
- super.prepareValidationContext();
|
|
| 138 |
- setValidatorContext(ui.getValidator());
|
|
| 139 |
- |
|
| 140 |
- }
|
|
| 141 |
- |
|
| 142 |
- @Override
|
|
| 143 | 133 |
protected boolean computeCanReopen() {
|
| 144 | 134 |
|
| 145 | 135 |
// on peut reouvrir une route si :
|
| ... | ... | @@ -44,7 +44,6 @@ import java.util.Date; |
| 44 | 44 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 45 | 45 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| 46 | 46 |
import org.nuiton.util.DateUtil;
|
| 47 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 48 | 47 |
|
| 49 | 48 |
|
| 50 | 49 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -100,9 +99,8 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto, SetSeineUI> |
| 100 | 99 |
addInfoMessage(t("observe.common.SetSeineDto.message.updating"));
|
| 101 | 100 |
break;
|
| 102 | 101 |
case READ:
|
| 103 |
- addMessage(getUi(),
|
|
| 104 |
- NuitonValidatorScope.INFO,
|
|
| 105 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 102 |
+ addInfoMessage(
|
|
| 103 |
+ ActivitySeineDto.class,
|
|
| 106 | 104 |
t("observe.common.ActivitySeineDto.message.not.open"));
|
| 107 | 105 |
break;
|
| 108 | 106 |
}
|
| ... | ... | @@ -134,12 +132,6 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto, SetSeineUI> |
| 134 | 132 |
|
| 135 | 133 |
}
|
| 136 | 134 |
|
| 137 |
- @Override
|
|
| 138 |
- protected void prepareValidationContext() {
|
|
| 139 |
- super.prepareValidationContext();
|
|
| 140 |
- setValidatorContext(ui.getValidator());
|
|
| 141 |
- }
|
|
| 142 |
- |
|
| 143 | 135 |
};
|
| 144 | 136 |
}
|
| 145 | 137 |
|
| ... | ... | @@ -48,7 +48,6 @@ import javax.swing.JTable; |
| 48 | 48 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 49 | 49 |
import org.apache.commons.logging.Log;
|
| 50 | 50 |
import org.apache.commons.logging.LogFactory;
|
| 51 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 52 | 51 |
|
| 53 | 52 |
|
| 54 | 53 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -160,9 +159,8 @@ public class TargetSampleUIHandler<U extends ContentTableUI<TargetSampleDto, Tar |
| 160 | 159 |
|
| 161 | 160 |
mode = ContentUIMode.READ;
|
| 162 | 161 |
|
| 163 |
- addMessage(getUi(),
|
|
| 164 |
- NuitonValidatorScope.INFO,
|
|
| 165 |
- getTypeI18nKey(SetSeineDto.class),
|
|
| 162 |
+ addInfoMessage(
|
|
| 163 |
+ SetSeineDto.class,
|
|
| 166 | 164 |
discarded ?
|
| 167 | 165 |
t("observe.common.SetSeineDto.message.no.targetCatch") :
|
| 168 | 166 |
t("observe.common.SetSeineDto.message.no.targetDiscarded")
|
| ... | ... | @@ -177,12 +177,6 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein |
| 177 | 177 |
}
|
| 178 | 178 |
|
| 179 | 179 |
@Override
|
| 180 |
- protected void prepareValidationContext() {
|
|
| 181 |
- super.prepareValidationContext();
|
|
| 182 |
- setValidatorContext(ui.getValidator());
|
|
| 183 |
- }
|
|
| 184 |
- |
|
| 185 |
- @Override
|
|
| 186 | 180 |
protected void setForm() {
|
| 187 | 181 |
|
| 188 | 182 |
String programId = getSelectedParentId();
|
| ... | ... | @@ -526,7 +526,11 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E>> |
| 526 | 526 |
}
|
| 527 | 527 |
|
| 528 | 528 |
protected void addInfoMessage(String message) {
|
| 529 |
- addMessage(ui, NuitonValidatorScope.INFO, getTypeI18nKey(getModel().getBeanType()), t(message));
|
|
| 529 |
+ addMessage(NuitonValidatorScope.INFO, getModel().getBeanType(), t(message));
|
|
| 530 |
+ }
|
|
| 531 |
+ |
|
| 532 |
+ public void addMessage(NuitonValidatorScope scope, Class fieldName, String message) {
|
|
| 533 |
+ openAction.addInfoMessage(fieldName, message);
|
|
| 530 | 534 |
}
|
| 531 | 535 |
|
| 532 | 536 |
protected String getTypeI18nKey(Class<?> klass) {
|
| ... | ... | @@ -39,6 +39,7 @@ import fr.ird.observe.client.ui.content.spi.init.TabInfoInitializer; |
| 39 | 39 |
import fr.ird.observe.client.ui.content.spi.referential.ContentReferentialUIHandler;
|
| 40 | 40 |
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
| 41 | 41 |
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 42 |
+import fr.ird.observe.client.validation.ClientValidationContext;
|
|
| 42 | 43 |
import fr.ird.observe.dto.IdDto;
|
| 43 | 44 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 44 | 45 |
import fr.ird.observe.dto.form.Form;
|
| ... | ... | @@ -47,6 +48,8 @@ import fr.ird.observe.services.action.LoadFormRequestDto; |
| 47 | 48 |
import fr.ird.observe.services.action.PreCreateFormRequestDto;
|
| 48 | 49 |
import java.awt.Component;
|
| 49 | 50 |
import java.awt.FocusTraversalPolicy;
|
| 51 |
+import java.util.List;
|
|
| 52 |
+import java.util.Objects;
|
|
| 50 | 53 |
import javax.swing.JComponent;
|
| 51 | 54 |
import javax.swing.JToolBar;
|
| 52 | 55 |
import javax.swing.SwingUtilities;
|
| ... | ... | @@ -58,9 +61,11 @@ import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel; |
| 58 | 61 |
import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
|
| 59 | 62 |
import org.nuiton.jaxx.widgets.datetime.DateTimeEditor;
|
| 60 | 63 |
import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor;
|
| 64 |
+import org.nuiton.jaxx.widgets.select.BeanListHeader;
|
|
| 61 | 65 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 62 | 66 |
|
| 63 | 67 |
|
| 68 |
+import static fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper.getTypeI18nKey;
|
|
| 64 | 69 |
import static org.nuiton.i18n.I18n.t;
|
| 65 | 70 |
|
| 66 | 71 |
/**
|
| ... | ... | @@ -96,7 +101,6 @@ public abstract class OpenAction<E extends IdDto, U extends ContentUI<E>> { |
| 96 | 101 |
}
|
| 97 | 102 |
|
| 98 | 103 |
public final void run() {
|
| 99 |
- |
|
| 100 | 104 |
initModel();
|
| 101 | 105 |
resetValidationContext();
|
| 102 | 106 |
initUi();
|
| ... | ... | @@ -142,14 +146,12 @@ public abstract class OpenAction<E extends IdDto, U extends ContentUI<E>> { |
| 142 | 146 |
}
|
| 143 | 147 |
|
| 144 | 148 |
protected void updateExtra() {
|
| 145 |
- |
|
| 146 | 149 |
}
|
| 147 | 150 |
|
| 148 | 151 |
public void startEditUI() {
|
| 149 | 152 |
prepareValidationContext();
|
| 150 | 153 |
setEditing();
|
| 151 | 154 |
attachValidators();
|
| 152 |
-// UIHelper.processDataBinding(ui, "reset.enabled", "save.enabled");
|
|
| 153 | 155 |
}
|
| 154 | 156 |
|
| 155 | 157 |
protected void setTitle() {
|
| ... | ... | @@ -198,15 +200,24 @@ public abstract class OpenAction<E extends IdDto, U extends ContentUI<E>> { |
| 198 | 200 |
ObserveClientApplicationContext.get().getValidationContext().reset();
|
| 199 | 201 |
}
|
| 200 | 202 |
|
| 201 |
- protected void prepareValidationContext() {
|
|
| 202 |
- |
|
| 203 |
- // reset all validators
|
|
| 203 |
+ private void prepareValidationContext() {
|
|
| 204 | 204 |
detachValidators();
|
| 205 |
- |
|
| 206 |
- // reset validation cache
|
|
| 207 | 205 |
resetValidationContext();
|
| 208 |
- |
|
| 209 |
- setValidatorContext((SwingValidator<?>) ui.getObjectById("validator"));
|
|
| 206 |
+ SwingValidator<?> validator = (SwingValidator<?>) ui.getObjectById("validator");
|
|
| 207 |
+ if (validator != null) {
|
|
| 208 |
+ setValidatorContext(validator);
|
|
| 209 |
+ }
|
|
| 210 |
+ ImmutableCollection<CoordinatesEditor> coordinatesEditors = formManager.getCoordinatesEditors();
|
|
| 211 |
+ if (coordinatesEditors != null) {
|
|
| 212 |
+ CoordinatesEditorInitializer.prepareValidationContext(coordinatesEditors);
|
|
| 213 |
+ }
|
|
| 214 |
+ BeanListHeader referentialListHeader = (BeanListHeader) ui.getObjectById("referentialListHeader");
|
|
| 215 |
+ if (referentialListHeader != null) {
|
|
| 216 |
+ List data = referentialListHeader.getData();
|
|
| 217 |
+ ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 218 |
+ log.debug(String.format("%s Set referentiel list [%s] in validation context : %d", prefix, getModel().getBeanType().getSimpleName(), data.size()));
|
|
| 219 |
+ validationContext.setEditingReferentielList(data);
|
|
| 220 |
+ }
|
|
| 210 | 221 |
}
|
| 211 | 222 |
|
| 212 | 223 |
protected void attachValidators(E bean) {
|
| ... | ... | @@ -217,7 +228,8 @@ public abstract class OpenAction<E extends IdDto, U extends ContentUI<E>> { |
| 217 | 228 |
SwingValidatorUtil.setValidatorBean(ui, null);
|
| 218 | 229 |
}
|
| 219 | 230 |
|
| 220 |
- protected void setValidatorContext(SwingValidator<?> validator) {
|
|
| 231 |
+ private void setValidatorContext(SwingValidator<?> validator) {
|
|
| 232 |
+ Objects.requireNonNull(validator);
|
|
| 221 | 233 |
validator.setContext(model.getContentMode().name().toLowerCase());
|
| 222 | 234 |
}
|
| 223 | 235 |
|
| ... | ... | @@ -231,21 +243,30 @@ public abstract class OpenAction<E extends IdDto, U extends ContentUI<E>> { |
| 231 | 243 |
}
|
| 232 | 244 |
|
| 233 | 245 |
protected void addInfoMessage(String message) {
|
| 234 |
- addMessage(ui, NuitonValidatorScope.INFO, ObserveI18nDecoratorHelper.getTypeI18nKey(model.getBeanType()), t(message));
|
|
| 246 |
+ addInfoMessage(model.getBeanType(), t(message));
|
|
| 247 |
+ }
|
|
| 248 |
+ |
|
| 249 |
+ protected void addTitleInfoMessage(String message) {
|
|
| 250 |
+ addTitleMessage(NuitonValidatorScope.INFO, model.getBeanType(), t(message));
|
|
| 251 |
+ }
|
|
| 252 |
+ |
|
| 253 |
+ public void addInfoMessage(Class fieldName, String message) {
|
|
| 254 |
+ SwingValidatorMessageTableModel model = ui.getErrorTableModel();
|
|
| 255 |
+ model.addMessages(ui, getTypeI18nKey(fieldName), NuitonValidatorScope.INFO, message);
|
|
| 235 | 256 |
}
|
| 236 | 257 |
|
| 237 |
- public static <E extends IdDto, U extends ContentUI<E>> void addMessage(U ui, NuitonValidatorScope scope, String fieldName, String message) {
|
|
| 258 |
+ private void addTitleMessage(NuitonValidatorScope scope, Class fieldName, String message) {
|
|
| 238 | 259 |
SwingValidatorMessageTableModel model = ui.getErrorTableModel();
|
| 239 |
- model.addMessages(ui, fieldName, scope, message);
|
|
| 260 |
+ model.addMessages(ui, ObserveI18nDecoratorHelper.getTitle(fieldName), scope, message);
|
|
| 240 | 261 |
}
|
| 241 | 262 |
|
| 242 |
- protected void fixFormSize() {
|
|
| 263 |
+ private void fixFormSize() {
|
|
| 243 | 264 |
|
| 244 | 265 |
// we want to see the hole form on screen
|
| 245 |
- ui.setMinimumSize(ui.getPreferredSize());
|
|
| 266 |
+// ui.setMinimumSize(ui.getPreferredSize());
|
|
| 246 | 267 |
}
|
| 247 | 268 |
|
| 248 |
- protected void grabFocusOnForm() {
|
|
| 269 |
+ private void grabFocusOnForm() {
|
|
| 249 | 270 |
ObserveMainUI mainUI = ObserveClientApplicationContext.get().getMainUI();
|
| 250 | 271 |
boolean focusOnNavigation = mainUI.getModel().isFocusOnNavigation();
|
| 251 | 272 |
if (focusOnNavigation) {
|
| ... | ... | @@ -26,10 +26,12 @@ import com.google.common.collect.ImmutableCollection; |
| 26 | 26 |
import fr.ird.observe.client.ObserveClientApplicationContext;
|
| 27 | 27 |
import fr.ird.observe.client.ui.content.spi.ContentUI;
|
| 28 | 28 |
import fr.ird.observe.client.ui.content.spi.ContentUIInitializerContext;
|
| 29 |
+import fr.ird.observe.client.validation.ClientValidationContext;
|
|
| 29 | 30 |
import fr.ird.observe.dto.IdDto;
|
| 30 | 31 |
import io.ultreia.java4all.lang.GetterProducer;
|
| 31 | 32 |
import java.beans.PropertyChangeEvent;
|
| 32 | 33 |
import java.beans.PropertyChangeListener;
|
| 34 |
+import java.util.Objects;
|
|
| 33 | 35 |
import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
|
| 34 | 36 |
import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor;
|
| 35 | 37 |
import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditorModel;
|
| ... | ... | @@ -41,6 +43,8 @@ import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditorModel; |
| 41 | 43 |
*/
|
| 42 | 44 |
public class CoordinatesEditorInitializer<E extends IdDto, U extends ContentUI<E>> extends ContentUIComponentInitializerSupport<CoordinatesEditor, E, U> {
|
| 43 | 45 |
|
| 46 |
+ private static final String VALIDATION_CONTEXT_CLIENT_PROPERTY = "validationContext";
|
|
| 47 |
+ |
|
| 44 | 48 |
public CoordinatesEditorInitializer() {
|
| 45 | 49 |
super(CoordinatesEditor.class);
|
| 46 | 50 |
}
|
| ... | ... | @@ -54,7 +58,9 @@ public class CoordinatesEditorInitializer<E extends IdDto, U extends ContentUI<E |
| 54 | 58 |
component.getDmdFormat().setFocusable(false);
|
| 55 | 59 |
component.getDmsFormat().setFocusable(false);
|
| 56 | 60 |
component.getDdFormat().setFocusable(false);
|
| 57 |
- |
|
| 61 |
+ // check we have
|
|
| 62 |
+ String validationContextName = getValidationContextName(component);
|
|
| 63 |
+ Objects.requireNonNull(validationContextName, String.format("No ValidationContext client property found on %s in %s", component.getName(), context.getUi().getClass().getName()));
|
|
| 58 | 64 |
}
|
| 59 | 65 |
|
| 60 | 66 |
public static void install(ImmutableCollection<CoordinatesEditor> components) {
|
| ... | ... | @@ -89,6 +95,18 @@ public class CoordinatesEditorInitializer<E extends IdDto, U extends ContentUI<E |
| 89 | 95 |
}
|
| 90 | 96 |
}
|
| 91 | 97 |
|
| 98 |
+ public static <U extends ContentUI> void prepareValidationContext(ImmutableCollection<CoordinatesEditor> components) {
|
|
| 99 |
+ ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 100 |
+ for (CoordinatesEditor component : components) {
|
|
| 101 |
+ String validationContextName = getValidationContextName(component);
|
|
| 102 |
+ validationContext.setCoordinatesEditor(validationContextName, component);
|
|
| 103 |
+ }
|
|
| 104 |
+ }
|
|
| 105 |
+ |
|
| 106 |
+ private static String getValidationContextName(CoordinatesEditor component) {
|
|
| 107 |
+ return (String) component.getClientProperty(VALIDATION_CONTEXT_CLIENT_PROPERTY);
|
|
| 108 |
+ }
|
|
| 109 |
+ |
|
| 92 | 110 |
private static class MyPropertyChangeListener implements PropertyChangeListener {
|
| 93 | 111 |
|
| 94 | 112 |
private final ImmutableCollection<CoordinatesEditor> components;
|
| ... | ... | @@ -57,7 +57,7 @@ public abstract class ContentReferentialUIOpenAction<E extends ReferentialDto, R |
| 57 | 57 |
/** Logger. */
|
| 58 | 58 |
private static final Log log = LogFactory.getLog(ContentReferentialUIOpenAction.class);
|
| 59 | 59 |
|
| 60 |
- public ContentReferentialUIOpenAction(U ui, ContentUIFormManager<E, ?> formManager, ObserveSwingDataSource dataSource, ClientDataContext dataContext, String prefix) {
|
|
| 60 |
+ ContentReferentialUIOpenAction(U ui, ContentUIFormManager<E, ?> formManager, ObserveSwingDataSource dataSource, ClientDataContext dataContext, String prefix) {
|
|
| 61 | 61 |
super(ui, formManager, dataSource, dataContext, prefix);
|
| 62 | 62 |
}
|
| 63 | 63 |
|
| ... | ... | @@ -194,22 +194,9 @@ public abstract class ContentReferentialUIOpenAction<E extends ReferentialDto, R |
| 194 | 194 |
// pass in editing mode (without any modification possible)
|
| 195 | 195 |
model.setEditing(true);
|
| 196 | 196 |
|
| 197 |
- ObserveClientApplicationContext applicationContext = ObserveClientApplicationContext.get();
|
|
| 198 |
- ClientValidationContext validationContext = applicationContext.getValidationContext();
|
|
| 197 |
+ ClientValidationContext validationContext = ObserveClientApplicationContext.get().getValidationContext();
|
|
| 199 | 198 |
validationContext.reset();
|
| 200 | 199 |
}
|
| 201 | 200 |
}
|
| 202 | 201 |
|
| 203 |
- @Override
|
|
| 204 |
- protected void prepareValidationContext() {
|
|
| 205 |
- super.prepareValidationContext();
|
|
| 206 |
- BeanListHeader<R> jList = ui.getReferentialListHeader();
|
|
| 207 |
- List<R> data = jList.getData();
|
|
| 208 |
- ObserveClientApplicationContext applicationContext = ObserveClientApplicationContext.get();
|
|
| 209 |
- ClientValidationContext validationContext = applicationContext.getValidationContext();
|
|
| 210 |
- if (log.isDebugEnabled()) {
|
|
| 211 |
- log.debug("Set referentiel list [" + getModel().getBeanType().getSimpleName() + "] in validation context : " + data.size());
|
|
| 212 |
- }
|
|
| 213 |
- validationContext.setEditingReferentielList(data);
|
|
| 214 |
- }
|
|
| 215 | 202 |
}
|
| ... | ... | @@ -34,10 +34,7 @@ import fr.ird.observe.dto.IdDto; |
| 34 | 34 |
import fr.ird.observe.dto.data.longline.ActivityLonglineObsDto;
|
| 35 | 35 |
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
| 36 | 36 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 37 |
-import java.awt.Dimension;
|
|
| 38 | 37 |
import javax.swing.JButton;
|
| 39 |
-import javax.swing.JSplitPane;
|
|
| 40 |
-import org.nuiton.validator.NuitonValidatorScope;
|
|
| 41 | 38 |
|
| 42 | 39 |
|
| 43 | 40 |
import static org.nuiton.i18n.I18n.n;
|
| ... | ... | @@ -96,18 +93,16 @@ public abstract class ContentTableUIOpenAction<E extends IdDto, D extends IdDto, |
| 96 | 93 |
NavigationTreeNodeSupport node = getNavigationTree().getSelectedNode();
|
| 97 | 94 |
String entityLabel = ObserveI18nDecoratorHelper.getTypeI18nKey(node.getParent().getDataType());
|
| 98 | 95 |
message = t(message, t(entityLabel));
|
| 99 |
- addMessage(ui, NuitonValidatorScope.INFO, entityLabel, message);
|
|
| 96 |
+ addInfoMessage(node.getParent().getDataType(), message);
|
|
| 100 | 97 |
break;
|
| 101 | 98 |
case READ:
|
| 102 | 99 |
if (dataContext.isSelectedActivityLongline()) {
|
| 103 |
- addMessage(ui,
|
|
| 104 |
- NuitonValidatorScope.INFO,
|
|
| 105 |
- ObserveI18nDecoratorHelper.getTypeI18nKey(ActivityLonglineObsDto.class),
|
|
| 100 |
+ addInfoMessage(
|
|
| 101 |
+ ActivityLonglineObsDto.class,
|
|
| 106 | 102 |
t("observe.common.ActivityLonglineObsDto.message.not.open"));
|
| 107 | 103 |
} else {
|
| 108 |
- addMessage(ui,
|
|
| 109 |
- NuitonValidatorScope.INFO,
|
|
| 110 |
- ObserveI18nDecoratorHelper.getTypeI18nKey(ActivitySeineDto.class),
|
|
| 104 |
+ addInfoMessage(
|
|
| 105 |
+ ActivitySeineDto.class,
|
|
| 111 | 106 |
t("observe.common.ActivitySeineDto.message.not.open"));
|
| 112 | 107 |
}
|
| 113 | 108 |
break;
|
| ... | ... | @@ -157,24 +152,24 @@ public abstract class ContentTableUIOpenAction<E extends IdDto, D extends IdDto, |
| 157 | 152 |
}
|
| 158 | 153 |
}
|
| 159 | 154 |
|
| 160 |
- @Override
|
|
| 161 |
- protected void fixFormSize() {
|
|
| 162 |
- |
|
| 163 |
- if (getModel().isShowData()) {
|
|
| 164 |
- super.fixFormSize();
|
|
| 165 |
- } else {
|
|
| 166 |
- |
|
| 167 |
- // we want to see the hole form on screen
|
|
| 168 |
- Dimension preferredSize = ui.getPreferredSize();
|
|
| 169 |
- |
|
| 170 |
- JSplitPane parentContainer = ui.getParentContainer(JSplitPane.class);
|
|
| 171 |
- if (parentContainer != null) {
|
|
| 172 |
- ui.setMinimumSize(new Dimension(preferredSize.width, parentContainer.getPreferredSize().height - 200));
|
|
| 173 |
- }
|
|
| 174 |
- |
|
| 175 |
-// parentContainer.getRightComponent().setMinimumSize(new Dimension(preferredSize.width, 200));
|
|
| 176 |
- }
|
|
| 177 |
- }
|
|
| 155 |
+// @Override
|
|
| 156 |
+// protected void fixFormSize() {
|
|
| 157 |
+//
|
|
| 158 |
+// if (getModel().isShowData()) {
|
|
| 159 |
+// super.fixFormSize();
|
|
| 160 |
+// } else {
|
|
| 161 |
+//
|
|
| 162 |
+// // we want to see the hole form on screen
|
|
| 163 |
+// Dimension preferredSize = ui.getPreferredSize();
|
|
| 164 |
+//
|
|
| 165 |
+// JSplitPane parentContainer = ui.getParentContainer(JSplitPane.class);
|
|
| 166 |
+// if (parentContainer != null) {
|
|
| 167 |
+// ui.setMinimumSize(new Dimension(preferredSize.width, parentContainer.getPreferredSize().height - 200));
|
|
| 168 |
+// }
|
|
| 169 |
+//
|
|
| 170 |
+//// parentContainer.getRightComponent().setMinimumSize(new Dimension(preferredSize.width, 200));
|
|
| 171 |
+// }
|
|
| 172 |
+// }
|
|
| 178 | 173 |
|
| 179 | 174 |
public void updateSaveAction(boolean create) {
|
| 180 | 175 |
JButton button = ui.getSaveEntry();
|