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
July 2012
- 5 participants
- 74 discussions
r3536 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by athimel@users.chorem.org 18 Jul '12
by athimel@users.chorem.org 18 Jul '12
18 Jul '12
Author: athimel
Date: 2012-07-18 13:36:40 +0200 (Wed, 18 Jul 2012)
New Revision: 3536
Url: http://chorem.org/repositories/revision/lima/3536
Log:
Fix indentation !
Use variable instead of 7 getEditorComponent()
No 'if' without {?\194?\160}
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
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-18 09:50:01 UTC (rev 3535)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-18 11:36:40 UTC (rev 3536)
@@ -58,7 +58,7 @@
/**
* Table des transaction qui ajoute des comportement (keys).
- *
+ *
* <ul>
* <li>Auto creation des entrees si la transaction est vide (tab)
* <li>positionnement automatique sur les cellules editables
@@ -117,7 +117,7 @@
Highlighter colorTransaction =
new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
-
+
// highlight unbalanced financial transactions
predicate = new HighlightPredicate() {
@Override
@@ -317,18 +317,22 @@
public boolean editCellAt(int row, int column, EventObject e) {
boolean result = super.editCellAt(row, column, e);
int lengthCellValue;
- if (getEditorComponent() != null)
- if (getEditorComponent() instanceof JXDatePicker) {
- lengthCellValue = ((JXDatePicker)getEditorComponent()).getEditor().getText().length();
+ Component editorComponent = getEditorComponent();
+ if (editorComponent != null) {
+ if (editorComponent instanceof JXDatePicker) {
+ JXDatePicker datePickerComponent = (JXDatePicker) editorComponent;
+ lengthCellValue = datePickerComponent.getEditor().getText().length();
if (lengthCellValue != -1) {
- ((JXDatePicker)getEditorComponent()).getEditor().select(lengthCellValue, lengthCellValue);
+ datePickerComponent.getEditor().select(lengthCellValue, lengthCellValue);
}
- } else if ( (getEditorComponent() instanceof JTextComponent)) {
- lengthCellValue = ((JTextComponent)getEditorComponent()).getText().length();
- if (lengthCellValue != -1) {
- ((JTextComponent)getEditorComponent()).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
r3535 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: financialtransaction lettering
by mallon@users.chorem.org 18 Jul '12
by mallon@users.chorem.org 18 Jul '12
18 Jul '12
Author: mallon
Date: 2012-07-18 11:50:01 +0200 (Wed, 18 Jul 2012)
New Revision: 3535
Url: http://chorem.org/repositories/revision/lima/3535
Log:
Apr?\195?\168s la revue de code : Corrections sur les imports de type "javax.swing.*", des logs, des commentaires non-javadoc sur les m?\195?\169thodes publiques, et de la m?\195?\169thode de suppression des ?\195?\169l?\195?\169ments de la liste des deux mod?\195?\168les d?\195?\169l?\195?\169gu?\195?\169s dans le lettrage.
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/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java
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-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -26,8 +26,6 @@
package org.chorem.lima.ui.financialtransaction;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FinancialTransaction;
@@ -43,11 +41,13 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
-import javax.swing.*;
+import javax.swing.SwingWorker;
+import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.plaf.BorderUIResource;
import javax.swing.text.JTextComponent;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -72,8 +72,6 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
- private static final Log log = LogFactory.getLog(FinancialTransactionViewHandler.class);
-
protected FinancialTransactionViewHandler handler;
private int x_tab;
@@ -84,7 +82,7 @@
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)));
+ UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource(new LineBorder(new Color(0, 0, 0), 2)));
addKeyListener(new MyKeyAdapter());
@@ -157,14 +155,14 @@
final FinancialTransactionViewHandler handler = getHandler();
- /*Allow to block access to the first row when touch enter pressed, if selection on
+ /*Allow to block access to the first row when key enter pressed, if selection on
* last row*/
if (e.getKeyCode() == KeyEvent.VK_ENTER){
- int selectedRow = table.getSelectedRow()+1;
+ int selectedRow = table.getSelectedRow();
if(selectedRow != table.getRowCount()){
- table.setRowSelectionInterval(table.getSelectedRow(), table.getSelectedRow());
+ table.setRowSelectionInterval(selectedRow+1, selectedRow+1);
} else {
- table.setRowSelectionInterval(table.getSelectedRow()-1, table.getSelectedRow()-1);
+ table.setRowSelectionInterval(selectedRow, selectedRow);
}
}
@@ -245,7 +243,6 @@
FinancialTransaction financialTransaction = (FinancialTransaction) object;
if (CollectionUtils.isEmpty(financialTransaction.getEntry())) {
handler.addEntry();
- //setColumnSelectionInterval(1, 1);
setColumnSelectionInterval(0, 0);
}
}
@@ -282,7 +279,6 @@
}
} else {
handler.addEntry();
- //setColumnSelectionInterval(1, 1);
setColumnSelectionInterval(0, 0);
y_tab++;
// positionne la sélection sur la nouvelle ligne créée
@@ -322,23 +318,17 @@
boolean result = super.editCellAt(row, column, e);
int lengthCellValue;
if (getEditorComponent() != null)
- if (getEditorComponent() instanceof JXDatePicker) {
- if (log.isInfoEnabled()) {
- log.info("Test sur JXDatePicker");
- }
- lengthCellValue = ((JXDatePicker)getEditorComponent()).getEditor().getText().length();
- if (lengthCellValue != -1) {
- ((JXDatePicker)getEditorComponent()).getEditor().select(lengthCellValue, lengthCellValue);
- }
- } else if ( (getEditorComponent() instanceof JTextComponent)) {
- if (log.isInfoEnabled()) {
- log.info("Test sur JTextComponent / Number editor");
- }
- lengthCellValue = ((JTextComponent)getEditorComponent()).getText().length();
- if (lengthCellValue != -1) {
- ((JTextComponent)getEditorComponent()).select(lengthCellValue, lengthCellValue);
- }
+ if (getEditorComponent() instanceof JXDatePicker) {
+ lengthCellValue = ((JXDatePicker)getEditorComponent()).getEditor().getText().length();
+ if (lengthCellValue != -1) {
+ ((JXDatePicker)getEditorComponent()).getEditor().select(lengthCellValue, lengthCellValue);
}
+ } else if ( (getEditorComponent() instanceof JTextComponent)) {
+ lengthCellValue = ((JTextComponent)getEditorComponent()).getText().length();
+ if (lengthCellValue != -1) {
+ ((JTextComponent)getEditorComponent()).select(lengthCellValue, lengthCellValue);
+ }
+ }
return result;
}
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-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -262,6 +262,26 @@
return result;
}
+ /**Get the precedent entry of the entry passed in parameter*/
+ public Entry getPrecedentEntry(Entry entry) {
+ for (Object transactionOrEntry : transactionAndEntries) {
+ if(transactionOrEntry instanceof Entry) {
+ if (transactionOrEntry.equals(entry)) {
+ //'-1' for precedent...
+ return (Entry)getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1);
+ }
+ }
+ }
+ return null;
+ }
+
+ public Object getObjectAt(int row) {
+ if (row == -1) {
+ return null;
+ }
+ return transactionAndEntries.get(row);
+ }
+
/** to modifiy financialtransaction or entry */
@Override
public void setValueAt(Object value, int row, int column) {
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-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -44,7 +44,9 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.*;
+import javax.swing.JComboBox;
+import javax.swing.JOptionPane;
+import javax.swing.ListSelectionModel;
import java.awt.event.ItemEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -348,34 +350,39 @@
// real selected row or selected transaction row ?
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
- int firstentryBookrow = tableModel.getFirstEntry(indexSelectedRow);
+ //int firstentryBookrow = tableModel.getFirstEntry(indexSelectedRow);
+ Entry precedentEntry = tableModel.getPrecedentEntry((Entry)tableModel.getObjectAt(indexSelectedRow));
+ if (log.isInfoEnabled()) {
+ log.info("Selected row : " + indexSelectedRow);
+ }
+
String defaultVoucher = null;
String defaultDescription = null;
- String defaultAccount = null;
+
+ if (precedentEntry != null) {
+ defaultVoucher = precedentEntry.getVoucher();
+ defaultDescription = precedentEntry.getDescription();
+ }
+
+ // creates the new entry
+ Entry entry = new EntryImpl();
+ entry.setVoucher(defaultVoucher);
+ entry.setDescription(defaultDescription);
+
+ String defaultAccount;
//Actual (2012) tva percentage : 19,6%
BigDecimal tvaPercentAdd = new BigDecimal(0.196);
BigDecimal tvaTax = null;
- if (firstentryBookrow != -1) {
- defaultVoucher = (String) tableModel.getValueAt(firstentryBookrow, 1);
- defaultDescription = (String) tableModel.getValueAt(firstentryBookrow, 3);
- //Calculation of tva tax only if first entry is a sale
- defaultAccount = (String) tableModel.getValueAt(firstentryBookrow, 2);
+ //Calculation of tva tax only if first entry is a sale
+ if (precedentEntry.getAccount()!= null){
+ defaultAccount = precedentEntry.getAccount().getAccountNumber();
if (defaultAccount.equals("410") || defaultAccount.equals("418")){
- if (log.isInfoEnabled()) {
- log.info("Calcul de la TVA");
- }
- tvaTax = ((BigDecimal)tableModel.getValueAt(firstentryBookrow, 4)).multiply(tvaPercentAdd);
+ tvaTax = (precedentEntry.getAmount()).multiply(tvaPercentAdd);
}
-
}
- // creates the new entry
- Entry entry = new EntryImpl();
- entry.setVoucher(defaultVoucher);
- entry.setDescription(defaultDescription);
-
//Set tva tax on the debit of the new entry
if (tvaTax != null){
entry.setAmount(tvaTax);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -23,9 +23,6 @@
* #L%
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.math.BigDecimal;
@@ -46,7 +43,6 @@
public static final String UNLETTRED_PROPERTY = "unLettred";
protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
- private static final Log log = LogFactory.getLog(LetteringViewHandler.class);
protected LetteringTableModel model;
protected boolean lettred;
@@ -131,7 +127,10 @@
firePropertyChange(SOLDE_PROPERTY, oldSolde, this.solde);
}
- //Allow to add / subtract credit / debit and balance
+ /**Allow to add / subtract credit / debit and balance
+ * @param amount debit or credit
+ * @param debit it indicate if amount is debit or not
+ * */
public void balanceCalculation(BigDecimal amount, boolean debit){
BigDecimal debitVal = debit ? amount : BigDecimal.ZERO;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -24,11 +24,9 @@
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Entry;
-import javax.swing.*;
+import javax.swing.DefaultListSelectionModel;
import java.util.ArrayList;
import java.util.List;
@@ -37,14 +35,15 @@
*/
public class LetteringSelectionModel extends DefaultListSelectionModel {
- private static final Log log = LogFactory.getLog(LetteringSelectionModel.class);
protected LetteringTableModel letteringTableModel;
protected LetteringEditModel editModel;
protected int lineSelected;
protected List<Entry> selectedRows = new ArrayList<Entry>();
- //Modele de selection du tableau lors de la selection d une entree lettree
-
+ /**Table selection model when entry selected is lettered
+ * @param letteringTableModel model of the table
+ * @param editModel model managing update of debit / credit / balance
+ * */
public LetteringSelectionModel(LetteringTableModel letteringTableModel, LetteringEditModel editModel) {
this.letteringTableModel = letteringTableModel;
this.editModel = editModel;
@@ -52,31 +51,18 @@
//@Override
public void addSelectionInterval(int row, int column){
- if (log.isInfoEnabled()) {
- log.info("addSelectionInterval");
- }
setSelectionInterval(row, column);
}
//@Override
public void removeSelectionInterval(int row, int column){
- if (log.isInfoEnabled()) {
- log.info("removeSelectionInterval");
- }
- //setSelectionInterval(row, column);
}
@Override
public void setSelectionInterval(int row, int column){
- if (log.isInfoEnabled()) {
- log.info("setSelectionInterval");
- }
if ( selectedRows.isEmpty() || !searchRowSelected(row)){
- if (log.isInfoEnabled()) {
- log.info("Selection ligne...");
- }
resetAttribute();
super.clearSelection();
@@ -105,7 +91,8 @@
}
/**PropertyChange on editModel in the handler, and, there,
- * set values on it.
+ * set values it.
+ * @param lettering state of attributes lettered and unlettered in editModel
* */
public void updateBalanceAndLetteringButton(boolean lettering){
@@ -122,9 +109,7 @@
//to reinitialize model attribute
public void resetAttribute(){
- for (int i = 0; i < selectedRows.size(); i ++){
- selectedRows.remove(i);
- }
+ selectedRows.clear();
}
/**search if the selected row is in the list
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-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -34,7 +34,11 @@
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
import org.jdesktop.swingx.JXTable;
-import javax.swing.*;
+import javax.swing.DefaultCellEditor;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.math.BigDecimal;
@@ -56,7 +60,7 @@
public LetteringTable(LetteringTableModel letteringTableModel) {
super(letteringTableModel);
- //To block reaction of the dual touch 'ctrl+a' (Selection of all lines)
+ //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/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -26,8 +26,6 @@
package org.chorem.lima.ui.lettering;
import org.apache.commons.lang3.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.DateFilterImpl;
import org.chorem.lima.beans.LetteringFilter;
import org.chorem.lima.business.api.AccountService;
@@ -40,7 +38,7 @@
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import javax.swing.*;
+import javax.swing.JComboBox;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
@@ -59,8 +57,6 @@
*/
public class LetteringViewHandler{
- private static final Log log = LogFactory.getLog(LetteringViewHandler.class);
-
protected LetteringView view;
protected LetteringTable table;
@@ -134,7 +130,6 @@
view.getAccountComboBox().setSelectedItem(allAccounts.get(0));
}
-
//By default, we have the beginning of the fiscal period (Or of current
//date if no fiscal period) and the end of the current date
FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -23,11 +23,9 @@
* #L%
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Entry;
-import javax.swing.*;
+import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionListener;
/**
@@ -35,7 +33,6 @@
*/
public class LettringAndUnlettringSelectionModel implements ListSelectionModel {
- private static final Log log = LogFactory.getLog(LetteringViewHandler.class);
protected LetteringSelectionModel letteringSelectionModel;
protected UnlettringSelectionModel unlettringSelectionModel;
protected LetteringTableModel letteringTableModel;
@@ -53,7 +50,10 @@
delegate = unlettringSelectionModel;
}
- /**choice of model : two differents ui reactions, if lettering is present or not*/
+ /**choice of model : two differents ui reactions, if lettering is present or not
+ * @param row index of the selected line
+ * @param column index of the selected column
+ * */
@Override
public void setSelectionInterval(int row, int column) {
@@ -71,7 +71,10 @@
}
- /**return true if lettering is null, or not null but empty*/
+ /**return true if lettering is null, or not null but empty
+ * @param row index of the line to test
+ * @return boolean
+ * */
public boolean letteringNotExist(int row){
boolean emptyOrNull;
entry = letteringTableModel.getEntryAt(row);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-17 15:51:28 UTC (rev 3534)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-18 09:50:01 UTC (rev 3535)
@@ -23,22 +23,22 @@
* #L%
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Entry;
-import javax.swing.*;
+import javax.swing.DefaultListSelectionModel;
import java.util.ArrayList;
import java.util.List;
public class UnlettringSelectionModel extends DefaultListSelectionModel {
- private static final Log log = LogFactory.getLog(UnlettringSelectionModel.class);
protected LetteringTableModel letteringTableModel;
protected List<Entry> selectedRows;
protected LetteringEditModel editModel;
- //Modele de selection du tableau lors de la selection d une entree non lettree
+ /**Table selection model when entry selected is no lettered
+ * @param letteringTableModel model of the table
+ * @param editModel model managing update of debit / credit / balance
+ * */
public UnlettringSelectionModel(LetteringTableModel letteringTableModel, LetteringEditModel editModel) {
this.letteringTableModel = letteringTableModel;
this.editModel = editModel;
@@ -60,24 +60,10 @@
@Override
public void setSelectionInterval(int row, int column){
- if (log.isInfoEnabled()) {
- if (selectedRows.isEmpty()){
- log.info("Liste de lignes vide");
- }else{
- log.info("Liste de lignes pleines");
- }
- if (searchRowSelected(row)){
- log.info("Ligne dans la liste");
- }
- }
-
//Case where line is selected a second time (So, must deselect it on second click)
if (selectedRows.isEmpty() || !searchRowSelected(row)){
selectedRows.add(letteringTableModel.getEntryAt(row));
super.addSelectionInterval(row, column);
- if (log.isInfoEnabled()) {
- log.info("New row selected");
- }
}else {
deleteLine(row, column);
}
@@ -87,7 +73,8 @@
/**
* search the line in a list of selected rows
* and delete it
- * @param row line to delete
+ * @param row index of the line to delete
+ * @param column index of the column to delete
* */
public void deleteLine(int row, int column){
for (Entry entrySearching : selectedRows){
@@ -96,11 +83,7 @@
break;
}
}
-
super.removeSelectionInterval(row, column);
- if (log.isInfoEnabled()) {
- log.info("Old row : deleting...");
- }
}
/**search if the selected row is in the list
@@ -109,9 +92,6 @@
* @return true if line find
* */
public boolean searchRowSelected(int row){
- if (log.isInfoEnabled()) {
- log.info("Ligne recherchee : " + row);
- }
for (Entry entrySearching : selectedRows){
if (entrySearching == letteringTableModel.getEntryAt(row)){
return true;
@@ -122,14 +102,11 @@
/**PropertyChange on editModel in the handler, and, there,
* set values it.
+ * @param lettering state of attributes lettered and unlettered in editModel
* */
public void updateBalanceAndLetteringButton(boolean lettering){
editModel.resetDebitCreditBalance();
- if (log.isInfoEnabled()) {
- log.info("size of selectedRows (>?) : " + selectedRows.size());
- }
-
//treatment unuseful if no rows are selected
if (selectedRows.size() != 0){
for (Entry entry : selectedRows){
@@ -141,20 +118,12 @@
editModel.setLettred(lettering);
}else{
editModel.setLettred(!lettering);
- if (log.isInfoEnabled()) {
- log.info("size of selectedRows : " + selectedRows.size());
- }
}
}
- //to reinitialize model attribute
+ /**to reinitialize model attribute*/
public void resetAttribute(){
- if (log.isInfoEnabled()) {
- log.info("Contenu de la liste supprimé");
- }
- for (int i = 0; i < selectedRows.size(); i ++){
- selectedRows.remove(i);
- }
+ selectedRows.clear();
}
@Override
1
0
r3534 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 17 Jul '12
by mallon@users.chorem.org 17 Jul '12
17 Jul '12
Author: mallon
Date: 2012-07-17 17:51:28 +0200 (Tue, 17 Jul 2012)
New Revision: 3534
Url: http://chorem.org/repositories/revision/lima/3534
Log:
fixes #700 Colonne des comptes remise (Panneau de lettrage), afin de savoir auquel appartient l'entr?\195?\169e; correction sur l'accessibilit?\195?\169 du bouton 'lettrer'.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-17 15:15:23 UTC (rev 3533)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-17 15:51:28 UTC (rev 3534)
@@ -61,7 +61,7 @@
public void setLettred(boolean lettred) {
boolean oldLettrer = isLettred();
- if(lettred && (solde == BigDecimal.ZERO || solde.intValue() == 0)){
+ if(lettred && (solde == BigDecimal.ZERO || solde.doubleValue() == 0)){
this.lettred = lettred;
}else{
this.lettred = false;
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-17 15:15:23 UTC (rev 3533)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-17 15:51:28 UTC (rev 3534)
@@ -62,6 +62,10 @@
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
+
+ //Get new account editor
+ setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()));
+
//Get new entry book editor
setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor());
//Get new account editor
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-17 15:15:23 UTC (rev 3533)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-17 15:51:28 UTC (rev 3534)
@@ -116,6 +116,9 @@
case 1:
result = String.class;
break;
+ case 2:
+ result = String.class;
+ break;
case 3:
result = Account.class;
break;
@@ -142,7 +145,7 @@
result = _("lima.table.date");
break;
case 1:
- result = _("lima.table.entrybook");
+ result = _("lima.table.account");
break;
case 2:
result = _("lima.table.voucher");
@@ -182,8 +185,8 @@
case 0:
result = datesEntree.get(row); // date
break;
- case 1: // entry book
- result = entryBooks.get(row);
+ case 1:
+ result = currentEntry.getAccount().getAccountNumber();
break;
case 2:
result = currentEntry.getVoucher();
1
0
r3533 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 17 Jul '12
by mallon@users.chorem.org 17 Jul '12
17 Jul '12
Author: mallon
Date: 2012-07-17 17:15:23 +0200 (Tue, 17 Jul 2012)
New Revision: 3533
Url: http://chorem.org/repositories/revision/lima/3533
Log:
fixes #701 Correction des mod?\195?\168les et de l'utilisation des filtres, r?\195?\168glant le probl?\195?\168me de s?\195?\169lection des lignes du tableau, apr?\195?\168s utilisation des filtres; combinaison 'ctrl+a' (S?\195?\169lection de toutes les lignes) d?\195?\169sactiv?\195?\169e.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-17 13:35:19 UTC (rev 3532)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-17 15:15:23 UTC (rev 3533)
@@ -41,7 +41,7 @@
protected LetteringTableModel letteringTableModel;
protected LetteringEditModel editModel;
protected int lineSelected;
- protected List<Integer> selectedRows = new ArrayList<Integer>();
+ protected List<Entry> selectedRows = new ArrayList<Entry>();
//Modele de selection du tableau lors de la selection d une entree lettree
@@ -52,16 +52,26 @@
//@Override
public void addSelectionInterval(int row, int column){
+ if (log.isInfoEnabled()) {
+ log.info("addSelectionInterval");
+ }
setSelectionInterval(row, column);
}
//@Override
public void removeSelectionInterval(int row, int column){
+ if (log.isInfoEnabled()) {
+ log.info("removeSelectionInterval");
+ }
//setSelectionInterval(row, column);
}
@Override
public void setSelectionInterval(int row, int column){
+ if (log.isInfoEnabled()) {
+ log.info("setSelectionInterval");
+ }
+
if ( selectedRows.isEmpty() || !searchRowSelected(row)){
if (log.isInfoEnabled()) {
@@ -80,8 +90,8 @@
for(Entry entry : getEntries()){
if (StringUtils.isNotBlank(entry.getLettering())){
if (entry.getLettering().equals(currentLettring)){
+ selectedRows.add(entry);
int entryToSelect = letteringTableModel.getIndexOfEntry(entry);
- selectedRows.add(entryToSelect);
super.addSelectionInterval(entryToSelect, entryToSelect);
}
}
@@ -100,11 +110,9 @@
public void updateBalanceAndLetteringButton(boolean lettering){
editModel.resetDebitCreditBalance();
- for (int row : selectedRows){
- Entry entryAt = letteringTableModel.getEntryAt(row);
-
+ for (Entry entry : selectedRows){
//Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(entryAt.getAmount(), entryAt.getDebit());
+ editModel.balanceCalculation(entry.getAmount(), entry.getDebit());
}
//For U.I. buttons (Lettering and unlettering)
@@ -125,8 +133,8 @@
* @return true if line find
* */
public boolean searchRowSelected(int row){
- for (Integer rowSearching : selectedRows){
- if (rowSearching == row){
+ for (Entry entrySearching : selectedRows){
+ if (entrySearching == letteringTableModel.getEntryAt(row)){
return true;
}
}
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-17 13:35:19 UTC (rev 3532)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-17 15:15:23 UTC (rev 3533)
@@ -34,6 +34,9 @@
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
import org.jdesktop.swingx.JXTable;
+import javax.swing.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
import java.math.BigDecimal;
import java.util.Date;
@@ -49,12 +52,14 @@
private static final long serialVersionUID = 3133690382049594727L;
protected LetteringViewHandler handler;
- protected boolean controlTouchPressed;
public LetteringTable(LetteringTableModel letteringTableModel) {
super(letteringTableModel);
- controlTouchPressed = false;
+ //To block reaction of the dual touch '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");
+
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
//Get new entry book editor
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-17 13:35:19 UTC (rev 3532)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-17 15:15:23 UTC (rev 3533)
@@ -98,6 +98,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
editModel.resetDebitCreditBalance();
+ view.getLettringAndUnlettringSelectionModel().resetAttribute();
updateAllEntries();
}
});
@@ -109,6 +110,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
editModel.resetDebitCreditBalance();
+ view.getLettringAndUnlettringSelectionModel().resetAttribute();
updateAllEntries();
}
});
@@ -213,6 +215,7 @@
if (row > 0) {
comboBox.setSelectedIndex(row - 1);
}
+ view.getLettringAndUnlettringSelectionModel().resetAttribute();
}
/**
@@ -227,6 +230,7 @@
if (row < size - 1) {
comboBox.setSelectedIndex(row + 1);
}
+ view.getLettringAndUnlettringSelectionModel().resetAttribute();
}
/**Add a group of three letters to n entries*/
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-17 13:35:19 UTC (rev 3532)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-17 15:15:23 UTC (rev 3533)
@@ -67,7 +67,6 @@
letteringSelectionModel.resetAttribute();
}
- //editModel.resetDebitCreditBalance();
delegate.setSelectionInterval(row, column);
}
@@ -82,6 +81,11 @@
return emptyOrNull;
}
+ public void resetAttribute(){
+ letteringSelectionModel.resetAttribute();
+ unlettringSelectionModel.resetAttribute();
+ }
+
@Override
public void addSelectionInterval(int index0, int index1) {
delegate.addSelectionInterval(index0, index1);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-17 13:35:19 UTC (rev 3532)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-17 15:15:23 UTC (rev 3533)
@@ -35,14 +35,14 @@
private static final Log log = LogFactory.getLog(UnlettringSelectionModel.class);
protected LetteringTableModel letteringTableModel;
- protected List<Integer> selectedRows;
+ protected List<Entry> selectedRows;
protected LetteringEditModel editModel;
//Modele de selection du tableau lors de la selection d une entree non lettree
public UnlettringSelectionModel(LetteringTableModel letteringTableModel, LetteringEditModel editModel) {
this.letteringTableModel = letteringTableModel;
this.editModel = editModel;
- selectedRows = new ArrayList<Integer>();
+ selectedRows = new ArrayList<Entry>();
editModel.resetDebitCreditBalance();
}
@@ -73,7 +73,7 @@
//Case where line is selected a second time (So, must deselect it on second click)
if (selectedRows.isEmpty() || !searchRowSelected(row)){
- selectedRows.add(row);
+ selectedRows.add(letteringTableModel.getEntryAt(row));
super.addSelectionInterval(row, column);
if (log.isInfoEnabled()) {
log.info("New row selected");
@@ -90,9 +90,9 @@
* @param row line to delete
* */
public void deleteLine(int row, int column){
- for (Integer rowSearching : selectedRows){
- if (rowSearching == row){
- selectedRows.remove(rowSearching);
+ for (Entry entrySearching : selectedRows){
+ if (entrySearching == letteringTableModel.getEntryAt(row)){
+ selectedRows.remove(entrySearching);
break;
}
}
@@ -109,8 +109,11 @@
* @return true if line find
* */
public boolean searchRowSelected(int row){
- for (Integer rowSearching : selectedRows){
- if (rowSearching == row){
+ if (log.isInfoEnabled()) {
+ log.info("Ligne recherchee : " + row);
+ }
+ for (Entry entrySearching : selectedRows){
+ if (entrySearching == letteringTableModel.getEntryAt(row)){
return true;
}
}
@@ -129,17 +132,14 @@
//treatment unuseful if no rows are selected
if (selectedRows.size() != 0){
- for (int row : selectedRows){
- Entry entryAt = letteringTableModel.getEntryAt(row);
-
+ for (Entry entry : selectedRows){
//Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(entryAt.getAmount(), entryAt.getDebit());
+ editModel.balanceCalculation(entry.getAmount(), entry.getDebit());
}
//For U.I. buttons (Lettering and unlettering)
editModel.setUnLettred(!lettering);
editModel.setLettred(lettering);
}else{
-
editModel.setLettred(!lettering);
if (log.isInfoEnabled()) {
log.info("size of selectedRows : " + selectedRows.size());
@@ -149,6 +149,9 @@
//to reinitialize model attribute
public void resetAttribute(){
+ if (log.isInfoEnabled()) {
+ log.info("Contenu de la liste supprimé");
+ }
for (int i = 0; i < selectedRows.size(); i ++){
selectedRows.remove(i);
}
1
0
r3532 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by mallon@users.chorem.org 17 Jul '12
by mallon@users.chorem.org 17 Jul '12
17 Jul '12
Author: mallon
Date: 2012-07-17 15:35:19 +0200 (Tue, 17 Jul 2012)
New Revision: 3532
Url: http://chorem.org/repositories/revision/lima/3532
Log:
fixes #648 Ajout du calcul de la tva (Celle ?\195?\160 19,6%), lors de l ajout d'une seconde entree du compte 410 ou 418; suppression des colonnes lettre et journal, devenues obsoletes.
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/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
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-16 17:09:57 UTC (rev 3531)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-17 13:35:19 UTC (rev 3532)
@@ -30,14 +30,12 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.ui.celleditor.AccountTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
-import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
import org.jdesktop.swingx.JXDatePicker;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
@@ -95,9 +93,6 @@
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
- //Get new entry book editor
- setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor());
-
//Get new account editor
setDefaultEditor(Account.class, new AccountTableCellEditor());
@@ -113,9 +108,6 @@
//get new Account renderer for empty cells
setDefaultRenderer(Account.class, new EmptyCellRenderer());
- //get new EntryBook renderer for empty cells
- setDefaultRenderer(EntryBook.class, new EmptyCellRenderer());
-
//highlight financial financial transactions
HighlightPredicate predicate = new HighlightPredicate() {
@Override
@@ -242,11 +234,6 @@
x_tab = 0;
}
- if (log.isInfoEnabled()) {
- log.info("Valeur de x_tab : " + x_tab + "\n" +
- "Valeur de y_tab : " + y_tab);
- }
-
//skip all cell while not editable or if end of table add entry or transaction or end of table
while (!isCellEditable(y_tab, x_tab) && end) {
//if end of row
@@ -258,7 +245,8 @@
FinancialTransaction financialTransaction = (FinancialTransaction) object;
if (CollectionUtils.isEmpty(financialTransaction.getEntry())) {
handler.addEntry();
- setColumnSelectionInterval(1, 1);
+ //setColumnSelectionInterval(1, 1);
+ setColumnSelectionInterval(0, 0);
}
}
//if entry
@@ -294,7 +282,8 @@
}
} else {
handler.addEntry();
- setColumnSelectionInterval(1, 1);
+ //setColumnSelectionInterval(1, 1);
+ setColumnSelectionInterval(0, 0);
y_tab++;
// positionne la sélection sur la nouvelle ligne créée
setRowSelectionInterval(y_tab, y_tab);
@@ -314,18 +303,12 @@
}
}
-
- //focusEdition();
+
}
}
private class MyMouseAdapter extends MouseAdapter {
- /*@Override
- public void mouseClicked(MouseEvent e){
- focusEdition();
- }*/
-
@Override
public void mousePressed(MouseEvent e) {
if (rowAtPoint(e.getPoint()) == -1) {
@@ -334,92 +317,9 @@
}
}
- //TEST
- /*boolean selectAllForActionEvent;
- boolean selectAllForMouseEvent;
- boolean selectAllForKeyEvent;
-
@Override
public boolean editCellAt(int row, int column, EventObject e) {
boolean result = super.editCellAt(row, column, e);
-
- if (selectAllForMouseEvent || selectAllForActionEvent || selectAllForKeyEvent){
- selectAll(e);
- }
-
- return result;
- }
-
- private void selectAll(EventObject e) {
- final Component editor = getEditorComponent();
-
- if (editor == null || ! (editor instanceof JTextComponent)){
- return;
- }
-
- if (e == null) {
- ((JTextComponent)editor).selectAll();
- return;
- }
-
- // Typing in the cell was used to activate the editor
- if (e instanceof KeyEvent && selectAllForKeyEvent) {
- ((JTextComponent)editor).selectAll();
- return;
- }
-
- // F2 was used to activate the editor
- if (e instanceof ActionEvent && selectAllForActionEvent){
- ((JTextComponent)editor).selectAll();
- return;
- }
-
- // A mouse click was used to activate the editor.
- // Generally this is a double click and the second mouse click is
- // passed to the editor which would remove the text selection unless
- // we use the invokeLater()
- if (e instanceof MouseEvent && selectAllForMouseEvent) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- ((JTextComponent)editor).selectAll();
- }
- });
- }
- }*/
-
- /*public void setSelectAllForEdit(boolean selectAllForEdit){
- setSelectAllForMouseEvent( selectAllForEdit );
- setSelectAllForActionEvent( selectAllForEdit );
- setSelectAllForKeyEvent( selectAllForEdit );
- }*/
-
- /*
- * Set the Select All property when editing is invoked by the mouse
- */
- /*public void setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent){
- selectAllForMouseEvent = isSelectAllForMouseEvent;
- }*/
-
- /*
- * Set the Select All property when editing is invoked by the "F2" key
- */
- /*public void setSelectAllForActionEvent(boolean isSelectAllForActionEvent) {
- selectAllForActionEvent = isSelectAllForActionEvent;
- }*/
-
- /*
- * Set the Select All property when editing is invoked by
- * typing directly into the cell
- */
- /*public void setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent){
- selectAllForKeyEvent = isSelectAllForKeyEvent;
- }*/
-
- //FIN TEST
-
- @Override
- public boolean editCellAt(int row, int column, EventObject e) {
- boolean result = super.editCellAt(row, column, e);
int lengthCellValue;
if (getEditorComponent() != null)
if (getEditorComponent() instanceof JXDatePicker) {
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-16 17:09:57 UTC (rev 3531)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-17 13:35:19 UTC (rev 3532)
@@ -28,7 +28,6 @@
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.service.LimaServiceFactory;
@@ -67,7 +66,7 @@
@Override
public int getColumnCount() {
- return 9;
+ return 7;
}
@Override
@@ -80,29 +79,23 @@
result = Date.class;
break;
case 1:
- result = EntryBook.class;
+ result = String.class;
break;
case 2:
- result = String.class;
+ result = Account.class;
break;
case 3:
- result = Account.class;
+ result = String.class;
break;
case 4:
- result = String.class;
+ result = BigDecimal.class;
break;
case 5:
- result = String.class;
+ result = BigDecimal.class;
break;
case 6:
result = BigDecimal.class;
break;
- case 7:
- result = BigDecimal.class;
- break;
- case 8:
- result = BigDecimal.class;
- break;
}
return result;
}
@@ -116,27 +109,21 @@
result = _("lima.ui.financialtransaction.date");
break;
case 1:
- result = _("lima.ui.financialtransaction.entrybook");
- break;
- case 2:
result = _("lima.ui.financialtransaction.voucher");
break;
- case 3:
+ case 2:
result = _("lima.ui.financialtransaction.account");
break;
- case 4:
+ case 3:
result = _("lima.ui.financialtransaction.description");
break;
- case 5:
- result = _("lima.ui.financialtransaction.letter");
- break;
- case 6:
+ case 4:
result = _("lima.ui.financialtransaction.debit");
break;
- case 7:
+ case 5:
result = _("lima.ui.financialtransaction.credit");
break;
- case 8:
+ case 6:
result = _("lima.ui.financialtransaction.balance");
break;
}
@@ -168,31 +155,21 @@
result = currentRow.getTransactionDate();
break;
case 1:
- if (currentRow.getEntryBook() != null) {
- result = currentRow.getEntryBook().getCode();
- } else {
- result = null;
- }
- break;
- case 2:
result = null; //voucher
break;
- case 3:
+ case 2:
result = null; // account
break;
- case 4:
+ case 3:
result = null; // description
break;
- case 5:
- result = null; // letter
- break;
- case 6:
+ case 4:
result = amountDebit;
break;
- case 7:
+ case 5:
result = amountCredit;
break;
- case 8:
+ case 6:
result = amountDebit.subtract(amountCredit);
break;
}
@@ -202,32 +179,26 @@
case 0:
result = null; // date
break;
- case 1: // entry book
- result = null;
- break;
- case 2:
+ case 1:
result = currentEntry.getVoucher();
break;
- case 3: // account
+ case 2: // account
if (currentEntry.getAccount() != null) {
result = currentEntry.getAccount().getAccountNumber();
} else {
result = null;
}
break;
- case 4:
+ case 3:
result = currentEntry.getDescription();
break;
- case 5:
- result = currentEntry.getLettering();
- break;
- case 6:
+ case 4:
result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
break;
- case 7:
+ case 5:
result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
break;
- case 8:
+ case 6:
result = null;
break;
}
@@ -244,11 +215,11 @@
boolean editableCell = false;
Object currentRow = transactionAndEntries.get(rowIndex);
// cells editable for the financialtransaction row, no cells exclude the date
- if (currentRow instanceof FinancialTransaction && (columnIndex == 0 || columnIndex == 1)) {
+ if (currentRow instanceof FinancialTransaction && (columnIndex == 0)) {
editableCell = true;
}
// cells editable for the entry row, all cells exclude the date
- if (currentRow instanceof Entry && !(columnIndex == 0 || columnIndex == 1 || columnIndex == 8)) {
+ if (currentRow instanceof Entry && !(columnIndex == 0 || columnIndex == 6)) {
editableCell = true;
}
return editableCell;
@@ -305,18 +276,6 @@
//update
currentFinancialTransaction.setTransactionDate((Date) value);
break;
- case 1:
- // FIXME echatellier 20120515 je ne comprend pas pourquoi
- // il n'est pas possible de changer le journal si la transaction
- // a des entrées
- // update : autorisation si le journal est null au moins
- if (currentFinancialTransaction.getEntry() != null
- && currentFinancialTransaction.getEntryBook() != null) {
- // not authorized to change the value
- return;
- }
- currentFinancialTransaction.setEntryBook((EntryBook) value);
- break;
}
// update transaction
@@ -327,7 +286,7 @@
currentFinancialTransaction = currentEntry.getFinancialTransaction();
boolean updateTransaction = false;
switch (column) {
- case 2:
+ case 1:
String voucher = ((String) value).trim();
int firstEntryRow = getFirstEntry(row);
@@ -346,7 +305,7 @@
currentEntry.setVoucher(voucher);
}
break;
- case 3:
+ case 2:
Account account = (Account) value;
currentEntry.setAccount(account);
// let's copy the account description
@@ -365,7 +324,7 @@
currentEntry.setDescription(description1);
}
break;
- case 4:
+ case 3:
String description = ((String) value).trim();
firstEntryRow = getFirstEntry(row);
if (row == firstEntryRow) {
@@ -383,14 +342,11 @@
currentEntry.setDescription(description);
}
break;
- case 5:
- currentEntry.setLettering((String) value);
- break;
- case 6:
+ case 4:
currentEntry.setAmount((BigDecimal) value);
currentEntry.setDebit(true);
break;
- case 7:
+ case 5:
currentEntry.setAmount((BigDecimal) value);
currentEntry.setDebit(false);
break;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-16 17:09:57 UTC (rev 3531)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-17 13:35:19 UTC (rev 3532)
@@ -22,7 +22,7 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<Table name="test">
+<Table>
<import>
javax.swing.ListSelectionModel
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-16 17:09:57 UTC (rev 3531)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-17 13:35:19 UTC (rev 3532)
@@ -46,6 +46,7 @@
import javax.swing.*;
import java.awt.event.ItemEvent;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -351,16 +352,40 @@
String defaultVoucher = null;
String defaultDescription = null;
+ String defaultAccount = null;
+ //Actual (2012) tva percentage : 19,6%
+ BigDecimal tvaPercentAdd = new BigDecimal(0.196);
+ BigDecimal tvaTax = null;
if (firstentryBookrow != -1) {
- // there is no first entry, grab the voucher and
- defaultVoucher = (String) tableModel.getValueAt(firstentryBookrow, 2);
- defaultDescription = (String) tableModel.getValueAt(firstentryBookrow, 4);
+ defaultVoucher = (String) tableModel.getValueAt(firstentryBookrow, 1);
+ defaultDescription = (String) tableModel.getValueAt(firstentryBookrow, 3);
+
+ //Calculation of tva tax only if first entry is a sale
+ defaultAccount = (String) tableModel.getValueAt(firstentryBookrow, 2);
+ if (defaultAccount.equals("410") || defaultAccount.equals("418")){
+ if (log.isInfoEnabled()) {
+ log.info("Calcul de la TVA");
+ }
+ tvaTax = ((BigDecimal)tableModel.getValueAt(firstentryBookrow, 4)).multiply(tvaPercentAdd);
+ }
+
}
// creates the new entry
Entry entry = new EntryImpl();
entry.setVoucher(defaultVoucher);
entry.setDescription(defaultDescription);
+
+ //Set tva tax on the debit of the new entry
+ if (tvaTax != null){
+ entry.setAmount(tvaTax);
+ entry.setDebit(true);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("tva : " + tvaTax);
+ }
+
// check if current row is a transaction or an entry
FinancialTransaction currentTransaction = null;
Object currentRow = tableModel.getElementAt(indexSelectedRow);
1
0
r3531 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: celleditor financialtransaction
by mallon@users.chorem.org 16 Jul '12
by mallon@users.chorem.org 16 Jul '12
16 Jul '12
Author: mallon
Date: 2012-07-16 19:09:57 +0200 (Mon, 16 Jul 2012)
New Revision: 3531
Url: http://chorem.org/repositories/revision/lima/3531
Log:
fixes #647 Correction sur les editeurs de cellules (Panneau de saisie des ?\195?\169critures), afin de permettre que la valeur affichee ne soit pas supprimee des l edition de la cellule.
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/EntryBookTableCellEditor.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-16 10:41:16 UTC (rev 3530)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-16 17:09:57 UTC (rev 3531)
@@ -23,11 +23,13 @@
* #L%
*/
-import java.awt.Component;
-import java.math.BigDecimal;
-import javax.swing.JTable;
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.FocusEvent;
+import java.math.BigDecimal;
+
/**
* @author sletellier <letellier(a)codelutin.com>
*/
@@ -51,4 +53,16 @@
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() {
+ numberEditor.getTextField().requestFocus();
+ int length = numberEditor.getTextField().getText().length();
+ numberEditor.getTextField().select(length, length);
+ }
+ });
+ }
}
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-16 10:41:16 UTC (rev 3530)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2012-07-16 17:09:57 UTC (rev 3531)
@@ -29,13 +29,11 @@
import org.chorem.lima.LimaContext;
import org.jdesktop.swingx.JXDatePicker;
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
+import javax.swing.*;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.table.TableCellEditor;
-import java.awt.Component;
+import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
@@ -101,18 +99,14 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
-// public static DateTableCellEditor getInstance() {
-// if (editor == null) {
-// editor = new DateTableCellEditor();
-// }
-// return editor;
-// }
-
/** Listeners */
+ //To stay with old value and just complete it
+ @Override
public void focusGained(FocusEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- datePicker.getEditor().selectAll();
+ int length = datePicker.getEditor().getText().length();
+ datePicker.getEditor().select(length, length);
}
});
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2012-07-16 10:41:16 UTC (rev 3530)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EntryBookTableCellEditor.java 2012-07-16 17:09:57 UTC (rev 3531)
@@ -34,13 +34,10 @@
import org.chorem.lima.widgets.JWideComboBox;
import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-import javax.swing.AbstractCellEditor;
-import javax.swing.JTable;
-import javax.swing.ListCellRenderer;
-import javax.swing.SwingUtilities;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.text.JTextComponent;
-import java.awt.Component;
+import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
@@ -141,10 +138,4 @@
return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2;
}
-// public static EntryBookTableCellEditor getInstance() {
-// if (editor == null) {
-// editor = new EntryBookTableCellEditor();
-// }
-// return editor;
-// }
}
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-16 10:41:16 UTC (rev 3530)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-16 17:09:57 UTC (rev 3531)
@@ -38,6 +38,7 @@
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EmptyCellRenderer;
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
+import org.jdesktop.swingx.JXDatePicker;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
@@ -47,6 +48,7 @@
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.plaf.BorderUIResource;
+import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@@ -54,6 +56,7 @@
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).
@@ -80,7 +83,6 @@
private int y_tab;
public FinancialTransactionTable(FinancialTransactionViewHandler handler) {
-
this.handler = handler;
//Change border of cell focus for a better visibility
@@ -147,6 +149,7 @@
colorTransaction =
new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
+
}
public FinancialTransactionViewHandler getHandler() {
@@ -311,10 +314,18 @@
}
}
+
+ //focusEdition();
}
}
private class MyMouseAdapter extends MouseAdapter {
+
+ /*@Override
+ public void mouseClicked(MouseEvent e){
+ focusEdition();
+ }*/
+
@Override
public void mousePressed(MouseEvent e) {
if (rowAtPoint(e.getPoint()) == -1) {
@@ -322,4 +333,113 @@
}
}
}
+
+ //TEST
+ /*boolean selectAllForActionEvent;
+ boolean selectAllForMouseEvent;
+ boolean selectAllForKeyEvent;
+
+ @Override
+ public boolean editCellAt(int row, int column, EventObject e) {
+ boolean result = super.editCellAt(row, column, e);
+
+ if (selectAllForMouseEvent || selectAllForActionEvent || selectAllForKeyEvent){
+ selectAll(e);
+ }
+
+ return result;
+ }
+
+ private void selectAll(EventObject e) {
+ final Component editor = getEditorComponent();
+
+ if (editor == null || ! (editor instanceof JTextComponent)){
+ return;
+ }
+
+ if (e == null) {
+ ((JTextComponent)editor).selectAll();
+ return;
+ }
+
+ // Typing in the cell was used to activate the editor
+ if (e instanceof KeyEvent && selectAllForKeyEvent) {
+ ((JTextComponent)editor).selectAll();
+ return;
+ }
+
+ // F2 was used to activate the editor
+ if (e instanceof ActionEvent && selectAllForActionEvent){
+ ((JTextComponent)editor).selectAll();
+ return;
+ }
+
+ // A mouse click was used to activate the editor.
+ // Generally this is a double click and the second mouse click is
+ // passed to the editor which would remove the text selection unless
+ // we use the invokeLater()
+ if (e instanceof MouseEvent && selectAllForMouseEvent) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ ((JTextComponent)editor).selectAll();
+ }
+ });
+ }
+ }*/
+
+ /*public void setSelectAllForEdit(boolean selectAllForEdit){
+ setSelectAllForMouseEvent( selectAllForEdit );
+ setSelectAllForActionEvent( selectAllForEdit );
+ setSelectAllForKeyEvent( selectAllForEdit );
+ }*/
+
+ /*
+ * Set the Select All property when editing is invoked by the mouse
+ */
+ /*public void setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent){
+ selectAllForMouseEvent = isSelectAllForMouseEvent;
+ }*/
+
+ /*
+ * Set the Select All property when editing is invoked by the "F2" key
+ */
+ /*public void setSelectAllForActionEvent(boolean isSelectAllForActionEvent) {
+ selectAllForActionEvent = isSelectAllForActionEvent;
+ }*/
+
+ /*
+ * Set the Select All property when editing is invoked by
+ * typing directly into the cell
+ */
+ /*public void setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent){
+ selectAllForKeyEvent = isSelectAllForKeyEvent;
+ }*/
+
+ //FIN TEST
+
+ @Override
+ public boolean editCellAt(int row, int column, EventObject e) {
+ boolean result = super.editCellAt(row, column, e);
+ int lengthCellValue;
+ if (getEditorComponent() != null)
+ if (getEditorComponent() instanceof JXDatePicker) {
+ if (log.isInfoEnabled()) {
+ log.info("Test sur JXDatePicker");
+ }
+ lengthCellValue = ((JXDatePicker)getEditorComponent()).getEditor().getText().length();
+ if (lengthCellValue != -1) {
+ ((JXDatePicker)getEditorComponent()).getEditor().select(lengthCellValue, lengthCellValue);
+ }
+ } else if ( (getEditorComponent() instanceof JTextComponent)) {
+ if (log.isInfoEnabled()) {
+ log.info("Test sur JTextComponent / Number editor");
+ }
+ lengthCellValue = ((JTextComponent)getEditorComponent()).getText().length();
+ if (lengthCellValue != -1) {
+ ((JTextComponent)getEditorComponent()).select(lengthCellValue, lengthCellValue);
+ }
+ }
+ return result;
+ }
+
}
1
0
r3530 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by mallon@users.chorem.org 16 Jul '12
by mallon@users.chorem.org 16 Jul '12
16 Jul '12
Author: mallon
Date: 2012-07-16 12:41:16 +0200 (Mon, 16 Jul 2012)
New Revision: 3530
Url: http://chorem.org/repositories/revision/lima/3530
Log:
fixes #646 Modification de la couleur du focus de selection de cellule, pour plus de visibilite.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
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-16 09:58:46 UTC (rev 3529)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-16 10:41:16 UTC (rev 3530)
@@ -45,6 +45,8 @@
import org.jdesktop.swingx.decorator.Highlighter;
import javax.swing.*;
+import javax.swing.border.LineBorder;
+import javax.swing.plaf.BorderUIResource;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@@ -81,6 +83,9 @@
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)));
+
addKeyListener(new MyKeyAdapter());
addMouseListener(new MyMouseAdapter());
1
0
r3529 - in trunk/lima-swing/src/main: java/org/chorem/lima java/org/chorem/lima/ui resources/i18n
by mallon@users.chorem.org 16 Jul '12
by mallon@users.chorem.org 16 Jul '12
16 Jul '12
Author: mallon
Date: 2012-07-16 11:58:46 +0200 (Mon, 16 Jul 2012)
New Revision: 3529
Url: http://chorem.org/repositories/revision/lima/3529
Log:
Correction du nom de l'entree et de la methode, pour la creation du fichier d etat de l application ("LIMA_STATE_DIR" en "LIMA_STATE_FILE")
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/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
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-16 09:51:27 UTC (rev 3528)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-07-16 09:58:46 UTC (rev 3529)
@@ -336,8 +336,8 @@
return result;
}
- public File getLimaStateDirectory() {
- File result = getOptionAsFile(Option.LIMA_STATE_DIRECTORY.key);
+ public File getLimaStateFile() {
+ File result = getOptionAsFile(Option.LIMA_STATE_FILE.key);
return result;
}
@@ -400,7 +400,7 @@
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_DIRECTORY("lima.state.dir", n_("lima.config.state.dir"), "${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);
public final String key;
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-16 09:51:27 UTC (rev 3528)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-07-16 09:58:46 UTC (rev 3529)
@@ -113,7 +113,7 @@
LimaConfig limaConfig = LimaConfig.getInstance();
- File limaStateFile = limaConfig.getLimaStateDirectory();
+ File limaStateFile = limaConfig.getLimaStateFile();
return limaStateFile;
}
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-16 09:51:27 UTC (rev 3528)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-16 09:58:46 UTC (rev 3529)
@@ -75,7 +75,7 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Host adress
-lima.config.state.dir=State file of LIMA
+lima.config.state.file=State file of LIMA
lima.config.i18n.dir.description=
lima.config.locale.description=Localization used by LIMA
lima.config.resources.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-16 09:51:27 UTC (rev 3528)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-16 09:58:46 UTC (rev 3529)
@@ -75,7 +75,7 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Adresse du serveur distant
-lima.config.state.dir=Fichier d'état de l'application
+lima.config.state.file=Fichier d'état de l'application
lima.config.i18n.dir.description=
lima.config.locale.description=Locale utilisée par l'application
lima.config.resources.dir.description=
1
0
r3528 - in trunk/lima-swing/src/main: java/org/chorem/lima java/org/chorem/lima/ui resources/i18n
by mallon@users.chorem.org 16 Jul '12
by mallon@users.chorem.org 16 Jul '12
16 Jul '12
Author: mallon
Date: 2012-07-16 11:51:27 +0200 (Mon, 16 Jul 2012)
New Revision: 3528
Url: http://chorem.org/repositories/revision/lima/3528
Log:
Correction du syst?\195?\168me de cr?\195?\169ation de fichier xml utilis?\195?\169e par la librairie swing.widgets (Etat de l'application), via la classe LimaConfig (Ajout d'une entr?\195?\169e "LIMA_STATE_DIR")
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/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
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-16 08:54:47 UTC (rev 3527)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2012-07-16 09:51:27 UTC (rev 3528)
@@ -25,16 +25,7 @@
package org.chorem.lima;
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-
import jaxx.runtime.JAXXUtil;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,6 +40,14 @@
import org.nuiton.util.VersionUtil;
import org.nuiton.util.converter.ConverterUtil;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* La configuration de l'application.
*
@@ -337,6 +336,11 @@
return result;
}
+ public File getLimaStateDirectory() {
+ File result = getOptionAsFile(Option.LIMA_STATE_DIRECTORY.key);
+ return result;
+ }
+
public File getResourcesDirectory() {
File result = getOptionAsFile(Option.RESOURCES_DIRECTORY.key);
return result;
@@ -395,7 +399,8 @@
LAUNCH_UI("lima.ui.launchui", n_("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true),
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_HOST_ADDRESS("lima.host.address", n_("lima.config.host.adress"), "localhost", String.class, false, false),
+ LIMA_STATE_DIRECTORY("lima.state.dir", n_("lima.config.state.dir"), "${lima.data.dir}/limaState.xml", String.class, false, false);
public final String key;
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-16 08:54:47 UTC (rev 3527)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2012-07-16 09:51:27 UTC (rev 3528)
@@ -98,7 +98,7 @@
// show main ui
MainView ui = new MainView(rootContext);
- swingSession = new SwingSession(createFileLimaState(), false);
+ swingSession = new SwingSession(getLimaStateFile(), false);
LimaContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui);
@@ -108,24 +108,14 @@
return ui;
}
- //Creation of xml lima state file
- protected File createFileLimaState(){
- File limaStateDir = new File("././.lima/reports");
- File limaState = new File("././.lima/reports/limaState.xml");
+ //Get xml lima state file
+ protected File getLimaStateFile(){
- try {
- if(!limaStateDir.exists()){
- limaStateDir.mkdirs();
- }
- if(!limaState.exists()){
- limaState.createNewFile();
- }
- } catch (Exception ex) {
- if (log.isInfoEnabled()) {
- log.info("can't create lima state file : " + ex.getMessage(), ex);
- }
- }
- return limaState;
+ LimaConfig limaConfig = LimaConfig.getInstance();
+
+ File limaStateFile = limaConfig.getLimaStateDirectory();
+
+ return limaStateFile;
}
public void changeLanguage(MainView mainUI, Locale newLocale) {
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-16 08:54:47 UTC (rev 3527)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-16 09:51:27 UTC (rev 3528)
@@ -75,6 +75,7 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Host adress
+lima.config.state.dir=State file of LIMA
lima.config.i18n.dir.description=
lima.config.locale.description=Localization used by LIMA
lima.config.resources.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-16 08:54:47 UTC (rev 3527)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-16 09:51:27 UTC (rev 3528)
@@ -75,6 +75,7 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Adresse du serveur distant
+lima.config.state.dir=Fichier d'état de l'application
lima.config.i18n.dir.description=
lima.config.locale.description=Locale utilisée par l'application
lima.config.resources.dir.description=
1
0
r3527 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by mallon@users.chorem.org 16 Jul '12
by mallon@users.chorem.org 16 Jul '12
16 Jul '12
Author: mallon
Date: 2012-07-16 10:54:47 +0200 (Mon, 16 Jul 2012)
New Revision: 3527
Url: http://chorem.org/repositories/revision/lima/3527
Log:
fixes #698 Apr?\195?\168s correction de la table du panneau de saisie des ?\195?\169critures, l'ajout d'une troisi?\195?\168me entr?\195?\169e via la touche tabulation ne g?\195?\169n?\195?\168re plus d'erreur d'index.
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
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-13 16:42:21 UTC (rev 3526)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-07-16 08:54:47 UTC (rev 3527)
@@ -26,6 +26,8 @@
package org.chorem.lima.ui.financialtransaction;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
@@ -67,6 +69,8 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3133690382049594727L;
+ private static final Log log = LogFactory.getLog(FinancialTransactionViewHandler.class);
+
protected FinancialTransactionViewHandler handler;
private int x_tab;
@@ -228,9 +232,13 @@
//end of row
else {
x_tab = 0;
- y_tab++;
}
+ if (log.isInfoEnabled()) {
+ log.info("Valeur de x_tab : " + x_tab + "\n" +
+ "Valeur de y_tab : " + y_tab);
+ }
+
//skip all cell while not editable or if end of table add entry or transaction or end of table
while (!isCellEditable(y_tab, x_tab) && end) {
//if end of row
@@ -295,6 +303,7 @@
x_tab++;
}
}
+
}
}
}
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-13 16:42:21 UTC (rev 3526)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-16 08:54:47 UTC (rev 3527)
@@ -66,7 +66,6 @@
*/
public class FinancialTransactionViewHandler implements ServiceListener {
- /** log. */
private static final Log log = LogFactory.getLog(FinancialTransactionViewHandler.class);
/** Managed view. */
1
0