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
r3546 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 20 Jul '12
by mallon@users.chorem.org 20 Jul '12
20 Jul '12
Author: mallon
Date: 2012-07-20 14:24:05 +0200 (Fri, 20 Jul 2012)
New Revision: 3546
Url: http://chorem.org/repositories/revision/lima/3546
Log:
fixes #707 Suppression des anciens labels faisant office de titres, ajout de panels avec titres, et diminution de la place prise par chacune des fonctionnalit?\195?\169s.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-20 12:07:10 UTC (rev 3545)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-20 12:24:05 UTC (rev 3546)
@@ -9,21 +9,22 @@
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
+ published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
+
+ You should have received a copy of the GNU General Public
License along with this program. If not, see
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<Table>
+<Table constraints='BorderLayout.NORTH'>
+
<import>
org.chorem.lima.ui.common.AccountComboBoxModel
org.chorem.lima.ui.common.FinancialPeriodComboBoxModel
@@ -33,7 +34,7 @@
org.chorem.lima.beans.LetteringFilter
org.chorem.lima.beans.LetteringFilterImpl
</import>
-
+
<LetteringViewHandler id="handler" constructorParams="this"/>
<LetteringTableModel id="tableModel"/>
@@ -43,63 +44,57 @@
<LettringSelectionModel id='lettringSelectionModel' constructorParams=' tableModel'
onValueChanged="handler.balanceAndActions()"/>
- <script><![CDATA[
+ <script>
+ <![CDATA[
void $afterCompleteSetup() {
handler.init();
}
- ]]></script>
+ ]]>
+ </script>
<row>
- <cell anchor="center" weightx="1" columns="2">
- <JLabel text="lima.ui.lettering.account" labelFor='{panelAccountComboBox}'/>
+ <cell>
+ <JPanel layout='{new BorderLayout()}' id="panelAccountComboBox" border='{new TitledBorder(_("lima.ui.lettering.account"))}'>
+ <org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/>
+ <JComboBox id="accountComboBox" model="{accountComboBoxModel}"
+ renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
+ onActionPerformed="filterModel.setAccount((Account)accountComboBoxModel.getSelectedItem())"
+ constraints='BorderLayout.WEST'/>
+ <JButton id="backCount" text="lima.ui.account.buttonback"
+ onActionPerformed="handler.back(accountComboBox)"
+ constraints='BorderLayout.CENTER'/>
+ <JButton id="nextCount" text="lima.ui.account.buttonnext"
+ onActionPerformed="handler.next(accountComboBox)"
+ constraints='BorderLayout.EAST'/>
+ </JPanel>
</cell>
- <cell anchor="center" weightx="1">
- <JLabel text="lima.ui.lettering.period" labelFor='{panelFinancialPeriodComboBox}'/>
- </cell>
- <cell anchor="center" weightx="1">
- <JLabel text="lima.ui.lettering.entry" labelFor='{entryPanel}'/>
- </cell>
- </row>
- <row>
- <cell anchor="center" weightx="1" columns="2">
- <JPanel id="panelAccountComboBox">
- <org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/>
- <JComboBox id="accountComboBox" model="{accountComboBoxModel}"
- renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
- onActionPerformed="filterModel.setAccount((Account)accountComboBoxModel.getSelectedItem())"/>
- <JButton id="backCount" text="lima.ui.account.buttonback"
- onActionPerformed="handler.back(accountComboBox)"/>
- <JButton id="nextCount" text="lima.ui.account.buttonnext"
- onActionPerformed="handler.next(accountComboBox)"/>
- </JPanel>
- </cell>
- <cell anchor="center" weightx="1">
- <JPanel id="panelFinancialPeriodComboBox">
- <Table>
+ <cell>
+ <JPanel id="panelFinancialPeriodComboBox" layout='{new BorderLayout()}' border='{new TitledBorder(_("lima.ui.lettering.period"))}'>
+ <Table constraints='BorderLayout.NORTH'>
<row>
<cell>
- <JLabel text="lima.ui.lettering.beginFinancialPeriod"/>
- </cell>
+ <JLabel text="lima.ui.lettering.beginFinancialPeriod"/>
+ </cell>
<cell>
- <JXDatePicker id="pickerDebut"
- onActionPerformed="filterModel.setDateStart(pickerDebut.getDate())"/>
+ <JXDatePicker id="pickerDebut"
+ onActionPerformed="filterModel.setDateStart(pickerDebut.getDate())"/>
</cell>
</row>
<row>
<cell>
- <JLabel text="lima.ui.lettering.endFinancialPeriod"/>
+ <JLabel text="lima.ui.lettering.endFinancialPeriod"/>
</cell>
<cell>
- <JXDatePicker id="pickerFin"
- onActionPerformed="filterModel.setDateEnd(pickerFin.getDate())"/>
+ <JXDatePicker id="pickerFin"
+ onActionPerformed="filterModel.setDateEnd(pickerFin.getDate())"/>
</cell>
</row>
</Table>
- </JPanel>
+ </JPanel>
</cell>
<cell anchor="center" weightx="1">
- <JPanel id="entryPanel">
- <Table>
+ <JPanel id="entryPanel" layout='{new BorderLayout()}' border='{new TitledBorder(_("lima.ui.lettering.entry"))}'>
+ <Table constraints='BorderLayout.NORTH'>
<row>
<cell>
<JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup"
@@ -107,16 +102,16 @@
</cell>
<cell>
<JLabel text="lima.ui.lettering.checkLettredEntry"/>
- </cell>
+ </cell>
</row>
<row>
<cell>
<JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup"
onActionPerformed="filterModel.setDisplayUnlettred(true) ; filterModel.setDisplayLettered(false)"/>
- </cell>
+ </cell>
<cell>
<JLabel text="lima.ui.lettering.checkNoLettredEntry"/>
- </cell>
+ </cell>
</row>
<row>
<cell>
@@ -127,67 +122,62 @@
<JLabel text="lima.ui.lettering.checkAll"/>
</cell>
</row>
- </Table>
+ </Table>
</JPanel>
</cell>
</row>
- <row>
- <cell anchor="center" weightx="0.25">
- <JLabel/>
- </cell>
- <cell anchor="center" weightx="0.25">
- <JLabel text="lima.ui.lettering.selectDebit" labelFor='{debitTexttField}'/>
- </cell>
- <cell anchor="center" weightx="0.25">
- <JLabel text="lima.ui.lettering.selectCredit" labelFor='{creditTextField}'/>
- </cell>
- <cell anchor="center" weightx="0.25">
- <JLabel text="lima.ui.lettering.selectSolde" labelFor='{soldeTextField}'/>
- </cell>
- </row>
- <row>
- <cell anchor='center' weightx="0.25">
- <JLabel text="lima.ui.lettering.selectEntry"/>
- </cell>
- <cell fill="horizontal" weightx="0.25">
- <JTextField id="debitTexttField" editable="false" text="{editModel.getDebit().toString()}"
- focusable="false"/>
- </cell>
- <cell fill="horizontal" weightx="0.25">
- <JTextField id="creditTextField" editable="false" text="{editModel.getCredit().toString()}"
- focusable="false"/>
- </cell>
- <cell fill="horizontal" weightx="0.25">
- <JTextField id="soldeTextField" editable="false" text="{editModel.getSolde().toString()}"
- focusable="false"/>
- </cell>
- </row>
<row>
- <cell anchor="center" columns='4'>
- <JLabel text="lima.ui.lettering.actions" labelFor='{actionsPanel}'/>
- </cell>
+ <cell fill="horizontal" columns="4">
+ <JPanel id="selectedEntry" layout='{new BorderLayout()}' border='{new TitledBorder(_("lima.ui.lettering.selectEntry"))}'>
+ <Table constraints='BorderLayout.NORTH'>
+ <row>
+ <cell anchor="center" weightx="0.6">
+ <JLabel text="lima.ui.lettering.selectDebit" labelFor='{debitTexttField}'/>
+ </cell>
+ <cell fill="horizontal" weightx="0.6">
+ <JTextField id="debitTexttField" editable="false" text="{editModel.getDebit().toString()}"
+ focusable="false"/>
+ </cell>
+ <cell anchor="center" weightx="0.6">
+ <JLabel text="lima.ui.lettering.selectCredit" labelFor='{creditTextField}'/>
+ </cell>
+ <cell fill="horizontal" weightx="0.6">
+ <JTextField id="creditTextField" editable="false" text="{editModel.getCredit().toString()}"
+ focusable="false"/>
+ </cell>
+ <cell anchor="center" weightx="0.6">
+ <JLabel text="lima.ui.lettering.selectSolde" labelFor='{soldeTextField}'/>
+ </cell>
+ <cell fill="horizontal" weightx="0.6">
+ <JTextField id="soldeTextField" editable="false" text="{editModel.getSolde().toString()}"
+ focusable="false"/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
</row>
<row>
<cell anchor="center" columns='4'>
<JPanel id="actionsPanel">
- <JButton id="lettered" text="lima.ui.lettering.buttonLettered"
+ <JButton id="lettered" text="lima.ui.lettering.buttonLettered"
enabled="{editModel.isLettred()}"
onActionPerformed="handler.addLetter()"/>
- <JButton id="noLettered" text="lima.ui.lettering.buttonNoLettered"
+ <JButton id="noLettered" text="lima.ui.lettering.buttonNoLettered"
enabled="{editModel.isUnLettred()}"
onActionPerformed="handler.removeLetter()"/>
</JPanel>
</cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1" columns="4">
- <JScrollPane>
- <LetteringTable
- id="table" sortable="false" rowHeight="22"
- constructorParams="getTableModel()"
- selectionModel="{lettringSelectionModel}"
- />
- </JScrollPane>
- </cell>
+ <cell fill="both" weightx="1" weighty="1" columns="4">
+ <JScrollPane>
+ <LetteringTable
+ id="table" sortable="false" rowHeight="22"
+ constructorParams="getTableModel()"
+ selectionModel="{lettringSelectionModel}"
+ />
+ </JScrollPane>
+ </cell>
</row>
</Table>
\ No newline at end of file
1
0
r3545 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org 20 Jul '12
by echatellier@users.chorem.org 20 Jul '12
20 Jul '12
Author: echatellier
Date: 2012-07-20 14:07:10 +0200 (Fri, 20 Jul 2012)
New Revision: 3545
Url: http://chorem.org/repositories/revision/lima/3545
Log:
Remove tabulations
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-07-20 12:05:26 UTC (rev 3544)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2012-07-20 12:07:10 UTC (rev 3545)
@@ -47,7 +47,7 @@
// FIXME echatellier 20120413 la requete ne fonctionne pas
// et retourne vide
/*String query = "FROM " + Account.class.getName() + " a WHERE a NOT IN (" +
- "FROM " + Account.class.getName() + " b where b.accountNumber like concat(a.accountNumber,'%'))";
+ "FROM " + Account.class.getName() + " b where b.accountNumber like concat(a.accountNumber,'%'))";
List<Account> accounts = context.find(query);*/
// code temporaire non performant en attandant:
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-20 12:05:26 UTC (rev 3544)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-20 12:07:10 UTC (rev 3545)
@@ -125,7 +125,7 @@
public String findLetters() throws TopiaException{
String result = "";
String query = "Select E.lettering FROM " + Entry.class.getName() + " E" +
- " order by E.lettering desc";
+ " order by E.lettering desc";
List<String> letters = context.findAll(query);
if (!letters.isEmpty()) {
1
0
r3544 - trunk/lima-swing/src/main/java/org/chorem/lima/ui
by echatellier@users.chorem.org 20 Jul '12
by echatellier@users.chorem.org 20 Jul '12
20 Jul '12
Author: echatellier
Date: 2012-07-20 14:05:26 +0200 (Fri, 20 Jul 2012)
New Revision: 3544
Url: http://chorem.org/repositories/revision/lima/3544
Log:
Remove tabulations
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2012-07-20 12:04:34 UTC (rev 3543)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2012-07-20 12:05:26 UTC (rev 3544)
@@ -45,17 +45,17 @@
SwingUtil.getLayer(mainPanel).setUI(betaLayer);
}
- public LimaConfig getConfig() {
- return LimaContext.CONFIG_DEF.getContextValue(getDelegateContext());
- }
+ public LimaConfig getConfig() {
+ return LimaContext.CONFIG_DEF.getContextValue(getDelegateContext());
+ }
- public MainViewHandler getHandler() {
- return getContextValue(MainViewHandler.class);
- }
+ public MainViewHandler getHandler() {
+ return getContextValue(MainViewHandler.class);
+ }
- public boolean acceptLocale(Locale l, String expected) {
- return l != null && l.toString().equals(expected);
- }
+ public boolean acceptLocale(Locale l, String expected) {
+ return l != null && l.toString().equals(expected);
+ }
]]>
</script>
1
0
r3543 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod lima-swing/src/main/java/org/chorem/lima/ui/lettering
by echatellier@users.chorem.org 20 Jul '12
by echatellier@users.chorem.org 20 Jul '12
20 Jul '12
Author: echatellier
Date: 2012-07-20 14:04:34 +0200 (Fri, 20 Jul 2012)
New Revision: 3543
Url: http://chorem.org/repositories/revision/lima/3543
Log:
Remove tabulations
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-07-20 12:04:34 UTC (rev 3543)
@@ -109,7 +109,6 @@
return null;
}
-
/** Rules to check before block fiscals periods */
@Override
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod) throws LimaException {
@@ -118,10 +117,10 @@
/** Rules to check before delete fiscals periods */
@Override
- public void deleteFiscalPeriodRules(FiscalPeriod fiscalPeriod)
- throws LimaException {
- }
-
+ public void deleteFiscalPeriodRules(FiscalPeriod fiscalPeriod)
+ throws LimaException {
+ }
+
/**
* Rules to check if an account and all his subaccount is not used
* Recursive function
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-07-20 12:04:34 UTC (rev 3543)
@@ -202,20 +202,20 @@
*/
@Override
public void deleteFiscalPeriodRules(FiscalPeriod fiscalPeriod) throws LimaBusinessException {
-
- try {
-
- FinancialTransactionDAO financialTransactionDAO = getDaoHelper().getFinancialTransactionDAO();
-
- //Check if the fiscal period to delete is empty
- if (financialTransactionDAO.findAllByDates(fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate()).size() != 0) {
+
+ try {
+
+ FinancialTransactionDAO financialTransactionDAO = getDaoHelper().getFinancialTransactionDAO();
+
+ //Check if the fiscal period to delete is empty
+ if (financialTransactionDAO.findAllByDates(fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate()).size() != 0) {
throw new LimaBusinessException(_("lima-business.franceaccountingrules.fiscalperiodnotempty"));
- }
+ }
} catch (TopiaException ex) {
throw new LimaException("Can't check rule", ex);
}
}
-
+
/**
* Check if old financialperiod for a an entrybook are closed before bock the asked closedperiodicentrybook
* <p/>
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-20 12:04:34 UTC (rev 3543)
@@ -447,23 +447,23 @@
}
}
- @Override
- /**
+ /**
* to delete a fiscal period
* <p/>
* check localized rules before delete it
*/
- public void deleteFiscalPeriod(FiscalPeriod fiscalPeriod)
- throws LimaException {
+ @Override
+ public void deleteFiscalPeriod(FiscalPeriod fiscalPeriod)
+ throws LimaException {
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
try {
try {
- //get entities with DAO
- FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
+ //get entities with DAO
+ FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
- // re-attach entities to current session
+ // re-attach entities to current session
FiscalPeriod localFiscalPeriod = fiscalPeriodDAO.findByTopiaId(fiscalPeriod.getTopiaId());
//check rules
@@ -475,9 +475,9 @@
//delete closedPeriodicEntryBook before fiscal period
for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBookDAOList) {
- // fix : ObjectDeletedException: deleted object would be re-saved by cascade (Need to delete association between entryBook and financial period via closedPeriodEntityBook)
+ // fix : ObjectDeletedException: deleted object would be re-saved by cascade (Need to delete association between entryBook and financial period via closedPeriodEntityBook)
closedPeriodicEntryBook.getEntryBook().removeFinancialPeriodClosedPeriodicEntryBook(closedPeriodicEntryBook);
- closedPeriodicEntryBookDAO.delete(closedPeriodicEntryBook);
+ closedPeriodicEntryBookDAO.delete(closedPeriodicEntryBook);
}
fiscalPeriodDAO.delete(localFiscalPeriod);
@@ -490,6 +490,6 @@
throw new LimaException("Can't delete period", ex);
}
- }
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2012-07-20 12:04:34 UTC (rev 3543)
@@ -67,7 +67,7 @@
<JComboBox id="periodComboBox"
javaBean="new JComboBox(ComboBoxPeriodEnum.descriptions())"
onActionPerformed="periodSearchPanel.refresh(ComboBoxPeriodEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/>
+ validate(); repaint()"/>
</cell>
<cell>
<FinancialTransactionPeriodSearchPanel
@@ -122,7 +122,7 @@
<JComboBox id="accountComboBox"
javaBean="new JComboBox(ComboBoxAccountsEnum.descriptions())"
onActionPerformed="accountSearchPanel.refresh(ComboBoxAccountsEnum.valueOfDescription((String) accountComboBox.getSelectedItem()));
- validate(); repaint()"/>
+ validate(); repaint()"/>
</cell>
<cell>
<AccountSearchPanel javaBean="accountSearchPanel"/>
@@ -151,13 +151,13 @@
<JComboBox id="amountComboBox"
javaBean="new JComboBox(FinancialStatementWayEnum.descriptions())"
onActionPerformed="handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription((String)amountComboBox.getSelectedItem()));
- handler.refresh()"/>
+ handler.refresh()"/>
</cell>
<cell>
<JComboBox id="operatorComboBox"
javaBean="new JComboBox(ComboBoxOperatorsEnum.descriptions())"
onActionPerformed="amountSearchPanel.refresh(ComboBoxOperatorsEnum.valueOfDescription((String) operatorComboBox.getSelectedItem()));
- validate(); repaint()"/>
+ validate(); repaint()"/>
</cell>
<cell>
<AmountSearchPanel javaBean="amountSearchPanel"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2012-07-20 12:04:34 UTC (rev 3543)
@@ -50,7 +50,6 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
-import org.chorem.lima.ui.home.FinancialTransactionsPane;
import org.jdesktop.swingx.JXTable;
import org.nuiton.util.DateUtil;
@@ -123,17 +122,17 @@
FiscalPeriod fiscalPeriod = addPeriodDialog.getPeriod();
if (fiscalPeriod != null) {
- //check if fiscalperiod have 12 months, ask a confirmation
- int nbMonth = DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
- fiscalPeriod.getEndDate());
- int response = JOptionPane.YES_OPTION;
- if (nbMonth != 12) {
- response = JOptionPane.showConfirmDialog(view,
+ //check if fiscalperiod have 12 months, ask a confirmation
+ int nbMonth = DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate(),
+ fiscalPeriod.getEndDate());
+ int response = JOptionPane.YES_OPTION;
+ if (nbMonth != 12) {
+ response = JOptionPane.showConfirmDialog(view,
_("lima.ui.fiscalperiod.addfiscalperiod.morethan12"),
_("lima.ui.fiscalperiod.addfiscalperiodtitle"),
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
- }
-
+ }
+
if (response == JOptionPane.YES_OPTION) {
fiscalPeriod = fiscalPeriodService.createFiscalPeriod(fiscalPeriod);
model.addFiscalPeriod(fiscalPeriod);
@@ -145,26 +144,26 @@
* Undisplay period and perform delete.
*/
public void deleteFiscalPeriod() {
-
- JXTable fiscalPeriodeTable = view.getFiscalPeriodTable();
- FiscalPeriodTableModel model = (FiscalPeriodTableModel) view.getFiscalPeriodTable().getModel();
-
+
+ JXTable fiscalPeriodeTable = view.getFiscalPeriodTable();
+ FiscalPeriodTableModel model = (FiscalPeriodTableModel) view.getFiscalPeriodTable().getModel();
+
//check if the user want to delete the fiscal year
int response = JOptionPane.showConfirmDialog(view,
_("lima.ui.fiscalperiod.delete.confirmation"),
_("lima.ui.fiscalperiod.delete.title"), JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
-
+
int selectedRow = fiscalPeriodeTable.getSelectedRow();
FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow);
-
+
if (response == JOptionPane.YES_OPTION) {
- fiscalPeriodService.deleteFiscalPeriod(selectedFiscalPeriod);
-
- model.deleteFiscalPeriod(selectedFiscalPeriod);
+ fiscalPeriodService.deleteFiscalPeriod(selectedFiscalPeriod);
+
+ model.deleteFiscalPeriod(selectedFiscalPeriod);
}
}
-
+
/**
* Init add period view.
*
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-20 11:49:46 UTC (rev 3542)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-20 12:04:34 UTC (rev 3543)
@@ -22,7 +22,6 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
<Table>
<import>
@@ -44,13 +43,11 @@
<LettringSelectionModel id='lettringSelectionModel' constructorParams=' tableModel'
onValueChanged="handler.balanceAndActions()"/>
- <script>
- <![CDATA[
+ <script><![CDATA[
void $afterCompleteSetup() {
handler.init();
}
- ]]>
- </script>
+ ]]></script>
<row>
<cell anchor="center" weightx="1" columns="2">
@@ -67,13 +64,13 @@
<cell anchor="center" weightx="1" columns="2">
<JPanel id="panelAccountComboBox">
<org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/>
- <JComboBox id="accountComboBox" model="{accountComboBoxModel}"
- renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
- onActionPerformed="filterModel.setAccount((Account)accountComboBoxModel.getSelectedItem())"/>
- <JButton id="backCount" text="lima.ui.account.buttonback"
- onActionPerformed="handler.back(accountComboBox)"/>
- <JButton id="nextCount" text="lima.ui.account.buttonnext"
- onActionPerformed="handler.next(accountComboBox)"/>
+ <JComboBox id="accountComboBox" model="{accountComboBoxModel}"
+ renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
+ onActionPerformed="filterModel.setAccount((Account)accountComboBoxModel.getSelectedItem())"/>
+ <JButton id="backCount" text="lima.ui.account.buttonback"
+ onActionPerformed="handler.back(accountComboBox)"/>
+ <JButton id="nextCount" text="lima.ui.account.buttonnext"
+ onActionPerformed="handler.next(accountComboBox)"/>
</JPanel>
</cell>
<cell anchor="center" weightx="1">
@@ -97,7 +94,7 @@
onActionPerformed="filterModel.setDateEnd(pickerFin.getDate())"/>
</cell>
</row>
- </Table>
+ </Table>
</JPanel>
</cell>
<cell anchor="center" weightx="1">
@@ -183,14 +180,14 @@
</cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1" columns="4">
- <JScrollPane>
- <LetteringTable
- id="table" sortable="false" rowHeight="22"
- constructorParams="getTableModel()"
- selectionModel="{lettringSelectionModel}"
- />
- </JScrollPane>
- </cell>
+ <cell fill="both" weightx="1" weighty="1" columns="4">
+ <JScrollPane>
+ <LetteringTable
+ id="table" sortable="false" rowHeight="22"
+ constructorParams="getTableModel()"
+ selectionModel="{lettringSelectionModel}"
+ />
+ </JScrollPane>
+ </cell>
</row>
</Table>
\ No newline at end of file
1
0
r3542 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by echatellier@users.chorem.org 20 Jul '12
by echatellier@users.chorem.org 20 Jul '12
20 Jul '12
Author: echatellier
Date: 2012-07-20 13:49:46 +0200 (Fri, 20 Jul 2012)
New Revision: 3542
Url: http://chorem.org/repositories/revision/lima/3542
Log:
Fix javaBean
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.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-20 09:01:02 UTC (rev 3541)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-20 11:49:46 UTC (rev 3542)
@@ -1,4 +1,3 @@
-package org.chorem.lima.ui.lettering;
/*
* #%L
* Lima :: Swing
@@ -22,15 +21,17 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+package org.chorem.lima.ui.lettering;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author sletellier <letellier(a)codelutin.com>
*/
-public class LetteringEditModel {
+public class LetteringEditModel implements Serializable {
public static final String DEBIT_PROPERTY = "debit";
1
0
r3541 - in trunk: lima-callao/src/main/java/org/chorem/lima/entity lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 20 Jul '12
by mallon@users.chorem.org 20 Jul '12
20 Jul '12
Author: mallon
Date: 2012-07-20 11:01:02 +0200 (Fri, 20 Jul 2012)
New Revision: 3541
Url: http://chorem.org/repositories/revision/lima/3541
Log:
Correction du lien entre 'DateFilter' et 'LetteringFilter' : d?\195?\169sormais, 'LetteringFilter' h?\195?\169rite de 'DateFilter', permettant ainsi d'?\195?\169viter d'avoir ?\195?\160 poser un second 'propertyChange' sur l'objet 'DateFilter' ?\195?\160 l'origine dans 'LetteringFilter' (Composition).
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-19 16:07:36 UTC (rev 3540)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-20 09:01:02 UTC (rev 3541)
@@ -204,7 +204,7 @@
query += " and E.financialTransaction.transactionDate between :beginDate and :endDate " +
" order by F.transactionDate, F." + FinancialTransaction.TOPIA_CREATE_DATE;
- entries = context.findAll(query, "account", filter.getAccount().getAccountNumber() + "%", "beginDate", filter.getFiscalDateFilter().getDateStart(), "endDate", filter.getFiscalDateFilter().getDateEnd());
+ entries = context.findAll(query, "account", filter.getAccount().getAccountNumber() + "%", "beginDate", filter.getDateStart(), "endDate", filter.getDateEnd());
return entries;
}
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-19 16:07:36 UTC (rev 3540)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-20 09:01:02 UTC (rev 3541)
@@ -85,7 +85,7 @@
</cell>
<cell>
<JXDatePicker id="pickerDebut"
- onActionPerformed="filterModel.getFiscalDateFilter().setDateStart(pickerDebut.getDate())"/>
+ onActionPerformed="filterModel.setDateStart(pickerDebut.getDate())"/>
</cell>
</row>
<row>
@@ -94,7 +94,7 @@
</cell>
<cell>
<JXDatePicker id="pickerFin"
- onActionPerformed="filterModel.getFiscalDateFilter().setDateEnd(pickerFin.getDate())"/>
+ onActionPerformed="filterModel.setDateEnd(pickerFin.getDate())"/>
</cell>
</row>
</Table>
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-19 16:07:36 UTC (rev 3540)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-20 09:01:02 UTC (rev 3541)
@@ -109,19 +109,6 @@
}
});
- //FIXME Allon-11/07/2012 : mettre simplement deux dates au niveau de 'LetteringFilter'
- //pour eviter d'avoir a poser un propertyChange supplementaire sur le 'DateFilter'
- filter.getFiscalDateFilter().addPropertyChangeListener(new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- onBalanceChanged(null);
- view.getLettringSelectionModel().clearSelection();
- updateAllEntries();
- onButtonModeChanged("all");
- }
- });
-
editModel.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -261,8 +248,8 @@
view.getPickerDebut().setDate(defaultDateBegFiscalPeriod);
view.getPickerFin().setDate(defaultDateEndCurrent);
- filter.getFiscalDateFilter().setDateStart(defaultDateBegFiscalPeriod);
- filter.getFiscalDateFilter().setDateEnd(defaultDateEndCurrent);
+ filter.setDateStart(defaultDateBegFiscalPeriod);
+ filter.setDateEnd(defaultDateEndCurrent);
filter.setDisplayUnlettred(true);
updateAllEntries();
1
0
r3540 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/celleditor java/org/chorem/lima/ui/lettering resources resources/i18n
by mallon@users.chorem.org 19 Jul '12
by mallon@users.chorem.org 19 Jul '12
19 Jul '12
Author: mallon
Date: 2012-07-19 18:07:36 +0200 (Thu, 19 Jul 2012)
New Revision: 3540
Url: http://chorem.org/repositories/revision/lima/3540
Log:
fixes #706 Simplification de l'utilisation des mod?\195?\168les pour le panneau de lettrage (Suppression des mod?\195?\168les d?\195?\169l?\195?\169gu?\195?\169s, pose d'un listener sur le mod?\195?\168le de s?\195?\169lection.).
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.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/celleditor/BigDecimalTableCellEditor.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/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.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/lima-swing/src/main/resources/log4j.properties
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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -25,17 +25,20 @@
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import java.awt.Component;
import java.awt.event.FocusEvent;
import java.math.BigDecimal;
/**
* @author sletellier <letellier(a)codelutin.com>
*/
-public class BigDecimalTableCellEditor extends NumberCellEditor<BigDecimal> {
+public class BigDecimalTableCellEditor extends NumberCellEditor<BigDecimal>{
protected int row;
+ protected JTextField textFieldNumberValue;
/**
* constructor
@@ -59,10 +62,27 @@
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);
+ textFieldNumberValue = numberEditor.getTextField();
+ textFieldNumberValue.requestFocus();
+ int length = textFieldNumberValue.getText().length();
+ textFieldNumberValue.select(length, length);
}
});
}
+
+ /**To limit number of decimals at two, and rounded up it
+ * */
+ /*@Override
+ public void focusLost(FocusEvent e) {*/
+ //getCellEditorValue().setScale(2, RoundingMode.HALF_UP);
+ /*SwingUtilities.invokeLater(new Runnable() {
+ public void run() {*/
+ /* BigDecimal cellEditorValue = getCellEditorValue();
+ cellEditorValue.setScale(2, RoundingMode.HALF_UP);
+ System.out.println("cellEditorValue : " + cellEditorValue);
+ numberEditor.getTextField().setText(cellEditorValue.toString());
+ System.out.println("numberEditor.getTextField().getText() : " + numberEditor.getTextField().getText());*/
+ /* }
+ });*/
+ //}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -127,29 +127,6 @@
firePropertyChange(SOLDE_PROPERTY, oldSolde, this.solde);
}
- /**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;
- BigDecimal creditVal = debit ? BigDecimal.ZERO : amount;
-
- if (debitVal == BigDecimal.ZERO){
-
- if (creditVal != BigDecimal.ZERO){
- setCredit(creditVal);
- setSolde(creditVal, true);
- }
- }else if (creditVal == BigDecimal.ZERO){
- setDebit(debitVal);
- setSolde(debitVal, false);
- }else{
- resetDebitCreditBalance();
- }
- }
-
public void resetDebitCreditBalance(){
setDebit(BigDecimal.ZERO);
setCredit(BigDecimal.ZERO);
Deleted: 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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -1,128 +0,0 @@
-package org.chorem.lima.ui.lettering;
-/*
- * #%L
- * Lima :: Swing
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2012 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 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.apache.commons.lang3.StringUtils;
-import org.chorem.lima.entity.Entry;
-
-import javax.swing.DefaultListSelectionModel;
-import java.util.List;
-
-/**
- * @author sletellier <letellier(a)codelutin.com>
- */
-public class LetteringSelectionModel extends DefaultListSelectionModel {
-
- protected LetteringTableModel letteringTableModel;
- protected LetteringEditModel editModel;
- protected int lineSelected;
-
- //protected List<Entry> selectedRows = new ArrayList<Entry>();
-
- /**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;
- }
-
- //@Override
- public void addSelectionInterval(int row, int column){
- setSelectionInterval(row, column);
- }
-
- //@Override
- public void removeSelectionInterval(int row, int column){
- }
-
- @Override
- public void setSelectionInterval(int row, int column){
-
- if ( isSelectionEmpty() || !isSelectedIndex(row)){
- super.clearSelection();
- lineSelected = row;
- String currentLettring = getCurrentLettring();
- setValueIsAdjusting(true);
- try {
- //select entries with the same letter of the selected entry
- for(Entry entry : getEntries()){
- if (StringUtils.isNotBlank(entry.getLettering())){
- if (entry.getLettering().equals(currentLettring)){
- int entryToSelect = letteringTableModel.getIndexOfEntry(entry);
- super.addSelectionInterval(entryToSelect, entryToSelect);
- }
- }
- }
- } finally {
- setValueIsAdjusting(false);
- }
- updateBalanceAndLetteringButton(false);
- }
- }
-
- /**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();
-
- Entry selectedEntry;
- for (int i = 0; i < letteringTableModel.getRowCount(); i ++){
- if (isSelectedIndex(i)){
- selectedEntry = letteringTableModel.getEntryAt(i);
- //Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(selectedEntry.getAmount(), selectedEntry.getDebit());
- }
- }
-
- //For U.I. buttons (Lettering and unlettering)
- editModel.setUnLettred(!lettering);
- editModel.setLettred(lettering);
- }
-
- //to reinitialize model attribute
- /*public void resetAttribute(){
- clearSelection();
- }*/
-
- public List<Entry> getEntries(){
- return letteringTableModel.getEntries();
- }
-
- public String getCurrentLettring(){
- return getCurrentEntrySelected().getLettering();
- }
-
- public Entry getCurrentEntrySelected(){
- return letteringTableModel.getEntryAt(lineSelected);
- }
-
- @Override
- public int getSelectionMode() {
- return MULTIPLE_INTERVAL_SELECTION;
- }
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-19 16:07:36 UTC (rev 3540)
@@ -38,13 +38,11 @@
<LetteringViewHandler id="handler" constructorParams="this"/>
<LetteringTableModel id="tableModel"/>
- <LetteringEditModel id='editModel'/>
<LetteringFilter id='filterModel' initializer='new LetteringFilterImpl()'/>
+ <LetteringEditModel id='editModel'/>
- <LetteringSelectionModel id='letteringSelectionModel' constructorParams='tableModel, editModel'/>
- <UnlettringSelectionModel id='unletteringSelectionModel' constructorParams='tableModel, editModel'/>
- <LettringAndUnlettringSelectionModel id='lettringAndUnlettringSelectionModel'
- constructorParams='letteringSelectionModel, unletteringSelectionModel, tableModel, editModel'/>
+ <LettringSelectionModel id='lettringSelectionModel' constructorParams=' tableModel'
+ onValueChanged="handler.balanceAndActions()"/>
<script>
<![CDATA[
@@ -190,7 +188,7 @@
<LetteringTable
id="table" sortable="false" rowHeight="22"
constructorParams="getTableModel()"
- selectionModel="{lettringAndUnlettringSelectionModel}"
+ selectionModel="{lettringSelectionModel}"
/>
</JScrollPane>
</cell>
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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -26,6 +26,8 @@
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;
@@ -41,6 +43,7 @@
import javax.swing.JComboBox;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -68,11 +71,16 @@
protected EntryBookService entryBookService;
protected LetteringFilter filter;
+
+ protected BigDecimal debit = BigDecimal.ZERO;
+ protected BigDecimal credit = BigDecimal.ZERO;
+ protected BigDecimal solde = BigDecimal.ZERO;
+ protected LettringSelectionModel lettringSelectionModel;
protected LetteringEditModel editModel;
+ private static final Log log = LogFactory.getLog(LetteringViewHandler.class);
public LetteringViewHandler(LetteringView view) {
this.view = view;
-
financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
accountService = LimaServiceFactory.getService(AccountService.class);
@@ -85,17 +93,19 @@
*/
public void init() {
filter = view.getFilterModel();
+ editModel = view.getEditModel();
+ lettringSelectionModel = view.getLettringSelectionModel();
filter.setFiscalDateFilter(new DateFilterImpl());
- editModel=view.getEditModel();
loadComboAndRows();
filter.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- editModel.resetDebitCreditBalance();
- view.getLettringAndUnlettringSelectionModel().clearSelection();
+ onBalanceChanged(null);
+ view.getLettringSelectionModel().clearSelection();
updateAllEntries();
+ onButtonModeChanged("all");
}
});
@@ -105,21 +115,122 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
- editModel.resetDebitCreditBalance();
- view.getLettringAndUnlettringSelectionModel().clearSelection();
+ onBalanceChanged(null);
+ view.getLettringSelectionModel().clearSelection();
updateAllEntries();
+ onButtonModeChanged("all");
}
});
editModel.addPropertyChangeListener(new PropertyChangeListener() {
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
- updateBalanceAndLetteringButton();
+ view.getCreditTextField().setText(editModel.getCredit().toString());
+ view.getDebitTexttField().setText(editModel.getDebit().toString());
+ view.getSoldeTextField().setText(editModel.getSolde().toString());
+ view.getNoLettered().setEnabled(editModel.isUnLettred());
+ view.getLettered().setEnabled(editModel.isLettred());
}
});
}
+ public void balanceAndActions() {
+ if (!letteringNotExist(view.getTable().getSelectedRow())) {
+ //unlettred entries
+ onBalanceChanged(null);
+ setValuesForSelectedEntries();
+
+ //For U.I. buttons (Lettering and unlettering)
+ onButtonModeChanged("delettrer");
+ } else {
+ //lettred entries
+ onBalanceChanged(null);
+ //treatment unuseful if no rows are selected
+ if (!view.getLettringSelectionModel().isSelectionEmpty()) {
+ setValuesForSelectedEntries();
+ onButtonModeChanged("lettrer");
+ } else {
+ onButtonModeChanged("all");
+ }
+ }
+ }
+
+ /**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 = false;
+ if (row != -1) {
+ Entry entry = view.getTableModel().getEntryAt(row);
+ String lettering = entry.getLettering();
+ emptyOrNull = (lettering==null||lettering.isEmpty());
+ }
+ return emptyOrNull;
+ }
+
+ public void onButtonModeChanged(String mode) {
+ if (mode.equals("delettrer")) {
+ editModel.setLettred(false);
+ editModel.setUnLettred(true);
+ } else if (mode.equals("lettrer")) {
+ if (log.isDebugEnabled()) {
+ log.debug("Lettred entry");
+ }
+ editModel.setUnLettred(false);
+ editModel.setLettred(true);
+ }else {
+ editModel.setLettred(false);
+ editModel.setUnLettred(false);
+ }
+ }
+
+ public void setValuesForSelectedEntries() {
+ Entry selectedEntry;
+ LetteringTableModel tableModel = view.getTableModel();
+ for (int i = 0; i < tableModel.getRowCount(); i ++){
+ if (view.getLettringSelectionModel().isSelectedIndex(i)){
+ selectedEntry = tableModel.getEntryAt(i);
+ //Set values for calculation (By LetteringEditModel) of balance
+ onBalanceChanged(selectedEntry);
+ }
+ }
+ }
+
+ public void onBalanceChanged(Entry balance) {
+ if (balance == null) {
+ editModel.setCredit(BigDecimal.ZERO);
+ editModel.setDebit(BigDecimal.ZERO);
+ editModel.setSolde(BigDecimal.ZERO, false);
+ } else {
+ balanceCalculation(balance.getAmount(), balance.getDebit());
+ }
+ }
+
+ /**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;
+ BigDecimal creditVal = debit ? BigDecimal.ZERO : amount;
+
+ if (debitVal == BigDecimal.ZERO){
+
+ if (creditVal != BigDecimal.ZERO){
+
+ editModel.setCredit(creditVal);
+ editModel.setSolde(creditVal, true);
+ }
+ }else if (creditVal == BigDecimal.ZERO){
+ editModel.setDebit(debitVal);
+ editModel.setSolde(debitVal, false);
+ }else{
+ onBalanceChanged(null);
+ }
+ }
+
public void loadComboAndRows(){
List<Account> allAccounts = accountService.getAllAccounts();
@@ -181,24 +292,10 @@
view.getTableModel().updateEntries(entries, datesEntree, journalEntrees);
}
- editModel.resetDebitCreditBalance();
- view.getLettringAndUnlettringSelectionModel().clearSelection();
+ onBalanceChanged(null);
+ view.getLettringSelectionModel().clearSelection();
}
- public void updateBalanceAndLetteringButton(){
-
- view.creditTextField.setText(editModel.getCredit().toString());
- view.debitTexttField.setText(editModel.getDebit().toString());
- view.soldeTextField.setText(editModel.getSolde().toString());
-
- view.lettered.setEnabled(editModel.isLettred());
- view.noLettered.setEnabled(editModel.isUnLettred());
-
- //FIXME Allon-11/07/2012 : probleme de rafraichissement de la table, lors
- //de la delegation de modele ('LetteringSelectionModele')
- view.getTable().repaint();
- }
-
/**
* Select previous value in combo box.
*
@@ -210,7 +307,7 @@
if (row > 0) {
comboBox.setSelectedIndex(row - 1);
}
- view.getLettringAndUnlettringSelectionModel().clearSelection();
+ view.getLettringSelectionModel().clearSelection();
}
/**
@@ -225,22 +322,25 @@
if (row < size - 1) {
comboBox.setSelectedIndex(row + 1);
}
- view.getLettringAndUnlettringSelectionModel().clearSelection();
+ view.getLettringSelectionModel().clearSelection();
}
/**Add a group of three letters to n entries*/
public void addLetter() {
String newLetters = financialTransactionService.getNextLetters();
+
changeLetter(newLetters);
editModel.setLettred(false);
- editModel.resetDebitCreditBalance();
+ editModel.setUnLettred(false);
+ onBalanceChanged(null);
}
/**Remove a group of three letters to n entries*/
public void removeLetter() {
changeLetter(null);
+ editModel.setLettred(false);
editModel.setUnLettred(false);
- editModel.resetDebitCreditBalance();
+ onBalanceChanged(null);
}
/**Add or remove a group of three letters to n entries*/
Deleted: 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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -1,176 +0,0 @@
-package org.chorem.lima.ui.lettering;
-/*
- * #%L
- * Lima :: Swing
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2012 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 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.chorem.lima.entity.Entry;
-
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionListener;
-
-/**
- * @author sletellier <letellier(a)codelutin.com>
- */
-public class LettringAndUnlettringSelectionModel implements ListSelectionModel {
-
- protected LetteringSelectionModel letteringSelectionModel;
- protected UnlettringSelectionModel unlettringSelectionModel;
- protected LetteringTableModel letteringTableModel;
- protected LetteringEditModel editModel;
- protected ListSelectionModel delegate;
- protected Entry entry;
-
- public LettringAndUnlettringSelectionModel(LetteringSelectionModel letteringSelectionModel,
- UnlettringSelectionModel unlettringSelectionModel,
- LetteringTableModel letteringTableModel, LetteringEditModel letteringEditModel){
- this.letteringSelectionModel = letteringSelectionModel;
- this.unlettringSelectionModel = unlettringSelectionModel;
- this.letteringTableModel = letteringTableModel;
- this.editModel = letteringEditModel;
- delegate = unlettringSelectionModel;
- }
-
- /**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) {
- if (!letteringNotExist(row)) {
- delegate = letteringSelectionModel;
- clearSelection();
- }
- else {
- delegate = unlettringSelectionModel;
- }
- delegate.setSelectionInterval(row, column);
- }
-
- /**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);
- String lettering = entry.getLettering();
- emptyOrNull = (lettering==null||lettering.isEmpty());
- return emptyOrNull;
- }
-
- @Override
- public void addSelectionInterval(int index0, int index1) {
- delegate.addSelectionInterval(index0, index1);
- }
-
- @Override
- public void removeSelectionInterval(int index0, int index1) {
- delegate.removeSelectionInterval(index0, index1);
- }
-
- @Override
- public int getMinSelectionIndex() {
- return delegate.getMinSelectionIndex();
- }
-
- @Override
- public int getMaxSelectionIndex() {
- return delegate.getMaxSelectionIndex();
- }
-
- @Override
- public boolean isSelectedIndex(int index) {
- return delegate.isSelectedIndex(index);
- }
-
- @Override
- public int getAnchorSelectionIndex() {
- return delegate.getAnchorSelectionIndex();
- }
-
- @Override
- public void setAnchorSelectionIndex(int index) {
- delegate.setAnchorSelectionIndex(index);
- }
-
- @Override
- public int getLeadSelectionIndex() {
- return delegate.getLeadSelectionIndex();
- }
-
- @Override
- public void setLeadSelectionIndex(int index) {
- delegate.setLeadSelectionIndex(index);
- }
-
- @Override
- public void clearSelection() {
- delegate.clearSelection();
- }
-
- @Override
- public boolean isSelectionEmpty() {
- return delegate.isSelectionEmpty();
- }
-
- @Override
- public void insertIndexInterval(int index, int length, boolean before) {
- delegate.insertIndexInterval(index, length, before);
- }
-
- @Override
- public void removeIndexInterval(int index0, int index1) {
- delegate.removeIndexInterval(index0, index1);
- }
-
- @Override
- public void setValueIsAdjusting(boolean valueIsAdjusting) {
- delegate.setValueIsAdjusting(valueIsAdjusting);
- }
-
- @Override
- public boolean getValueIsAdjusting() {
- return delegate.getValueIsAdjusting();
- }
-
- @Override
- public void setSelectionMode(int selectionMode) {
- delegate.setSelectionMode(selectionMode);
- }
-
- @Override
- public int getSelectionMode() {
- return delegate.getSelectionMode();
- }
-
- @Override
- public void addListSelectionListener(ListSelectionListener x) {
- delegate.addListSelectionListener(x);
- }
-
- @Override
- public void removeListSelectionListener(ListSelectionListener x) {
- delegate.removeListSelectionListener(x);
- }
-
-}
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java (from rev 3538, trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -0,0 +1,146 @@
+package org.chorem.lima.ui.lettering;
+/*
+ * #%L
+ * Lima :: Swing
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2012 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 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.lang3.StringUtils;
+import org.chorem.lima.entity.Entry;
+
+import javax.swing.DefaultListSelectionModel;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.List;
+
+/**
+ * @author sletellier <letellier(a)codelutin.com>
+ */
+public class LettringSelectionModel extends DefaultListSelectionModel{
+
+ protected LetteringTableModel letteringTableModel;
+ protected Entry entry;
+ protected int lineSelected;
+ protected boolean letteringEntrySelected;
+ protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public LettringSelectionModel(LetteringTableModel letteringTableModel){
+ this.letteringTableModel = letteringTableModel;
+ }
+
+ @Override
+ public void addSelectionInterval(int row, int column) {
+ setSelectionInterval(row, column);
+ }
+
+ @Override
+ public void setSelectionInterval(int row, int column) {
+ if (!letteringNotExist(row)) {
+
+ //lettred entries
+ if ( isSelectionEmpty() || !isSelectedIndex(row)){
+ clearSelection();
+ lineSelected = row;
+ String currentLettring = getCurrentLettring();
+
+ //select entries with the same letter of the selected entry
+ for(Entry entry : getEntries()){
+ if (StringUtils.isNotBlank(entry.getLettering())){
+ if (entry.getLettering().equals(currentLettring)){
+ int entryToSelect = letteringTableModel.getIndexOfEntry(entry);
+ super.addSelectionInterval(entryToSelect, entryToSelect);
+ }
+ }
+ }
+ }
+ letteringEntrySelected = true;
+ }
+ else {
+
+ //unlettred entries
+ //To clear the selection when it changes from lettered entry to unlettered
+ if (letteringEntrySelected) {
+ clearSelection();
+ }
+
+ if (isSelectionEmpty() || !isSelectedIndex(row)){
+ super.addSelectionInterval(row, column);
+ }else {
+ super.removeSelectionInterval(row, column);
+ }
+
+ letteringEntrySelected = false;
+ }
+ }
+
+ /**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);
+ String lettering = entry.getLettering();
+ emptyOrNull = (lettering==null||lettering.isEmpty());
+ return emptyOrNull;
+ }
+
+ public List<Entry> getEntries(){
+ return letteringTableModel.getEntries();
+ }
+
+ public String getCurrentLettring(){
+ return getCurrentEntrySelected().getLettering();
+ }
+
+ public Entry getCurrentEntrySelected(){
+ return letteringTableModel.getEntryAt(lineSelected);
+ }
+
+ @Override
+ public int getSelectionMode() {
+ return MULTIPLE_INTERVAL_SELECTION;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(propertyName, listener);
+ }
+
+ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ pcs.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ protected void firePropertyChange(String propertyName, Object newValue) {
+ firePropertyChange(propertyName, null, newValue);
+ }
+}
Deleted: 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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-19 16:07:36 UTC (rev 3540)
@@ -1,103 +0,0 @@
-package org.chorem.lima.ui.lettering;
-/*
- * #%L
- * Lima :: Swing
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2012 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 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.chorem.lima.entity.Entry;
-
-import javax.swing.DefaultListSelectionModel;
-
-public class UnlettringSelectionModel extends DefaultListSelectionModel {
-
- protected LetteringTableModel letteringTableModel;
- protected LetteringEditModel editModel;
-
- /**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;
- editModel.resetDebitCreditBalance();
- }
-
- @Override
- public void addSelectionInterval(int row, int column){
- setSelectionInterval(row, column);
- }
-
- @Override
- public void removeSelectionInterval(int row, int column){
- super.removeSelectionInterval(row, column);
- updateBalanceAndLetteringButton(true);
- }
-
- @Override
- public void setSelectionInterval(int row, int column){
-
- //Case where line is selected a second time (So, must deselect it on second click)
- if (isSelectionEmpty() || !isSelectedIndex(row)){
- super.addSelectionInterval(row, column);
- }else {
- super.removeSelectionInterval(row, column);
- }
- updateBalanceAndLetteringButton(true);
- }
-
- /**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();
-
- //treatment unuseful if no rows are selected
- if (!isSelectionEmpty()){
- Entry selectedEntry;
- for (int i = 0; i < letteringTableModel.getRowCount(); i ++){
- if (isSelectedIndex(i)){
- selectedEntry = letteringTableModel.getEntryAt(i);
- //Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(selectedEntry.getAmount(), selectedEntry.getDebit());
- }
- }
- //For U.I. buttons (Lettering and unlettering)
- editModel.setUnLettred(!lettering);
- editModel.setLettred(lettering);
- }else{
- editModel.setLettred(!lettering);
- }
- }
-
- /**to reinitialize model attribute*/
- /*public void resetAttribute(){
- clearSelection();
- }*/
-
- @Override
- public int getSelectionMode() {
- return MULTIPLE_INTERVAL_SELECTION;
- }
-
-}
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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-19 16:07:36 UTC (rev 3540)
@@ -75,11 +75,11 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Host adress
-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=
lima.config.scale.description=
+lima.config.state.file=State file of LIMA
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=FullScreen
lima.documents=Documents…
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-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-19 16:07:36 UTC (rev 3540)
@@ -75,11 +75,11 @@
lima.config.data.dir.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Adresse du serveur distant
-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=
lima.config.scale.description=
+lima.config.state.file=Fichier d'état de l'application
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=Plein écran
lima.documents=Documents…
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2012-07-18 13:44:26 UTC (rev 3539)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2012-07-19 16:07:36 UTC (rev 3540)
@@ -39,3 +39,6 @@
# package level
log4j.logger.org.chorem.lima=INFO
log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTable=DEBUG
+log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=DEBUG
+log4j.logger.org.chorem.lima.ui.lettering.LettringSelectionModel=DEBUG
+log4j.logger.org.chorem.lima.ui.lettering.LetteringEditModel=DEBUG
1
0
r3539 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
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 15:44:26 +0200 (Wed, 18 Jul 2012)
New Revision: 3539
Url: http://chorem.org/repositories/revision/lima/3539
Log:
Correction concernant l'inclusion d'une variable.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
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-18 13:40:02 UTC (rev 3538)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-18 13:44:26 UTC (rev 3539)
@@ -267,8 +267,9 @@
for (Object transactionOrEntry : transactionAndEntries) {
if(transactionOrEntry instanceof Entry) {
if (transactionOrEntry.equals(entry)) {
- if (getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1) instanceof Entry){
- return (Entry)getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1);
+ Object objectAt = getObjectAt(transactionAndEntries.indexOf(transactionOrEntry) - 1);
+ if (objectAt instanceof Entry){
+ return (Entry) objectAt;
} else {
return null;
}
1
0
r3538 - 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 15:40:02 +0200 (Wed, 18 Jul 2012)
New Revision: 3538
Url: http://chorem.org/repositories/revision/lima/3538
Log:
fixes #692 Correction de la remise ?\195?\160 z?\195?\169ro des totaux d?\195?\169bit / cr?\195?\169dit / solde lors d'un lettrage ou delettrage.
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/FinancialTransactionViewHandler.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/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/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -267,8 +267,11 @@
for (Object transactionOrEntry : transactionAndEntries) {
if(transactionOrEntry instanceof Entry) {
if (transactionOrEntry.equals(entry)) {
- //'-1' for precedent...
- return (Entry)getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1);
+ if (getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1) instanceof Entry){
+ return (Entry)getObjectAt(transactionAndEntries.indexOf(transactionOrEntry)-1);
+ } else {
+ return null;
+ }
}
}
}
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-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -351,7 +351,10 @@
int indexSelectedRow = table.getSelectedRow();
if (indexSelectedRow != -1) {
//int firstentryBookrow = tableModel.getFirstEntry(indexSelectedRow);
- Entry precedentEntry = tableModel.getPrecedentEntry((Entry)tableModel.getObjectAt(indexSelectedRow));
+ Entry precedentEntry = null;
+ if (tableModel.getObjectAt(indexSelectedRow) instanceof Entry) {
+ precedentEntry = tableModel.getPrecedentEntry((Entry)tableModel.getObjectAt(indexSelectedRow));
+ }
if (log.isInfoEnabled()) {
log.info("Selected row : " + indexSelectedRow);
@@ -376,7 +379,7 @@
BigDecimal tvaTax = null;
//Calculation of tva tax only if first entry is a sale
- if (precedentEntry.getAccount()!= null){
+ if (precedentEntry != null && precedentEntry.getAccount()!= null){
defaultAccount = precedentEntry.getAccount().getAccountNumber();
if (defaultAccount.equals("410") || defaultAccount.equals("418")){
tvaTax = (precedentEntry.getAmount()).multiply(tvaPercentAdd);
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-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -62,21 +62,16 @@
public void setSelectionInterval(int row, int column){
if ( isSelectionEmpty() || !isSelectedIndex(row)){
-
super.clearSelection();
-
lineSelected = row;
String currentLettring = getCurrentLettring();
-
setValueIsAdjusting(true);
-
try {
//select entries with the same letter of the selected entry
for(Entry entry : getEntries()){
if (StringUtils.isNotBlank(entry.getLettering())){
if (entry.getLettering().equals(currentLettring)){
int entryToSelect = letteringTableModel.getIndexOfEntry(entry);
- System.out.println("there : " + entryToSelect);
super.addSelectionInterval(entryToSelect, entryToSelect);
}
}
@@ -93,7 +88,6 @@
* @param lettering state of attributes lettered and unlettered in editModel
* */
public void updateBalanceAndLetteringButton(boolean lettering){
-
editModel.resetDebitCreditBalance();
Entry selectedEntry;
@@ -111,9 +105,9 @@
}
//to reinitialize model attribute
- public void resetAttribute(){
+ /*public void resetAttribute(){
clearSelection();
- }
+ }*/
public List<Entry> getEntries(){
return letteringTableModel.getEntries();
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-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -9,15 +9,15 @@
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
+ *
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
@@ -94,7 +94,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
editModel.resetDebitCreditBalance();
- view.getLettringAndUnlettringSelectionModel().resetAttribute();
+ view.getLettringAndUnlettringSelectionModel().clearSelection();
updateAllEntries();
}
});
@@ -106,7 +106,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
editModel.resetDebitCreditBalance();
- view.getLettringAndUnlettringSelectionModel().resetAttribute();
+ view.getLettringAndUnlettringSelectionModel().clearSelection();
updateAllEntries();
}
});
@@ -210,7 +210,7 @@
if (row > 0) {
comboBox.setSelectedIndex(row - 1);
}
- view.getLettringAndUnlettringSelectionModel().resetAttribute();
+ view.getLettringAndUnlettringSelectionModel().clearSelection();
}
/**
@@ -225,20 +225,22 @@
if (row < size - 1) {
comboBox.setSelectedIndex(row + 1);
}
- view.getLettringAndUnlettringSelectionModel().resetAttribute();
+ view.getLettringAndUnlettringSelectionModel().clearSelection();
}
/**Add a group of three letters to n entries*/
public void addLetter() {
String newLetters = financialTransactionService.getNextLetters();
changeLetter(newLetters);
- view.getEditModel().setLettred(false);
+ editModel.setLettred(false);
+ editModel.resetDebitCreditBalance();
}
/**Remove a group of three letters to n entries*/
public void removeLetter() {
changeLetter(null);
- view.getEditModel().setUnLettred(false);
+ editModel.setUnLettred(false);
+ editModel.resetDebitCreditBalance();
}
/**Add or remove 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-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringAndUnlettringSelectionModel.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -56,19 +56,14 @@
* */
@Override
public void setSelectionInterval(int row, int column) {
-
if (!letteringNotExist(row)) {
delegate = letteringSelectionModel;
- //to reinitialize model attribute when delegation change
- unlettringSelectionModel.resetAttribute();
+ clearSelection();
}
else {
delegate = unlettringSelectionModel;
- letteringSelectionModel.resetAttribute();
}
-
delegate.setSelectionInterval(row, column);
-
}
/**return true if lettering is null, or not null but empty
@@ -80,15 +75,9 @@
entry = letteringTableModel.getEntryAt(row);
String lettering = entry.getLettering();
emptyOrNull = (lettering==null||lettering.isEmpty());
-
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-18 12:32:38 UTC (rev 3537)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-18 13:40:02 UTC (rev 3538)
@@ -91,9 +91,9 @@
}
/**to reinitialize model attribute*/
- public void resetAttribute(){
+ /*public void resetAttribute(){
clearSelection();
- }
+ }*/
@Override
public int getSelectionMode() {
1
0
r3537 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/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 14:32:38 +0200 (Wed, 18 Jul 2012)
New Revision: 3537
Url: http://chorem.org/repositories/revision/lima/3537
Log:
Apr?\195?\168s la revue de code : Suppression de la liste inutile dans les deux sous mod?\195?\168les d?\195?\169l?\195?\169gu?\195?\169s du lettrage.
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/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-18 11:36:40 UTC (rev 3536)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java 2012-07-18 12:32:38 UTC (rev 3537)
@@ -27,7 +27,6 @@
import org.chorem.lima.entity.Entry;
import javax.swing.DefaultListSelectionModel;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -38,8 +37,9 @@
protected LetteringTableModel letteringTableModel;
protected LetteringEditModel editModel;
protected int lineSelected;
- protected List<Entry> selectedRows = new ArrayList<Entry>();
+ //protected List<Entry> selectedRows = new ArrayList<Entry>();
+
/**Table selection model when entry selected is lettered
* @param letteringTableModel model of the table
* @param editModel model managing update of debit / credit / balance
@@ -61,9 +61,8 @@
@Override
public void setSelectionInterval(int row, int column){
- if ( selectedRows.isEmpty() || !searchRowSelected(row)){
+ if ( isSelectionEmpty() || !isSelectedIndex(row)){
- resetAttribute();
super.clearSelection();
lineSelected = row;
@@ -76,8 +75,8 @@
for(Entry entry : getEntries()){
if (StringUtils.isNotBlank(entry.getLettering())){
if (entry.getLettering().equals(currentLettring)){
- selectedRows.add(entry);
int entryToSelect = letteringTableModel.getIndexOfEntry(entry);
+ System.out.println("there : " + entryToSelect);
super.addSelectionInterval(entryToSelect, entryToSelect);
}
}
@@ -87,7 +86,6 @@
}
updateBalanceAndLetteringButton(false);
}
- resetAttribute();
}
/**PropertyChange on editModel in the handler, and, there,
@@ -97,9 +95,14 @@
public void updateBalanceAndLetteringButton(boolean lettering){
editModel.resetDebitCreditBalance();
- for (Entry entry : selectedRows){
- //Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(entry.getAmount(), entry.getDebit());
+
+ Entry selectedEntry;
+ for (int i = 0; i < letteringTableModel.getRowCount(); i ++){
+ if (isSelectedIndex(i)){
+ selectedEntry = letteringTableModel.getEntryAt(i);
+ //Set values for calculation (By LetteringEditModel) of balance
+ editModel.balanceCalculation(selectedEntry.getAmount(), selectedEntry.getDebit());
+ }
}
//For U.I. buttons (Lettering and unlettering)
@@ -109,23 +112,9 @@
//to reinitialize model attribute
public void resetAttribute(){
- selectedRows.clear();
+ clearSelection();
}
- /**search if the selected row is in the list
- * (List of precedent selected rows)
- * @param row line searched in the list
- * @return true if line find
- * */
- public boolean searchRowSelected(int row){
- for (Entry entrySearching : selectedRows){
- if (entrySearching == letteringTableModel.getEntryAt(row)){
- return true;
- }
- }
- return false;
- }
-
public List<Entry> getEntries(){
return letteringTableModel.getEntries();
}
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-18 11:36:40 UTC (rev 3536)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/UnlettringSelectionModel.java 2012-07-18 12:32:38 UTC (rev 3537)
@@ -26,13 +26,10 @@
import org.chorem.lima.entity.Entry;
import javax.swing.DefaultListSelectionModel;
-import java.util.ArrayList;
-import java.util.List;
public class UnlettringSelectionModel extends DefaultListSelectionModel {
protected LetteringTableModel letteringTableModel;
- protected List<Entry> selectedRows;
protected LetteringEditModel editModel;
/**Table selection model when entry selected is no lettered
@@ -42,7 +39,6 @@
public UnlettringSelectionModel(LetteringTableModel letteringTableModel, LetteringEditModel editModel) {
this.letteringTableModel = letteringTableModel;
this.editModel = editModel;
- selectedRows = new ArrayList<Entry>();
editModel.resetDebitCreditBalance();
}
@@ -53,7 +49,7 @@
@Override
public void removeSelectionInterval(int row, int column){
- deleteLine(row, column);
+ super.removeSelectionInterval(row, column);
updateBalanceAndLetteringButton(true);
}
@@ -61,45 +57,14 @@
public void setSelectionInterval(int row, int column){
//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));
+ if (isSelectionEmpty() || !isSelectedIndex(row)){
super.addSelectionInterval(row, column);
}else {
- deleteLine(row, column);
+ super.removeSelectionInterval(row, column);
}
updateBalanceAndLetteringButton(true);
}
- /**
- * search the line in a list of selected rows
- * and delete it
- * @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){
- if (entrySearching == letteringTableModel.getEntryAt(row)){
- selectedRows.remove(entrySearching);
- break;
- }
- }
- super.removeSelectionInterval(row, column);
- }
-
- /**search if the selected row is in the list
- * (List of precedent selected rows)
- * @param row line searched in the list
- * @return true if line find
- * */
- public boolean searchRowSelected(int row){
- for (Entry entrySearching : selectedRows){
- if (entrySearching == letteringTableModel.getEntryAt(row)){
- return true;
- }
- }
- return false;
- }
-
/**PropertyChange on editModel in the handler, and, there,
* set values it.
* @param lettering state of attributes lettered and unlettered in editModel
@@ -108,10 +73,14 @@
editModel.resetDebitCreditBalance();
//treatment unuseful if no rows are selected
- if (selectedRows.size() != 0){
- for (Entry entry : selectedRows){
- //Set values for calculation (By LetteringEditModel) of balance
- editModel.balanceCalculation(entry.getAmount(), entry.getDebit());
+ if (!isSelectionEmpty()){
+ Entry selectedEntry;
+ for (int i = 0; i < letteringTableModel.getRowCount(); i ++){
+ if (isSelectedIndex(i)){
+ selectedEntry = letteringTableModel.getEntryAt(i);
+ //Set values for calculation (By LetteringEditModel) of balance
+ editModel.balanceCalculation(selectedEntry.getAmount(), selectedEntry.getDebit());
+ }
}
//For U.I. buttons (Lettering and unlettering)
editModel.setUnLettred(!lettering);
@@ -123,7 +92,7 @@
/**to reinitialize model attribute*/
public void resetAttribute(){
- selectedRows.clear();
+ clearSelection();
}
@Override
1
0