| ... |
... |
@@ -6,15 +6,15 @@ |
|
6
|
6
|
* %%
|
|
7
|
7
|
* This program is free software: you can redistribute it and/or modify
|
|
8
|
8
|
* it under the terms of the GNU General Public License as
|
|
9
|
|
- * published by the Free Software Foundation, either version 3 of the
|
|
|
9
|
+ * published by the Free Software Foundation, either version 3 of the
|
|
10
|
10
|
* License, or (at your option) any later version.
|
|
11
|
|
- *
|
|
|
11
|
+ *
|
|
12
|
12
|
* This program is distributed in the hope that it will be useful,
|
|
13
|
13
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
14
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
15
|
* GNU General Public License for more details.
|
|
16
|
|
- *
|
|
17
|
|
- * You should have received a copy of the GNU General Public
|
|
|
16
|
+ *
|
|
|
17
|
+ * You should have received a copy of the GNU General Public
|
|
18
|
18
|
* License along with this program. If not, see
|
|
19
|
19
|
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
20
|
20
|
* #L%
|
| ... |
... |
@@ -24,40 +24,38 @@ package fr.ird.observe.client.ui.content.open; |
|
24
|
24
|
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
|
25
|
25
|
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
|
26
|
26
|
import fr.ird.observe.client.db.constants.DataContextType;
|
|
27
|
|
-import fr.ird.observe.client.ui.util.UIHelper;
|
|
28
|
27
|
import fr.ird.observe.client.ui.content.ContentMode;
|
|
29
|
28
|
import fr.ird.observe.client.ui.content.ContentUIHandler;
|
|
30
|
29
|
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
31
|
30
|
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
|
31
|
+import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
|
|
32
|
32
|
import fr.ird.observe.client.ui.tree.navigation.nodes.longline.ProgramLonglineNavigationTreeNode;
|
|
33
|
33
|
import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode;
|
|
|
34
|
+import fr.ird.observe.client.ui.util.UIHelper;
|
|
34
|
35
|
import fr.ird.observe.client.validation.ClientValidationContext;
|
|
35
|
|
-import fr.ird.observe.dto.IdDto;
|
|
|
36
|
+import fr.ird.observe.dto.data.DataDto;
|
|
36
|
37
|
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
|
37
|
38
|
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
38
|
39
|
import org.apache.commons.logging.Log;
|
|
39
|
40
|
import org.apache.commons.logging.LogFactory;
|
|
40
|
41
|
import org.nuiton.validator.NuitonValidatorScope;
|
|
41
|
42
|
|
|
42
|
|
-
|
|
43
|
43
|
import static org.nuiton.i18n.I18n.t;
|
|
44
|
44
|
|
|
45
|
45
|
/**
|
|
46
|
46
|
* @author Tony Chemit - dev@tchemit.fr
|
|
47
|
47
|
* @since 1.0
|
|
48
|
48
|
*/
|
|
49
|
|
-public abstract class ContentOpenableUIHandler<E extends IdDto, U extends ContentOpenableUI<E, U>> extends ContentUIHandler<E, U> {
|
|
|
49
|
+public abstract class ContentOpenableUIHandler<E extends DataDto, U extends ContentOpenableUI<E, U>> extends ContentUIHandler<E, U> {
|
|
50
|
50
|
|
|
51
|
|
- protected static final String POSITION_OPENABLE = "positionOpenable";
|
|
|
51
|
+ private static final String POSITION_OPENABLE = "positionOpenable";
|
|
52
|
52
|
|
|
53
|
53
|
/** Logger */
|
|
54
|
54
|
static private final Log log = LogFactory.getLog(ContentOpenableUIHandler.class);
|
|
55
|
|
-
|
|
|
55
|
+ private static final String UPDATE_TRIP_NODE = "updateTripNode";
|
|
56
|
56
|
protected final String closeMessage;
|
|
57
|
57
|
|
|
58
|
|
- public ContentOpenableUIHandler(DataContextType parentType,
|
|
59
|
|
- DataContextType type,
|
|
60
|
|
- String closeMessage) {
|
|
|
58
|
+ public ContentOpenableUIHandler(DataContextType parentType, DataContextType type, String closeMessage) {
|
|
61
|
59
|
super(parentType, type);
|
|
62
|
60
|
this.closeMessage = closeMessage;
|
|
63
|
61
|
}
|
| ... |
... |
@@ -122,6 +120,18 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
122
|
120
|
}
|
|
123
|
121
|
}
|
|
124
|
122
|
|
|
|
123
|
+ @Override
|
|
|
124
|
+ protected void afterDelete() {
|
|
|
125
|
+ super.afterDelete();
|
|
|
126
|
+ NavigationTree treeHelper = getNavigationTree();
|
|
|
127
|
+ NavigationTreeNodeSupport parent = treeHelper.getSelectedNode().getParent();
|
|
|
128
|
+ if (!(parent instanceof ReferenceNavigationTreeNodeSupport)) {
|
|
|
129
|
+ parent = parent.getParent();
|
|
|
130
|
+ }
|
|
|
131
|
+ parent.reload();
|
|
|
132
|
+ treeHelper.reloadNode(parent, false);
|
|
|
133
|
+ }
|
|
|
134
|
+
|
|
125
|
135
|
public abstract boolean doCloseData();
|
|
126
|
136
|
|
|
127
|
137
|
public final void afterCloseData() {
|
| ... |
... |
@@ -138,7 +148,7 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
138
|
148
|
|
|
139
|
149
|
removeAllMessages(ui);
|
|
140
|
150
|
addMessage(ui, NuitonValidatorScope.INFO,
|
|
141
|
|
- getTypeI18nKey(bean.getClass()), t(closeMessage));
|
|
|
151
|
+ getTypeI18nKey(bean.getClass()), t(closeMessage));
|
|
142
|
152
|
|
|
143
|
153
|
NavigationTree treeHelper = getNavigationTree();
|
|
144
|
154
|
treeHelper.reloadSelectedNode(bean instanceof TripSeineDto || bean instanceof TripLonglineDto, true);
|
| ... |
... |
@@ -159,6 +169,11 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
159
|
169
|
|
|
160
|
170
|
NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
161
|
171
|
NavigationTreeNodeSupport parentNode = node.getParent();
|
|
|
172
|
+ NavigationTreeNodeSupport parentDataNode = parentNode;
|
|
|
173
|
+ if (!(parentNode instanceof ReferenceNavigationTreeNodeSupport)) {
|
|
|
174
|
+ parentDataNode = parentNode.getParent();
|
|
|
175
|
+ }
|
|
|
176
|
+
|
|
162
|
177
|
boolean create = node.getId() == null;
|
|
163
|
178
|
|
|
164
|
179
|
E bean = getBean();
|
| ... |
... |
@@ -181,6 +196,10 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
181
|
196
|
// on crée le noeud final de la marée
|
|
182
|
197
|
node = treeHelper.addOpenable(parentNode, bean);
|
|
183
|
198
|
|
|
|
199
|
+ if (parentNode != parentDataNode) {
|
|
|
200
|
+ parentDataNode.reload();
|
|
|
201
|
+ treeHelper.reloadNode(parentDataNode, false);
|
|
|
202
|
+ }
|
|
184
|
203
|
// arrêt de l'édition de l'écran courant
|
|
185
|
204
|
stopEditUI();
|
|
186
|
205
|
|
| ... |
... |
@@ -202,6 +221,11 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
202
|
221
|
treeHelper.selectNode(node);
|
|
203
|
222
|
}
|
|
204
|
223
|
|
|
|
224
|
+ node.reload();
|
|
|
225
|
+ if (parentNode != parentDataNode) {
|
|
|
226
|
+ parentDataNode.reload();
|
|
|
227
|
+ treeHelper.reloadNode(parentDataNode, false);
|
|
|
228
|
+ }
|
|
205
|
229
|
// on repaint le noeud et ses enfants
|
|
206
|
230
|
treeHelper.reloadSelectedNode(false, true);
|
|
207
|
231
|
}
|
| ... |
... |
@@ -286,8 +310,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten |
|
286
|
310
|
}
|
|
287
|
311
|
}
|
|
288
|
312
|
|
|
289
|
|
- private static final String UPDATE_TRIP_NODE = "updateTripNode";
|
|
290
|
|
-
|
|
291
|
313
|
protected void repaintTripNode() {
|
|
292
|
314
|
|
|
293
|
315
|
Boolean updateTripNode = getUi().getContextValue(Boolean.class, UPDATE_TRIP_NODE);
|