r3689 - in trunk: lima-callao/src/main/resources/i18n lima-swing lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/Filter lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondit
Author: Bavencoff Date: 2013-06-27 15:25:12 +0200 (Thu, 27 Jun 2013) New Revision: 3689 Url: http://chorem.org/projects/lima/repository/revisions/3689 Log: modification du system de recherche des transactions Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx trunk/lima-swing/src/main/resources/icons/action-remove-condition.png Modified: trunk/lima-callao/src/main/resources/i18n/lima-callao_en_GB.properties trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties trunk/lima-swing/pom.xml trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties Modified: trunk/lima-callao/src/main/resources/i18n/lima-callao_en_GB.properties =================================================================== --- trunk/lima-callao/src/main/resources/i18n/lima-callao_en_GB.properties 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-callao/src/main/resources/i18n/lima-callao_en_GB.properties 2013-06-27 13:25:12 UTC (rev 3689) @@ -1,3 +1,18 @@ +lima.BigDecimal.date.operand.notequal= +lima.enum.BigDecimal.operand.equal= +lima.enum.BigDecimal.operand.lower= +lima.enum.BigDecimal.operand.lowerorequal= +lima.enum.BigDecimal.operand.upper= +lima.enum.BigDecimal.operand.upperorequal= lima.enum.comboboxamount.both=All lima.enum.comboboxamount.credit=Credit lima.enum.comboboxamount.debit=Debit +lima.enum.date.operand.after= +lima.enum.date.operand.different= +lima.enum.date.operand.previous= +lima.enum.date.operand.same= +lima.enum.string.operand.begin= +lima.enum.string.operand.contain= +lima.enum.string.operand.ending= +lima.enum.string.operand.equal= +lima.string.date.operand.notequal= Modified: trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties =================================================================== --- trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties 2013-06-27 13:25:12 UTC (rev 3689) @@ -1,3 +1,18 @@ +lima.BigDecimal.date.operand.notequal= +lima.enum.BigDecimal.operand.equal= +lima.enum.BigDecimal.operand.lower= +lima.enum.BigDecimal.operand.lowerorequal= +lima.enum.BigDecimal.operand.upper= +lima.enum.BigDecimal.operand.upperorequal= lima.enum.comboboxamount.both=Tous lima.enum.comboboxamount.credit=Crédit lima.enum.comboboxamount.debit=Débit +lima.enum.date.operand.after=après le +lima.enum.date.operand.different=différent du +lima.enum.date.operand.previous=avant le +lima.enum.date.operand.same=le +lima.enum.string.operand.begin=Commence par +lima.enum.string.operand.contain=Contient +lima.enum.string.operand.ending=Fini par +lima.enum.string.operand.equal=Égal à +lima.string.date.operand.notequal=Différent de Modified: trunk/lima-swing/pom.xml =================================================================== --- trunk/lima-swing/pom.xml 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/pom.xml 2013-06-27 13:25:12 UTC (rev 3689) @@ -121,6 +121,11 @@ <groupId>org.nuiton</groupId> <artifactId>nuiton-widgets</artifactId> </dependency> + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-validator</artifactId> + <version>2.5.6</version> + </dependency> </dependencies> Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,61 @@ +package org.chorem.lima.ui.Filter.AccountCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.AccountCondition; +import org.chorem.lima.entity.Account; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; + +import javax.swing.*; +import java.awt.event.ItemEvent; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class AccountConditionHandler implements ConditionHandler { + + private static final Log log = LogFactory.getLog(AccountConditionHandler.class); + + protected AccountCondition condition; + + protected AccountConditionView view; + + protected FinancialTransactionConditionHandler filterHandler; + + public AccountConditionHandler (AccountConditionView view) { + this.view = view; + this.condition = new AccountCondition(); + } + + public Account getAccount() { + return condition.getAccount(); + } + + public void setAccount(Account account) { + condition.setAccount(account); + } + + public void accountSelected(ItemEvent event) { + condition.setAccount((Account) event.getItem()); + } + + public void delete() { + filterHandler.removeCondition(this); + } + + @Override + public AccountCondition getCondition() { + return condition; + } + + @Override + public JComponent getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/AccountCondition/AccountConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,58 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.DefaultComboBoxModel + org.chorem.lima.beans.AccountCondition + org.chorem.lima.ui.common.AccountListRenderer + </import> + + <AccountConditionHandler id="handler" + javaBean="new AccountConditionHandler(this)"/> + + <org.chorem.lima.ui.combobox.AccountComboBoxModel id="accountModel" /> + + <row> + <cell> + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.ui.financialtransaction.account"/> + </cell> + <cell weightx="1" anchor="west"> + <JComboBox id="account" + model="{accountModel}" + renderer="{new AccountListRenderer()}" + selectedItem="{handler.getAccount()}" + onItemStateChanged="handler.accountSelected(event)"/> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,70 @@ +package org.chorem.lima.ui.Filter.BigDecimalCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.AbstractBigDecimalCondition; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.DebitCondition; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; + +import java.awt.event.ItemEvent; +import java.math.BigDecimal; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class BigDecimalConditionHandler implements ConditionHandler { + + private static final Log log = LogFactory.getLog(BigDecimalConditionHandler.class); + + protected BigDecimalConditionView view; + + protected AbstractBigDecimalCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public BigDecimalConditionHandler(BigDecimalConditionView view) { + this.view = view; + this.condition = new DebitCondition(); + } + + public BigDecimal getValue() { + return condition.getValue(); + } + + public void setValue(BigDecimal value) { + condition.setValue(value); + } + + public void setOperand(AbstractBigDecimalCondition.Operand operand) { + condition.setOperand(operand); + } + + public AbstractBigDecimalCondition.Operand getOperand() { + return condition.getOperand(); + } + + public void delete() { + filterHandler.removeCondition(this); + } + + public void operandSelected(ItemEvent event) { + condition.setOperand((AbstractBigDecimalCondition.Operand) event.getItem()); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public BigDecimalConditionView getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,70 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.DefaultComboBoxModel + org.chorem.lima.beans.AbstractBigDecimalCondition + jaxx.runtime.swing.editor.NumberEditor + java.math.BigDecimal + </import> + + <BigDecimalConditionHandler id="handler" + javaBean="new BigDecimalConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel id="label" text=""/> + </cell> + <cell> + <JComboBox id="operandComboBox" + model="{new DefaultComboBoxModel(AbstractBigDecimalCondition.Operand.values())}" + selectedItem="{handler.getOperand()}" + onItemStateChanged="handler.operandSelected(event)"/> + </cell> + <cell weightx="1" anchor="west"> + <NumberEditor id="bigDecimaleditor" + constructorParams="this" + bean="{handler}" + model="{handler.getValue()}" + property="value" + modelType="{BigDecimal.class}" + numberPattern="([1-9]\d*|0)(\.\d*)?" + useFloat="true" + useSign="false" + autoPopup="false" + showPopupButton="false" + showReset="false"/> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,14 @@ +package org.chorem.lima.ui.Filter.BigDecimalCondition; + +import org.chorem.lima.beans.CreditCondition; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class CreditConditionHandler extends BigDecimalConditionHandler { + + public CreditConditionHandler(BigDecimalConditionView view) { + super(view); + this.condition = new CreditCondition(); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/CreditConditionView.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,17 @@ +package org.chorem.lima.ui.Filter.BigDecimalCondition; + +import static org.nuiton.i18n.I18n._; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class CreditConditionView extends BigDecimalConditionView { + + public CreditConditionView() { + super(); + setHandler(new CreditConditionHandler(this)); + getLabel().setText(_("lima.ui.financialtransaction.credit")); + getBigDecimaleditor().setBean(handler); + getBigDecimaleditor().init(); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,14 @@ +package org.chorem.lima.ui.Filter.BigDecimalCondition; + +import org.chorem.lima.beans.DebitCondition; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DebitConditionHandler extends BigDecimalConditionHandler { + + public DebitConditionHandler(BigDecimalConditionView view) { + super(view); + this.condition = new DebitCondition(); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/DebitConditionView.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,17 @@ +package org.chorem.lima.ui.Filter.BigDecimalCondition; + +import static org.nuiton.i18n.I18n._; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DebitConditionView extends BigDecimalConditionView { + + public DebitConditionView() { + super(); + setHandler(new DebitConditionHandler(this)); + getLabel().setText(_("lima.ui.financialtransaction.debit")); + getBigDecimaleditor().setBean(handler); + getBigDecimaleditor().init(); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/ConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,18 @@ +package org.chorem.lima.ui.Filter; + +import org.chorem.lima.beans.Condition; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; + +import javax.swing.*; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public interface ConditionHandler { + + public Condition getCondition(); + + public JComponent getView(); + + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler); +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,75 @@ +package org.chorem.lima.ui.Filter.EntryBookCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.EntryBookCondition; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.api.EntryBookService; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import java.util.List; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class EntryBookConditionHandler implements ConditionHandler { + + private static final Log log = LogFactory.getLog(EntryBookConditionHandler.class); + + protected EntryBookConditionView view; + + protected EntryBookCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public EntryBookConditionHandler(EntryBookConditionView view) { + this.view = view; + this.condition = new EntryBookCondition(); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public JComponent getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } + + public Object[] getEntryBookList() { + EntryBookService entryBookService = LimaServiceFactory.getService(EntryBookService.class); + Object[] result = {}; + List<EntryBook> periods = null; + try { + periods = entryBookService.getAllEntryBooks(); + result = periods.toArray(); + } catch (LimaException ex) { + if (log.isDebugEnabled()) { + log.debug("Can't get Financial Period list", ex); + } + } + return result; + } + + public void setEntryBook(ListSelectionEvent event) { + JList entryBookList = view.getEntryBookList(); + List selectedValuesList = entryBookList.getSelectedValuesList(); + condition.setEntryBooks(selectedValuesList); + } + + public void delete() { + filterHandler.removeCondition(this); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/EntryBookCondition/EntryBookConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,56 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + org.chorem.lima.entity.EntryBook + org.chorem.lima.ui.LimaRendererUtil + </import> + <EntryBookConditionHandler id="handler" + javaBean="new EntryBookConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.enum.list.entryBook"/> + </cell> + <cell weightx="1" anchor="west"> + <JScrollPane preferredSize="{new Dimension(300, 60)}" minimumSize="{new Dimension(300, 60)}"> + <JList id="entryBookList" + selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + visibleRowCount="-1" + listData="{handler.getEntryBookList()}" + cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}" + onValueChanged="handler.setEntryBook(event)"/> + </JScrollPane> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,14 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import org.chorem.lima.beans.DescriptionCondition; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DescriptionConditionHandler extends StringConditionHandler { + + public DescriptionConditionHandler(StringConditionView view) { + super(view); + this.condition = new DescriptionCondition(); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/DescriptionConditionView.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,15 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import static org.nuiton.i18n.I18n._; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DescriptionConditionView extends StringConditionView { + + public DescriptionConditionView() { + super(); + setHandler(new DescriptionConditionHandler(this)); + getLabel().setText(_("lima.ui.financialtransaction.description")); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,15 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import org.chorem.lima.beans.LetteringCondition; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class LetteringConditionHandler extends StringConditionHandler { + + public LetteringConditionHandler(StringConditionView view) { + super(view); + this.condition = new LetteringCondition(); + } + +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/LetteringConditionView.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,15 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import static org.nuiton.i18n.I18n._; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class LetteringConditionView extends StringConditionView { + + public LetteringConditionView() { + super(); + setHandler(new LetteringConditionHandler(this)); + getLabel().setText(_("lima.ui.financialtransaction.letter")); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,89 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.AbstractStringCondition; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.VoucherCondition; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; +import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; + +import java.awt.event.ActionEvent; +import java.awt.event.ItemEvent; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class StringConditionHandler implements ConditionHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionSearchViewHandler.class); + + protected StringConditionView view; + + protected AbstractStringCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public StringConditionHandler(StringConditionView view) { + this.view = view; + this.condition = new VoucherCondition(); + } + + public String getText() { + return condition.getValue(); + } + + public void setText(String text) { + condition.setValue(text); + } + + public void setText(ActionEvent event) { + String text = view.getTextField().getText(); + setText(text); + } + + public void setOperand(AbstractStringCondition.Operand operand) { + condition.setOperand(operand); + } + + public AbstractStringCondition.Operand getOperand() { + return condition.getOperand(); + } + + public boolean isSensitiveCase() { + return condition.isSensitiveCase(); + } + + public void setSensitiveCase(boolean sensitiveCase) { + condition.setSensitiveCase(sensitiveCase); + } + + public void setSensitiveCase(ActionEvent event) { + boolean selected = view.getSensitiveCaseCheckBox().isSelected(); + setSensitiveCase(selected); + } + + public void delete() { + filterHandler.removeCondition(this); + } + + public void operandSelected(ItemEvent event) { + condition.setOperand((AbstractStringCondition.Operand) event.getItem()); + } + + @Override + public Condition getCondition() { + return condition; + } + + public StringConditionView getView() { + return view; + } + + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,65 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.DefaultComboBoxModel + org.chorem.lima.beans.AbstractStringCondition + </import> + + <StringConditionHandler id="handler" + javaBean="new StringConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel id="label" text=""/> + </cell> + <cell> + <JComboBox id="operandComboBox" + model="{new DefaultComboBoxModel(AbstractStringCondition.Operand.values())}" + selectedItem="{handler.getOperand()}" + onItemStateChanged="handler.operandSelected(event)"/> + </cell> + <cell> + <JTextField id="textField" + text="{handler.getText()}" + onActionPerformed="handler.setText(event)" /> + </cell> + <cell weightx="1" anchor="west"> + <JCheckBox id="sensitiveCaseCheckBox" + text="lima.filer.condition.sensitive.case" + selected="{handler.isSensitiveCase()}" + onActionPerformed="handler.setSensitiveCase(event)" /> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,16 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import org.chorem.lima.beans.VoucherCondition; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class VoucherConditionHandler extends StringConditionHandler { + + + public VoucherConditionHandler(StringConditionView view) { + super(view); + this.condition = new VoucherCondition(); + } + +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/VoucherConditionView.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,16 @@ +package org.chorem.lima.ui.Filter.StringCondition; + +import static org.nuiton.i18n.I18n._; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class VoucherConditionView extends StringConditionView { + + public VoucherConditionView() { + super(); + setHandler(new VoucherConditionHandler(this)); + getLabel().setText(_("lima.ui.financialtransaction.voucher")); + } + +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,79 @@ +package org.chorem.lima.ui.Filter.dateCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.DateCondition; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; +import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; + +import java.awt.event.ItemEvent; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DateConditionHandler implements ConditionHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionSearchViewHandler.class); + + protected DateConditionView view; + + protected DateCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public DateConditionHandler( DateConditionView view) { + this.view = view; + this.condition = new DateCondition(); + } + + public Date getDate() { + return condition.getDate(); + } + + public void setDate(Date date) { + condition.setDate(date); + } + + public void setOperand(DateCondition.Operand operand) { + condition.setOperand(operand); + } + + public DateCondition.Operand getOperand() { + return condition.getOperand(); + } + + public DateFormat[] getFormats() { + DateFormat[] formats = {DateFormat.getDateInstance(DateFormat.SHORT), new SimpleDateFormat("dd/MM/yyyy")}; + return formats; + } + + public void delete() { + filterHandler.removeCondition(this); + } + + public void operandSelected(ItemEvent event) { + condition.setOperand((DateCondition.Operand) event.getItem()); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public DateConditionView getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,59 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.DefaultComboBoxModel + org.chorem.lima.beans.DateCondition + </import> + <DateConditionHandler id="handler" + javaBean="new DateConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.ui.financialtransaction.date"/> + </cell> + <cell> + <JComboBox id="operandComboBox" + model="{new DefaultComboBoxModel(DateCondition.Operand.values())}" + selectedItem="{handler.getOperand()}" + onItemStateChanged="handler.operandSelected(event)"/> + </cell> + <cell weightx="1" anchor="west"> + <JAXXDatePicker id='datePicker' + date='{handler.getDate()}' + formats='{handler.getFormats()}' + onActionPerformed='handler.setDate(datePicker.getDate())'/> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,75 @@ +package org.chorem.lima.ui.Filter.dateIntervalCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.DateIntervalCondition; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; +import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; + +import javax.swing.*; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class DateIntervalConditionHandler implements ConditionHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionSearchViewHandler.class); + + protected DateIntervalConditionView view; + + protected DateIntervalCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public DateIntervalConditionHandler(DateIntervalConditionView view) { + this.view = view; + this.condition = new DateIntervalCondition(); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public JComponent getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } + + public DateFormat[] getFormats() { + DateFormat[] formats = {DateFormat.getDateInstance(DateFormat.SHORT), new SimpleDateFormat("dd/MM/yyyy")}; + return formats; + } + + public void delete() { + filterHandler.removeCondition(this); + } + + public Date getBeginDate() { + return condition.getBeginDate(); + } + + public void setBeginDate(Date beginDate) { + condition.setBeginDate(beginDate); + } + + public Date getEndDate() { + return condition.getEndDate(); + } + + public void setEndDate(Date endDate) { + condition.setEndDate(endDate); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,62 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.DefaultComboBoxModel + org.chorem.lima.beans.DateCondition + </import> + <DateIntervalConditionHandler id="handler" + javaBean="new DateIntervalConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.ui.financialtransaction.date.in"/> + </cell> + <cell> + <JAXXDatePicker id='beginDatePicker' + date='{handler.getBeginDate()}' + formats='{handler.getFormats()}' + onActionPerformed='handler.setBeginDate(beginDatePicker.getDate())'/> + </cell> + <cell> + <JLabel text="lima.ui.financialtransaction.date.to"/> + </cell> + <cell weightx="1" anchor="west"> + <JAXXDatePicker id='endDatePicker' + date='{handler.getEndDate()}' + formats='{handler.getFormats()}' + onActionPerformed='handler.setEndDate(endDatePicker.getDate())'/> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,79 @@ +package org.chorem.lima.ui.Filter.financialPeriodCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.FinancialPeriodCondition; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.api.FinancialPeriodService; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; +import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import java.util.List; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class FinancialPeriodConditionHandler implements ConditionHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionSearchViewHandler.class); + + protected FinancialPeriodConditionView view; + + protected FinancialPeriodCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public FinancialPeriodConditionHandler(FinancialPeriodConditionView view) { + this.view = view; + this.condition = new FinancialPeriodCondition(); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public JComponent getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } + + public Object[] getFinancialPeriodList() { + FinancialPeriodService financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class); + Object[] result = {}; + List<FinancialPeriod> periods = null; + try { + periods = financialPeriodService.getAllFinancialPeriods(); + result = periods.toArray(); + } catch (LimaException ex) { + if (log.isDebugEnabled()) { + log.debug("Can't get Financial Period list", ex); + } + } + return result; + } + + public void setFinancialPeriod(ListSelectionEvent event) { + JList financialPeriodList = view.getFinancialPeriodList(); + List selectedValuesList = financialPeriodList.getSelectedValuesList(); + condition.setFinancialPeriods(selectedValuesList); + } + + public void delete() { + filterHandler.removeCondition(this); + } + +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialPeriodCondition/FinancialPeriodConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,56 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + org.chorem.lima.entity.FinancialPeriod + org.chorem.lima.ui.LimaRendererUtil + </import> + <FinancialPeriodConditionHandler id="handler" + javaBean="new FinancialPeriodConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.enum.comboboxperiod.financialperiod"/> + </cell> + <cell weightx="1" anchor="west"> + <JScrollPane preferredSize="{new Dimension(250, 80)}" minimumSize="{new Dimension(250, 80)}"> + <JList id="financialPeriodList" + selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + visibleRowCount="-1" + listData="{handler.getFinancialPeriodList()}" + cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class)}" + onValueChanged="handler.setFinancialPeriod(event)"/> + </JScrollPane> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,75 @@ +package org.chorem.lima.ui.Filter.financialTransactionCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.FinancialTransactionCondition; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchViewHandler; + +import javax.swing.*; +import java.util.List; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class FinancialTransactionConditionHandler { + + /** log. */ + private static final Log log = + LogFactory.getLog(FinancialTransactionSearchViewHandler.class); + + protected FinancialTransactionConditionView view; + + protected FinancialTransactionCondition filter; + + public FinancialTransactionConditionHandler(FinancialTransactionConditionView view) { + this.view = view; + this.filter = new FinancialTransactionCondition(); + } + + public void setAllConditions(boolean all) { + filter.setAllConditions(all); + } + + public boolean isAllConditions() { + return filter.isAllConditions(); + } + + public FinancialTransactionCondition getFilter() { + return filter; + } + + public void addCondition(ConditionHandler conditionHandler) { + // add model + List<Condition> conditions = filter.getConditions(); + Condition condition = conditionHandler.getCondition(); + boolean add = conditions.add(condition); + + // add view + if (add) { + JPanel conditionPanel = view.getConditionPanel(); + JComponent conditionView = conditionHandler.getView(); + conditionPanel.add(conditionView); + conditionPanel.validate(); + conditionPanel.repaint(); + } + conditionHandler.setFilterHandler(this); + } + + public void removeCondition(ConditionHandler conditionHandler) { + // remove model + List<Condition> conditions = filter.getConditions(); + Condition condition = conditionHandler.getCondition(); + boolean remove = conditions.remove(condition); + + // remove view + if (remove) { + JPanel conditionPanel = view.getConditionPanel(); + JComponent conditionView = conditionHandler.getView(); + conditionPanel.remove(conditionView); + view.getParent().validate(); + view.getParent().repaint(); + } + } +} Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx (from rev 3683, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/financialTransactionCondition/FinancialTransactionConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,59 @@ +<!-- + #%L + Lima Swing + + $Id$ + $HeadURL$ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + javax.swing.BoxLayout + </import> + <FinancialTransactionConditionHandler id="handler" + javaBean="new FinancialTransactionConditionHandler(this)"/> + + <row> + <cell weightx="1" anchor="east"> + <JRadioButton text="lima.filter.condition.one" + id="AllRadioButton" + onActionPerformed="handler.setAllConditions(false)" + buttonGroup="radioButtons" + selected="{!handler.isAllConditions()}"/> + </cell> + <cell weightx="0" > + <JRadioButton text="lima.filter.condition.all" + id="OneRadioButton" + onActionPerformed="handler.setAllConditions(true)" + buttonGroup="radioButtons" + selected="{handler.isAllConditions()}"/> + </cell> + </row> + <row> + <cell fill="both" weightx="1" columns="2" anchor="west"> + <JPanel id="conditionPanel" + layout="{new BoxLayout(conditionPanel, BoxLayout.PAGE_AXIS)}"> + </JPanel> + </cell> + </row> +</Table> \ No newline at end of file Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,76 @@ +package org.chorem.lima.ui.Filter.fiscalPeriodCondition; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.beans.Condition; +import org.chorem.lima.beans.FiscalPeriodCondition; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.api.FiscalPeriodService; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import java.util.List; + + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class FiscalPeriodConditionHandler implements ConditionHandler { + + private static final Log log = LogFactory.getLog(FiscalPeriodConditionHandler.class); + + protected FiscalPeriodConditionView view; + + protected FiscalPeriodCondition condition; + + protected FinancialTransactionConditionHandler filterHandler; + + public FiscalPeriodConditionHandler(FiscalPeriodConditionView view) { + this.view = view; + this.condition = new FiscalPeriodCondition(); + } + + @Override + public Condition getCondition() { + return condition; + } + + @Override + public JComponent getView() { + return view; + } + + @Override + public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { + this.filterHandler = filterHandler; + } + + public Object[] getFiscalPeriodList() { + FiscalPeriodService fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class); + Object[] result = {}; + List<FiscalPeriod> periods = null; + try { + periods = fiscalPeriodService.getAllFiscalPeriods(); + result = periods.toArray(); + } catch (LimaException ex) { + if (log.isDebugEnabled()) { + log.debug("Can't get Fiscal Period list", ex); + } + } + return result; + } + + public void setFiscalPeriod(ListSelectionEvent event) { + JList fiscalPeriodList = view.getFiscalPeriodList(); + List selectedValuesList = fiscalPeriodList.getSelectedValuesList(); + condition.setFiscalPeriods(selectedValuesList); + } + + public void delete() { + filterHandler.removeCondition(this); + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/fiscalPeriodCondition/FiscalPeriodConditionView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -0,0 +1,56 @@ +<!-- + #%L + Lima Swing + + $Id: FinancialTransactionSearchView.jaxx 3683 2013-06-19 07:42:34Z Bavencoff $ + $HeadURL: http://svn.chorem.org/svn/lima/trunk/lima-swing/src/main/java/org/chorem/lim... $ + %% + 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 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% + --> + +<Table> + <import> + java.awt.Dimension + javax.swing.ListSelectionModel + org.chorem.lima.entity.FiscalPeriod + org.chorem.lima.ui.LimaRendererUtil + </import> + <FiscalPeriodConditionHandler id="handler" + javaBean="new FiscalPeriodConditionHandler(this)"/> + + <row> + <cell > + <JButton toolTipText="lima.filter.condition.delete" + actionIcon='remove-condition' + onActionPerformed="handler.delete()" /> + </cell> + <cell> + <JLabel text="lima.enum.comboboxperiod.fiscalperiod"/> + </cell> + <cell weightx="1" anchor="west"> + <JScrollPane preferredSize="{new Dimension(250, 80)}" minimumSize="{new Dimension(250, 80)}"> + <JList id="fiscalPeriodList" + selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + visibleRowCount="-1" + listData="{handler.getFiscalPeriodList()}" + cellRenderer="{LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class)}" + onValueChanged="handler.setFiscalPeriod(event)"/> + </JScrollPane> + </cell> + </row> +</Table> \ No newline at end of file Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -25,7 +25,7 @@ package org.chorem.lima.ui.financialtransactionsearch; -import org.chorem.lima.beans.FinancialTransactionSearch; +import org.chorem.lima.beans.FinancialTransactionCondition; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; @@ -67,7 +67,7 @@ protected FiscalPeriod selectedFiscalPeriod; /** data cache */ - protected FinancialTransactionSearch financialTransactionSearch; + protected FinancialTransactionCondition financialTransactionCondition; /** * Model constructor. @@ -81,9 +81,9 @@ FinancialPeriodService.class); } - protected void refresh(FinancialTransactionSearch financialTransactionSearch) { - this.financialTransactionSearch = financialTransactionSearch; - List<FinancialTransaction> transactions = financialTransactionService.searchFinancialTransaction(financialTransactionSearch); + protected void refresh(FinancialTransactionCondition financialTransactionCondition) { + this.financialTransactionCondition = financialTransactionCondition; + List<FinancialTransaction> transactions = financialTransactionService.searchFinancialTransaction(this.financialTransactionCondition); setTransactions(transactions); } @@ -107,7 +107,7 @@ if ((serviceName.contains("FinancialTransaction") || methodeName.contains("importEntries") || methodeName.contains("importAll")) && !methodeName.contains("search")) { //on recharge la liste - refresh(financialTransactionSearch); + refresh(financialTransactionCondition); } } 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 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2013-06-27 13:25:12 UTC (rev 3689) @@ -25,24 +25,27 @@ <Table> <import> - java.awt.Dimension - javax.swing.ListSelectionModel - javax.swing.text.Document - org.chorem.lima.enums.ComboBoxPeriodEnum - org.chorem.lima.enums.ComboBoxAccountsEnum - org.chorem.lima.enums.ComboBoxEntryBooksEnum - org.chorem.lima.enums.ComboBoxLetterEnum - org.chorem.lima.FinancialStatementWayEnum - org.chorem.lima.enums.ComboBoxOperatorsEnum - org.chorem.lima.ui.financialtransaction.FinancialTransactionDefaultTable - org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTableModel - org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTable + java.awt.Dimension + javax.swing.ListSelectionModel + javax.swing.text.Document + org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionView + org.chorem.lima.enums.ComboBoxPeriodEnum + org.chorem.lima.enums.ComboBoxAccountsEnum + org.chorem.lima.enums.ComboBoxEntryBooksEnum + org.chorem.lima.enums.ComboBoxLetterEnum + org.chorem.lima.FinancialStatementWayEnum + org.chorem.lima.enums.ComboBoxOperatorsEnum + org.chorem.lima.ui.financialtransaction.FinancialTransactionDefaultTable + org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTableModel + org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchTable + java.awt.Color + javax.swing.BorderFactory </import> <FinancialTransactionSearchViewHandler id="handler" javaBean="new FinancialTransactionSearchViewHandler(this)"/> <Boolean id="selectedRow" javaBean="false"/> <Dimension id="fieldSize" javaBean="new java.awt.Dimension()"/> - <script> + <!--script> <![CDATA[ AccountSearchPanel accountSearchPanel = new AccountSearchPanel(handler); AmountSearchPanel amountSearchPanel = new AmountSearchPanel(handler); @@ -58,151 +61,57 @@ } ]]> - </script> + </script--> <row> <cell fill="both"> <JToolBar floatable="false"> - <JButton toolTipText="lima.filter.date" + <JButton toolTipText="lima.filter.date.one" actionIcon='filter-transaction-date' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addDateCondition()"/> + <JButton toolTipText="lima.filter.date.interval" + actionIcon='filter-transaction-date' + onActionPerformed="getHandler().addDateIntervalCondition()"/> + <JButton toolTipText="lima.filter.date.financial.period" + actionIcon='filter-transaction-date' + onActionPerformed="getHandler().addFinancialPeriodCondition()"/> + <JButton toolTipText="lima.filter.date.fiscal.period" + actionIcon='filter-transaction-date' + onActionPerformed="getHandler().addFiscalPeriodCondition()"/> <JButton toolTipText="lima.filter.entrybook" actionIcon='filter-transaction-entrybook' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addEntryBookCondition()"/> <JButton toolTipText="lima.filter.voucher" actionIcon='filter-transaction-voucher' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addVoucherCondition()"/> <JButton toolTipText="lima.filter.account" actionIcon='filter-transaction-account' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addAccountCondition()"/> <JButton toolTipText="lima.filter.description" actionIcon='filter-transaction-description' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addDescriptionCondition()"/> <JButton toolTipText="lima.filter.letter" actionIcon='filter-transaction-letter' - onActionPerformed="getHandler().refresh()"/> - <JButton toolTipText="lima.filter.amount" + onActionPerformed="getHandler().addLetteringCondition()"/> + <JButton toolTipText="lima.filter.debit" actionIcon='filter-transaction-amount' - onActionPerformed="getHandler().refresh()"/> + onActionPerformed="getHandler().addDebitCondition()"/> + <JButton toolTipText="lima.filter.credit" + actionIcon='filter-transaction-amount' + onActionPerformed="getHandler().addCreditCondition()"/> <JToolBar.Separator/> <JButton toolTipText="{ _("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh' onActionPerformed="getHandler().refresh()"/> </JToolBar> </cell> </row> + <row> - <cell fill='both'> - <Table> - <row> - <cell anchor="west"> - <JComboBox id="periodComboBox" - javaBean="new JComboBox(ComboBoxPeriodEnum.descriptions())" - onActionPerformed="periodSearchPanel.refresh(ComboBoxPeriodEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <FinancialTransactionPeriodSearchPanel - javaBean="periodSearchPanel"/> - </cell> - </row> - </Table> + <cell fill='both' weightx="1"> + <FinancialTransactionConditionView id="financialTransactionConditionView" /> </cell> </row> + <row> - <cell fill='both'> - <Table> - <row> - <cell> - <JLabel text="lima.table.voucher"/> - </cell> - <cell> - <JTextField id='voucher' - minimumSize="{voucher.getPreferredSize()}"/> - <Document javaBean="voucher.getDocument()" - onInsertUpdate='handler.setVoucher(voucher.getText())' - onRemoveUpdate='handler.setVoucher(voucher.getText())'/> - </cell> - <cell> - <JLabel text="lima.table.description"/> - </cell> - <cell> - <JTextField id='description' - minimumSize='{description.getPreferredSize()}'/> - <Document javaBean="description.getDocument()" - onInsertUpdate='handler.setDescription(description.getText())' - onRemoveUpdate='handler.setDescription(description.getText())'/> - </cell> - <cell> - <JComboBox id="letterComboBox" - javaBean="new JComboBox(ComboBoxLetterEnum.descriptions())" - onActionPerformed="letterSearchPanel.refresh(ComboBoxLetterEnum.valueOfDescription((String) letterComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <LetterSearchPanel javaBean="letterSearchPanel"/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both'> - <Table> - <row> - <cell> - <JComboBox id="accountComboBox" - javaBean="new JComboBox(ComboBoxAccountsEnum.descriptions())" - onActionPerformed="accountSearchPanel.refresh(ComboBoxAccountsEnum.valueOfDescription((String) accountComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <AccountSearchPanel javaBean="accountSearchPanel"/> - </cell> - <cell> - <JComboBox id="entryBookComboBox" - javaBean="new JComboBox(ComboBoxEntryBooksEnum.descriptions())" - onActionPerformed="entryBookSearchPanel.refresh(ComboBoxEntryBooksEnum.valueOfDescription((String) entryBookComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <EntryBookSearchPanel javaBean="entryBookSearchPanel"/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both'> - <Table> - <row> - <cell> - <JLabel text="lima.common.amount"/> - </cell> - <cell> - <JComboBox id="amountComboBox" - javaBean="new JComboBox(FinancialStatementWayEnum.descriptions())" - onActionPerformed="handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription((String)amountComboBox.getSelectedItem())); - handler.refresh()"/> - </cell> - <cell> - <JComboBox id="operatorComboBox" - javaBean="new JComboBox(ComboBoxOperatorsEnum.descriptions())" - onActionPerformed="amountSearchPanel.refresh(ComboBoxOperatorsEnum.valueOfDescription((String) operatorComboBox.getSelectedItem())); - validate(); repaint()"/> - </cell> - <cell> - <AmountSearchPanel javaBean="amountSearchPanel"/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell> - <JButton id="validSearch" text='lima.common.search' - onActionPerformed="handler.refresh()"/> - </cell> - </row> - <row> <cell fill="both" weightx="1" weighty="1"> <JScrollPane> <FinancialTransactionSearchTableModel Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2013-06-27 13:25:12 UTC (rev 3689) @@ -27,16 +27,24 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.FinancialStatementWayEnum; -import org.chorem.lima.beans.FinancialTransactionSearch; -import org.chorem.lima.beans.FinancialTransactionSearchImpl; +import org.chorem.lima.beans.FinancialTransactionCondition; import org.chorem.lima.business.api.FinancialTransactionService; -import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; +import org.chorem.lima.ui.Filter.AccountCondition.AccountConditionView; +import org.chorem.lima.ui.Filter.BigDecimalCondition.CreditConditionView; +import org.chorem.lima.ui.Filter.BigDecimalCondition.DebitConditionView; +import org.chorem.lima.ui.Filter.ConditionHandler; +import org.chorem.lima.ui.Filter.EntryBookCondition.EntryBookConditionView; +import org.chorem.lima.ui.Filter.StringCondition.DescriptionConditionView; +import org.chorem.lima.ui.Filter.StringCondition.LetteringConditionView; +import org.chorem.lima.ui.Filter.StringCondition.VoucherConditionView; +import org.chorem.lima.ui.Filter.dateCondition.DateConditionView; +import org.chorem.lima.ui.Filter.dateIntervalCondition.DateIntervalConditionView; +import org.chorem.lima.ui.Filter.financialPeriodCondition.FinancialPeriodConditionView; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; +import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionView; +import org.chorem.lima.ui.Filter.fiscalPeriodCondition.FiscalPeriodConditionView; -import java.util.Date; - /** * Handler associated with financial transaction view. * @@ -61,9 +69,6 @@ /** Transaction service. */ protected final FinancialTransactionService financialTransactionService; - /** data cache */ - protected FinancialTransactionSearch financialTransactionSearch; - protected Object clipBoard; protected FinancialTransactionSearchViewHandler(FinancialTransactionSearchView view) { @@ -74,234 +79,69 @@ LimaServiceFactory.getService( FinancialTransactionService.class); - financialTransactionSearch = new FinancialTransactionSearchImpl(); - } - public void setBeginDate(Date beginDate) { - financialTransactionSearch.setBeginDate(beginDate); } - public void setEndDate(Date endDate) { - - if (log.isDebugEnabled()) { - log.debug("End date passed : " + endDate); - } - - financialTransactionSearch.setEndDate(endDate); + protected void addCondition(ConditionHandler conditionHandler) { + FinancialTransactionConditionView filterView = view.getFinancialTransactionConditionView(); + FinancialTransactionConditionHandler handler = filterView.getHandler(); + handler.addCondition(conditionHandler); + view.validate(); + view.repaint(); } - public void setVoucher(String voucher) { - - String result = null; - if (!voucher.equals("")) { - result = voucher; - } - financialTransactionSearch.setVoucher(result); + public void addDateCondition() { + addCondition(new DateConditionView().getHandler()); } - public void setDescription(String description) { - String result = null; - if (!description.equals("")) { - result = description; - } - financialTransactionSearch.setDescription(result); + public void addDateIntervalCondition() { + addCondition(new DateIntervalConditionView().getHandler()); } - public void setLetter(String lettering) { - financialTransactionSearch.setLettering(lettering); + public void addFinancialPeriodCondition() { + addCondition(new FinancialPeriodConditionView().getHandler()); } - public String getLetter() { - return financialTransactionSearch.getLettering(); + public void addFiscalPeriodCondition() { + addCondition(new FiscalPeriodConditionView().getHandler()); } - public String getAccountsList() { - return financialTransactionSearch.getAccountList(); + public void addEntryBookCondition() { + addCondition(new EntryBookConditionView().getHandler()); } - public void setAccountsList(String accountsList) { - String result = null; - if (!accountsList.equals("")) { - result = accountsList; - } - financialTransactionSearch.setAccountList(result); + public void addVoucherCondition() { + addCondition(new VoucherConditionView().getHandler()); } - public Account getAccount() { - return financialTransactionSearch.getAccount(); + public void addDescriptionCondition() { + addCondition(new DescriptionConditionView().getHandler()); } - public void setAccount(Account account) { - financialTransactionSearch.setAccount(account); + public void addLetteringCondition() { + addCondition(new LetteringConditionView().getHandler()); } - public void setEntryBook(EntryBook entryBook) { - financialTransactionSearch.setEntryBook(entryBook); + public void addAccountCondition() { + addCondition(new AccountConditionView().getHandler()); } - - public String getAmount() { - return financialTransactionSearch.getAmount(); + public void addDebitCondition() { + addCondition(new DebitConditionView().getHandler()); } - public void setAmount(String amount) { - String result = null; - if (!amount.equals("")) { - result = amount; - } - financialTransactionSearch.setAmount(result); + public void addCreditCondition() { + addCondition(new CreditConditionView().getHandler()); } - public String getAmount2() { - return financialTransactionSearch.getAmount2(); - } - - public void setAmount2(String amount2) { - String result = null; - if (!amount2.equals("")) { - result = amount2; - } - financialTransactionSearch.setAmount2(result); - } - - public void setAmountWayEnum(FinancialStatementWayEnum amountWayEnum) { - financialTransactionSearch.setAmountWayEnum(amountWayEnum); - } - - public void setOperator(String operator) { - String result = null; - if (!operator.equals("")) { - result = operator; - } - financialTransactionSearch.setOperator(result); - } - - /** - * Delete selected row in table (could be transaction or entry). - * <p/> - * Called by model. - */ - /*public void deleteSelectedRow() { - - table = view.getFinancialTransactionSearchTable(); - tableModel = view.getFinancialTransactionSearchTableModel(); - - int indexSelectedRow = table.getSelectedRow(); - if (indexSelectedRow != -1) { - - Object selectedValue = tableModel.getElementAt(indexSelectedRow); - String message; - if (selectedValue instanceof FinancialTransaction) { - message = _("lima.charts.financialtransaction.question.removetransaction"); - } else { - message = _("lima.charts.financialtransaction.question.removeentry"); - } - - int response = JOptionPane.showConfirmDialog(view, message, - _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION); - - if (response == JOptionPane.YES_OPTION) { - - tableModel.removeObject(selectedValue, indexSelectedRow); - //select the upper line - ListSelectionModel selectionModel = - table.getSelectionModel(); - selectionModel.setSelectionInterval( - indexSelectedRow - 1, indexSelectedRow - 1); - } - } else { - if (log.isWarnEnabled()) { - log.warn("Call delete selected row without selection"); - } - } - } - - - //implement new transaction button - //add a new entry to the selected transaction - public void addEmptyEntry() { - - table = view.getFinancialTransactionSearchTable(); - tableModel = view.getFinancialTransactionSearchTableModel(); - - int indexSelectedRow = table.getSelectedRow(); - if (indexSelectedRow != -1) { - Object selectedValue = tableModel.getElementAt(indexSelectedRow); - //copy + paste the description - String description = (String) tableModel.getValueAt(indexSelectedRow, 4); - int index = tableModel.addEmptyEntry(selectedValue, description, indexSelectedRow); - //select the new line - ListSelectionModel selectionModel = - table.getSelectionModel(); - selectionModel.setSelectionInterval( - indexSelectedRow + 1, indexSelectedRow + 1); - //focus on second column - table.changeSelection(index, 1, false, false); - table.requestFocusInWindow(); - } else { - if (log.isWarnEnabled()) { - log.warn("Call addentry selected transaction without selection"); - } - } - } - - - //copy entry - public void copyRow() { - table = view.getFinancialTransactionSearchTable(); - int indexSelectedRow = table.getSelectedRow(); - - if (indexSelectedRow != -1) { - clipBoard = tableModel.getElementAt(indexSelectedRow); - } - } - - //paste entry - public void pasteRow() { - table = view.getFinancialTransactionSearchTable(); - int indexSelectedRow = table.getSelectedRow(); - - if (indexSelectedRow != -1) { - Object selectedValue = tableModel.getElementAt(indexSelectedRow); - if (clipBoard instanceof Entry) { - int index = tableModel.addEntry(selectedValue, (Entry) clipBoard, indexSelectedRow); - //select the new line - ListSelectionModel selectionModel = - table.getSelectionModel(); - selectionModel.setSelectionInterval( - indexSelectedRow + 1, indexSelectedRow + 1); - //focus on second column - table.changeSelection(index, 1, false, false); - table.requestFocusInWindow(); - } - - } - - } - - - //add a new transaction - public void addFinancialTransaction() { - table = view.getFinancialTransactionSearchTable(); - tableModel = view.getFinancialTransactionSearchTableModel(); - - int index = tableModel.addFinancialTransaction(); - //select the new line - int numberRow = table.getRowCount(); - ListSelectionModel selectionModel = - table.getSelectionModel(); - selectionModel.setSelectionInterval(numberRow - 1, numberRow - 1); - //focus on first column - table.changeSelection(index, 0, false, false); - table.requestFocusInWindow(); - } */ - - public void refresh() { + FinancialTransactionConditionView ConditionView = view.getFinancialTransactionConditionView(); + FinancialTransactionConditionHandler conditionHandler = ConditionView.getHandler(); + FinancialTransactionCondition condition= conditionHandler.getFilter(); tableModel = view.getFinancialTransactionSearchTableModel(); if (tableModel != null) { - tableModel.refresh(financialTransactionSearch); + tableModel.refresh(condition); } } 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 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2013-06-27 13:25:12 UTC (rev 3689) @@ -5,6 +5,13 @@ Piece= lima-business.document.entrybooks= lima-business.document.generalentrybook= +lima.Filter.account= +lima.Filter.amount= +lima.Filter.date= +lima.Filter.description= +lima.Filter.entrybook= +lima.Filter.letter= +lima.Filter.voucher= lima.about.translate.content=<h3>How to translate Lima</h3>You can help us to translate or improve label in Lima.<br/><ul><li>Get the <strong>lima-i18n.csv</strong> file in the <strong>i18n</strong> directory</li><li>open it in Libre office (separator caracter is <strong>Tab</strong>)</li><li>Do you work \:)</li><li>At last, send us back the modified file</li></ul><br/>We will apply the patch before next release. lima.accountsreports.listerror=Can't get entries list lima.action.commandline.help=Show help in console @@ -140,10 +147,22 @@ lima.enum.comboboxperiod.financialperiod=Financial period lima.enum.comboboxperiod.fiscalperiod=Fiscal period lima.enum.comboboxperiod.period=Period +lima.enum.list.entryBook= lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>\:<br/>%s</body></html> +lima.filer.condition.sensitive.case= +lima.filer.condition.string= lima.filter.account= lima.filter.amount= +lima.filter.condition.all= +lima.filter.condition.delete= +lima.filter.condition.one= +lima.filter.credit= lima.filter.date= +lima.filter.date.financial.period= +lima.filter.date.fiscal.period= +lima.filter.date.interval= +lima.filter.date.one= +lima.filter.debit= lima.filter.description= lima.filter.entrybook= lima.filter.letter= @@ -234,6 +253,7 @@ lima.title.about=About Lima... lima.title.about.description=Open sources accounting software lima.title.about.translate=Translate Lima +lima.tooltip.Filter= lima.tooltip.filter=<html>Regular expression \:<br/>- accounts interval i..j <br/>- accounts list i,j,k <br/>- Exclude an account -i</html> lima.tooltip.lettering=<html>Add a letter on many entries <br/>Select many rows with combination ctrl + click</html> lima.ui.account.addaccount= @@ -281,6 +301,8 @@ lima.ui.financialtransaction.buttonnext= lima.ui.financialtransaction.credit= lima.ui.financialtransaction.date= +lima.ui.financialtransaction.date.in= +lima.ui.financialtransaction.date.to= lima.ui.financialtransaction.debit= lima.ui.financialtransaction.description= lima.ui.financialtransaction.entrybook= 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 2013-06-27 13:12:22 UTC (rev 3688) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2013-06-27 13:25:12 UTC (rev 3689) @@ -1,8 +1,5 @@ = -= -Date= -Fitre= -Piece= lima-business.document.entrybooks= lima-business.document.generalentrybook= lima.about.translate.content=<h2>Comment traduire Lima</h2>Vous pouvez nous aider à traduire Lima.<hr/><br/><ul><li>Récupérer le fichier <strong>lima-i18n.csv</strong> dans le répertoire <strong>i18n</strong></li><li>ouvrez le avec un tableur (le caractère séprateur est une Tabultation)</li><li>Traduisez, Améliorer, ...</li><li>Enfin renvoyez-le nous</li></ul><br/>Nous intégrerons vos modifications avant la prochaine version. @@ -139,10 +136,24 @@ lima.enum.comboboxperiod.financialperiod=Période Financière lima.enum.comboboxperiod.fiscalperiod=Exercice lima.enum.comboboxperiod.period=Période +lima.enum.list.entryBook=Journaux +lima.enum.list.financialperiod=Périodes Financières +lima.enum.list.fiscalperiod=Exercices +lima.enum.list.period=Périodes lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html> +lima.filer.condition.sensitive.case=sensible à la case lima.filter.account=Ajouter un filtre sur les comptes lima.filter.amount=Ajouter un filtre sur les montants +lima.filter.condition.all=Valide toutes les conditions +lima.filter.condition.delete=Supprimer la condition +lima.filter.condition.one=Valide au moins une condition +lima.filter.credit=Ajouter un filtre sur les crédits lima.filter.date=Ajouter un filtre sur les dates +lima.filter.date.financial.period=Ajouter un filtre sur la période financière +lima.filter.date.fiscal.period=Ajouter un filtre sur l'exercice +lima.filter.date.interval=Ajouter un filtre sur un interval de dates +lima.filter.date.one=Ajouter un filtre sur une date +lima.filter.debit=Ajouter un filtre sur les débits lima.filter.description=Ajouter un filtre sur les descriptions lima.filter.entrybook=Ajouter un filtre sur les journaux lima.filter.letter=Ajouter un filtre sur les lettres @@ -211,7 +222,7 @@ lima.table.account=Compte lima.table.balance=Solde lima.table.credit=Crédit -lima.table.date= +lima.table.date=Date lima.table.debit=Débit lima.table.debitcredit=Débit et Crédit lima.table.description=Description @@ -232,6 +243,7 @@ lima.title.about=À propos de Lima... lima.title.about.description=Logiciel de comptabilité Libre lima.title.about.translate=traduire Lima +lima.tooltip.Filter= lima.tooltip.filter=<html>Expression régulière \:<br/>- intervalle de compte i..j <br/>- liste de compte i,j,k <br/>- Exclure un compte -i</html> lima.tooltip.lettering=<html>Pour ajouter une lettre à plusieurs écritures <br/>Sélectionner plusieurs lignes avec la combinaison ctrl + click</html> lima.ui.account.addaccount=Nouveau compte @@ -278,7 +290,9 @@ lima.ui.financialtransaction.buttonback=← lima.ui.financialtransaction.buttonnext=→ lima.ui.financialtransaction.credit=Crédit -lima.ui.financialtransaction.date= +lima.ui.financialtransaction.date=Date +lima.ui.financialtransaction.date.in=Date du +lima.ui.financialtransaction.date.to=au lima.ui.financialtransaction.debit=Débit lima.ui.financialtransaction.description=Description lima.ui.financialtransaction.entrybook=Journal Added: trunk/lima-swing/src/main/resources/icons/action-remove-condition.png =================================================================== (Binary files differ) Property changes on: trunk/lima-swing/src/main/resources/icons/action-remove-condition.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
participants (1)
-
Bavencoff@users.chorem.org