Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
94ba8702
by Tony Chemit at 2020-07-10T16:30:13+02:00
-
9f5f153f
by Tony Chemit at 2020-07-10T16:32:05+02:00
2 changed files:
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/content/ContentUIHandler.java
- client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/tree/navigation/nodes/data/ll/logbook/ActivityLonglineLogbookNavigationTreeNode.java
Changes:
| ... | ... | @@ -91,6 +91,7 @@ import javax.swing.JTabbedPane; |
| 91 | 91 |
import javax.swing.JToolBar;
|
| 92 | 92 |
import javax.swing.SwingUtilities;
|
| 93 | 93 |
import java.awt.Component;
|
| 94 |
+import java.awt.FocusTraversalPolicy;
|
|
| 94 | 95 |
import java.awt.KeyboardFocusManager;
|
| 95 | 96 |
import java.beans.PropertyChangeListener;
|
| 96 | 97 |
import java.util.Arrays;
|
| ... | ... | @@ -459,6 +460,7 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 459 | 460 |
// dettach all validators
|
| 460 | 461 |
uninstallValidators();
|
| 461 | 462 |
}
|
| 463 |
+ |
|
| 462 | 464 |
public void resetFromPreviousUi(U ui) {
|
| 463 | 465 |
if (tabbedPaneValidator != null) {
|
| 464 | 466 |
JTabbedPane mainTabbedPane = (JTabbedPane) ui.getObjectById(JaxxObjectInitializer.MAIN_TABBED_PANE);
|
| ... | ... | @@ -467,6 +469,7 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 467 | 469 |
}
|
| 468 | 470 |
}
|
| 469 | 471 |
}
|
| 472 |
+ |
|
| 470 | 473 |
final void destroyUI() {
|
| 471 | 474 |
if (ui == null) {
|
| 472 | 475 |
return;
|
| ... | ... | @@ -904,8 +907,14 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 904 | 907 |
}
|
| 905 | 908 |
|
| 906 | 909 |
public final void setFormFocusOwner(Component formFocusOwner) {
|
| 907 |
- ObserveLayoutFocusTraversalPolicy<?> focusTraversalPolicy = (ObserveLayoutFocusTraversalPolicy<?>) ui.getFocusTraversalPolicy();
|
|
| 908 |
- Component realFocusComponent = focusTraversalPolicy.getRealFocusComponent(formFocusOwner);
|
|
| 910 |
+ FocusTraversalPolicy focusTraversalPolicy = ui.getFocusTraversalPolicy();
|
|
| 911 |
+ Component realFocusComponent;
|
|
| 912 |
+ if (focusTraversalPolicy instanceof ObserveLayoutFocusTraversalPolicy) {
|
|
| 913 |
+ ObserveLayoutFocusTraversalPolicy<?> focusTraversalPolicy1 = (ObserveLayoutFocusTraversalPolicy<?>) ui.getFocusTraversalPolicy();
|
|
| 914 |
+ realFocusComponent = focusTraversalPolicy1.getRealFocusComponent(formFocusOwner);
|
|
| 915 |
+ } else {
|
|
| 916 |
+ realFocusComponent = focusTraversalPolicy.getFirstComponent(ui.getContentContainer());
|
|
| 917 |
+ }
|
|
| 909 | 918 |
ui.getModel().setFormFocusOwner(realFocusComponent);
|
| 910 | 919 |
}
|
| 911 | 920 |
|
| ... | ... | @@ -30,6 +30,7 @@ import fr.ird.observe.dto.data.ll.logbook.ActivityReference; |
| 30 | 30 |
import fr.ird.observe.dto.data.ll.logbook.SampleReference;
|
| 31 | 31 |
import fr.ird.observe.dto.data.ll.logbook.SetDto;
|
| 32 | 32 |
import fr.ird.observe.dto.data.ll.logbook.SetReference;
|
| 33 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 33 | 34 |
import fr.ird.observe.navigation.model.edit.longline.node.ObserveLonglineLogbookActivityEditNode;
|
| 34 | 35 |
import fr.ird.observe.navigation.model.select.longline.node.ObserveLonglineLogbookActivitySelectNode;
|
| 35 | 36 |
import fr.ird.observe.navigation.tree.SingleReferenceContainerNode;
|
| ... | ... | @@ -107,4 +108,17 @@ public class ActivityLonglineLogbookNavigationTreeNode extends ReferenceNavigati |
| 107 | 108 |
public SetLonglineLogbookNavigationTreeNode newSingleChildNode(String parentId) {
|
| 108 | 109 |
return newSingleChildNode(new SetReference(new SetDto(), null));
|
| 109 | 110 |
}
|
| 111 |
+ |
|
| 112 |
+ public int getNewPosition(DtoReference beanReference) {
|
|
| 113 |
+ if (beanReference instanceof SetReference) {
|
|
| 114 |
+ return 0;
|
|
| 115 |
+ }
|
|
| 116 |
+ if (beanReference instanceof SampleReference) {
|
|
| 117 |
+ if (getData().getSet() == null) {
|
|
| 118 |
+ return 0;
|
|
| 119 |
+ }
|
|
| 120 |
+ return 1;
|
|
| 121 |
+ }
|
|
| 122 |
+ throw new IllegalStateException(String.format("Can't manage bean: %s", beanReference));
|
|
| 123 |
+ }
|
|
| 110 | 124 |
}
|