Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 1853 discussions
r3558 - in trunk/lima-swing/src/main/java/org/chorem/lima: . ui ui/celleditor
by mallon@users.chorem.org 01 Aug '12
by mallon@users.chorem.org 01 Aug '12
01 Aug '12
Author: mallon
Date: 2012-08-01 13:27:51 +0200 (Wed, 01 Aug 2012)
New Revision: 3558
Url: http://chorem.org/repositories/revision/lima/3558
Log:
Correction des deux editeurs de cellule sur lesquels portent les changements de comportement dans la configuration de Lima.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-08-01 09:07:09 UTC (rev 3557)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-08-01 11:27:51 UTC (rev 3558)
@@ -429,7 +429,7 @@
LIMA_HOST_ADDRESS("lima.host.address", n_("lima.config.host.adress"), "localhost", String.class, false, false),
LIMA_STATE_FILE("lima.state.file", n_("lima.config.state.file"), "${lima.data.dir}/limaState.xml", String.class, false, false),
COLOR_SELECTION_FOCUS("colorselectionfocus", _("lima.config.colorselectionfocus"), "#000000", Color.class, false, false),
- COMPORTMENT_EDITING_CELL("comportmenteditingcell", n_("lima.config.comportmenteditingcell"), "ALL", comportmentEditingCellEnum.class, false, false);
+ COMPORTMENT_EDITING_CELL("comportmenteditingcell", _("lima.config.comportmenteditingcell"), "ALL", comportmentEditingCellEnum.class, false, false);
public enum comportmentEditingCellEnum {ALL, NOTHING};
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-08-01 09:07:09 UTC (rev 3557)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-08-01 11:27:51 UTC (rev 3558)
@@ -206,6 +206,8 @@
helper.addOption(LimaConfig.Option.SCALE);
helper.addOption(LimaConfig.Option.THOUSAND_SEPARATOR);
helper.addOption(LimaConfig.Option.CURRENCY);
+ /*Pas de 'callBack' sur le changement de comportement lors de l'édition d'une cellule,
+ * car les deux éditeurs concernés rappellent la config dans un listener ('focusGained')*/
helper.addOption(LimaConfig.Option.COMPORTMENT_EDITING_CELL);
helper.addOption(colorSelectionFocus);
helper.setOptionCallBack(colorSelectionFocus.key);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-01 09:07:09 UTC (rev 3557)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-01 11:27:51 UTC (rev 3558)
@@ -38,7 +38,6 @@
public class BigDecimalTableCellEditor extends NumberCellEditor<BigDecimal>{
protected int row;
- protected String comportmentEditingCell;
public BigDecimalTableCellEditor() {
super(BigDecimal.class, false);
@@ -46,7 +45,7 @@
@Override
public void focusGained(FocusEvent e) {
- comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
+ String comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
JTextField numberEditorTextField = super.getNumberEditor().getTextField();
if (comportmentEditingCell.equals("ALL")) {
numberEditorTextField.selectAll();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-08-01 09:07:09 UTC (rev 3557)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-08-01 11:27:51 UTC (rev 3558)
@@ -51,7 +51,7 @@
private static final long serialVersionUID = 1L;
private final JXDatePicker datePicker;
- protected String comportmentEditingCell;
+ //protected String comportmentEditingCell;
//used to tell if the user has pressed a key
private Date date;
@@ -61,7 +61,7 @@
datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale());
datePicker.getEditor().addFocusListener(this);
datePicker.getEditor().addAncestorListener(this);
- comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
+ //comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
}
@Override
@@ -109,6 +109,7 @@
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFormattedTextField dateFormattedTextField = datePicker.getEditor();
+ String comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
if (comportmentEditingCell.equals("ALL")) {
dateFormattedTextField.selectAll();
} else {
@@ -119,15 +120,6 @@
});
}
- /** Listeners */
- /*public void focusGained(FocusEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- datePicker.getEditor().selectAll();
- }
- });
- }*/
-
public void focusLost(FocusEvent e) {
}
1
0
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>
1
0
31 Jul '12
Author: mallon
Date: 2012-07-31 16:09:36 +0200 (Tue, 31 Jul 2012)
New Revision: 3556
Url: http://chorem.org/repositories/revision/lima/3556
Log:
Suppression de methodes rendues inutiles, dans la classe principale.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-07-31 13:37:49 UTC (rev 3555)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-07-31 14:09:36 UTC (rev 3556)
@@ -137,7 +137,6 @@
LimaConfig config = context.getConfig();
config.parse(args);
context.initI18n(config);
- context.initEditingComportement(config);
return context;
}
1
0
Author: mallon
Date: 2012-07-31 15:37:49 +0200 (Tue, 31 Jul 2012)
New Revision: 3555
Url: http://chorem.org/repositories/revision/lima/3555
Log:
refs #712 Ajout de deux entrees dans le panneau de configuration de l application : une liste deroulante permettant de modifier le comportement de la selection du contenu a l edition, et un editeur de couleur afin de selectionner la couleur du focus de selection d une cellule. (Rajout d'un ?\195?\169diteur dans jaxx 'ColorEditor', et d'un convertisseur de couleur dans nuiton-utils 'ColorConverter'.) - Reste le visuel de selection de la couleur a rendre plus comprehensible.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.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/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
trunk/pom.xml
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -40,6 +40,7 @@
import org.nuiton.util.VersionUtil;
import org.nuiton.util.converter.ConverterUtil;
+import java.awt.Color;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
@@ -72,6 +73,14 @@
protected Version version;
/**
+ * Get the configuration file
+ * @return name of the config. file
+ * */
+ /*public String getConfigFile() {
+ return configFile;
+ }*/
+
+ /**
* Get copyright text (include version).
*
* @return copyright text
@@ -123,6 +132,7 @@
instance = new LimaConfig();
instance.loadConfiguration(configFile);
}
+
return instance;
}
@@ -355,6 +365,22 @@
return getOption(Option.LIMA_HOST_ADDRESS.key);
}
+ public void setColorSelectionFocus(String color) {
+ setOption(Option.COLOR_SELECTION_FOCUS.key, color);
+ }
+
+ public Color getColorSelectionFocus() {
+ return getOptionAsColor((Option.COLOR_SELECTION_FOCUS.key));
+ }
+
+ public void setComportmentEditingCell(String comportmentEditingCell) {
+ setOption(Option.COMPORTMENT_EDITING_CELL.key, comportmentEditingCell);
+ }
+
+ public String getComportmentEditingCell() {
+ return getOption((Option.COMPORTMENT_EDITING_CELL.key));
+ }
+
/** Used in ???? */
public static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"};
@@ -386,6 +412,7 @@
*/
public enum Option implements OptionDef {
+
CONFIG_FILE(CONFIG_FILE_NAME, n_("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true),
DATA_DIR("lima.data.dir", n_("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false),
RESOURCES_DIRECTORY("lima.resources.dir", n_("lima.config.resources.dir.description"), "${lima.data.dir}/resources-${application.version}", String.class, false, false),
@@ -400,8 +427,12 @@
SUPPORT_EMAIL("lima.misc.supportemail", n_("lima.misc.supportemail.description"), "support(a)codelutin.com", String.class, false, false),
OPENEJB_REMOTEMODE("lima.openejb.remotemode", n_("lima.openejb.remotemode.description"), "false", String.class, false, false),
LIMA_HOST_ADDRESS("lima.host.address", n_("lima.config.host.adress"), "localhost", String.class, false, false),
- LIMA_STATE_FILE("lima.state.file", n_("lima.config.state.file"), "${lima.data.dir}/limaState.xml", String.class, false, false);
+ LIMA_STATE_FILE("lima.state.file", n_("lima.config.state.file"), "${lima.data.dir}/limaState.xml", String.class, false, false),
+ COLOR_SELECTION_FOCUS("colorselectionfocus", _("lima.config.colorselectionfocus"), "#000000", Color.class, false, false),
+ COMPORTMENT_EDITING_CELL("comportmenteditingcell", n_("lima.config.comportmenteditingcell"), "ALL", comportmentEditingCellEnum.class, false, false);
+ public enum comportmentEditingCellEnum {ALL, NOTHING};
+
public final String key;
public final String description;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -137,6 +137,7 @@
LimaConfig config = context.getConfig();
config.parse(args);
context.initI18n(config);
+ context.initEditingComportement(config);
return context;
}
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -197,6 +197,8 @@
helper.addOption(LimaConfig.Option.SCALE);
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.buildUI(context, _("lima.config.category.directories"));
helper.displayUI(ui, false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -24,9 +24,12 @@
*/
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import org.chorem.lima.LimaConfig;
import javax.swing.JTable;
+import javax.swing.JTextField;
import java.awt.Component;
+import java.awt.event.FocusEvent;
import java.math.BigDecimal;
/**
@@ -35,15 +38,25 @@
public class BigDecimalTableCellEditor extends NumberCellEditor<BigDecimal>{
protected int row;
+ protected String comportmentEditingCell;
- /**
- * constructor
- */
public BigDecimalTableCellEditor() {
super(BigDecimal.class, false);
}
@Override
+ public void focusGained(FocusEvent e) {
+ comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
+ JTextField numberEditorTextField = super.getNumberEditor().getTextField();
+ if (comportmentEditingCell.equals("ALL")) {
+ numberEditorTextField.selectAll();
+ } else {
+ int textFieldSize = numberEditorTextField.getText().length();
+ numberEditorTextField.select(textFieldSize, textFieldSize);
+ }
+ }
+
+ @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.row = row;
return super.getTableCellEditorComponent(table, value, isSelected, row, column);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -26,10 +26,12 @@
package org.chorem.lima.ui.celleditor;
import org.apache.commons.lang3.time.DateUtils;
+import org.chorem.lima.LimaConfig;
import org.chorem.lima.LimaContext;
import org.jdesktop.swingx.JXDatePicker;
import javax.swing.AbstractCellEditor;
+import javax.swing.JFormattedTextField;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
@@ -46,11 +48,11 @@
public class DateTableCellEditor extends AbstractCellEditor
implements TableCellEditor, FocusListener, AncestorListener {
+ private static final long serialVersionUID = 1L;
+
private final JXDatePicker datePicker;
+ protected String comportmentEditingCell;
- private static final long serialVersionUID = 1L;
-// private static DateTableCellEditor editor;
-
//used to tell if the user has pressed a key
private Date date;
@@ -59,6 +61,7 @@
datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale());
datePicker.getEditor().addFocusListener(this);
datePicker.getEditor().addAncestorListener(this);
+ comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell();
}
@Override
@@ -101,15 +104,30 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
- /** Listeners */
+ @Override
public void focusGained(FocusEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- datePicker.getEditor().selectAll();
+ JFormattedTextField dateFormattedTextField = datePicker.getEditor();
+ if (comportmentEditingCell.equals("ALL")) {
+ dateFormattedTextField.selectAll();
+ } else {
+ int textFieldSize = dateFormattedTextField.getText().length();
+ dateFormattedTextField.select(textFieldSize, textFieldSize);
+ }
}
});
}
+ /** Listeners */
+ /*public void focusGained(FocusEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ datePicker.getEditor().selectAll();
+ }
+ });
+ }*/
+
public void focusLost(FocusEvent e) {
}
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -32,6 +32,7 @@
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;
@@ -40,6 +41,10 @@
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.
*
@@ -55,6 +60,7 @@
private static final long serialVersionUID = -1960326844433064178L;
protected FinancialPeriodViewHandler handler;
+ protected Color colorSelectionFocus;
protected FinancialPeriodTableModel model;
@@ -65,6 +71,9 @@
*/
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -26,8 +26,13 @@
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;
@@ -39,15 +44,16 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3221024449873737253L;
- /** log. */
- private static final Log log = LogFactory
- .getLog(FinancialStatementChartTreeTable.class);
-
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -25,6 +25,7 @@
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;
@@ -32,6 +33,9 @@
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;
@@ -45,6 +49,7 @@
private static final long serialVersionUID = 154211277688304679L;
protected FinancialStatementReportTableModel model;
+ protected Color colorSelectionFocus;
private Highlighter colorTransaction;
@@ -54,6 +59,10 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -26,6 +26,7 @@
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;
@@ -70,6 +71,7 @@
private static final long serialVersionUID = 3133690382049594727L;
protected FinancialTransactionViewHandler handler;
+ protected Color colorSelectionFocus;
private int x_tab;
@@ -78,8 +80,9 @@
public FinancialTransactionTable(FinancialTransactionViewHandler handler) {
this.handler = handler;
- //Change border of cell focus for a better visibility
- UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(new Color(0, 0, 0), 2)));
+ //Change border of cell focus
+ colorSelectionFocus = LimaConfig.getInstance().getColorSelectionFocus();
+ UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(colorSelectionFocus, 2)));
addKeyListener(new MyKeyAdapter());
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -27,6 +27,7 @@
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;
@@ -41,6 +42,9 @@
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;
@@ -63,11 +67,8 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
- /** log. */
- private static final Log log = LogFactory
- .getLog(FinancialTransactionSearchTable.class);
-
protected FinancialTransactionSearchViewHandler handler;
+ protected Color colorSelectionFocus;
private Highlighter colorTransaction;
@@ -77,6 +78,10 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -25,6 +25,7 @@
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;
@@ -39,6 +40,9 @@
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;
@@ -61,6 +65,7 @@
private static final long serialVersionUID = 3133690382049594727L;
protected FinancialTransactionUnbalancedViewHandler handler;
+ protected Color colorSelectionFocus;
private Highlighter colorTransaction;
@@ -69,6 +74,9 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -25,6 +25,7 @@
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;
@@ -32,6 +33,9 @@
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;
@@ -60,10 +64,14 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -25,6 +25,7 @@
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;
@@ -32,6 +33,9 @@
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;
@@ -53,10 +57,16 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -25,6 +25,7 @@
package org.chorem.lima.ui.lettering;
+import org.chorem.lima.LimaConfig;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.ui.celleditor.AccountTableCellEditor;
@@ -39,6 +40,10 @@
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;
@@ -56,10 +61,15 @@
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-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2012-07-31 13:37:49 UTC (rev 3555)
@@ -26,6 +26,7 @@
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;
@@ -34,6 +35,9 @@
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;
@@ -48,17 +52,18 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3960840343197845825L;
- /** log. */
- private static final Log log = LogFactory
- .getLog(VatChartTreeTable.class);
-
protected VatChartViewHandler handler;
+ 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/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-31 13:37:49 UTC (rev 3555)
@@ -70,6 +70,8 @@
lima.config.category.directories.description=Directories used by LIMA
lima.config.category.other=Other
lima.config.category.other.description=Other configuration properties
+lima.config.colorselectionfocus=Cadring color of the selection of a cell
+lima.config.comportmenteditingcell=Comportment selection of the containing on the edition of a cell
lima.config.configFileName.description=
lima.config.currency.description=
lima.config.data.dir.description=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-31 13:37:49 UTC (rev 3555)
@@ -70,6 +70,8 @@
lima.config.category.directories.description=Répertoires utilisés par Lima
lima.config.category.other=Autre
lima.config.category.other.description=Autre propriétés de configuration
+lima.config.colorselectionfocus=Couleur de l'encadrement de sélection d'une cellule
+lima.config.comportmenteditingcell=Comportement de la sélection du contenu lors de l'édition d'une cellule ('ALL' \: sélection de tout le contenu; 'NOTHING' \: aucune sélection)
lima.config.configFileName.description=
lima.config.currency.description=
lima.config.data.dir.description=
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-07-30 10:17:08 UTC (rev 3554)
+++ trunk/pom.xml 2012-07-31 13:37:49 UTC (rev 3555)
@@ -342,10 +342,10 @@
<projectId>lima</projectId>
<!-- customized libs version -->
- <nuitonUtilsVersion>2.5.1</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.5.2-SNAPSHOT</nuitonUtilsVersion>
<eugenePluginVersion>2.4.2</eugenePluginVersion>
<topiaVersion>2.6.11</topiaVersion>
- <jaxxVersion>2.5.1</jaxxVersion>
+ <jaxxVersion>2.5.3-SNAPSHOT</jaxxVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<openEjbVersion>4.0.0</openEjbVersion>
<slf4jVersion>1.6.6</slf4jVersion>
1
0
r3554 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/financialtransaction resources
by mallon@users.chorem.org 30 Jul '12
by mallon@users.chorem.org 30 Jul '12
30 Jul '12
Author: mallon
Date: 2012-07-30 12:17:08 +0200 (Mon, 30 Jul 2012)
New Revision: 3554
Url: http://chorem.org/repositories/revision/lima/3554
Log:
fixes #710 Ajout du surlignage en rouge des entrees ayant leur debit et credit egaux a zero, et correction du surlignage des transactions n ayant pas leur balance a zero.
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/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/resources/log4j.properties
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-24 16:39:43 UTC (rev 3553)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-30 10:17:08 UTC (rev 3554)
@@ -121,7 +121,7 @@
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
boolean isHighlighted = false;
- Object value = adapter.getValueAt(adapter.row, 8);
+ Object value = adapter.getValueAt(adapter.row, 6);
if (value instanceof BigDecimal) {
BigDecimal currentBalance = (BigDecimal) value;
// can compare two BigDecimals with different scales
@@ -133,10 +133,29 @@
return isHighlighted;
}
};
+
+ //To color in red entry with debit and credit equals to zero
colorTransaction =
new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
+ HighlightPredicate debitCreditZero = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+
+ Object valueDebit = adapter.getValueAt(adapter.row, 4);
+ Object valueCredit = adapter.getValueAt(adapter.row, 5);
+
+ return (valueDebit.equals(BigDecimal.ZERO) || valueDebit.toString().equals("0.00"))
+ && (valueCredit.equals(BigDecimal.ZERO) || valueCredit.toString().equals("0.00"));
+ }
+ };
+
+ Highlighter entryDebitCreditZero =
+ new ColorHighlighter(debitCreditZero, new Color(255, 198, 209), null);
+ addHighlighter(entryDebitCreditZero);
+
}
public FinancialTransactionViewHandler getHandler() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-24 16:39:43 UTC (rev 3553)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-30 10:17:08 UTC (rev 3554)
@@ -109,7 +109,7 @@
}
// entry books
- List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks();
+ final List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks();
view.getEntryBookComboBoxModel().setObjects(allEntryBooks);
if (log.isDebugEnabled()) {
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2012-07-24 16:39:43 UTC (rev 3553)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2012-07-30 10:17:08 UTC (rev 3554)
@@ -42,4 +42,4 @@
log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=DEBUG
log4j.logger.org.chorem.lima.ui.lettering.LettringSelectionModel=DEBUG
log4j.logger.org.chorem.lima.ui.lettering.LetteringEditModel=DEBUG
-log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTableModel=DEBUG
+log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTableModel=DEBUG
\ No newline at end of file
1
0
r3553 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/financialtransaction resources
by mallon@users.chorem.org 24 Jul '12
by mallon@users.chorem.org 24 Jul '12
24 Jul '12
Author: mallon
Date: 2012-07-24 18:39:43 +0200 (Tue, 24 Jul 2012)
New Revision: 3553
Url: http://chorem.org/repositories/revision/lima/3553
Log:
refs #710 Correction permettant de ne plus avoir de ligne a zero lorsqu une des deux cellules (Debit / credit) est seulement editee. Reste le surlignage en rouge lors de la creation d une entree (Et donc avec des valeurs par defaut a zero pour le debit / credit).
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/resources/log4j.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-24 14:56:32 UTC (rev 3552)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-24 16:39:43 UTC (rev 3553)
@@ -175,6 +175,7 @@
}
} else if (result instanceof Entry) {
Entry currentEntry = (Entry) result;
+
switch (column) {
case 0:
result = null; // date
@@ -228,7 +229,7 @@
/**
* Obtain the first entry book of the current transaction.
*
- * @param selectedRow
+ * @param selectedRow row selected
* @return first entry index
*/
public int getFirstEntry(int selectedRow) {
@@ -292,7 +293,7 @@
Object currentRow = transactionAndEntries.get(row);
- FinancialTransaction currentFinancialTransaction = null;
+ FinancialTransaction currentFinancialTransaction;
if (currentRow instanceof FinancialTransaction) {
currentFinancialTransaction = (FinancialTransaction) currentRow;
switch (column) {
@@ -306,96 +307,98 @@
financialTransactionService.updateFinancialTransaction(currentFinancialTransaction);
} else if (currentRow instanceof Entry) {
- Entry currentEntry = (Entry) currentRow;
- currentFinancialTransaction = currentEntry.getFinancialTransaction();
- boolean updateTransaction = false;
- switch (column) {
- case 1:
- String voucher = ((String) value).trim();
+ /*To stay with one value in debit or credit*/
+ if ( !value.equals(BigDecimal.ZERO) && !value.equals(BigDecimal.valueOf(Double.valueOf("00.00")))) {
+ Entry currentEntry = (Entry) currentRow;
+ currentFinancialTransaction = currentEntry.getFinancialTransaction();
+ boolean updateTransaction = false;
+ switch (column) {
+ case 1:
+ String voucher = ((String) value).trim();
- int firstEntryRow = getFirstEntry(row);
- if (row == firstEntryRow) {
+ int firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
- // let's update the voucher of all entries of
- // the transaction
+ // let's update the voucher of all entries of
+ // the transaction
- for (Entry entry : currentFinancialTransaction.getEntry()) {
- entry.setVoucher(voucher);
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
+ entry.setVoucher(voucher);
+ }
+ updateTransaction = true;
+ } else {
+
+ // not on first row, just update this entry voucher
+ currentEntry.setVoucher(voucher);
}
- updateTransaction = true;
- } else {
+ break;
+ case 2:
+ Account account = (Account) value;
+ currentEntry.setAccount(account);
+ // let's copy the account description
+ String description1 = account.getLabel();
+ firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
+ // let's update the description of all entries of
+ // the transaction
- // not on first row, just update this entry voucher
- currentEntry.setVoucher(voucher);
- }
- break;
- case 2:
- Account account = (Account) value;
- currentEntry.setAccount(account);
- // let's copy the account description
- String description1 = account.getLabel();
- firstEntryRow = getFirstEntry(row);
- if (row == firstEntryRow) {
- // let's update the description of all entries of
- // the transaction
-
- for (Entry entry : currentFinancialTransaction.getEntry()) {
- entry.setDescription(description1);
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
+ entry.setDescription(description1);
+ }
+ updateTransaction = true;
+ } else {
+ // not on first row, just update this entry description
+ currentEntry.setDescription(description1);
}
- updateTransaction = true;
- } else {
- // not on first row, just update this entry description
- currentEntry.setDescription(description1);
- }
- break;
- case 3:
- String description = ((String) value).trim();
- firstEntryRow = getFirstEntry(row);
- if (row == firstEntryRow) {
+ break;
+ case 3:
+ String description = ((String) value).trim();
+ firstEntryRow = getFirstEntry(row);
+ if (row == firstEntryRow) {
- // let's update the description of all entries of
- // the transaction
+ // let's update the description of all entries of
+ // the transaction
- for (Entry entry : currentFinancialTransaction.getEntry()) {
- entry.setDescription(description);
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
+ entry.setDescription(description);
+ }
+ updateTransaction = true;
+ } else {
+
+ // not on first row, just update this entry description
+ currentEntry.setDescription(description);
}
- updateTransaction = true;
- } else {
+ break;
+ case 4:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(true);
+ break;
+ case 5:
+ currentEntry.setAmount((BigDecimal) value);
+ currentEntry.setDebit(false);
+ break;
+ }
- // not on first row, just update this entry description
- currentEntry.setDescription(description);
+ // some modification must update all other
+ // first row modification update following rows
+ if (updateTransaction) {
+ // FIXME echatellier 20120413 make a single service call
+ for (Entry entry : currentFinancialTransaction.getEntry()) {
+ financialTransactionService.updateEntry(entry);
}
- break;
- case 4:
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(true);
- break;
- case 5:
- currentEntry.setAmount((BigDecimal) value);
- currentEntry.setDebit(false);
- break;
- }
-
- // some modification must update all other
- // first row modification update following rows
- if (updateTransaction) {
- // FIXME echatellier 20120413 make a single service call
- for (Entry entry : currentFinancialTransaction.getEntry()) {
- financialTransactionService.updateEntry(entry);
+ } else {
+ financialTransactionService.updateEntry(currentEntry);
}
- } else {
- financialTransactionService.updateEntry(currentEntry);
+ // FIXME echatellier 20120413 une modification des dates fait que l'ordre
+ // devient faux
+ int trIndex = indexOf(currentFinancialTransaction);
+ int endIndex = trIndex;
+ if (currentFinancialTransaction.getEntry() != null) {
+ endIndex += currentFinancialTransaction.getEntry().size();
+ }
+ fireTableRowsUpdated(trIndex, endIndex);
}
}
-
- // FIXME echatellier 20120413 une modification des dates fait que l'ordre
- // devient faux
- int trIndex = indexOf(currentFinancialTransaction);
- int endIndex = trIndex;
- if (currentFinancialTransaction.getEntry() != null) {
- endIndex += currentFinancialTransaction.getEntry().size();
- }
- fireTableRowsUpdated(trIndex, endIndex);
}
public Object getElementAt(int row) {
@@ -431,7 +434,7 @@
/**
* Insert new row.
*
- * @param object
+ * @param object object to insert
*/
public void addRow(Object object) {
transactionAndEntries.add(object);
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2012-07-24 14:56:32 UTC (rev 3552)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2012-07-24 16:39:43 UTC (rev 3553)
@@ -42,3 +42,4 @@
log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=DEBUG
log4j.logger.org.chorem.lima.ui.lettering.LettringSelectionModel=DEBUG
log4j.logger.org.chorem.lima.ui.lettering.LetteringEditModel=DEBUG
+log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTableModel=DEBUG
1
0
r3552 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by mallon@users.chorem.org 24 Jul '12
by mallon@users.chorem.org 24 Jul '12
24 Jul '12
Author: mallon
Date: 2012-07-24 16:56:32 +0200 (Tue, 24 Jul 2012)
New Revision: 3552
Url: http://chorem.org/repositories/revision/lima/3552
Log:
Modification de la requete de selection de la derniere lettre : utilisation de distinct, afin de ne pas avoir a utiliser un hashSet.
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-24 14:47:00 UTC (rev 3551)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-24 14:56:32 UTC (rev 3552)
@@ -25,20 +25,15 @@
package org.chorem.lima.entity;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.LetteringFilter;
import org.nuiton.topia.TopiaException;
+import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
public class EntryDAOImpl<E extends Entry> extends EntryDAOAbstract<Entry> {
- private static final Log log = LogFactory.getLog(EntryDAOImpl.class);
-
/**
* Requete generique qui recupere les entrees equilibrées portant entre
* deux dates.
@@ -124,12 +119,12 @@
return entries;
}
- public Set<String> findLetters() throws TopiaException{
- String query = "Select E.lettering FROM " + Entry.class.getName() + " E" +
+ public List<String> findLetters() throws TopiaException{
+ String query = "Select distinct E.lettering FROM " + Entry.class.getName() + " E" +
" where E.lettering <> null" +
" order by E.lettering desc";
- Set<String> result = new HashSet<String>(context.findAll(query));
+ List<String> result = new ArrayList<String>(context.findAll(query));
return result;
}
1
0
r3551 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: celleditor financialtransaction
by mallon@users.chorem.org 24 Jul '12
by mallon@users.chorem.org 24 Jul '12
24 Jul '12
Author: mallon
Date: 2012-07-24 16:47:00 +0200 (Tue, 24 Jul 2012)
New Revision: 3551
Url: http://chorem.org/repositories/revision/lima/3551
Log:
fixes #647 Le contenu des cellules de saisie est d?\195?\169sormais s?\195?\169lectionn?\195?\169 par d?\195?\169faut lors d'une ?\195?\169dition.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-24 14:25:42 UTC (rev 3550)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-24 14:47:00 UTC (rev 3551)
@@ -26,10 +26,7 @@
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
import java.awt.Component;
-import java.awt.event.FocusEvent;
import java.math.BigDecimal;
/**
@@ -38,7 +35,6 @@
public class BigDecimalTableCellEditor extends NumberCellEditor<BigDecimal>{
protected int row;
- protected JTextField textFieldNumberValue;
/**
* constructor
@@ -47,42 +43,10 @@
super(BigDecimal.class, false);
}
- public int getRow() {
- return row;
- }
-
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.row = row;
return super.getTableCellEditorComponent(table, value, isSelected, row, column);
}
- //To stay with old value and just complete it
- @Override
- public void focusGained(FocusEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- textFieldNumberValue = numberEditor.getTextField();
- textFieldNumberValue.requestFocus();
- int length = textFieldNumberValue.getText().length();
- textFieldNumberValue.select(length, length);
- }
- });
- }
-
- /**To limit number of decimals at two, and rounded up it
- * */
- /*@Override
- public void focusLost(FocusEvent e) {*/
- //getCellEditorValue().setScale(2, RoundingMode.HALF_UP);
- /*SwingUtilities.invokeLater(new Runnable() {
- public void run() {*/
- /* BigDecimal cellEditorValue = getCellEditorValue();
- cellEditorValue.setScale(2, RoundingMode.HALF_UP);
- System.out.println("cellEditorValue : " + cellEditorValue);
- numberEditor.getTextField().setText(cellEditorValue.toString());
- System.out.println("numberEditor.getTextField().getText() : " + numberEditor.getTextField().getText());*/
- /* }
- });*/
- //}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-07-24 14:25:42 UTC (rev 3550)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-07-24 14:47:00 UTC (rev 3551)
@@ -29,11 +29,13 @@
import org.chorem.lima.LimaContext;
import org.jdesktop.swingx.JXDatePicker;
-import javax.swing.*;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.table.TableCellEditor;
-import java.awt.*;
+import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
@@ -100,13 +102,10 @@
}
/** Listeners */
- //To stay with old value and just complete it
- @Override
public void focusGained(FocusEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- int length = datePicker.getEditor().getText().length();
- datePicker.getEditor().select(length, length);
+ datePicker.getEditor().selectAll();
}
});
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2012-07-24 14:25:42 UTC (rev 3550)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2012-07-24 14:47:00 UTC (rev 3551)
@@ -24,15 +24,14 @@
*/
package org.chorem.lima.ui.celleditor;
-import java.awt.Color;
-import java.awt.Component;
-
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
/**
* Renderer qui affiche la valeur de la cellule (toString()) en permettant de
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-24 14:25:42 UTC (rev 3550)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-24 14:47:00 UTC (rev 3551)
@@ -34,7 +34,6 @@
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
-import org.jdesktop.swingx.JXDatePicker;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
@@ -45,7 +44,6 @@
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.plaf.BorderUIResource;
-import javax.swing.text.JTextComponent;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.KeyAdapter;
@@ -54,7 +52,6 @@
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.Date;
-import java.util.EventObject;
/**
* Table des transaction qui ajoute des comportement (keys).
@@ -313,27 +310,4 @@
}
}
- @Override
- public boolean editCellAt(int row, int column, EventObject e) {
- boolean result = super.editCellAt(row, column, e);
- int lengthCellValue;
- Component editorComponent = getEditorComponent();
- if (editorComponent != null) {
- if (editorComponent instanceof JXDatePicker) {
- JXDatePicker datePickerComponent = (JXDatePicker) editorComponent;
- lengthCellValue = datePickerComponent.getEditor().getText().length();
- if (lengthCellValue != -1) {
- datePickerComponent.getEditor().select(lengthCellValue, lengthCellValue);
- }
- } else if ((editorComponent instanceof JTextComponent)) {
- JTextComponent textComponent = (JTextComponent) editorComponent;
- lengthCellValue = textComponent.getText().length();
- if (lengthCellValue != -1) {
- textComponent.select(lengthCellValue, lengthCellValue);
- }
- }
- }
- return result;
- }
-
}
1
0
r3550 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/utils lima-business/src/test/java/org/chorem/lima/business lima-business/src/test/resources lima-callao/src/main/java/org/chorem/lima/entity
by mallon@users.chorem.org 24 Jul '12
by mallon@users.chorem.org 24 Jul '12
24 Jul '12
Author: mallon
Date: 2012-07-24 16:25:42 +0200 (Tue, 24 Jul 2012)
New Revision: 3550
Url: http://chorem.org/repositories/revision/lima/3550
Log:
fixes #709 Correction de l incrementation du lettrage, permettant de depasser les 17000 possibilites; realisation d une classe de test pour le comparator ajoute, ainsi que pour la classe de service permettant d obtenir la lettre suivante; remplacement de la liste, contenant les resultats de la requete, par un hashset.
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/LetteringComparator.java
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/LetteringComparatorTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/utils/
Removed:
trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-business/src/test/resources/log4j.properties
trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-23 15:42:42 UTC (rev 3549)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -35,6 +35,7 @@
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.OptionsService;
import org.chorem.lima.business.api.ReportService;
+import org.chorem.lima.business.utils.LetteringComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.Entry;
@@ -52,6 +53,7 @@
import javax.ejb.TransactionAttribute;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -124,39 +126,39 @@
@Override
public String getNextLetters() throws LimaException {
String lastActualLetters;
-
try {
EntryDAO entryDAO = getDaoHelper().getEntryDAO();
- lastActualLetters = entryDAO.findLetters();
+
+ List<String> letters = new ArrayList<String>(entryDAO.findLetters());
+ lastActualLetters = findLastLetter(letters);
+
} catch (Exception ex) {
throw new LimaException("Can't get new letters", ex);
}
- String nextThirdLetter ="A";
- String nextSecondLetter = "A";
- String nextFirstLetter = "A";
+ /**Increment letter alphabetically*/
+ if (lastActualLetters.charAt(0) != 'Z') {
+ String finLastActualLetters = lastActualLetters.substring(1, lastActualLetters.length());
+ return String.valueOf( (char) (lastActualLetters.charAt(0) + 1)) + finLastActualLetters;
+ } else {
+ return "A" + lastActualLetters;
+ }
+ }
- //TODO:permettre de lettrer avec plus de trois lettres
+ public String findLastLetter(List<String> letters) {
- if (lastActualLetters != null && !lastActualLetters.isEmpty()){
- if (lastActualLetters.length() > 2 && lastActualLetters.charAt(2) != 'Z'){
- nextThirdLetter = incrementLetter(2, lastActualLetters);
- }else if (lastActualLetters.length() > 1 && lastActualLetters.charAt(1) != 'Z'){
- nextSecondLetter = incrementLetter(1, lastActualLetters);
- }else if (lastActualLetters.charAt(0) != 'Z'){
- nextFirstLetter = incrementLetter(0, lastActualLetters);
- }
- }
+ String result;
- String nextLetters = String.valueOf(nextFirstLetter + nextSecondLetter + nextThirdLetter);
+ Collections.sort(letters, new LetteringComparator());
+ Collections.reverse(letters);
- return nextLetters;
- }
+ if (letters.isEmpty()) {
+ result = "";
- /**Increment letter alphabetically*/
- protected String incrementLetter(int indiceLetter, String lastActualLetters){
- int valueLetter = lastActualLetters.charAt(indiceLetter);
- return String.valueOf( (char) (valueLetter + 1));
+ } else {
+ result = letters.get(0);
+ }
+ return result;
}
/**
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/LetteringComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/LetteringComparator.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/LetteringComparator.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -0,0 +1,34 @@
+package org.chorem.lima.business.utils;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: mallon
+ * Date: 24/07/12
+ * Time: 15:39
+ * To change this template use File | Settings | File Templates.
+ */
+public class LetteringComparator implements Serializable , Comparator<String> {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int compare(String firstString, String secondString) {
+
+ int lengthFirstString = firstString.length();
+ int lengthSecondString = secondString.length();
+
+ if (lengthFirstString < lengthSecondString) {
+ return -1;
+ } else if (lengthFirstString > lengthSecondString) {
+ return 1;
+ } else {
+ if (firstString.charAt(0) < secondString.charAt(0)) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+ }
+}
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java 2012-07-23 15:42:42 UTC (rev 3549)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -1,145 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * 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>.
- * #L%
- */
-
-package org.chorem.lima.business;
-
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.EntryImpl;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FinancialTransactionImpl;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.util.List;
-
-/**
- * Test on financial transaction service.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class FinancialTransactionServiceImplTest extends AbstractLimaTest {
-
- @Before
- public void initTest() throws LimaException, ParseException {
- initTestDatabase();
- }
-
- /**
- * Test to find all unbalanced transactions.
- * Nothing wrong here.
- *
- * @throws ParseException
- * @throws LimaException
- */
- @Test
- public void testGetInexactTransactionAllGood() throws ParseException, LimaException {
- FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
- List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
- Assert.assertTrue(transactions.isEmpty());
- }
-
- /**
- * Test to find all unbalanced transactions.
- *
- * wrong data.
- *
- * @throws ParseException
- * @throws LimaException
- */
- @Test
- public void testGetInexactTransactionNotAllGood() throws ParseException, LimaException {
-
- EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv");
- Account accountVmpVae = accountService.getAccountByNumber("511");
-
- FinancialTransaction transaction1 = new FinancialTransactionImpl();
- transaction1.setTransactionDate(df.parse("April 5, 2012"));
- transaction1.setEntryBook(journalDesVentes);
- transaction1 = financialTransactionService.createFinancialTransaction(transaction1);
-
- Entry tr1Entry1 = new EntryImpl();
- tr1Entry1.setAmount(BigDecimal.valueOf(42.0));
- tr1Entry1.setAccount(accountVmpVae);
- tr1Entry1.setFinancialTransaction(transaction1);
- //tr1Entry1.setDescription("test desc");
- tr1Entry1.setVoucher("voucher");
- tr1Entry1 = financialTransactionService.createEntry(tr1Entry1);
-
- Entry tr1Entry2 = new EntryImpl();
- tr1Entry2.setAmount(BigDecimal.valueOf(42.0));
- tr1Entry2.setDebit(true);
- tr1Entry2.setAccount(accountVmpVae);
- tr1Entry2.setFinancialTransaction(transaction1);
- tr1Entry2.setDescription("test desc");
- tr1Entry2.setVoucher("voucher");
- tr1Entry2 = financialTransactionService.createEntry(tr1Entry2);
-
- // one in period
- FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
- List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
- Assert.assertEquals(1, transactions.size());
- }
-
- /**
- * Test to find all unbalanced transactions.
- *
- * Test only unbalanced transactions (no data errors : fields).
- *
- * @throws ParseException
- * @throws LimaException
- */
- @Test
- public void testGetUnbalancedTransactionNotAllGood() throws ParseException, LimaException {
-
- EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv");
- Account accountVmpVae = accountService.getAccountByNumber("511");
-
- FinancialTransaction transaction1 = new FinancialTransactionImpl();
- transaction1.setTransactionDate(df.parse("April 5, 2012"));
- transaction1.setEntryBook(journalDesVentes);
- transaction1 = financialTransactionService.createFinancialTransaction(transaction1);
-
- Entry tr1Entry1 = new EntryImpl();
- tr1Entry1.setAmount(BigDecimal.valueOf(54.0));
- tr1Entry1.setAccount(accountVmpVae);
- tr1Entry1.setFinancialTransaction(transaction1);
- tr1Entry1.setDescription("test desc");
- tr1Entry1.setVoucher("voucher");
- tr1Entry1 = financialTransactionService.createEntry(tr1Entry1);
-
- // one in period
- FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
- List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
- Assert.assertEquals(1, transactions.size());
- }
-}
Added: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java (rev 0)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -0,0 +1,165 @@
+/*
+ * #%L
+ * $Id: FinancialTransactionServiceImplTest.java 3408 2012-05-09 15:37:59Z echatellier $
+ * $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-business/src/test/java/org/chorem… $
+ * %%
+ * Copyright (C) 2012 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * 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>.
+ * #L%
+ */
+
+package org.chorem.lima.business;
+
+import org.chorem.lima.business.ejb.FinancialTransactionServiceImpl;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.EntryImpl;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FinancialTransactionImpl;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test on financial transaction service.
+ *
+ * @author chatellier
+ * @version $Revision: 3408 $
+ *
+ * Last update : $Date: 2012-05-09 17:37:59 +0200 (mer. 09 mai 2012) $
+ * By : $Author: echatellier $
+ */
+public class FinancialTransactionServiceImplTest extends AbstractLimaTest {
+
+ @Before
+ public void initTest() throws LimaException, ParseException {
+ initTestDatabase();
+ }
+
+ /**
+ * Test to find all unbalanced transactions.
+ * Nothing wrong here.
+ *
+ * @throws ParseException
+ * @throws LimaException
+ */
+ @Test
+ public void testGetInexactTransactionAllGood() throws ParseException, LimaException {
+ FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
+ List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
+ Assert.assertTrue(transactions.isEmpty());
+ }
+
+ /**
+ * Test to find all unbalanced transactions.
+ *
+ * wrong data.
+ *
+ * @throws ParseException
+ * @throws LimaException
+ */
+ @Test
+ public void testGetInexactTransactionNotAllGood() throws ParseException, LimaException {
+
+ EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv");
+ Account accountVmpVae = accountService.getAccountByNumber("511");
+
+ FinancialTransaction transaction1 = new FinancialTransactionImpl();
+ transaction1.setTransactionDate(df.parse("April 5, 2012"));
+ transaction1.setEntryBook(journalDesVentes);
+ transaction1 = financialTransactionService.createFinancialTransaction(transaction1);
+
+ Entry tr1Entry1 = new EntryImpl();
+ tr1Entry1.setAmount(BigDecimal.valueOf(42.0));
+ tr1Entry1.setAccount(accountVmpVae);
+ tr1Entry1.setFinancialTransaction(transaction1);
+ //tr1Entry1.setDescription("test desc");
+ tr1Entry1.setVoucher("voucher");
+ tr1Entry1 = financialTransactionService.createEntry(tr1Entry1);
+
+ Entry tr1Entry2 = new EntryImpl();
+ tr1Entry2.setAmount(BigDecimal.valueOf(42.0));
+ tr1Entry2.setDebit(true);
+ tr1Entry2.setAccount(accountVmpVae);
+ tr1Entry2.setFinancialTransaction(transaction1);
+ tr1Entry2.setDescription("test desc");
+ tr1Entry2.setVoucher("voucher");
+ tr1Entry2 = financialTransactionService.createEntry(tr1Entry2);
+
+ // one in period
+ FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
+ List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
+ Assert.assertEquals(1, transactions.size());
+ }
+
+ /**
+ * Test to find all unbalanced transactions.
+ *
+ * Test only unbalanced transactions (no data errors : fields).
+ *
+ * @throws ParseException
+ * @throws LimaException
+ */
+ @Test
+ public void testGetUnbalancedTransactionNotAllGood() throws ParseException, LimaException {
+
+ EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv");
+ Account accountVmpVae = accountService.getAccountByNumber("511");
+
+ FinancialTransaction transaction1 = new FinancialTransactionImpl();
+ transaction1.setTransactionDate(df.parse("April 5, 2012"));
+ transaction1.setEntryBook(journalDesVentes);
+ transaction1 = financialTransactionService.createFinancialTransaction(transaction1);
+
+ Entry tr1Entry1 = new EntryImpl();
+ tr1Entry1.setAmount(BigDecimal.valueOf(54.0));
+ tr1Entry1.setAccount(accountVmpVae);
+ tr1Entry1.setFinancialTransaction(transaction1);
+ tr1Entry1.setDescription("test desc");
+ tr1Entry1.setVoucher("voucher");
+ tr1Entry1 = financialTransactionService.createEntry(tr1Entry1);
+
+ // one in period
+ FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0);
+ List<FinancialTransaction> transactions = financialTransactionService.getAllInexactFinancialTransactions(fiscalPeriod);
+ Assert.assertEquals(1, transactions.size());
+ }
+
+ @Test
+ public void testFindLastLetter() {
+
+ List<String> letters = Arrays.asList("A", "BZ", "ZZZ", "C", "Z", "E");
+
+ FinancialTransactionServiceImpl instance = new FinancialTransactionServiceImpl();
+
+ String nextLetter = instance.findLastLetter(letters);
+ Assert.assertEquals("ZZZ", nextLetter);
+
+ Assert.assertEquals("A", letters.get(5));
+ Assert.assertEquals("C", letters.get(4));
+ Assert.assertEquals("E", letters.get(3));
+ Assert.assertEquals("Z", letters.get(2));
+ Assert.assertEquals("BZ", letters.get(1));
+ Assert.assertEquals("ZZZ", letters.get(0));
+ }
+}
Added: trunk/lima-business/src/test/java/org/chorem/lima/business/LetteringComparatorTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/LetteringComparatorTest.java (rev 0)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/LetteringComparatorTest.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -0,0 +1,35 @@
+package org.chorem.lima.business;
+
+import org.chorem.lima.business.utils.LetteringComparator;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: mallon
+ * Date: 24/07/12
+ * Time: 15:42
+ * To change this template use File | Settings | File Templates.
+ */
+public class LetteringComparatorTest {
+
+ @Test
+ public void testCompare() {
+ List<String> letters = Arrays.asList("A", "BZ", "ZZZ", "C", "Z", "E");
+
+ Collections.sort(letters, new LetteringComparator());
+ Collections.reverse(letters);
+
+ Assert.assertEquals("A", letters.get(5));
+ Assert.assertEquals("C", letters.get(4));
+ Assert.assertEquals("E", letters.get(3));
+ Assert.assertEquals("Z", letters.get(2));
+ Assert.assertEquals("BZ", letters.get(1));
+ Assert.assertEquals("ZZZ", letters.get(0));
+ }
+
+}
Modified: trunk/lima-business/src/test/resources/log4j.properties
===================================================================
--- trunk/lima-business/src/test/resources/log4j.properties 2012-07-23 15:42:42 UTC (rev 3549)
+++ trunk/lima-business/src/test/resources/log4j.properties 2012-07-24 14:25:42 UTC (rev 3550)
@@ -31,4 +31,6 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.org.chorem.lima=INFO
\ No newline at end of file
+log4j.logger.org.chorem.lima=INFO
+
+log4j.logger.org.chorem.lima.business.ejb.FinancialTransactionServiceImpl=DEBUG
\ No newline at end of file
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-23 15:42:42 UTC (rev 3549)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-24 14:25:42 UTC (rev 3550)
@@ -31,7 +31,9 @@
import org.nuiton.topia.TopiaException;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public class EntryDAOImpl<E extends Entry> extends EntryDAOAbstract<Entry> {
@@ -122,15 +124,12 @@
return entries;
}
- public String findLetters() throws TopiaException{
- String result = "";
+ public Set<String> findLetters() throws TopiaException{
String query = "Select E.lettering FROM " + Entry.class.getName() + " E" +
+ " where E.lettering <> null" +
" order by E.lettering desc";
- List<String> letters = context.findAll(query);
- if (!letters.isEmpty()) {
- result = letters.get(0);
- }
+ Set<String> result = new HashSet<String>(context.findAll(query));
return result;
}
1
0
r3549 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 23 Jul '12
by mallon@users.chorem.org 23 Jul '12
23 Jul '12
Author: mallon
Date: 2012-07-23 17:42:42 +0200 (Mon, 23 Jul 2012)
New Revision: 3549
Url: http://chorem.org/repositories/revision/lima/3549
Log:
fixes #708 Correction de l'affichage du bouton 'Equilibrer'.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-23 15:16:46 UTC (rev 3548)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-23 15:42:42 UTC (rev 3549)
@@ -109,20 +109,33 @@
if (view.getTable().getSelectedRows().length == 0) {
onButtonModeChanged("all");
} else if (!letteringNotExist(view.getTable().getSelectedRow())) {
- if (view.getTable().getSelectedRows().length == 2) {
- onButtonModeChanged("rounded");
- }
- //unlettred entries
+
+ //lettred entries
onBalanceChanged(null);
setValuesForSelectedEntries();
//For U.I. buttons (Lettering and unlettering)
onButtonModeChanged("delettrer");
} else {
- //lettred entries
- if (view.getTable().getSelectedRows().length == 2) {
- onButtonModeChanged("rounded");
+ int[] selectedRows = view.getTable().getSelectedRows();
+ if (selectedRows.length == 2) {
+
+ /*Treatment only if one of values contains decimals*/
+ LetteringTableModel tableModel = view.getTableModel();
+ Entry firstSelectedEntry = tableModel.getEntryAt(selectedRows[0]);
+ Entry secondSelectedEntry = tableModel.getEntryAt(selectedRows[1]);
+
+ String decimalFirstEntrySelected = (firstSelectedEntry.getAmount().toString().split("\\."))[1];
+ String decimalSecondSelectedEntry = (secondSelectedEntry.getAmount().toString().split("\\."))[1];
+ if ( !decimalFirstEntrySelected.equals("00") || !decimalSecondSelectedEntry.equals("00")
+ && secondSelectedEntry.getDebit() != firstSelectedEntry.getDebit()) {
+ onButtonModeChanged("equalized");
+ }
+ }else {
+ onButtonModeChanged("all");
}
+
+ //Unlettred entries
onBalanceChanged(null);
//treatment unuseful if no rows are selected
if (!view.getLettringSelectionModel().isSelectionEmpty()) {
@@ -158,7 +171,7 @@
}
editModel.setUnLettred(false);
editModel.setLettred(true);
- }else if (mode.equals("rounded")) {
+ }else if (mode.equals("equalized")) {
editModel.setEqualized(true);
} else {
editModel.setLettred(false);
@@ -286,10 +299,6 @@
LetteringTableModel tableModel = view.getTableModel();
- if (log.isDebugEnabled()) {
- log.debug("table.getSelectedRows() size : " + view.getTable().getSelectedRows().length);
- }
-
int[] selectedRows = view.getTable().getSelectedRows();
if (selectedRows.length == 2) {
@@ -297,13 +306,8 @@
Entry firstSelectedEntry = tableModel.getEntryAt(selectedRows[0]);
Entry secondSelectedEntry = tableModel.getEntryAt(selectedRows[1]);
- /*Treatment only if one of values contains decimals*/
- String decimalFirstEntrySelected = (firstSelectedEntry.getAmount().toString().split("\\."))[1];
- String decimalSecondSelectedEntry = (secondSelectedEntry.getAmount().toString().split("\\."))[1];
-
if ( (firstSelectedEntry.getAmount().compareTo(BigDecimal.ZERO) != 0 && secondSelectedEntry.getAmount().compareTo(BigDecimal.ZERO) != 0)
- && !firstSelectedEntry.getAmount().equals(secondSelectedEntry.getAmount())
- && ( !decimalFirstEntrySelected.equals("00") || !decimalSecondSelectedEntry.equals("00"))) {
+ && !firstSelectedEntry.getAmount().equals(secondSelectedEntry.getAmount())) {
/*Calculation of result with it
* Tab : 0 : debit
1
0