Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe Commits: d293972c by Tony CHEMIT at 2018-10-20T08:29:27Z [PS] Lorsque l'on enregistre le formulaire FOB depuis le 2d onglet, le focus revient sur le 1er onglet - Closes #1158 - - - - - 2 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java ===================================== @@ -1196,7 +1196,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U return getModel().getBean(); } - void openedUI() { + protected void openedUI() { SwingUtilities.invokeLater(this::forceGrabFocusOnForm); } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java ===================================== @@ -8,12 +8,12 @@ * 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>. @@ -27,6 +27,7 @@ import fr.ird.observe.client.db.ClientDataContext; import fr.ird.observe.client.db.ObserveSwingDataSource; import fr.ird.observe.client.db.constants.DataContextType; import fr.ird.observe.client.ui.content.ContentMode; +import fr.ird.observe.client.ui.content.ContentUI; import fr.ird.observe.client.ui.content.ContentUIHandler; import fr.ird.observe.client.ui.content.ContentUIModel; import fr.ird.observe.client.ui.content.ObserveLayoutFocusTraversalPolicy; @@ -193,8 +194,12 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, if (mode != ContentMode.READ) { getUi().startEdit(null); } + } + @Override + protected void openedUI() { SwingUtilities.invokeLater(() -> ui.getMainTabbedPane().setSelectedIndex(0)); + super.openedUI(); } @Override @@ -213,14 +218,14 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, getUi().getValidator().setContext(contextName); if (create) { addMessage(getUi(), - NuitonValidatorScope.INFO, - getTypeI18nKey(FloatingObjectDto.class), - t("observe.common.FloatingObjectDto.message.creating")); + NuitonValidatorScope.INFO, + getTypeI18nKey(FloatingObjectDto.class), + t("observe.common.FloatingObjectDto.message.creating")); } else { addMessage(getUi(), - NuitonValidatorScope.INFO, - getTypeI18nKey(FloatingObjectDto.class), - t("observe.common.FloatingObjectDto.message.updating")); + NuitonValidatorScope.INFO, + getTypeI18nKey(FloatingObjectDto.class), + t("observe.common.FloatingObjectDto.message.updating")); } super.startEditUI(FloatingObjectUI.BINDING_COMMENT_MODEL); contentUIModel.setModified(create); @@ -263,11 +268,19 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto, FloatingObjectReference reference = DtoModelHelper.fromDataDto(FloatingObjectDto.class).toReference(getDecoratorService().getReferentialLocale(), bean); node = treeHelper.addFloatingObject(parentNode, reference); stopEditUI(); + int selectedIndex = ui.getMainTabbedPane().getSelectedIndex(); if (refresh) { - treeHelper.selectSafeNode(node); + try { + treeHelper.selectSafeNode(node); + } finally { + if (selectedIndex > 0) { + // use new ui! + FloatingObjectUI content = ObserveSwingApplicationContext.get().getContentUIManager().getContent(); + SwingUtilities.invokeLater(() -> content.getMainTabbedPane().setSelectedIndex(selectedIndex)); + } + } } } else { - treeHelper.refreshSelectedNode(); } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d293972c9f0282bfca0f7681fde7... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d293972c9f0282bfca0f7681fde7... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT