Author: mallon Date: 2012-08-01 11:07:09 +0200 (Wed, 01 Aug 2012) New Revision: 3557 Url: http://chorem.org/repositories/revision/lima/3557 Log: Correction concernant l utilisation d un "callBack" sur la modification de couleur de selection d une cellule, permettant ainsi le changement de cette configuration a la volee. Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java trunk/pom.xml Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -59,6 +59,8 @@ import org.nuiton.widget.SwingSession; import javax.swing.*; +import javax.swing.border.LineBorder; +import javax.swing.plaf.BorderUIResource; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -182,11 +184,18 @@ public void showConfig(JAXXContext context) { MainView ui = getUI(context); - LimaConfig config = ui.getConfig(); + final LimaConfig config = ui.getConfig(); - //TODO pepin 2010-08-20 add all options + ConfigUIHelper helper = new ConfigUIHelper(config); - ConfigUIHelper helper = new ConfigUIHelper(config); + LimaConfig.Option colorSelectionFocus = LimaConfig.Option.COLOR_SELECTION_FOCUS; + helper.registerCallBack(colorSelectionFocus.key, _("lima.config.colorselectionfocus"), new ImageIcon(), new Runnable() { + @Override + public void run() { + UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(config.getColorSelectionFocus(), 2))); + } + }); + helper.addCategory(_("lima.config.category.directories"), _("lima.config.category.directories.description")); helper.addOption(LimaConfig.Option.CONFIG_FILE); @@ -198,7 +207,8 @@ helper.addOption(LimaConfig.Option.THOUSAND_SEPARATOR); helper.addOption(LimaConfig.Option.CURRENCY); helper.addOption(LimaConfig.Option.COMPORTMENT_EDITING_CELL); - helper.addOption(LimaConfig.Option.COLOR_SELECTION_FOCUS); + helper.addOption(colorSelectionFocus); + helper.setOptionCallBack(colorSelectionFocus.key); helper.buildUI(context, _("lima.config.category.directories")); helper.displayUI(ui, false); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -32,7 +32,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; @@ -41,10 +40,6 @@ import org.jdesktop.swingx.decorator.Highlighter; import org.jdesktop.swingx.decorator.HighlighterFactory; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; - /** * Financial period table adding color hidhlighter and key management. * @@ -60,7 +55,6 @@ private static final long serialVersionUID = -1960326844433064178L; protected FinancialPeriodViewHandler handler; - protected Color colorSelectionFocus; protected FinancialPeriodTableModel model; @@ -71,9 +65,6 @@ */ public FinancialPeriodTable(FinancialPeriodViewHandler handler) { this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); model = handler.view.getFinancialPeriodTableModel(); addKeyListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -24,15 +24,8 @@ */ package org.chorem.lima.ui.financialstatementchart; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaConfig; import org.jdesktop.swingx.JXTreeTable; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; -import java.awt.Color; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; @@ -45,15 +38,10 @@ private static final long serialVersionUID = 3221024449873737253L; protected FinancialStatementChartViewHandler handler; - protected Color colorSelectionFocus; public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler handler) { this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -25,7 +25,6 @@ package org.chorem.lima.ui.financialstatementreport; -import org.chorem.lima.LimaConfig; import org.chorem.lima.beans.FinancialStatementAmounts; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; @@ -33,9 +32,6 @@ import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyEvent; @@ -49,7 +45,6 @@ private static final long serialVersionUID = 154211277688304679L; protected FinancialStatementReportTableModel model; - protected Color colorSelectionFocus; private Highlighter colorTransaction; @@ -59,10 +54,6 @@ public FinancialStatementReportTable(FinancialStatementReportTableModel model) { super(model); - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -26,7 +26,6 @@ package org.chorem.lima.ui.financialtransaction; import org.apache.commons.collections.CollectionUtils; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.FinancialTransaction; @@ -42,9 +41,6 @@ import org.jdesktop.swingx.decorator.Highlighter; import javax.swing.SwingWorker; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyAdapter; @@ -71,7 +67,6 @@ private static final long serialVersionUID = 3133690382049594727L; protected FinancialTransactionViewHandler handler; - protected Color colorSelectionFocus; private int x_tab; @@ -80,10 +75,6 @@ public FinancialTransactionTable(FinancialTransactionViewHandler handler) { this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(new MyKeyAdapter()); addMouseListener(new MyMouseAdapter()); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -25,9 +25,6 @@ package org.chorem.lima.ui.financialtransactionsearch; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.ui.celleditor.AccountTableCellEditor; @@ -42,9 +39,6 @@ import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyEvent; @@ -68,7 +62,6 @@ private static final long serialVersionUID = 3133690382049594727L; protected FinancialTransactionSearchViewHandler handler; - protected Color colorSelectionFocus; private Highlighter colorTransaction; @@ -78,10 +71,6 @@ this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -25,7 +25,6 @@ package org.chorem.lima.ui.financialtransactionunbalanced; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.ui.celleditor.AccountTableCellEditor; @@ -40,9 +39,6 @@ import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyEvent; @@ -65,7 +61,6 @@ private static final long serialVersionUID = 3133690382049594727L; protected FinancialTransactionUnbalancedViewHandler handler; - protected Color colorSelectionFocus; private Highlighter colorTransaction; @@ -74,9 +69,6 @@ public FinancialTransactionUnbalancedTable(FinancialTransactionUnbalancedViewHandler handler) { this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -25,7 +25,6 @@ package org.chorem.lima.ui.fiscalperiod; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.FiscalPeriod; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; @@ -33,9 +32,6 @@ import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyEvent; @@ -64,14 +60,10 @@ private static final long serialVersionUID = -8462838870024505659L; protected FiscalPeriodTableModel model; - protected Color colorSelectionFocus; public FiscalPeriodTable(FiscalPeriodTableModel model) { super(model); this.model = model; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -25,7 +25,6 @@ package org.chorem.lima.ui.ledger; -import org.chorem.lima.LimaConfig; import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; @@ -33,9 +32,6 @@ import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.decorator.Highlighter; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import java.awt.Color; import java.awt.Component; import java.awt.event.KeyEvent; @@ -57,16 +53,8 @@ private Highlighter colorReportsDatas; - protected Color colorSelectionFocus; - - /** - */ public LedgerTable() { - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(this); addMouseListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -40,10 +40,6 @@ import javax.swing.JComponent; import javax.swing.JTextField; import javax.swing.KeyStroke; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; -import java.awt.Color; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.math.BigDecimal; @@ -61,15 +57,10 @@ private static final long serialVersionUID = 3133690382049594727L; protected LetteringViewHandler handler; - protected Color colorSelectionFocus; public LetteringTable(LetteringTableModel letteringTableModel) { super(letteringTableModel); - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - //To block reaction of the dual key 'ctrl+a' (Selection of all lines) InputMap im = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK), "none"); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2012-08-01 09:07:09 UTC (rev 3557) @@ -24,9 +24,6 @@ */ package org.chorem.lima.ui.vatchart; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaConfig; import org.chorem.lima.entity.VatStatement; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.decorator.ColorHighlighter; @@ -35,9 +32,6 @@ import org.jdesktop.swingx.decorator.Highlighter; import org.jdesktop.swingx.treetable.TreeTableModel; -import javax.swing.UIManager; -import javax.swing.border.LineBorder; -import javax.swing.plaf.BorderUIResource; import javax.swing.tree.TreePath; import java.awt.Color; import java.awt.Component; @@ -53,17 +47,13 @@ private static final long serialVersionUID = 3960840343197845825L; protected VatChartViewHandler handler; - protected Color colorSelectionFocus; + //protected Color colorSelectionFocus; private Highlighter colorLine; public VatChartTreeTable(VatChartViewHandler handler) { this.handler = handler; - //Change border of cell focus - colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus(); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2))); - addKeyListener(this); addMouseListener(this); Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-07-31 14:09:36 UTC (rev 3556) +++ trunk/pom.xml 2012-08-01 09:07:09 UTC (rev 3557) @@ -345,7 +345,7 @@ <nuitonUtilsVersion>2.5.2-SNAPSHOT</nuitonUtilsVersion> <eugenePluginVersion>2.4.2</eugenePluginVersion> <topiaVersion>2.6.11</topiaVersion> - <jaxxVersion>2.5.3-SNAPSHOT</jaxxVersion> + <jaxxVersion>2.5.4-SNAPSHOT</jaxxVersion> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> <openEjbVersion>4.0.0</openEjbVersion> <slf4jVersion>1.6.6</slf4jVersion>