This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 73a98135dd2ab3db5440d14331450e5e3cdbb451 Author: dcosse <cosse@codelutin.com> Date: Wed Sep 30 11:34:35 2015 +0200 refs #1268 déplacement du ListSelectionModel dans le handler --- .../org/chorem/lima/business/ServiceListener.java | 2 +- .../lima/business/ejb/VatStatementServiceImpl.java | 2 +- .../lima/ui/combobox/EntryBookComboBoxModel.java | 4 +- .../ui/combobox/FiscalPeriodComboBoxModel.java | 4 +- .../lima/ui/entrybook/EntryBookViewHandler.java | 8 +-- .../ui/fiscalperiod/FiscalPeriodViewHandler.java | 4 +- .../java/org/chorem/lima/ui/home/AccountsPane.java | 6 +- .../org/chorem/lima/ui/home/EntryBooksPane.java | 8 +-- .../lima/ui/home/FinancialTransactionsPane.java | 6 +- .../org/chorem/lima/ui/home/FiscalYearsPane.java | 10 ++-- .../org/chorem/lima/ui/vatchart/VatChartView.jaxx | 5 +- .../lima/ui/vatchart/VatChartViewHandler.java | 69 +++++++++++++--------- .../chorem/lima/ui/vatchart/VatChartViewModel.java | 5 +- 13 files changed, 72 insertions(+), 61 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java index d97bbcd..2fe75c1 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/ServiceListener.java @@ -24,6 +24,6 @@ package org.chorem.lima.business; public interface ServiceListener { - void notifyMethod(String serviceName, String methodeName); + void notifyMethod(String serviceName, String methodName); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java index cd63bca..f792e18 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java @@ -80,7 +80,7 @@ public class VatStatementServiceImpl extends AbstractLimaService implements VatS protected void validateNewVATStatement(VatStatement masterVatStatement, VatStatement vatStatement) throws AlreadyExistVatStatementException, NotAllowedLabelException, AlreadyAffectedVatBoxException { - if (StringUtils.isNotBlank(vatStatement.getLabel()) && vatStatement.getLabel().contains("/")) { + if (vatStatement.getLabel()!= null && vatStatement.getLabel().contains("/")) { throw new NotAllowedLabelException(vatStatement.getLabel()); } if (masterVatStatement != null) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java index 65ef4f0..295ed1c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java @@ -92,8 +92,8 @@ public class EntryBookComboBoxModel extends AbstractListModel implements ComboBo } @Override - public void notifyMethod(String serviceName, String methodeName) { - if (methodeName.contains("EntryBook") || methodeName.contains("importAll")) { + public void notifyMethod(String serviceName, String methodName) { + if (methodName.contains("EntryBook") || methodName.contains("importAll")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java index 2d297db..9a2a118 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java @@ -121,8 +121,8 @@ public class FiscalPeriodComboBoxModel extends AbstractListModel implements Comb } @Override - public void notifyMethod(String serviceName, String methodeName) { - if (serviceName.contains("FiscalPeriod") || methodeName.contains("importAll")) { + public void notifyMethod(String serviceName, String methodName) { + if (serviceName.contains("FiscalPeriod") || methodName.contains("importAll")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java index 89f8b88..ef3db65 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java @@ -299,12 +299,12 @@ public class EntryBookViewHandler implements ServiceListener { } @Override - public void notifyMethod(String serviceName, String methodeName) { + public void notifyMethod(String serviceName, String methodName) { //refresh on import datas - if (methodeName.contains("importEntryBooks") - || methodeName.contains("importAll") - || methodeName.contains("importAs")) { + if (methodName.contains("importEntryBooks") + || methodName.contains("importAll") + || methodName.contains("importAs")) { loadAllEntryBooks(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java index ba31827..fec4cf6 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java @@ -532,9 +532,9 @@ public class FiscalPeriodViewHandler implements ServiceListener { } @Override - public void notifyMethod(String serviceName, String methodeName) { + public void notifyMethod(String serviceName, String methodName) { //refresh on import datas - if (methodeName.contains("importAll")) { + if (methodName.contains("importAll")) { loadAllFiscalPeriod(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java index 514eda0..02495f3 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java @@ -99,9 +99,9 @@ public class AccountsPane extends AbstractHomePane implements ServiceListener { } @Override - public void notifyMethod(String serviceName, String methodeName) { - log.debug("Nom de la méthode : " + methodeName); - if (methodeName.contains("Account") || methodeName.contains("importAll") || methodeName.contains("importAs")) { + public void notifyMethod(String serviceName, String methodName) { + log.debug("Nom de la méthode : " + methodName); + if (methodName.contains("Account") || methodName.contains("importAll") || methodName.contains("importAs")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java index f9cff5e..619804a 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java @@ -121,10 +121,10 @@ public class EntryBooksPane extends AbstractHomePane implements ServiceListener } @Override - public void notifyMethod(String serviceName, String methodeName) { - log.debug("Nom de la méthode : " + methodeName); - if (methodeName.contains("EntryBook") || methodeName.contains("importAll") - || methodeName.contains("importAs") || methodeName.contains("importEntries")) { + public void notifyMethod(String serviceName, String methodName) { + log.debug("Nom de la méthode : " + methodName); + if (methodName.contains("EntryBook") || methodName.contains("importAll") + || methodName.contains("importAs") || methodName.contains("importEntries")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java index 85b36b1..9a3aef5 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java @@ -139,9 +139,9 @@ public class FinancialTransactionsPane extends AbstractHomePane implements Servi } @Override - public void notifyMethod(String serviceName, String methodeName) { - log.debug("Nom de la méthode : " + methodeName); - if (methodeName.contains("importEntries") || methodeName.contains("importAll") || methodeName.contains("importAs")) { + public void notifyMethod(String serviceName, String methodName) { + log.debug("Nom de la méthode : " + methodName); + if (methodName.contains("importEntries") || methodName.contains("importAll") || methodName.contains("importAs")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java b/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java index 97c2542..1595276 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java @@ -118,11 +118,11 @@ public class FiscalYearsPane extends AbstractHomePane implements ServiceListener } @Override - public void notifyMethod(String serviceName, String methodeName) { - log.debug("Nom de la méthode : " + methodeName); - if (methodeName.contains("FiscalPeriod") || - methodeName.contains("importAll") || - methodeName.contains("importAs")) { + public void notifyMethod(String serviceName, String methodName) { + log.debug("Nom de la méthode : " + methodName); + if (methodName.contains("FiscalPeriod") || + methodName.contains("importAll") || + methodName.contains("importAs")) { refresh(); } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx index 2bf5f16..6f25861 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx @@ -22,7 +22,6 @@ <JPanel layout="{new BorderLayout()}"> <import> - javax.swing.ListSelectionModel org.jdesktop.swingx.JXTreeTable org.jdesktop.swingx.decorator.HighlighterFactory </import> @@ -54,9 +53,7 @@ </JToolBar> - <JScrollPane constraints="BorderLayout.CENTER"> + <JScrollPane id="vatChartTreeTablePane" constraints="BorderLayout.CENTER"> <JXTreeTable id="vatTreeTable"/> - <ListSelectionModel initializer='vatTreeTable.getSelectionModel()' - onValueChanged="setSelectedRow(vatTreeTable.getSelectedRow() != -1)"/> </JScrollPane> </JPanel> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java index 2c363b5..3e7e817 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java @@ -44,6 +44,8 @@ import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; @@ -75,6 +77,25 @@ public class VatChartViewHandler implements ServiceListener { } + public static void DISPLAY_DIALOG(final JDialog dialog, Component view) { + InputMap inputMap = dialog.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + ActionMap actionMap = dialog.getRootPane().getActionMap(); + String binding = "dispose"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); + actionMap.put(binding, new AbstractAction() { + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + }); + + // jaxx constructor don't call super() ? + dialog.setLocationRelativeTo(view); + dialog.setVisible(true); + } + public void init() { InputMap inputMap = view.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); @@ -88,6 +109,22 @@ public class VatChartViewHandler implements ServiceListener { MutableTreeTableNode rootTreeTable = loadAllVatStatements(); setUpTreeTableModel(rootTreeTable); + + addTreeTableListener(); + + } + + protected void addTreeTableListener() { + ListSelectionModel model = view.getVatTreeTable().getSelectionModel(); + model.addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + JXTreeTable vatTreeTable = view.getVatTreeTable(); + view.setSelectedRow(vatTreeTable.getSelectedRow() != -1); + } + } + }); } protected void addShortCutEvent(InputMap inputMap) { @@ -163,7 +200,7 @@ public class VatChartViewHandler implements ServiceListener { public void importVatStatementChart() { final VatChartImportForm importVatForm = new VatChartImportForm(); - displayDialog(importVatForm); + DISPLAY_DIALOG(importVatForm, view); Object value = importVatForm.getChartVatStatementCombo().getSelectedItem(); // if action confirmed @@ -206,7 +243,7 @@ public class VatChartViewHandler implements ServiceListener { newVatChartMovement.setMasterVatStatement(masterVatStatement); editVatChartForm.setVatStatement(newVatChartMovement); - displayDialog(editVatChartForm); + DISPLAY_DIALOG(editVatChartForm, view); } public void updateVatStatement() { @@ -222,7 +259,7 @@ public class VatChartViewHandler implements ServiceListener { editVatChartForm.setIsUpdate(true); editVatChartForm.setVatStatement(vatStatement); - displayDialog(editVatChartForm); + DISPLAY_DIALOG(editVatChartForm, view); } @@ -295,32 +332,8 @@ public class VatChartViewHandler implements ServiceListener { } @Override - public void notifyMethod(String serviceName, String methodeName) { - if (methodeName.contains("VatStatements") - || methodeName.contains("importAll") - || methodeName.contains("importAs")) { - } - } - + public void notifyMethod(String serviceName, String methodName) {} - protected void displayDialog(final JDialog dialog) { - InputMap inputMap = dialog.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - ActionMap actionMap = dialog.getRootPane().getActionMap(); - String binding = "dispose"; - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), binding); - actionMap.put(binding, new AbstractAction() { - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { - dialog.dispose(); - } - }); - - // jaxx constructor don't call super() ? - dialog.setLocationRelativeTo(view); - dialog.setVisible(true); - } protected void addChildToParentsNode(DefaultMutableTreeTableNode parent, Collection<VatStatement> childs) { if (CollectionUtils.isNotEmpty(childs)) { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewModel.java index b4200e3..df3e065 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewModel.java @@ -21,6 +21,7 @@ */ package org.chorem.lima.ui.vatchart; +import jaxx.runtime.swing.JAXXWidgetUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaSwingConfig; @@ -166,11 +167,11 @@ public class VatChartViewModel extends DefaultTreeTableModel { String originalValue = null; switch (column) { case 1: - originalValue = copy.getAccounts() == null ? "" : copy.getAccounts(); + originalValue = JAXXWidgetUtil.getStringValue(copy.getAccounts()); copy.setAccounts(newValue); break; case 2: - originalValue = copy.getBoxName() == null ? "" : copy.getBoxName(); + originalValue = JAXXWidgetUtil.getStringValue(copy.getBoxName()); copy.setBoxName(newValue); break; default: -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.