Tony CHEMIT pushed to branch feature/issue-2907 at ultreiaio / ird-observe
Commits:
-
270eee57
by Tony Chemit at 2024-09-11T11:57:25+02:00
-
b4945146
by Tony Chemit at 2024-09-11T11:57:25+02:00
-
224a5b40
by Tony Chemit at 2024-09-11T12:06:35+02:00
-
1f940567
by Tony Chemit at 2024-09-11T12:06:57+02:00
-
90f70522
by Tony Chemit at 2024-09-11T12:06:57+02:00
-
5e6b88c9
by Tony Chemit at 2024-09-11T12:06:57+02:00
9 changed files:
- client/core/src/main/java/fr/ird/observe/client/util/table/JXTableUtil.java
- + client/core/src/main/java/fr/ird/observe/client/util/table/renderer/DecoratorTableRenderer.java
- 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/data/table/ContentTableUIHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUITableModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetCatchUI.jaxx
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetCatchUI.jcss
- 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
Changes:
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.client.util.table; |
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.ClientUIContextApplicationComponent;
|
| 26 | 26 | import fr.ird.observe.client.util.UIHelper;
|
| 27 | +import fr.ird.observe.client.util.table.renderer.DecoratorTableRenderer;
|
|
| 27 | 28 | import fr.ird.observe.dto.I18nDecoratorHelper;
|
| 28 | 29 | import io.ultreia.java4all.decoration.Decorated;
|
| 29 | 30 | import io.ultreia.java4all.decoration.Decorator;
|
| ... | ... | @@ -106,15 +107,7 @@ public class JXTableUtil { |
| 106 | 107 | }
|
| 107 | 108 | |
| 108 | 109 | public static TableCellRenderer newDecoratedRenderer(Decorator decorator) {
|
| 109 | - StringValue sv = value -> {
|
|
| 110 | - if (value == null) {
|
|
| 111 | - return null;
|
|
| 112 | - }
|
|
| 113 | - Decorated reference = (Decorated) value;
|
|
| 114 | - reference.registerDecorator(decorator);
|
|
| 115 | - return reference.decorate();
|
|
| 116 | - };
|
|
| 117 | - return getDefaultTableRenderer(sv, true);
|
|
| 110 | + return new DecoratorTableRenderer(decorator);
|
|
| 118 | 111 | }
|
| 119 | 112 | |
| 120 | 113 | public static TableCellRenderer newEmptyNumberTableCellRenderer() {
|
| 1 | +package fr.ird.observe.client.util.table.renderer;
|
|
| 2 | + |
|
| 3 | +/*-
|
|
| 4 | + * #%L
|
|
| 5 | + * ObServe Client :: Core
|
|
| 6 | + * %%
|
|
| 7 | + * Copyright (C) 2008 - 2023 IRD, Ultreia.io
|
|
| 8 | + * %%
|
|
| 9 | + * This program is free software: you can redistribute it and/or modify
|
|
| 10 | + * it under the terms of the GNU General Public License as
|
|
| 11 | + * published by the Free Software Foundation, either version 3 of the
|
|
| 12 | + * License, or (at your option) any later version.
|
|
| 13 | + *
|
|
| 14 | + * This program is distributed in the hope that it will be useful,
|
|
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 | + * GNU General Public License for more details.
|
|
| 18 | + *
|
|
| 19 | + * You should have received a copy of the GNU General Public
|
|
| 20 | + * License along with this program. If not, see
|
|
| 21 | + * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 | + * #L%
|
|
| 23 | + */
|
|
| 24 | + |
|
| 25 | +import io.ultreia.java4all.decoration.Decorated;
|
|
| 26 | +import io.ultreia.java4all.decoration.Decorator;
|
|
| 27 | +import org.jdesktop.swingx.renderer.DefaultTableRenderer;
|
|
| 28 | +import org.jdesktop.swingx.renderer.LabelProvider;
|
|
| 29 | +import org.jdesktop.swingx.renderer.StringValue;
|
|
| 30 | + |
|
| 31 | +import javax.swing.JComponent;
|
|
| 32 | +import javax.swing.JTable;
|
|
| 33 | +import java.awt.Component;
|
|
| 34 | + |
|
| 35 | +/**
|
|
| 36 | + * Created at 11/09/2024.
|
|
| 37 | + *
|
|
| 38 | + * @author Tony Chemit - dev@tchemit.fr
|
|
| 39 | + * @since 9.3.7
|
|
| 40 | + */
|
|
| 41 | +public class DecoratorTableRenderer extends DefaultTableRenderer {
|
|
| 42 | + |
|
| 43 | + public DecoratorTableRenderer(Decorator decorator) {
|
|
| 44 | + super(new DecoratorLabelProvider(decorator));
|
|
| 45 | + }
|
|
| 46 | + |
|
| 47 | + @Override
|
|
| 48 | + public DecoratorLabelProvider getComponentProvider() {
|
|
| 49 | + return (DecoratorLabelProvider) super.getComponentProvider();
|
|
| 50 | + }
|
|
| 51 | + public Decorator getDecorator() {
|
|
| 52 | + return getComponentProvider().getStringValue().getDecorator();
|
|
| 53 | + }
|
|
| 54 | + @Override
|
|
| 55 | + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
|
| 56 | + JComponent tableCellRendererComponent = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
|
| 57 | + String toolTipText = getString(value);
|
|
| 58 | + tableCellRendererComponent.setToolTipText(toolTipText);
|
|
| 59 | + return tableCellRendererComponent;
|
|
| 60 | + }
|
|
| 61 | + |
|
| 62 | + public static class DecoratorStringValue implements StringValue {
|
|
| 63 | + |
|
| 64 | + private final Decorator decorator;
|
|
| 65 | + |
|
| 66 | + private DecoratorStringValue(Decorator decorator) {
|
|
| 67 | + this.decorator = decorator;
|
|
| 68 | + }
|
|
| 69 | + |
|
| 70 | + @Override
|
|
| 71 | + public String getString(Object value) {
|
|
| 72 | + if (value == null) {
|
|
| 73 | + return null;
|
|
| 74 | + }
|
|
| 75 | + Decorated reference = (Decorated) value;
|
|
| 76 | + reference.registerDecorator(decorator);
|
|
| 77 | + return reference.decorate();
|
|
| 78 | + }
|
|
| 79 | + |
|
| 80 | + public Decorator getDecorator() {
|
|
| 81 | + return decorator;
|
|
| 82 | + }
|
|
| 83 | + }
|
|
| 84 | + |
|
| 85 | + public static class DecoratorLabelProvider extends LabelProvider {
|
|
| 86 | + |
|
| 87 | + |
|
| 88 | + public DecoratorLabelProvider(Decorator decorator) {
|
|
| 89 | + super(new DecoratorStringValue(decorator));
|
|
| 90 | + }
|
|
| 91 | + |
|
| 92 | + @Override
|
|
| 93 | + public DecoratorStringValue getStringValue() {
|
|
| 94 | + return (DecoratorStringValue) super.getStringValue();
|
|
| 95 | + }
|
|
| 96 | + }
|
|
| 97 | +} |
| ... | ... | @@ -173,6 +173,10 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 173 | 173 | container = (Container) ui.getObjectById(DefaultUIInitializer.MAIN_TABBED_PANE);
|
| 174 | 174 | if (withSubTab) {
|
| 175 | 175 | container = (Container) ui.getObjectById(DefaultUIInitializer.SUB_TABBED_PANE);
|
| 176 | + if (!container.isShowing()) {
|
|
| 177 | + // stay on main tabbed pane
|
|
| 178 | + container = (Container) ui.getObjectById(DefaultUIInitializer.MAIN_TABBED_PANE);
|
|
| 179 | + }
|
|
| 176 | 180 | }
|
| 177 | 181 | } else {
|
| 178 | 182 | container = ui.getContentBody();
|
| ... | ... | @@ -183,11 +187,19 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe |
| 183 | 187 | }
|
| 184 | 188 | |
| 185 | 189 | public Component computeFocusOwner() {
|
| 190 | + //FIXME Review this on Focus clean session
|
|
| 186 | 191 | Container container = computeFocusOwnerContainer();
|
| 187 | 192 | if (container instanceof JTabbedPane) {
|
| 188 | 193 | container = (Container) ((JTabbedPane) container).getSelectedComponent();
|
| 189 | 194 | }
|
| 190 | - return ui.getFocusTraversalPolicy().getFirstComponent(container);
|
|
| 195 | + Component result = ui.getFocusTraversalPolicy().getFirstComponent(container);
|
|
| 196 | + if (ui.getModel().getStates().isReadingMode()) {
|
|
| 197 | + return result;
|
|
| 198 | + }
|
|
| 199 | + if (result instanceof JTabbedPane) {
|
|
| 200 | + result = ((JTabbedPane) result).getSelectedComponent();
|
|
| 201 | + }
|
|
| 202 | + return ui.getFocusTraversalPolicy().getFirstComponent((Container) result);
|
|
| 191 | 203 | }
|
| 192 | 204 | |
| 193 | 205 | public void onModeChanged(ContentMode newMode) {
|
| ... | ... | @@ -45,6 +45,7 @@ import fr.ird.observe.client.datasource.editor.api.content.data.table.actions.en |
| 45 | 45 | import fr.ird.observe.client.datasource.editor.api.content.data.table.actions.entry.select.SelectNext;
|
| 46 | 46 | import fr.ird.observe.client.datasource.editor.api.content.data.table.actions.entry.select.SelectPrevious;
|
| 47 | 47 | import fr.ird.observe.client.datasource.editor.api.content.data.table.sortable.AutoSelectWithMoveUpAndDownShowPopupAction;
|
| 48 | +import fr.ird.observe.client.datasource.editor.api.focus.ContentZone;
|
|
| 48 | 49 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
|
| 49 | 50 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationScope;
|
| 50 | 51 | import fr.ird.observe.client.main.focus.FocusDispatcher;
|
| ... | ... | @@ -64,6 +65,7 @@ import java.awt.BorderLayout; |
| 64 | 65 | import java.awt.Component;
|
| 65 | 66 | import java.awt.Container;
|
| 66 | 67 | import java.awt.Rectangle;
|
| 68 | +import java.util.Objects;
|
|
| 67 | 69 | import java.util.function.Function;
|
| 68 | 70 | |
| 69 | 71 | /**
|
| ... | ... | @@ -376,7 +378,7 @@ public abstract class ContentTableUIHandler<D extends DataDto, C extends Contain |
| 376 | 378 | if (focusComponent instanceof JComponent) {
|
| 377 | 379 | focusComponent = focusDispatcher.dispatchFocus((JComponent) focusComponent);
|
| 378 | 380 | }
|
| 379 | - SwingUtilities.invokeLater(focusComponent::requestFocusInWindow);
|
|
| 381 | +// SwingUtilities.invokeLater(focusComponent::requestFocusInWindow);
|
|
| 380 | 382 | }
|
| 381 | 383 | }
|
| 382 | 384 | |
| ... | ... | @@ -385,11 +387,13 @@ public abstract class ContentTableUIHandler<D extends DataDto, C extends Contain |
| 385 | 387 | SwingUtilities.invokeLater(() -> {
|
| 386 | 388 | if (getFocusModel() != null) {
|
| 387 | 389 | unblockFocus();
|
| 388 | - ui.getHandler().grabFocusOnForm();
|
|
| 389 | - if (finalFocusComponent != null) {
|
|
| 390 | - SwingUtilities.invokeLater(finalFocusComponent::requestFocusInWindow);
|
|
| 390 | + //FIXME Review this on Focus clean session (the blockFocus does not work!!!)
|
|
| 391 | + if (Objects.equals(getFocusModel().getFocusOwnerZone(), ContentZone.ZONE_NAME)) {
|
|
| 392 | + ui.getHandler().grabFocusOnForm();
|
|
| 393 | + if (finalFocusComponent != null) {
|
|
| 394 | + SwingUtilities.invokeLater(finalFocusComponent::requestFocusInWindow);
|
|
| 395 | + }
|
|
| 391 | 396 | }
|
| 392 | - ;
|
|
| 393 | 397 | }
|
| 394 | 398 | });
|
| 395 | 399 | }
|
| ... | ... | @@ -194,7 +194,7 @@ public abstract class ContentTableUITableModel<D extends DataDto, C extends Cont |
| 194 | 194 | if (getColumnMeta(0).getType().equals(int.class)) {
|
| 195 | 195 | sorter.setComparator(0, Comparator.comparingInt(v -> (int) v));
|
| 196 | 196 | }
|
| 197 | - int index=-1;
|
|
| 197 | + int index = -1;
|
|
| 198 | 198 | for (ContentTableMeta<C> meta : metas) {
|
| 199 | 199 | index++;
|
| 200 | 200 | Class<?> type = meta.getType();
|
| ... | ... | @@ -205,6 +205,12 @@ public abstract class ContentTableUITableModel<D extends DataDto, C extends Cont |
| 205 | 205 | DecoratedSorter<?> decoratedSorter = decorator.definition().sorter();
|
| 206 | 206 | Comparator<?> comparator = decoratedSorter.getComparator((DecoratorDefinition) decorator.definition(), decoratorService.getReferentialLocale().getLocale(), decoratorIndex);
|
| 207 | 207 | sorter.setComparator(index, comparator);
|
| 208 | + } else if (boolean.class.equals(type)) {
|
|
| 209 | + sorter.setComparator(index, Comparator.comparingInt(v -> (boolean) v ? 1 : 0));
|
|
| 210 | + } else if (Boolean.class.equals(type)) {
|
|
| 211 | + sorter.setComparator(index, Comparator.nullsLast(Comparator.comparingInt(v -> (Boolean) v ? 1 : 0)));
|
|
| 212 | + } else if (Enum.class.isAssignableFrom(type)) {
|
|
| 213 | + sorter.setComparator(index, Comparator.comparing(Object::toString));
|
|
| 208 | 214 | }
|
| 209 | 215 | }
|
| 210 | 216 |
| ... | ... | @@ -120,17 +120,27 @@ |
| 120 | 120 | <JTabbedPane id='mainTabbedPane'>
|
| 121 | 121 | <tab id='caracteristicTab' i18nProperty="">
|
| 122 | 122 | <Table id='editForm' fill='both' insets='1'>
|
| 123 | - |
|
| 124 | 123 | <row>
|
| 125 | - <cell columns="2">
|
|
| 126 | - <!-- acquisition Mode -->
|
|
| 124 | + <cell columns="2" rows="2">
|
|
| 127 | 125 | <JPanel id='acquisitionMode'>
|
| 128 | 126 | <JRadioButton id='acquisitionModeIndividual'/>
|
| 129 | 127 | <JRadioButton id='acquisitionModeGrouped'/>
|
| 130 | 128 | </JPanel>
|
| 131 | 129 | </cell>
|
| 132 | - <cell columns="2" rows="2">
|
|
| 133 | - <!-- location on longline -->
|
|
| 130 | + <cell>
|
|
| 131 | + <JLabel id='numberLabel'/>
|
|
| 132 | + </cell>
|
|
| 133 | + <cell weightx='1' anchor='east'>
|
|
| 134 | + <NumberEditor id='number' styleClass="int6"/>
|
|
| 135 | + </cell>
|
|
| 136 | + </row>
|
|
| 137 | + <row>
|
|
| 138 | + <cell>
|
|
| 139 | + <JPanel/>
|
|
| 140 | + </cell>
|
|
| 141 | + </row>
|
|
| 142 | + <row>
|
|
| 143 | + <cell columns="2" rows="4">
|
|
| 134 | 144 | <Table id="locationOnLonglinePanel">
|
| 135 | 145 | <row>
|
| 136 | 146 | <cell anchor="west">
|
| ... | ... | @@ -158,9 +168,6 @@ |
| 158 | 168 | </row>
|
| 159 | 169 | </Table>
|
| 160 | 170 | </cell>
|
| 161 | - </row>
|
|
| 162 | - <!-- species -->
|
|
| 163 | - <row>
|
|
| 164 | 171 | <cell>
|
| 165 | 172 | <JLabel id='speciesLabel'/>
|
| 166 | 173 | </cell>
|
| ... | ... | @@ -168,16 +175,7 @@ |
| 168 | 175 | <FilterableComboBox id='species' genericType='SpeciesReference'/>
|
| 169 | 176 | </cell>
|
| 170 | 177 | </row>
|
| 171 | - |
|
| 172 | - <!-- tagNumber -->
|
|
| 173 | - <!-- count -->
|
|
| 174 | 178 | <row>
|
| 175 | - <cell anchor='west'>
|
|
| 176 | - <JLabel id='tagNumberLabel'/>
|
|
| 177 | - </cell>
|
|
| 178 | - <cell anchor='east' weightx="1" fill="both">
|
|
| 179 | - <NormalTextEditor id='tagNumber'/>
|
|
| 180 | - </cell>
|
|
| 181 | 179 | <cell>
|
| 182 | 180 | <JLabel id='countLabel'/>
|
| 183 | 181 | </cell>
|
| ... | ... | @@ -185,22 +183,6 @@ |
| 185 | 183 | <NumberEditor id='count' styleClass="int6"/>
|
| 186 | 184 | </cell>
|
| 187 | 185 | </row>
|
| 188 | - |
|
| 189 | - <!-- number -->
|
|
| 190 | - <row>
|
|
| 191 | - <cell>
|
|
| 192 | - <JLabel id='numberLabel'/>
|
|
| 193 | - </cell>
|
|
| 194 | - <cell weightx='1' anchor='east'>
|
|
| 195 | - <NumberEditor id='number' styleClass="int6"/>
|
|
| 196 | - </cell>
|
|
| 197 | - <cell columns="2">
|
|
| 198 | - <JPanel/>
|
|
| 199 | - </cell>
|
|
| 200 | - </row>
|
|
| 201 | - |
|
| 202 | - <!-- total weight -->
|
|
| 203 | - <!-- weightMeasureMethod -->
|
|
| 204 | 186 | <row>
|
| 205 | 187 | <cell>
|
| 206 | 188 | <JLabel id='totalWeightLabel'/>
|
| ... | ... | @@ -208,6 +190,8 @@ |
| 208 | 190 | <cell weightx='1' anchor='east'>
|
| 209 | 191 | <NumberEditor id='totalWeight' styleClass="float3"/>
|
| 210 | 192 | </cell>
|
| 193 | + </row>
|
|
| 194 | + <row>
|
|
| 211 | 195 | <cell>
|
| 212 | 196 | <JLabel id='weightMeasureMethodLabel'/>
|
| 213 | 197 | </cell>
|
| ... | ... | @@ -215,9 +199,6 @@ |
| 215 | 199 | <FilterableComboBox id='weightMeasureMethod' genericType='WeightMeasureMethodReference'/>
|
| 216 | 200 | </cell>
|
| 217 | 201 | </row>
|
| 218 | - |
|
| 219 | - <!-- catch healthStatus -->
|
|
| 220 | - <!-- hook position -->
|
|
| 221 | 202 | <row>
|
| 222 | 203 | <cell>
|
| 223 | 204 | <JLabel id='catchHealthStatusLabel'/>
|
| ... | ... | @@ -225,16 +206,7 @@ |
| 225 | 206 | <cell weightx='1' anchor='east'>
|
| 226 | 207 | <FilterableComboBox id='catchHealthStatus' genericType='HealthStatusReference'/>
|
| 227 | 208 | </cell>
|
| 228 | - <cell>
|
|
| 229 | - <JLabel id='hookPositionLabel'/>
|
|
| 230 | - </cell>
|
|
| 231 | - <cell weightx='1' anchor='east'>
|
|
| 232 | - <FilterableComboBox id='hookPosition' genericType='HookPositionReference'/>
|
|
| 233 | - </cell>
|
|
| 234 | 209 | </row>
|
| 235 | - |
|
| 236 | - <!-- catch fate -->
|
|
| 237 | - <!-- discard healthStatus -->
|
|
| 238 | 210 | <row>
|
| 239 | 211 | <cell>
|
| 240 | 212 | <JLabel id='catchFateLabel'/>
|
| ... | ... | @@ -249,24 +221,44 @@ |
| 249 | 221 | <FilterableComboBox id='discardHealthStatus' genericType='HealthStatusReference'/>
|
| 250 | 222 | </cell>
|
| 251 | 223 | </row>
|
| 252 | - |
|
| 253 | - <!-- hookWhenDiscarded -->
|
|
| 254 | - <!-- photoReferences -->
|
|
| 255 | 224 | <row>
|
| 225 | + <cell>
|
|
| 226 | + <JLabel id='hookPositionLabel'/>
|
|
| 227 | + </cell>
|
|
| 228 | + <cell weightx='1' anchor='east'>
|
|
| 229 | + <FilterableComboBox id='hookPosition' genericType='HookPositionReference'/>
|
|
| 230 | + </cell>
|
|
| 256 | 231 | <cell anchor="west">
|
| 257 | 232 | <JLabel id='hookWhenDiscardedLabel'/>
|
| 258 | 233 | </cell>
|
| 259 | 234 | <cell anchor='west' fill="both">
|
| 260 | 235 | <BooleanEditor id='hookWhenDiscarded'/>
|
| 261 | 236 | </cell>
|
| 237 | + </row>
|
|
| 238 | + <row>
|
|
| 262 | 239 | <cell anchor='west'>
|
| 263 | 240 | <JLabel id='photoReferencesLabel'/>
|
| 264 | 241 | </cell>
|
| 265 | 242 | <cell anchor='east' weightx="1" fill="both">
|
| 266 | 243 | <NormalTextEditor id='photoReferences'/>
|
| 267 | 244 | </cell>
|
| 245 | + <cell columns="2"/>
|
|
| 246 | + <!-- <cell anchor='west'>-->
|
|
| 247 | + <!-- <JLabel id='sampleReferencesLabel'/>-->
|
|
| 248 | + <!-- </cell>-->
|
|
| 249 | + <!-- <cell anchor='east' weightx="1" fill="both">-->
|
|
| 250 | + <!-- <NormalTextEditor id='sampleReferences'/>-->
|
|
| 251 | + <!-- </cell>-->
|
|
| 268 | 252 | </row>
|
| 253 | + <row>
|
|
| 254 | + <cell anchor='west'>
|
|
| 255 | + <JLabel id='tagNumberLabel'/>
|
|
| 256 | + </cell>
|
|
| 257 | + <cell anchor='east' weightx="1" fill="both">
|
|
| 258 | + <NormalTextEditor id='tagNumber'/>
|
|
| 259 | + </cell>
|
|
| 269 | 260 | |
| 261 | + </row>
|
|
| 270 | 262 | </Table>
|
| 271 | 263 | </tab>
|
| 272 | 264 |
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | }
|
| 27 | 27 | |
| 28 | 28 | #mainTabbedPane {
|
| 29 | - _focusComponent:{newComponentArray(acquisitionModeIndividual,depredated,beatDiameter)};
|
|
| 29 | + _focusComponent:{newComponentArray(number,depredated,beatDiameter)};
|
|
| 30 | 30 | }
|
| 31 | 31 | |
| 32 | 32 | /* ***************************************************************************** */
|
| ... | ... | @@ -43,7 +43,6 @@ import org.apache.logging.log4j.Logger; |
| 43 | 43 | import org.nuiton.jaxx.validator.swing.SwingValidator;
|
| 44 | 44 | |
| 45 | 45 | import javax.swing.AbstractAction;
|
| 46 | -import javax.swing.JComponent;
|
|
| 47 | 46 | import javax.swing.JToolBar;
|
| 48 | 47 | import java.awt.Component;
|
| 49 | 48 | import java.awt.event.ActionEvent;
|
| ... | ... | @@ -74,19 +73,20 @@ public class SetCatchUIHandler extends GeneratedSetCatchUIHandler { |
| 74 | 73 | |
| 75 | 74 | @Override
|
| 76 | 75 | protected Component getFocusComponentOnSelectedRow(SetCatchUI ui, boolean notPersisted, boolean newRow, CatchDto tableEditBean, CatchDto previousRowBean) {
|
| 77 | - JComponent requestFocus;
|
|
| 78 | - if (newRow) {
|
|
| 79 | - requestFocus = ui.getSpecies();
|
|
| 80 | - } else {
|
|
| 81 | - int acquisitionMode = tableEditBean.getAcquisitionMode();
|
|
| 82 | - CatchAcquisitionMode acquisitionModeEnum = CatchAcquisitionMode.valueOf(acquisitionMode);
|
|
| 83 | - if (acquisitionModeEnum.equals(CatchAcquisitionMode.GROUPED)) {
|
|
| 84 | - requestFocus = ui.getCount();
|
|
| 85 | - } else {
|
|
| 86 | - requestFocus = ui.getCatchHealthStatus();
|
|
| 87 | - }
|
|
| 88 | - }
|
|
| 89 | - return requestFocus;
|
|
| 76 | + //FIXME Review this on Focus clean session
|
|
| 77 | +// JComponent requestFocus;
|
|
| 78 | +// if (newRow) {
|
|
| 79 | +// requestFocus = ui.getNumber();
|
|
| 80 | +// } else {
|
|
| 81 | +// int acquisitionMode = tableEditBean.getAcquisitionMode();
|
|
| 82 | +// CatchAcquisitionMode acquisitionModeEnum = CatchAcquisitionMode.valueOf(acquisitionMode);
|
|
| 83 | +// if (acquisitionModeEnum.equals(CatchAcquisitionMode.GROUPED)) {
|
|
| 84 | +// requestFocus = ui.getCount();
|
|
| 85 | +// } else {
|
|
| 86 | +// requestFocus = ui.getCatchHealthStatus();
|
|
| 87 | +// }
|
|
| 88 | +// }
|
|
| 89 | + return ui.getNumber();
|
|
| 90 | 90 | }
|
| 91 | 91 | |
| 92 | 92 | @Override
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.editor.ll.data.observation; |
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.util.table.EditableListProperty;
|
| 26 | +import fr.ird.observe.client.util.table.renderer.DecoratorTableRenderer;
|
|
| 26 | 27 | import fr.ird.observe.dto.data.CatchAcquisitionMode;
|
| 27 | 28 | import fr.ird.observe.dto.data.ll.observation.CatchDto;
|
| 28 | 29 | import fr.ird.observe.dto.data.ll.observation.SizeMeasureDto;
|
| ... | ... | @@ -30,6 +31,8 @@ import fr.ird.observe.dto.data.ll.observation.WeightMeasureDto; |
| 30 | 31 | import org.apache.logging.log4j.LogManager;
|
| 31 | 32 | import org.apache.logging.log4j.Logger;
|
| 32 | 33 | |
| 34 | +import javax.swing.JTable;
|
|
| 35 | +import javax.swing.table.TableColumnModel;
|
|
| 33 | 36 | import java.util.Collection;
|
| 34 | 37 | import java.util.List;
|
| 35 | 38 | |
| ... | ... | @@ -79,6 +82,15 @@ public class SetCatchUITableModel extends GeneratedSetCatchUITableModel { |
| 79 | 82 | return weightMeasuresTableModel;
|
| 80 | 83 | }
|
| 81 | 84 | |
| 85 | + @Override
|
|
| 86 | + public void initTableUISize(JTable table) {
|
|
| 87 | + super.initTableUISize(table);
|
|
| 88 | + TableColumnModel columnModel = table.getColumnModel();
|
|
| 89 | + ((DecoratorTableRenderer) columnModel.getColumn(2).getCellRenderer()).getDecorator().setIndex(1);
|
|
| 90 | + ((DecoratorTableRenderer) columnModel.getColumn(3).getCellRenderer()).getDecorator().setIndex(1);
|
|
| 91 | + ((DecoratorTableRenderer) columnModel.getColumn(4).getCellRenderer()).getDecorator().setIndex(1);
|
|
| 92 | + }
|
|
| 93 | + |
|
| 82 | 94 | @Override
|
| 83 | 95 | protected void onBeforeResetRow(int row) {
|
| 84 | 96 | super.onBeforeResetRow(row);
|