Author: jpepin
Date: 2010-04-14 17:44:00 +0200 (Wed, 14 Apr 2010)
New Revision: 2861
Log:
modification ui transaction, model zargo
Modified:
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTableModel.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-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-04-14 15:44:00 UTC (rev 2861)
@@ -1,5 +1,6 @@
# Precise l'entete de l'ensemble des fichiers generes
model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */
-org.chorem.lima.entity.Account.attribute.subAccounts.tagvalue.lazy=false
+#org.chorem.lima.entity.Account.attribute.subAccounts.tagvalue.lazy=false
+org.chorem.lima.entity.Transaction.attribute.entry.tagvalue.lazy=false
#model.tagvalue.dbSchema=Callao
model.tagvalue.String=text
\ No newline at end of file
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-04-14 15:44:00 UTC (rev 2861)
@@ -219,9 +219,7 @@
public void updateAccount(TreePath path, Account account) throws LimaException {
// Calling account service
accountService.updateAccount(account);
- int index = getIndexOfChild(path.getParentPath().getLastPathComponent(), account);
- // TODO maybe not working if order change
- // modelSupport.fireChildChanged(path.getParentPath(), index, account);
+ //refresh the tree of the node
modelSupport.fireTreeStructureChanged(path.getParentPath());
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionView.jaxx 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionView.jaxx 2010-04-14 15:44:00 UTC (rev 2861)
@@ -33,20 +33,25 @@
<JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/>
<JMenuItem text="lima.print"/>
</JPopupMenu> -->
+
<row fill="horizontal" weightx="1" weighty="0" anchor="center">
<cell>
<JLabel id="entryBookLabel" text="lima.transaction.entrybook"/>
</cell>
<cell>
<JComboBox id="entryBookComboBox"
- model="{new org.chorem.lima.ui.transaction.model.EntryBookComboBoxModel()}" />
+ model="{new org.chorem.lima.ui.transaction.model.EntryBookComboBoxModel()}"
+ renderer="{new org.chorem.lima.ui.transaction.model.EntryBookRenderer()}"
+ />
</cell>
<cell>
- <JLabel id="periodLabel" text="lima.transaction.period"/>
+ <JLabel id="periodLabel" text="lima.transaction.period"
+ />
</cell>
<cell>
- <JComboBox id="financialPeriodPanel"
- model="{new org.chorem.lima.ui.transaction.model.FinancialPeriodComboBoxModel()}" />
+ <JComboBox id="financialPeriodComboBox"
+ model="{new org.chorem.lima.ui.transaction.model.FinancialPeriodComboBoxModel()}"
+ renderer="{new org.chorem.lima.ui.transaction.model.FinancialPeriodRenderer()}" />
</cell>
</row>
<row>
@@ -61,7 +66,7 @@
highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createAlternateStriping(Color.WHITE,new Color(250,250,250))}" />
<javax.swing.ListSelectionModel javaBean="getTransactionTable().getSelectionModel()"
onValueChanged="setSelectedRow(transactionTable.getSelectedRow() != -1)"/>
- </JScrollPane>
+ </JScrollPane>
</cell>
<cell>
<JButton text="lima.add.transaction"
@@ -70,9 +75,14 @@
</row>
<row>
<cell>
+ <!--
<JButton text="lima.remove.transaction"
onActionPerformed="getHandler().removeTransaction()"
enabled="{isSelectedRow()}"/>
+ -->
+ <JButton text="lima.remove.transaction"
+ onActionPerformed="getHandler().deleteSelectedRow()"
+ enabled="{isSelectedRow()}"/>
</cell>
</row>
<row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionViewHandler.java 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/TransactionViewHandler.java 2010-04-14 15:44:00 UTC (rev 2861)
@@ -20,15 +20,26 @@
import static org.nuiton.i18n.I18n._;
+import java.util.List;
+
import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.EntryBookImpl;
import org.chorem.lima.entity.Transaction;
-import org.chorem.lima.table.model.TransactionTableModel;
+import org.chorem.lima.entity.TransactionImpl;
+import org.chorem.lima.ui.entrybook.EntryBookForm;
+import org.chorem.lima.ui.entrybook.model.EntryBookTableModel;
import org.chorem.lima.ui.transaction.table.TransactionTable;
+import org.chorem.lima.ui.transaction.table.TransactionTableModel;
+import org.chorem.lima.util.ErrorHelper;
+import org.jdesktop.swingx.JXTable;
+
/**
* Handler associated with account view.
*
@@ -47,35 +58,57 @@
protected TransactionViewHandler(TransactionView view) {
this.view = view;
- }
+ }
+
+ //add a new transaction
+ protected void addEmptyTransaction() {
+ TransactionTable table = (TransactionTable)view.getTransactionTable();
+ TransactionTableModel model = (TransactionTableModel)table.getModel();
- public void addEmptyTransaction() {
-
+ try {
+ model.addEmptyTransaction();
+ } catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add transaction", ex);
+ }
+ ErrorHelper.showErrorDialog("Can't add transaction", ex);
+ }
}
- public void removeTransaction() {
+ //implement new transaction button
+ //add a new entry to the selected transaction
+ public void addEmptyEntry(){
+ TransactionTable table = (TransactionTable)view.getTransactionTable();
+ TransactionTableModel model = (TransactionTableModel)table.getModel();
+
+ int indexSelectedRow = table.getSelectedRow();
+ if (indexSelectedRow != -1) {
+ Object selectedValue = model.getElementAt(indexSelectedRow);
+ model.addEmptyEntry(selectedValue, indexSelectedRow);
+ }
+ else {
+ if (log.isWarnEnabled()) {
+ log.warn("Call addentry selected transaction without selection");
+ }
+ }
}
- public void addEmptyEntry() {
-
- }
-
/**
* Delete selected row in table (could be transaction or entry).
*
* Called by model.
+ * @throws LimaException
*/
- public void deleteSelectedRow() {
+ public void deleteSelectedRow(){
TransactionTable table = (TransactionTable)view.getTransactionTable();
- TransactionTableModel model = table.getModel();
+ TransactionTableModel model = (TransactionTableModel)table.getModel();
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
Object selectedValue = model.getElementAt(indexSelectedRow);
-
String message = null;
if (selectedValue instanceof Transaction) {
message = _("lima.question.remove.transaction");
@@ -88,11 +121,22 @@
_("lima.transaction.confirmdelete"), JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {
-
+
+ try {
+ model.removeObject(selectedValue, indexSelectedRow);
+ } catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't remove transaction or entry", ex);
+ }
+ ErrorHelper.showErrorDialog("Can't remove transaction or entry", ex);
+ }
+
+ /*
if (selectedValue instanceof Transaction) {
// TODO EC-20100409 implements this
if (log.isWarnEnabled()) {
log.warn("TODO implement Transaction deletion");
+ model.removeTransaction(selectedValue);
}
}
else if (selectedValue instanceof Entry) {
@@ -100,7 +144,7 @@
if (log.isWarnEnabled()) {
log.warn("TODO implement Entry deletion");
}
- }
+ }*/
}
}
else {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTable.java 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTable.java 2010-04-14 15:44:00 UTC (rev 2861)
@@ -82,7 +82,7 @@
* Lorsque l'utilisateur clique sur une ligne du tableau, on ajoute
* automatiquement une nouvelle ligne (une entrée comptable)
*/
- addMouseListener(getEmptyLineSelectionListener());
+ //addMouseListener(getEmptyLineSelectionListener());
/*
* Mod : il est possible d'activer cette option.
@@ -118,10 +118,10 @@
// Color transactions
- addColorTransaction();
- addColorNonBalancedTransaction();
+ // addColorTransaction();
+ // addColorNonBalancedTransaction();
}
-
+
/**
*
*/
@@ -156,7 +156,7 @@
* Cette méthode permet de colorer toutes les transactions dans le tableau
* afin de bien distinguer les transactions et entrées comptables.
*/
- protected void addColorTransaction() {
+ /* protected void addColorTransaction() {
if (colorTransaction != null) {
removeHighlighter(colorTransaction);
}
@@ -170,13 +170,13 @@
colorTransaction = new ColorHighlighter(predicate, new Color(222, 222,
222), null, null, null);
addHighlighter(colorTransaction);
- }
+ }*/
/**
* Permet de surligner une transaction dans le tableau lorsque cette dernière
* n'est pas équilibrée.
*/
- protected void addColorNonBalancedTransaction() {
+/* protected void addColorNonBalancedTransaction() {
if (colorBalance != null) {
removeHighlighter(colorBalance);
}
@@ -198,9 +198,9 @@
colorTransaction = new ColorHighlighter(predicate, new Color(255, 198,
209), null, null, null);
addHighlighter(colorTransaction);
- }
+ }*/
- @Override
+ /* @Override
public TransactionTableModel getModel() {
return (TransactionTableModel) this.dataModel;
}
@@ -210,20 +210,22 @@
return (TransactionSortedTableColumnModel) this.columnModel;
}
+*/
+ /*
public EmptyLineSelectionListener getEmptyLineSelectionListener() {
if (emptyLineSelectionListener == null) {
return new EmptyLineSelectionListener();
}
return emptyLineSelectionListener;
}
-
+*/
@Override
public void keyPressed(KeyEvent e) {
// VK_DELETE suppression de la transaction en cours
// ou de l'entree
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
- handler.deleteSelectedRow();
+ // handler.deleteSelectedRow();
}
// Touche : insert ou ctrl+I
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTableModel.java 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/transaction/table/TransactionTableModel.java 2010-04-14 15:44:00 UTC (rev 2861)
@@ -315,6 +315,41 @@
return result;
}
+ /**
+ * @throws LimaException
+ */
+ public void addEmptyTransaction() throws LimaException{
+ /* Calling transaction service */
+ //TODO transaction = currentdate, current periode, current journal
+ Transaction transaction=null;
+ transactionService.createTransaction(transaction);
+ int row = transactionService.getAllTransactions().indexOf(transaction);
+ fireTableRowsInserted(row, row);
+ }
+
+
+
+ /**
+ * @throws LimaException
+ */
+ public void addEmptyEntry(Object value, int row) {
+ /* Calling transaction service */
+ //TODO transaction = currentdate, current periode, current journal
+ List<Object> datas = getDataList();
+ Object currentRow = datas.get(row);
+ Entry entry=null;
+ if (currentRow instanceof Transaction) {
+ Transaction currentTransaction = (Transaction)currentRow;
+ currentTransaction.addEntry(entry);
+ }
+ else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry)currentRow;
+ //TODO recuperer l'entrée parente, ajouter entrée
+ }
+ fireTableRowsUpdated(row, row);
+ }
+
+
@Override
public void setValueAt(Object value, int row, int column) {
@@ -417,4 +452,35 @@
}
}
}
+
+ public Object getElementAt(int row){
+
+ List<Object> datas = getDataList();
+ Object currentRow = datas.get(row);
+ return currentRow;
+ }
+
+
+ /**
+ * Delete selected row in table (could be transaction or entry).
+ *
+ * Called by model.
+ * @param Object, int
+ * @throws LimaException
+ */
+ public void removeObject(Object object, int row) throws LimaException {
+ /* Calling journal service */
+
+ List<Object> datas = getDataList();
+ Object currentRow = datas.get(row);
+ if (currentRow instanceof Transaction) {
+ Transaction currentTransaction = (Transaction)currentRow;
+ transactionService.removeTransaction(currentTransaction);
+ fireTableRowsDeleted(row, row);
+ }
+ else if (currentRow instanceof Entry) {
+ Entry currentEntry = (Entry)currentRow;
+ //TODO supprimer l'entrée
+ }
+ }
}
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 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-04-14 15:44:00 UTC (rev 2861)
@@ -265,7 +265,7 @@
lima.tab.home=Home
lima.tab.journal=Journal
lima.tab.lettering=Lettering
-lima.tab.period=
+lima.tab.period=Period
lima.tab.reports=Reports
lima.tab.result=Result
lima.tab.search.result=Search result
@@ -273,19 +273,19 @@
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
lima.to=To
-lima.transaction.column.account=
-lima.transaction.column.balance=
-lima.transaction.column.credit=
-lima.transaction.column.date=
-lima.transaction.column.debit=
-lima.transaction.column.description=
-lima.transaction.column.document=
-lima.transaction.column.entrybook=
-lima.transaction.column.period=
-lima.transaction.column.status=
+lima.transaction.column.account=Account
+lima.transaction.column.balance=Balance
+lima.transaction.column.credit=Credit
+lima.transaction.column.date=Date
+lima.transaction.column.debit=Debit
+lima.transaction.column.description=Description
+lima.transaction.column.document=Voucher
+lima.transaction.column.entrybook=Entrybook
+lima.transaction.column.period=Period
+lima.transaction.column.status=Status
lima.transaction.confirmdelete=
lima.transaction.entrybook=
-lima.transaction.period=
+lima.transaction.period=Period
lima.ui.add.account=Add account
lima.ui.add.journal=Add journal
lima.ui.block.timespan=Block period
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 2010-04-13 19:56:51 UTC (rev 2860)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-04-14 15:44:00 UTC (rev 2861)
@@ -20,7 +20,7 @@
lima.action.normalscreen.tip=Revenir en \u00E9cran normal
lima.add.entry=Ajouter une entr\u00E9e
lima.add.lettering=
-lima.add.transaction=
+lima.add.transaction=Ajouter une transaction
lima.all=Tous
lima.all.criteria=Tous les crit\u00E8res correspondent
lima.amount=Montant
@@ -83,7 +83,7 @@
lima.description=Description
lima.edit=Editer
lima.edit.transaction=Editer une transaction
-lima.entries=
+lima.entries=Entr\u00E9es comptable
lima.entries.addtransaction=Ajouter une transaction
lima.entries.lettering=Ajouter une lettre
lima.entries.searchtransaction=Recherche les transactions
@@ -263,19 +263,19 @@
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=A propos de Lima...
lima.to=A
-lima.transaction.column.account=
-lima.transaction.column.balance=
-lima.transaction.column.credit=
-lima.transaction.column.date=
-lima.transaction.column.debit=
-lima.transaction.column.description=
-lima.transaction.column.document=
-lima.transaction.column.entrybook=
-lima.transaction.column.period=
-lima.transaction.column.status=
+lima.transaction.column.account=Compte
+lima.transaction.column.balance=Balance
+lima.transaction.column.credit=Cr\u00E9dit
+lima.transaction.column.date=Date
+lima.transaction.column.debit=D\u00E9bit
+lima.transaction.column.description=Description
+lima.transaction.column.document=Document
+lima.transaction.column.entrybook=Journal
+lima.transaction.column.period=P\u00E9riode
+lima.transaction.column.status=Statut
lima.transaction.confirmdelete=
lima.transaction.entrybook=Journal
-lima.transaction.period=
+lima.transaction.period=P\u00E9riode
lima.ui.add.account=Ajouter un compte
lima.ui.add.journal=Ajouter un journal
lima.ui.block.timespan=Bloquer une p\u00E9riode mensuelle