r2933 - in trunk: . .settings lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/account lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/balance lima-swing/src/main/java/org/chorem/lima/ui/combobox lima-swing/src/main/java/org/chorem/lima/ui/entrybook lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports lima-swing/src/main/java/org/chorem/lima/ui/financia
Author: jpepin Date: 2010-06-07 23:27:59 +0200 (Mon, 07 Jun 2010) New Revision: 2933 Url: http://chorem.org/repositories/revision/lima/2933 Log: Ajout d'une fonction de rafraichissement pour les vues. Optimisation du code au passage. Added: trunk/.settings/org.eclipse.core.resources.prefs Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/ClosureTimeSpanForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/styles.css Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.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 trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties trunk/pom.xml Added: trunk/.settings/org.eclipse.core.resources.prefs =================================================================== --- trunk/.settings/org.eclipse.core.resources.prefs (rev 0) +++ trunk/.settings/org.eclipse.core.resources.prefs 2010-06-07 21:27:59 UTC (rev 2933) @@ -0,0 +1,3 @@ +#Fri Jun 04 14:14:04 CEST 2010 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -315,7 +315,7 @@ log.debug(account); //commit - //commitTransaction(transaction); + commitTransaction(transaction); } catch (TopiaException ex) { Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -106,7 +106,7 @@ double credit = 0, debit = 0, solde = 0; if (account != null){ // First subaccount - List<Account> accounts = account.getSubAccounts(); + List<Account> accounts = (List<Account>) account.getSubAccounts(); accounts.addAll(account.getSubLedgers()); if (accounts.size() == 0){ reportsDatas = generateSubAccountReportsWithTransaction(account, Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ##% --> -<JDialog defaultCloseOperation="dispose_on_close" modal="true"> +<JDialog modal="true"> <org.chorem.lima.entity.Account id="account" javaBean='null'/> <Boolean id="addState" javaBean='true'/> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,20 +19,15 @@ package org.chorem.lima.ui.account; import static org.nuiton.i18n.I18n._; - import java.util.List; - import javax.swing.tree.TreePath; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.util.DialogHelper; import org.jdesktop.swingx.treetable.AbstractTreeTableModel; /** Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ##% --> -<JDialog defaultCloseOperation="dispose_on_close" modal="true"> +<JDialog modal="true"> <org.chorem.lima.entity.Account id="account" javaBean='null'/> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -20,13 +20,9 @@ package org.chorem.lima.ui.accountsreports; import static org.nuiton.i18n.I18n._; - import java.text.SimpleDateFormat; import java.util.Date; - import javax.swing.table.AbstractTableModel; - -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.ReportsDatas; @@ -83,8 +79,10 @@ int result = 0; // just prevent too much result - if (selectedAccount != null) { - result = cacheDataList.getListEntry().size(); + if (cacheDataList != null) { + if (cacheDataList.getListEntry() != null){ + result = cacheDataList.getListEntry().size(); + } } else { if (log.isDebugEnabled()) { @@ -129,7 +127,7 @@ @Override public Object getValueAt(int row, int column) { Object result = null; - if(selectedAccount != null) { + if(cacheDataList != null) { Entry currentRow = cacheDataList.getListEntry().get(row); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMMM yyyy"); @@ -179,21 +177,15 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } public void setAccount(Account account) { selectedAccount = account; - cacheDataList=getDataList(); - fireTableDataChanged(); } public ReportsDatas getDataList(){ @@ -211,4 +203,9 @@ return results; } + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -41,35 +41,42 @@ getBeginDatePicker().setDate(beginDate); getEndDatePicker().setDate(endDate); + + void $afterCompleteSetup() { + getHandler().refresh(); + } ]]> </script> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" onActionPerformed="getModelAccountsReportsTable().setBeginDate(beginDatePicker.getDate()); - getHandler().updateFooterLabel()" /> + getHandler().refresh()" /> </cell> - <cell> + <cell anchor="east"> <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="endDatePicker" onActionPerformed="getModelAccountsReportsTable().setEndDate(endDatePicker.getDate()); - getHandler().updateFooterLabel()"/> + getHandler().refresh()"/> </cell> - <cell> + <cell anchor="east"> <JLabel id="accountSelectorLabel" text="lima.account"/> </cell> - <cell> + <cell anchor="west"> <JComboBox id="accountSelectorComboBox" - model="{getModelAccounts()}" + model="{modelAccounts}" renderer="{new org.chorem.lima.ui.combobox.AccountRenderer()}" - onItemStateChanged="getModelAccountsReportsTable().setAccount((Account) event.getItem()); - getHandler().updateFooterLabel()" + onActionPerformed="getModelAccountsReportsTable().setAccount((Account) accountSelectorComboBox.getSelectedItem()); + getHandler().refresh()" editable="false" /> </cell> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,11 +19,10 @@ package org.chorem.lima.ui.accountsreports; import static org.nuiton.i18n.I18n._; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.ReportsDatas; -import org.chorem.lima.ui.ReportsHelper; +import org.chorem.lima.ui.combobox.AccountComboBoxModel; /** @@ -42,23 +41,27 @@ LogFactory.getLog(AccountsReportsViewHandler.class); protected AccountsReportsView view; - - /** Helper **/ - protected ReportsHelper helper; + + protected AccountsReportsTableModel tableModel; + + protected AccountComboBoxModel comboBoxModel; protected AccountsReportsViewHandler(AccountsReportsView view) { this.view = view; } - /* + public void refresh(){ + tableModel = view.getModelAccountsReportsTable(); + tableModel.refresh(); + + comboBoxModel = view.getModelAccounts(); + comboBoxModel.refresh(); + + /** * set text and amounts of labels credit, debit, solde */ - public void updateFooterLabel(){ - AccountsReportsTableModel tablemodel = - (AccountsReportsTableModel) view.getAccountsReportsTable().getModel(); + ReportsDatas cacheDataList = tableModel.cacheDataList; - ReportsDatas cacheDataList = tablemodel.cacheDataList; - if (cacheDataList != null){ // set amounts credit and debit and solde view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit())); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -71,7 +71,11 @@ @Override public int getRowCount() { - return cacheDataList.getReportsDatas().size(); + int result = 0; + if (cacheDataList != null){ + result = cacheDataList.getReportsDatas().size(); + } + return result; } @Override @@ -158,14 +162,10 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } /** @@ -187,4 +187,9 @@ return results; } + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -42,28 +42,31 @@ getModelBalanceTable().setEndDate(endDate); void $afterCompleteSetup() { - getHandler().updateFooterLabel(); + getHandler().refresh(); } ]]> </script> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" onActionPerformed="getModelBalanceTable().setBeginDate(beginDatePicker.getDate()); - getHandler().updateFooterLabel()" /> + getHandler().refresh()" /> </cell> - <cell> + <cell anchor="east"> <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="endDatePicker" onActionPerformed="getModelBalanceTable().setEndDate(endDatePicker.getDate()); - getHandler().updateFooterLabel()"/> + getHandler().refresh()"/> </cell> </row> <row> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,15 +19,11 @@ package org.chorem.lima.ui.balance; import static org.nuiton.i18n.I18n._; - -import java.util.List; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.business.FinancialTransactionService; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.ReportsHelper; /** @@ -50,8 +46,7 @@ /** service **/ protected FinancialTransactionService financialTransactionService; - /** Helper **/ - protected ReportsHelper helper; + protected BalanceTableModel model; protected BalanceViewHandler(BalanceView view) { this.view = view; @@ -60,14 +55,15 @@ } + public void refresh(){ + model = view.getModelBalanceTable(); + model.refresh(); + /** * update the labels credit, debit, solde on the footer * get all entries for all accounts on the selected period */ - public void updateFooterLabel(){ - BalanceTableModel tablemodel = - (BalanceTableModel) view.getBalanceTable().getModel(); - BalanceTrial cacheDataList = tablemodel.cacheDataList; + BalanceTrial cacheDataList = model.cacheDataList; if (cacheDataList != null){ // set amounts credit, debit and solde Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountComboBoxModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -20,9 +20,8 @@ import java.util.List; +import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; -import javax.swing.event.ListDataListener; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountService; @@ -35,7 +34,7 @@ * Account combo box model. */ -public class AccountComboBoxModel implements ComboBoxModel { +public class AccountComboBoxModel extends AbstractListModel implements ComboBoxModel { private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); @@ -58,17 +57,13 @@ @Override public void setSelectedItem(Object anItem) { selectedAccount = anItem; + fireContentsChanged(this, -1, -1); } - @Override - public void addListDataListener(ListDataListener arg0) { - // TODO Auto-generated method stub - - } @Override public Object getElementAt(int index) { - return datasCache.get(index); + return datasCache.get(index); } @Override @@ -76,12 +71,6 @@ return datasCache.size(); } - @Override - public void removeListDataListener(ListDataListener arg0) { - // TODO Auto-generated method stub - - } - public List<Account> getDataList(){ List<Account> result = null; try { @@ -95,6 +84,11 @@ return result; } + + public void refresh(){ + datasCache = getDataList(); + fireContentsChanged(this, 0, datasCache.size()); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/AccountRenderer.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -24,7 +24,6 @@ label.setText(account.getAccountNumber()+" - "+account.getLabel()); } return label; - } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/EntryBookComboBoxModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -18,6 +18,8 @@ package org.chorem.lima.ui.combobox; import java.util.List; + +import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; import org.apache.commons.logging.Log; @@ -37,7 +39,7 @@ * Last update : $Date$ * By : $Author$ */ -public class EntryBookComboBoxModel implements ComboBoxModel { +public class EntryBookComboBoxModel extends AbstractListModel implements ComboBoxModel { private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); @@ -52,55 +54,27 @@ cacheDatas = getDataList(); } - /* - * @see javax.swing.ListModel#getSize() - */ @Override public int getSize() { return cacheDatas.size(); } - /* - * @see javax.swing.ListModel#getElementAt(int) - */ @Override public Object getElementAt(int index) { return cacheDatas.get(index); } - /* - * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener) - */ @Override - public void addListDataListener(ListDataListener l) { - - } - - /* - * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener) - */ - @Override - public void removeListDataListener(ListDataListener l) { - - } - - /* - * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object) - */ - @Override public void setSelectedItem(Object anItem) { selectedEntryBook = anItem; } - /* - * @see javax.swing.ComboBoxModel#getSelectedItem() - */ @Override public Object getSelectedItem() { return selectedEntryBook; } - /* + /** * get the accounts list */ public List<EntryBook> getDataList(){ @@ -116,4 +90,9 @@ return result; } + public void refresh(){ + cacheDatas = getDataList(); + fireContentsChanged(this, 0, cacheDatas.size()); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FinancialPeriodComboBoxModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,6 +19,8 @@ package org.chorem.lima.ui.combobox; import java.util.List; + +import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; import org.apache.commons.logging.Log; @@ -39,7 +41,7 @@ * Last update : $Date$ * By : $Author$ */ -public class FinancialPeriodComboBoxModel implements ComboBoxModel { +public class FinancialPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel { private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); @@ -62,49 +64,21 @@ datasCache=getDataList(); } - /* - * @see javax.swing.ListModel#getSize() - */ @Override public int getSize() { return datasCache.size(); } - /* - * @see javax.swing.ListModel#getElementAt(int) - */ @Override public Object getElementAt(int index) { return datasCache.get(index); } - /* - * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener) - */ @Override - public void addListDataListener(ListDataListener l) { - - } - - /* - * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener) - */ - @Override - public void removeListDataListener(ListDataListener l) { - - } - - /* - * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object) - */ - @Override public void setSelectedItem(Object anItem) { selectedFinancialPeriod = anItem; } - /* - * @see javax.swing.ComboBoxModel#getSelectedItem() - */ @Override public Object getSelectedItem() { return selectedFinancialPeriod; @@ -125,7 +99,11 @@ log.debug("Can't get Financial Period list",ex); } } - return result; - + return result; } + + public void refresh(){ + datasCache = getDataList(); + fireContentsChanged(this, 0, datasCache.size()); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -18,85 +18,75 @@ package org.chorem.lima.ui.combobox; +import java.util.List; + +import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; import javax.swing.event.ListDataListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FiscalPeriodService; import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel; -public class FiscalPeriodComboBoxModel implements ComboBoxModel{ +public class FiscalPeriodComboBoxModel extends AbstractListModel implements ComboBoxModel{ + + private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); protected Object selectedFiscalPeriod; protected FiscalPeriodService fiscalPeriodService; + protected List<FiscalPeriod> datasCache; + + public FiscalPeriodComboBoxModel(){ fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); + datasCache = getDataList(); } - /* - * @see javax.swing.ListModel#getSize() - */ @Override public int getSize() { - int result = 0; - // TODO add cache - try { - result = fiscalPeriodService.getAllUnblockedFiscalPeriods().size(); - } - catch (LimaException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - return result; + return datasCache.size(); } - /* - * @see javax.swing.ListModel#getElementAt(int) - */ @Override public Object getElementAt(int index) { - Object result = null; - try { - result = fiscalPeriodService.getAllUnblockedFiscalPeriods().get(index); - } - catch (LimaException ex) { - ex.printStackTrace(); - } - return result; + return datasCache.get(index); } - /* - * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener) - */ - @Override - public void addListDataListener(ListDataListener l) { - - } - /* - * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener) - */ @Override - public void removeListDataListener(ListDataListener l) { - - } - - /* - * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object) - */ - @Override public void setSelectedItem(Object anItem) { selectedFiscalPeriod = anItem; } - /* - * @see javax.swing.ComboBoxModel#getSelectedItem() - */ @Override public Object getSelectedItem() { return selectedFiscalPeriod; } + public List<FiscalPeriod> getDataList(){ + List<FiscalPeriod> result = null; + try { + result = fiscalPeriodService.getAllUnblockedFiscalPeriods(); + } + catch (LimaException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't get list accounts", eee); + } + } + return result; + + } + + public void refresh(){ + datasCache = getDataList(); + fireContentsChanged(this, 0, datasCache.size()); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -20,17 +20,13 @@ package org.chorem.lima.ui.entrybook; import static org.nuiton.i18n.I18n._; - import javax.swing.table.AbstractTableModel; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.util.DialogHelper; /** * Entry book table model. @@ -60,13 +56,6 @@ entryBookService = LimaServiceFactory.getInstance().getEntryBookService(); } - /* - * @return - * - public List<JournalDTO> getData() { - return data; - }*/ - @Override public int getRowCount() { int result = 0; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -38,6 +38,8 @@ onValueChanged="setSelectedRow(entryBooksTable.getSelectedRow() != -1)"/> </JScrollPane> </cell> + </row> + <row> <cell fill="horizontal"> <JButton id="addButton" text="lima.entrybook.add" onActionPerformed="getHandler().addEntryBook()"/> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -20,12 +20,9 @@ package org.chorem.lima.ui.entrybooksreports; import static org.nuiton.i18n.I18n._; - import java.text.SimpleDateFormat; import java.util.Date; - import javax.swing.table.AbstractTableModel; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.ReportsDatas; @@ -183,21 +180,15 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - cacheDataList=getDataList(); - fireTableDataChanged(); } public void setEntryBook(EntryBook entryBook) { selectedEntryBook = entryBook; - cacheDataList=getDataList(); - fireTableDataChanged(); } public ReportsDatas getDataList(){ @@ -215,4 +206,9 @@ return results; } + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -41,35 +41,42 @@ getBeginDatePicker().setDate(beginDate); getEndDatePicker().setDate(endDate); + + void $afterCompleteSetup() { + getHandler().refresh(); + } ]]> </script> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" onActionPerformed="getModelTable().setBeginDate(beginDatePicker.getDate()); - getHandler().updateFooterLabel()" /> + getHandler().refresh()" /> </cell> - <cell> + <cell anchor="east"> <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="endDatePicker" onActionPerformed="getModelTable().setEndDate(endDatePicker.getDate()); - getHandler().updateFooterLabel()"/> + getHandler().refresh()"/> </cell> - <cell> + <cell anchor="east"> <JLabel id="entryBookSelectorLabel" text="lima.entrybook"/> </cell> - <cell> + <cell anchor="west"> <JComboBox id="entryBookComboBox" model="{getModelEntryBook()}" renderer="{new org.chorem.lima.ui.combobox.EntryBookRenderer()}" - onItemStateChanged="getModelTable().setEntryBook((EntryBook) event.getItem()); - getHandler().updateFooterLabel()" + onActionPerformed="getModelTable().setEntryBook((EntryBook) entryBookComboBox.getSelectedItem()); + getHandler().refresh()" editable="false" /> </cell> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -23,7 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.ReportsDatas; -import org.chorem.lima.ui.ReportsHelper; +import org.chorem.lima.ui.combobox.EntryBookComboBoxModel; /** @@ -42,24 +42,29 @@ LogFactory.getLog(EntryBooksReportsViewHandler.class); protected EntryBooksReportsView view; - - /** Helper **/ - protected ReportsHelper helper; + + protected EntryBooksReportsTable table; + + protected EntryBooksReportsTableModel tableModel; + + protected EntryBookComboBoxModel comboBoxModel; protected EntryBooksReportsViewHandler(EntryBooksReportsView view) { this.view = view; } - - + public void refresh(){ + tableModel = view.getModelTable(); + tableModel.refresh(); + + comboBoxModel = view.getModelEntryBook(); + comboBoxModel.refresh(); + /** * set text and amounts of labels credit, debit, solde */ - public void updateFooterLabel(){ - EntryBooksReportsTableModel tablemodel = view.getModelTable(); + ReportsDatas cacheDataList = tableModel.cacheDataList; - ReportsDatas cacheDataList = tablemodel.cacheDataList; - if (cacheDataList != null){ // set amounts credit, debit and solde view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit())); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -26,9 +26,7 @@ import javax.swing.table.AbstractTableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.EntryBookService; import org.chorem.lima.business.FinancialPeriodService; -import org.chorem.lima.business.FiscalPeriodService; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.EntryBook; @@ -52,19 +50,13 @@ private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); - /** services */ - protected FiscalPeriodService fiscalPeriodService; - protected EntryBookService entryBookService; + /** service */ protected FinancialPeriodService financialPeriodService; /** Datas cache */ protected List<ClosedPeriodicEntryBook> cacheDataList; public FinancialPeriodTableModel() { - fiscalPeriodService = - LimaServiceFactory.getInstance().getFiscalPeriodService(); - entryBookService = - LimaServiceFactory.getInstance().getEntryBookService(); financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService(); } 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 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -25,10 +25,7 @@ import java.util.Collections; import java.util.Date; import java.util.List; - -import javax.swing.JOptionPane; import javax.swing.table.AbstractTableModel; - import org.apache.commons.lang.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -49,7 +46,6 @@ import org.chorem.lima.util.DialogHelper; import org.chorem.lima.util.ErrorHelper; -import com.sun.xml.bind.Util; /** * Basic transaction table model. @@ -113,28 +109,33 @@ * @return */ protected List<Object> getDataList() { - List<Object> results = new ArrayList<Object>(); - try { - List<FinancialTransaction> financialtransactions = - financialTransactionService.getAllFinancialTransactionsForFinancialPeriod( - selectedFinancialPeriod); - for (FinancialTransaction financialtransaction : financialtransactions) { - results.add(financialtransaction); - List<Entry> entries = (List<Entry>) financialtransaction.getEntry(); - Collections.sort(entries, new EntryComparator()); - results.addAll(entries); + if (selectedFinancialPeriod != null){ + try { + List<FinancialTransaction> financialtransactions = + financialTransactionService.getAllFinancialTransactionsForFinancialPeriod( + selectedFinancialPeriod); + for (FinancialTransaction financialtransaction : financialtransactions) { + results.add(financialtransaction); + List<Entry> entries = (List<Entry>) financialtransaction.getEntry(); + Collections.sort(entries, new EntryComparator()); + results.addAll(entries); + } } - } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); - } - ErrorHelper.showErrorDialog("Can't get transaction list", eee); - } - + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); + } + ErrorHelper.showErrorDialog("Can't get transaction list", eee); + } + } return results; } + + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } @Override public int getColumnCount() { @@ -220,8 +221,7 @@ public int getRowCount() { int result = 0; - // just prevent too much result - if (selectedFinancialPeriod != null) { + if (cacheDataList != null) { //cacheDataList = getDataList(); result = cacheDataList.size(); } @@ -239,7 +239,7 @@ Object result = null; // just prevent too much result - if (selectedFinancialPeriod != null) { + if (cacheDataList != null) { result = cacheDataList.get(row); if (result instanceof FinancialTransaction) { @@ -332,10 +332,7 @@ public void setFinancialPeriod(FinancialPeriod financialPeriod){ - selectedFinancialPeriod = financialPeriod; - cacheDataList = getDataList(); - fireTableDataChanged(); } /** @@ -363,7 +360,7 @@ public void addFinancialTransaction() throws LimaException{ /* Calling transaction service */ FinancialTransaction financialTransaction = new FinancialTransactionImpl(); - //if a period and an entrybook is selected + //if a period is selected if (selectedFinancialPeriod != null){ financialTransaction.setFinancialPeriod(selectedFinancialPeriod); // get today @@ -422,8 +419,7 @@ @Override public void setValueAt(Object value, int row, int column) { int financialTransactionRow=0; - // just prevent too much result - if (selectedFinancialPeriod != null) { + if (cacheDataList != null) { Object currentRow = cacheDataList.get(row); if (currentRow instanceof FinancialTransaction) { FinancialTransaction currentFinancialTransaction = @@ -501,9 +497,11 @@ } public Object getElementAt(int row){ - - Object currentRow = cacheDataList.get(row); - return currentRow; + Object result = null; + if (cacheDataList != null){ + result = cacheDataList.get(row); + } + return result; } 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 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,11 +19,16 @@ <FinancialTransactionViewHandler id="handler" javaBean="new FinancialTransactionViewHandler(this)" /> <Boolean id="selectedRow" javaBean="false" /> <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/> + <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/> <script> <![CDATA[ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FinancialPeriod; + + void $afterCompleteSetup() { + getHandler().refresh(); + } ]]> </script> @@ -37,26 +42,31 @@ <JMenuItem text="lima.print"/> </JPopupMenu> --> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/> </cell> - <cell> + <cell anchor="west"> <JComboBox id="fiscalPeriodComboBox" - model="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel()}" + model="{getModelFiscalPeriod()}" renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}" - onItemStateChanged="getModelFinancialPeriod().setFiscalPeriod( (FiscalPeriod) event.getItem())" + onActionPerformed="getModelFinancialPeriod().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem()); + getHandler().refresh()" editable="false"/> </cell> - <cell> + <cell anchor="east"> <JLabel id="financialPeriodLabel" text="lima.transaction.period" /> </cell> - <cell> + <cell anchor="west"> <JComboBox id="financialPeriodComboBox" model="{getModelFinancialPeriod()}" renderer="{new org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer()}" - onItemStateChanged="getFinancialTransactionTableModel().setFinancialPeriod((FinancialPeriod) event.getItem())" + onActionPerformed="getFinancialTransactionTableModel().setFinancialPeriod( (FinancialPeriod) financialPeriodComboBox.getSelectedItem()); + getHandler().refresh()" editable="false" /> </cell> @@ -74,7 +84,7 @@ </cell> </row> <row> - <cell fill="both" weightx="1" weighty="1" rows="3" columns="7"> + <cell fill="both" weightx="1" weighty="1" rows="3" columns="9"> <JScrollPane> <org.chorem.lima.ui.financialtransaction.FinancialTransactionTableModel id="financialTransactionTableModel"/> 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 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -28,6 +28,8 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; import org.chorem.lima.ui.financialtransaction.FinancialTransactionView; import org.chorem.lima.util.DialogHelper; @@ -47,6 +49,14 @@ LogFactory.getLog(FinancialTransactionViewHandler.class); protected FinancialTransactionView view; + + protected FinancialTransactionTable table; + + protected FinancialTransactionTableModel tableModel; + + protected FiscalPeriodComboBoxModel fiscalPeriodComboBoxModel; + + protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel; protected FinancialTransactionViewHandler(FinancialTransactionView view) { this.view = view; @@ -54,13 +64,11 @@ //add a new transaction public void addFinancialTransaction() { - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); + table = view.getFinancialTransactionTable(); + tableModel = view.getFinancialTransactionTableModel(); try { - model.addFinancialTransaction(); + tableModel.addFinancialTransaction(); //select the new line int numberRow = table.getRowCount(); ListSelectionModel selectionModel = @@ -81,16 +89,14 @@ //add a new entry to the selected transaction public void addEmptyEntry(){ - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); + table = view.getFinancialTransactionTable(); + tableModel = view.getFinancialTransactionTableModel(); int indexSelectedRow = table.getSelectedRow(); if (indexSelectedRow != -1) { - Object selectedValue = model.getElementAt(indexSelectedRow); + Object selectedValue = tableModel.getElementAt(indexSelectedRow); try { - model.addEmptyEntry(selectedValue, indexSelectedRow); + tableModel.addEmptyEntry(selectedValue, indexSelectedRow); //select the new line ListSelectionModel selectionModel = table.getSelectionModel(); @@ -120,15 +126,13 @@ */ public void deleteSelectedRow(){ - FinancialTransactionTable table = - (FinancialTransactionTable)view.getFinancialTransactionTable(); - FinancialTransactionTableModel model = - (FinancialTransactionTableModel)table.getModel(); + table = view.getFinancialTransactionTable(); + tableModel = view.getFinancialTransactionTableModel(); int indexSelectedRow = table.getSelectedRow(); if (indexSelectedRow != -1) { - Object selectedValue = model.getElementAt(indexSelectedRow); + Object selectedValue = tableModel.getElementAt(indexSelectedRow); String message = null; if (selectedValue instanceof FinancialTransaction) { message = _("lima.question.remove.transaction"); @@ -143,7 +147,7 @@ if (response == JOptionPane.YES_OPTION) { try { - model.removeObject(selectedValue, indexSelectedRow); + tableModel.removeObject(selectedValue, indexSelectedRow); //select the upper line ListSelectionModel selectionModel = table.getSelectionModel(); @@ -162,4 +166,15 @@ } } } + + public void refresh(){ + tableModel = view.getFinancialTransactionTableModel(); + tableModel.refresh(); + + fiscalPeriodComboBoxModel = view.getModelFiscalPeriod(); + fiscalPeriodComboBoxModel.refresh(); + + financialPeriodComboBoxModel = view.getModelFinancialPeriod(); + financialPeriodComboBoxModel.refresh(); + } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -19,20 +19,13 @@ package org.chorem.lima.ui.financialtransactionunbalanced; import static org.nuiton.i18n.I18n._; - import java.util.ArrayList; -import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; - import javax.swing.table.AbstractTableModel; - -import org.apache.commons.lang.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.EntryBookService; -import org.chorem.lima.business.FinancialPeriodService; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.FinancialTransactionService; import org.chorem.lima.business.utils.EntryComparator; @@ -40,8 +33,6 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryImpl; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialPeriodImpl; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; @@ -73,12 +64,6 @@ /** Transaction service. */ protected final FinancialTransactionService financialTransactionService; - /** EntryBook service. */ - protected final EntryBookService entryBookService; - - /** FinancialPeriod service. */ - protected final FinancialPeriodService financialPeriodService; - /** selected financial period */ protected FiscalPeriod selectedFiscalPeriod; @@ -96,8 +81,6 @@ public FinancialTransactionUnbalancedTableModel() { /* Services */ financialTransactionService = LimaServiceFactory.getInstance().getTransactionService(); - entryBookService = LimaServiceFactory.getInstance().getEntryBookService(); - financialPeriodService = LimaServiceFactory.getInstance().getFinancialPeriodService(); } /** @@ -107,28 +90,34 @@ * @return */ protected List<Object> getDataList() { - List<Object> results = new ArrayList<Object>(); - try { - List<FinancialTransaction> financialtransactions = - financialTransactionService.getAllFinancialTransactionsUnbalanced(selectedFiscalPeriod); - for (FinancialTransaction financialtransaction : financialtransactions) { - results.add(financialtransaction); - List<Entry> entries = (List<Entry>) financialtransaction.getEntry(); - Collections.sort(entries, new EntryComparator()); - results.addAll(entries); + if(selectedFiscalPeriod != null){ + try { + List<FinancialTransaction> financialtransactions = + financialTransactionService.getAllFinancialTransactionsUnbalanced(selectedFiscalPeriod); + for (FinancialTransaction financialtransaction : financialtransactions) { + results.add(financialtransaction); + List<Entry> entries = (List<Entry>) financialtransaction.getEntry(); + Collections.sort(entries, new EntryComparator()); + results.addAll(entries); + } } + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); + } + + ErrorHelper.showErrorDialog("Can't get transaction list", eee); + } } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); - } - - ErrorHelper.showErrorDialog("Can't get transaction list", eee); - } return results; } + + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } @Override public int getColumnCount() { @@ -215,8 +204,7 @@ int result = 0; // just prevent too much result - if (selectedFiscalPeriod != null) { - //cacheDataList = getDataList(); + if (cacheDataList != null) { result = cacheDataList.size(); } else { @@ -233,7 +221,7 @@ Object result = null; // just prevent too much result - if (selectedFiscalPeriod != null) { + if (cacheDataList != null) { result = cacheDataList.get(row); if (result instanceof FinancialTransaction) { @@ -324,11 +312,8 @@ return result; } - public void setFiscalPeriod(FiscalPeriod fiscalPeriod){ - + public void setFiscalPeriod(FiscalPeriod fiscalPeriod){ selectedFiscalPeriod = fiscalPeriod; - cacheDataList = getDataList(); - fireTableDataChanged(); } /** @@ -371,8 +356,7 @@ entry.setFinancialTransaction(currentTransaction); financialTransactionService.createEntry(entry); //on recharge la liste - cacheDataList = getDataList(); - fireTableDataChanged(); + refresh(); } /** @@ -405,7 +389,7 @@ } //update the financial transaction in entire financialTransactionRow = - getDataList().indexOf(((FinancialTransaction) currentRow)); + cacheDataList.indexOf(((FinancialTransaction) currentRow)); } else if (currentRow instanceof Entry) { Entry currentEntry = (Entry)currentRow; @@ -444,11 +428,11 @@ } //update the financial transaction in entire financialTransactionRow = - getDataList().indexOf(((Entry) currentRow). + cacheDataList.indexOf(((Entry) currentRow). getFinancialTransaction()); } //on recharge la liste - cacheDataList = getDataList(); + //TODO PEPIN 20100607 Get financial transaction of cachedatelist on replace it fireTableRowsUpdated(financialTransactionRow, getRowCount()-1); } else { @@ -484,8 +468,7 @@ financialTransactionService.removeEntry(currentEntry); } //on recharge la liste - cacheDataList = getDataList(); - fireTableRowsDeleted(row, getRowCount()); + refresh(); } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -18,12 +18,15 @@ <Table> <FinancialTransactionUnbalancedViewHandler id="handler" javaBean="new FinancialTransactionUnbalancedViewHandler(this)" /> <Boolean id="selectedRow" javaBean="false" /> - <org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel id="modelFinancialPeriod"/> + <org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/> <script> <![CDATA[ import org.chorem.lima.entity.FiscalPeriod; - import org.chorem.lima.entity.FinancialPeriod; + + void $afterCompleteSetup() { + getHandler().refresh(); + } ]]> </script> @@ -37,19 +40,25 @@ <JMenuItem text="lima.print"/> </JPopupMenu> --> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="fiscalPeriodLabel" text="lima.charts.fiscalyear"/> </cell> - <cell> + <cell anchor="west"> <JComboBox id="fiscalPeriodComboBox" - model="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel()}" + model="{modelFiscalPeriod}" renderer="{new org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer()}" - onItemStateChanged="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) event.getItem())" + onActionPerformed="getFinancialTransactionUnbalancedTableModel().setFiscalPeriod( (FiscalPeriod) fiscalPeriodComboBox.getSelectedItem()); + getHandler().refresh()" editable="false"/> </cell> <cell> - <JButton text="lima.add.entry" onActionPerformed="getHandler().addEmptyEntry()"/> + <JButton text="lima.add.entry" + onActionPerformed="getHandler().addEmptyEntry()" + enabled="{isSelectedRow()}"/> </cell> <cell> <JButton text="lima.common.remove" @@ -58,7 +67,7 @@ </cell> </row> <row> - <cell fill="both" weightx="1" weighty="1" rows="3" columns="7"> + <cell fill="both" weightx="1" weighty="1" rows="1" columns="9"> <JScrollPane> <org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedTableModel id="financialTransactionUnbalancedTableModel" /> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; import org.chorem.lima.util.DialogHelper; /** @@ -46,6 +47,12 @@ LogFactory.getLog(FinancialTransactionUnbalancedViewHandler.class); protected FinancialTransactionUnbalancedView view; + + protected FinancialTransactionUnbalancedTable table; + + protected FinancialTransactionUnbalancedTableModel tableModel; + + protected FiscalPeriodComboBoxModel comboBoxModel; protected FinancialTransactionUnbalancedViewHandler(FinancialTransactionUnbalancedView view) { this.view = view; @@ -55,16 +62,14 @@ //add a new entry to the selected transaction public void addEmptyEntry(){ - FinancialTransactionUnbalancedTable table = - (FinancialTransactionUnbalancedTable)view.getFinancialTransactionUnbalancedTable(); - FinancialTransactionUnbalancedTableModel model = - (FinancialTransactionUnbalancedTableModel)table.getModel(); + table = view.getFinancialTransactionUnbalancedTable(); + tableModel = view.getFinancialTransactionUnbalancedTableModel(); int indexSelectedRow = table.getSelectedRow(); if (indexSelectedRow != -1) { - Object selectedValue = model.getElementAt(indexSelectedRow); + Object selectedValue = tableModel.getElementAt(indexSelectedRow); try { - model.addEmptyEntry(selectedValue, indexSelectedRow); + tableModel.addEmptyEntry(selectedValue, indexSelectedRow); //select the new line ListSelectionModel selectionModel = table.getSelectionModel(); @@ -90,20 +95,18 @@ /** * Delete selected row in table (could be transaction or entry). * - * Called by model. + * Called by tableModel. * @throws LimaException */ public void deleteSelectedRow(){ - FinancialTransactionUnbalancedTable table = - (FinancialTransactionUnbalancedTable)view.getFinancialTransactionUnbalancedTable(); - FinancialTransactionUnbalancedTableModel model = - (FinancialTransactionUnbalancedTableModel)table.getModel(); + table = view.getFinancialTransactionUnbalancedTable(); + tableModel = view.getFinancialTransactionUnbalancedTableModel(); int indexSelectedRow = table.getSelectedRow(); if (indexSelectedRow != -1) { - Object selectedValue = model.getElementAt(indexSelectedRow); + Object selectedValue = tableModel.getElementAt(indexSelectedRow); String message = null; if (selectedValue instanceof FinancialTransaction) { message = _("lima.question.remove.transaction"); @@ -118,7 +121,7 @@ if (response == JOptionPane.YES_OPTION) { try { - model.removeObject(selectedValue, indexSelectedRow); + tableModel.removeObject(selectedValue, indexSelectedRow); //select the upper line ListSelectionModel selectionModel = table.getSelectionModel(); @@ -137,4 +140,12 @@ } } } + + public void refresh(){ + tableModel = view.getFinancialTransactionUnbalancedTableModel(); + tableModel.refresh(); + + comboBoxModel = view.getModelFiscalPeriod(); + comboBoxModel.refresh(); + } } Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/ClosureTimeSpanForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/ClosureTimeSpanForm.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/ClosureTimeSpanForm.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -1,56 +0,0 @@ -<!-- ##% Lima Swing - Copyright (C) 2008 - 2010 CodeLutin - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ##% --> - -<JDialog modal="true"> - <style source="styles.css" /> - <script> - <![CDATA[ - - ]]> - </script> - <Table> - <row> - <cell> - <JLabel text="lima.closure.period.begin"/> - </cell> - <cell> - <JPanel id="beginPeriod"/> - </cell> - </row> - <row> - <cell> - <JLabel text="lima.to"/> - </cell> - <cell> - <JPanel id="endPeriod"/> - </cell> - </row> - <row> - <cell columns="2"> - <JTextArea styleClass="warning" text='{_("lima.closure.timespan.warning")}'/> - </cell> - </row> - <row> - <cell> - <JButton id="okButton" text="lima.common.ok" /> - </cell> - <cell> - <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="dispose()"/> - </cell> - </row> - </Table> -</JDialog> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -26,11 +26,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.FiscalPeriodService; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.util.DialogHelper; /** * TODO add comment here. @@ -54,9 +52,6 @@ fiscalPeriodService = LimaServiceFactory.getInstance().getFiscalPeriodService(); } - /* - * @see javax.swing.table.TableModel#getRowCount() - */ @Override public int getRowCount() { @@ -72,9 +67,6 @@ return result; } - /* - * @see javax.swing.table.TableModel#getColumnCount() - */ @Override public int getColumnCount() { return 2; @@ -94,9 +86,6 @@ return currentRow; } - /* - * @see javax.swing.table.TableModel#getColumnName(int) - */ @Override public String getColumnName(int columnIndex) { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -26,18 +26,8 @@ ]]> </script> - <!-- - <row fill="horizontal" weightx="1" anchor="center" columns="2"> - <cell> - <JPanel border='{BorderFactory.createTitledBorder(_("lima.period.filter"))}'> - <JLabel text="lima.fiscalperiod.periodFilterLabel"/> - <JComboBox id="periodFilterComboBox" /> - </JPanel> - </cell> - </row> - --> <row> - <cell fill="both" weightx="1" weighty="1"> + <cell fill="both" weightx="1" weighty="1" rows="4"> <JScrollPane> <org.chorem.lima.ui.fiscalperiod.FiscalPeriodTable id="fiscalPeriodTable" rowHeight="24" @@ -48,26 +38,23 @@ onValueChanged="setSelectedPeriod(fiscalPeriodTable.getSelectedRow() != -1)"/> </JScrollPane> </cell> - <cell fill="horizontal" weighty="1" anchor="north"> - <Table> - <row> - <cell> - <JButton id="addButton" text="lima.fiscalperiod.addFiscalPeriod" onActionPerformed="getHandler().addFiscalPeriod()"/> - </cell> - </row> - <row> - <cell> - <JButton id="blockButton" text="lima.fiscalperiod.block" enabled="{isSelectedPeriod()}" - onActionPerformed="getHandler().blockFiscalPeriod()" /> - </cell> - </row> - <row> - <cell> - <JButton id="deleteButton" text="DEBUG delete all" - onActionPerformed="getHandler().removeAllFiscalPeriods()" /> - </cell> - </row> - </Table> - </cell> </row> + <row> + <cell fill="horizontal"> + <JButton id="addButton" text="lima.fiscalperiod.addFiscalPeriod" + onActionPerformed="getHandler().addFiscalPeriod()"/> + </cell> + </row> + <row> + <cell> + <JButton id="blockButton" text="lima.fiscalperiod.block" enabled="{isSelectedPeriod()}" + onActionPerformed="getHandler().blockFiscalPeriod()" /> + </cell> + </row> + <row> + <cell> + <JButton id="deleteButton" text="DEBUG delete all" + onActionPerformed="getHandler().removeAllFiscalPeriods()" /> + </cell> + </row> </Table> Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/styles.css =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/styles.css 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/styles.css 2010-06-07 21:27:59 UTC (rev 2933) @@ -1,8 +0,0 @@ -.warning { - foreground: red; - // JTextArea sur plusieurs lignes - lineWrap: true; - // Implique que les mots ne sont pas coupés - wrapStyleWord: true; - editable: false; -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -75,8 +75,7 @@ /** * Constructor. */ - public LedgerTableModel() { - + public LedgerTableModel() { reportService = LimaServiceFactory.getInstance().getReportService(); } @@ -86,7 +85,7 @@ int result = 0; // just prevent too much result - if (selectedBeginDate != null && selectedEndDate != null) { + if (cacheDataList != null) { result = cacheDataList.size(); } else { @@ -140,7 +139,7 @@ Object result = null; // just prevent too much result - if (selectedBeginDate != null && selectedEndDate != null) { + if (cacheDataList != null) { result = cacheDataList.get(row); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMMMM yyyy"); @@ -240,14 +239,10 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - cacheDataList = getDataList(); - fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - cacheDataList = getDataList(); - fireTableDataChanged(); } /** @@ -278,4 +273,9 @@ return results; } + public void refresh(){ + cacheDataList = getDataList(); + fireTableDataChanged(); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2010-06-07 21:27:59 UTC (rev 2933) @@ -40,25 +40,32 @@ getBeginDatePicker().setDate(beginDate); getEndDatePicker().setDate(endDate); + + void $afterCompleteSetup() { + getHandler().refresh(); + } ]]> </script> - <row fill="horizontal" weightx="1" weighty="0" anchor="center"> - <cell> + <row weightx="1" weighty="0" anchor="center"> + <cell anchor="west"> + <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/> + </cell> + <cell anchor="east"> <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" onActionPerformed="getModelTable().setBeginDate(beginDatePicker.getDate()); - getHandler().updateFooterLabel()" /> + getHandler().refresh()" /> </cell> - <cell> + <cell anchor="east"> <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> </cell> - <cell> + <cell anchor="west"> <org.jdesktop.swingx.JXDatePicker id="endDatePicker" onActionPerformed="getModelTable().setEndDate(endDatePicker.getDate()); - getHandler().updateFooterLabel()"/> + getHandler().refresh()"/> </cell> </row> <row> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2010-06-07 21:27:59 UTC (rev 2933) @@ -22,7 +22,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.beans.BalanceTrial; -import org.chorem.lima.ui.ReportsHelper; /** @@ -42,30 +41,31 @@ protected LedgerView view; - /** Helper **/ - protected ReportsHelper helper; + protected LedgerTableModel model; protected LedgerViewHandler(LedgerView view) { this.view = view; } + public void refresh(){ + model = view.getModelTable(); + model.refresh(); - /* + /** * set text and amounts of labels credit, debit, solde */ - public void updateFooterLabel(){ - LedgerTableModel tablemodel = - (LedgerTableModel) view.getTable().getModel(); - BalanceTrial cacheDataList = tablemodel.balanceTrialCache; + BalanceTrial cacheDataList = model.balanceTrialCache; if (cacheDataList != null){ // set amounts credit, debit and solde - view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit())); - view.amountDebitLabel.setText(String.valueOf(cacheDataList.getAmountDebit())); + view.amountCreditLabel.setText( + String.valueOf(cacheDataList.getAmountCredit())); + view.amountDebitLabel.setText( + String.valueOf(cacheDataList.getAmountDebit())); Double amountSolde = cacheDataList.getAmountSolde(); - view.amountSoldeLabel.setText(String.valueOf(amountSolde)); + view.amountSoldeLabel.setText( + String.valueOf(amountSolde)); - if (amountSolde == 0){ view.soldeLabel.setText(_("lima.solde")); } 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-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-07 21:27:59 UTC (rev 2933) @@ -285,6 +285,7 @@ lima.question.remove.journal=Do you want to remove this journal ? lima.question.remove.transaction=Do you want to remove this transaction ? lima.quit=Quit +lima.refresh=\u21BB lima.remove=Remove lima.remove.lettering=Remove a letter lima.remove.transaction=Remove a transaction 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-06-04 08:43:32 UTC (rev 2932) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-07 21:27:59 UTC (rev 2933) @@ -9,6 +9,7 @@ Loading\ accounting...= TODO\ begincalendarPanel= TODO\ endcalendarPanel= +\\\\u21BB= calendarPanel\ TODO= lima.about.message=\u00C0 propos de Lima lima.account=Compte @@ -269,6 +270,7 @@ lima.question.remove.entry=Voulez-vous supprimer cette ligne de transaction? lima.question.remove.journal=Voulez-vous supprimer ce journal? lima.question.remove.transaction=Voulez-vous supprimer cette transaction? +lima.refresh=\u21BB lima.remove= lima.remove.lettering=Supprimer la lettre lima.remove.transaction=Supprimer une transaction Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-06-04 08:43:32 UTC (rev 2932) +++ trunk/pom.xml 2010-06-07 21:27:59 UTC (rev 2933) @@ -238,6 +238,7 @@ <properties> <platform>chorem.org</platform> <projectId>lima</projectId> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- customized libs version --> <nuiton-utils.version>1.2.2</nuiton-utils.version>
participants (1)
-
jpepin@users.chorem.org