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
June 2013
- 3 participants
- 24 discussions
Jenkins build became unstable: lima » Lima :: business #2617
by admin+hudson@codelutin.com 28 Jun '13
by admin+hudson@codelutin.com 28 Jun '13
28 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 17:53:46 +0200 (Thu, 27 Jun 2013)
New Revision: 3693
Url: http://chorem.org/projects/lima/repository/revisions/3693
Log:
correction du sigle diff?\195?\169rent
Modified:
trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties
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 15:40:38 UTC (rev 3692)
+++ trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties 2013-06-27 15:53:46 UTC (rev 3693)
@@ -1,7 +1,7 @@
lima.enum.BigDecimal.operand.equal=\=
lima.enum.BigDecimal.operand.lower=<
lima.enum.BigDecimal.operand.lowerorequal=<\=
-lima.enum.BigDecimal.operand.notequal=\u2260
+lima.enum.BigDecimal.operand.notequal=≠
lima.enum.BigDecimal.operand.upper=>
lima.enum.BigDecimal.operand.upperorequal=>\=
lima.enum.comboboxamount.both=Tous
1
0
r3692 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/financialtransactionsearch resources/icons
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 17:40:38 +0200 (Thu, 27 Jun 2013)
New Revision: 3692
Url: http://chorem.org/projects/lima/repository/revisions/3692
Log:
UI - recherche des transaction : modification des ic?\195?\180nes
Added:
trunk/lima-swing/src/main/resources/icons/action-filter-transaction-credit.png
trunk/lima-swing/src/main/resources/icons/action-filter-transaction-debit.png
trunk/lima-swing/src/main/resources/icons/action-filter-transaction-financial-period.png
trunk/lima-swing/src/main/resources/icons/action-filter-transaction-fiscal-period.png
trunk/lima-swing/src/main/resources/icons/action-filter-transaction-interval.png
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
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 14:49:18 UTC (rev 3691)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2013-06-27 15:40:38 UTC (rev 3692)
@@ -52,17 +52,23 @@
actionIcon='filter-transaction-date'
onActionPerformed="getHandler().addDateCondition()"/>
<JButton toolTipText="lima.filter.date.interval"
- actionIcon='filter-transaction-date'
+ actionIcon='filter-transaction-interval'
onActionPerformed="getHandler().addDateIntervalCondition()"/>
<JButton toolTipText="lima.filter.date.financial.period"
- actionIcon='filter-transaction-date'
+ actionIcon='filter-transaction-financial-period'
onActionPerformed="getHandler().addFinancialPeriodCondition()"/>
<JButton toolTipText="lima.filter.date.fiscal.period"
- actionIcon='filter-transaction-date'
+ actionIcon='filter-transaction-fiscal-period'
onActionPerformed="getHandler().addFiscalPeriodCondition()"/>
+
+ <JToolBar.Separator/>
+
<JButton toolTipText="lima.filter.entrybook"
actionIcon='filter-transaction-entrybook'
onActionPerformed="getHandler().addEntryBookCondition()"/>
+
+ <JToolBar.Separator/>
+
<JButton toolTipText="lima.filter.voucher"
actionIcon='filter-transaction-voucher'
onActionPerformed="getHandler().addVoucherCondition()"/>
@@ -75,11 +81,14 @@
<JButton toolTipText="lima.filter.letter"
actionIcon='filter-transaction-letter'
onActionPerformed="getHandler().addLetteringCondition()"/>
+
+ <JToolBar.Separator/>
+
<JButton toolTipText="lima.filter.debit"
- actionIcon='filter-transaction-amount'
+ actionIcon='filter-transaction-debit'
onActionPerformed="getHandler().addDebitCondition()"/>
<JButton toolTipText="lima.filter.credit"
- actionIcon='filter-transaction-amount'
+ actionIcon='filter-transaction-credit'
onActionPerformed="getHandler().addCreditCondition()"/>
<JToolBar.Separator/>
<JButton toolTipText="{ _("lima.ui.common.refresh") + " (F5)"}" actionIcon='refresh'
Added: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-credit.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-credit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-debit.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-debit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-financial-period.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-financial-period.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-fiscal-period.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-fiscal-period.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-interval.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/icons/action-filter-transaction-interval.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r3691 - in trunk: lima-callao/src/main/java/org/chorem/lima/beans lima-callao/src/main/resources/i18n lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition lima-swing/src/main/java/org/chorem/lima/ui/common
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 16:49:18 +0200 (Thu, 27 Jun 2013)
New Revision: 3691
Url: http://chorem.org/projects/lima/repository/revisions/3691
Log:
gestion des libell?\195?\169s pour les op?\195?\169randes des filtres sur les transaction
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/beans/Labeled.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java
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/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx
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/dateCondition/DateConditionView.jaxx
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java 2013-06-27 14:49:18 UTC (rev 3691)
@@ -34,9 +34,9 @@
this.operand = operand;
}
- public static enum Operand {
+ public static enum Operand implements Labeled {
EQUAL(_("lima.enum.BigDecimal.operand.equal")),
- NOT_EQUAL(_("lima.BigDecimal.date.operand.notequal")),
+ NOT_EQUAL(_("lima.enum.BigDecimal.operand.notequal")),
LOWER(_("lima.enum.BigDecimal.operand.lower")),
LOWER_OR_EQUAL(_("lima.enum.BigDecimal.operand.lowerorequal")),
UPPER(_("lima.enum.BigDecimal.operand.upper")),
@@ -48,6 +48,7 @@
this.label = label;
}
+ @Override
public String getLabel() {
return label;
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java 2013-06-27 14:49:18 UTC (rev 3691)
@@ -44,7 +44,7 @@
this.sensitiveCase = sensitiveCase;
}
- public static enum Operand {
+ public static enum Operand implements Labeled {
EQUAL(_("lima.enum.string.operand.equal")),
NOT_EQUAL(_("lima.string.date.operand.notequal")),
BEGIN(_("lima.enum.string.operand.begin")),
@@ -57,6 +57,7 @@
this.label = label;
}
+ @Override
public String getLabel() {
return label;
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java 2013-06-27 14:49:18 UTC (rev 3691)
@@ -39,7 +39,7 @@
v.visitDateCondition(this);
}
- public static enum Operand {
+ public static enum Operand implements Labeled {
SAME(_("lima.enum.date.operand.same")),
AFTER(_("lima.enum.date.operand.after")),
PREVIOUS(_("lima.enum.date.operand.previous")),
@@ -51,7 +51,7 @@
this.label = label;
}
-
+ @Override
public String getLabel() {
return label;
}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/Labeled.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/Labeled.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/Labeled.java 2013-06-27 14:49:18 UTC (rev 3691)
@@ -0,0 +1,9 @@
+package org.chorem.lima.beans;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface Labeled {
+
+ public String getLabel();
+}
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:37:16 UTC (rev 3690)
+++ trunk/lima-callao/src/main/resources/i18n/lima-callao_en_GB.properties 2013-06-27 14:49:18 UTC (rev 3691)
@@ -2,6 +2,7 @@
lima.enum.BigDecimal.operand.equal=
lima.enum.BigDecimal.operand.lower=
lima.enum.BigDecimal.operand.lowerorequal=
+lima.enum.BigDecimal.operand.notequal=
lima.enum.BigDecimal.operand.upper=
lima.enum.BigDecimal.operand.upperorequal=
lima.enum.comboboxamount.both=All
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:37:16 UTC (rev 3690)
+++ trunk/lima-callao/src/main/resources/i18n/lima-callao_fr_FR.properties 2013-06-27 14:49:18 UTC (rev 3691)
@@ -1,9 +1,9 @@
-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.BigDecimal.operand.equal=\=
+lima.enum.BigDecimal.operand.lower=<
+lima.enum.BigDecimal.operand.lowerorequal=<\=
+lima.enum.BigDecimal.operand.notequal=\u2260
+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
Modified: 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 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/BigDecimalCondition/BigDecimalConditionView.jaxx 2013-06-27 14:49:18 UTC (rev 3691)
@@ -32,6 +32,7 @@
org.chorem.lima.beans.AbstractBigDecimalCondition
jaxx.runtime.swing.editor.NumberEditor
java.math.BigDecimal
+ org.chorem.lima.ui.common.LabelListCellRenderer
</import>
<BigDecimalConditionHandler id="handler"
@@ -49,6 +50,7 @@
<cell>
<JComboBox id="operandComboBox"
model="{new DefaultComboBoxModel(AbstractBigDecimalCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
selectedItem="{handler.getOperand()}"
onItemStateChanged="handler.operandSelected(event)"/>
</cell>
Modified: 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 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/StringCondition/StringConditionView.jaxx 2013-06-27 14:49:18 UTC (rev 3691)
@@ -30,6 +30,7 @@
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
org.chorem.lima.beans.AbstractStringCondition
+ org.chorem.lima.ui.common.LabelListCellRenderer
</import>
<StringConditionHandler id="handler"
@@ -47,6 +48,7 @@
<cell>
<JComboBox id="operandComboBox"
model="{new DefaultComboBoxModel(AbstractStringCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
selectedItem="{handler.getOperand()}"
onItemStateChanged="handler.operandSelected(event)"/>
</cell>
Modified: 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 2013-06-27 13:37:16 UTC (rev 3690)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx 2013-06-27 14:49:18 UTC (rev 3691)
@@ -30,6 +30,7 @@
javax.swing.text.Document
javax.swing.DefaultComboBoxModel
org.chorem.lima.beans.DateCondition
+ org.chorem.lima.ui.common.LabelListCellRenderer
</import>
<DateConditionHandler id="handler"
javaBean="new DateConditionHandler(this)"/>
@@ -46,6 +47,7 @@
<cell>
<JComboBox id="operandComboBox"
model="{new DefaultComboBoxModel(DateCondition.Operand.values())}"
+ renderer="{new LabelListCellRenderer()}"
selectedItem="{handler.getOperand()}"
onItemStateChanged="handler.operandSelected(event)"/>
</cell>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/LabelListCellRenderer.java 2013-06-27 14:49:18 UTC (rev 3691)
@@ -0,0 +1,26 @@
+package org.chorem.lima.ui.common;
+
+import org.chorem.lima.beans.Labeled;
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
+import java.awt.*;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class LabelListCellRenderer extends BasicComboBoxRenderer {
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+
+ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+
+ if (value instanceof Labeled) {
+ setText(((Labeled) value).getLabel());
+ }
+
+ return this;
+ }
+
+}
1
0
r3690 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 15:37:16 +0200 (Thu, 27 Jun 2013)
New Revision: 3690
Url: http://chorem.org/projects/lima/repository/revisions/3690
Log:
Suppression du code mort suite ?\195?\160 la modification de la recherche de transaction
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchComboBox.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,99 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.ui.combobox.AccountComboBoxModel;
-import org.chorem.lima.ui.common.AccountListRenderer;
-import org.chorem.lima.util.AccountToString;
-import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-
-import javax.swing.JComboBox;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-public class AccountSearchComboBox extends JComboBox implements KeyListener {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log =
- LogFactory.getLog(AccountSearchComboBox.class);
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public AccountSearchComboBox(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- AccountComboBoxModel accountComboBoxModel = new AccountComboBoxModel();
- AccountListRenderer accountRenderer = new AccountListRenderer();
- setModel(accountComboBoxModel);
- setRenderer(accountRenderer);
- setEditable(true);
- AutoCompleteDecorator.decorate(this, AccountToString.getInstance());
- getEditor().getEditorComponent().addKeyListener(this);
- addActionListener(this);
- }
-
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Object object = getSelectedItem();
- if (object instanceof Account) {
- handler.setAccount((Account) getSelectedItem());
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
-
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- Object object = getSelectedItem();
- if (object instanceof Account) {
- Account account = (Account) getSelectedItem();
- //to prevent useless call to service
- if (!account.equals(handler.getAccount())) {
- handler.setAccount(account);
- }
-
- }
-
- // delegate popup list menu
- if (e.getKeyChar() == KeyEvent.VK_ENTER) {
- firePopupMenuCanceled();
- }
- }
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AccountSearchPanel.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,96 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.chorem.lima.entity.Account;
-import org.chorem.lima.enums.ComboBoxAccountsEnum;
-
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-import static org.nuiton.i18n.I18n._;
-
-public class AccountSearchPanel extends JPanel {
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public AccountSearchPanel(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- }
-
- public void refresh(ComboBoxAccountsEnum comboBoxAccountsEnum) {
-
- switch (comboBoxAccountsEnum) {
- case ALL:
- handler.setAccount(null);
- handler.refresh();
- removeAll();
- break;
-
- case ACCOUNT:
- AccountSearchComboBox accountComboBox = new AccountSearchComboBox(handler);
- handler.setAccount((Account) accountComboBox.getSelectedItem());
- handler.refresh();
- removeAll();
- add(accountComboBox);
- break;
-
- case ACCOUNT_LIST:
- final JTextField accountsList = new JTextField(16);
- accountsList.setMinimumSize(accountsList.getPreferredSize());
- accountsList.setToolTipText(_("lima.tooltip.filter"));
- KeyListener accountsListKeyListener = new KeyListener() {
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- String accounts = accountsList.getText();
- //to prevent useless call to service
- if (!accounts.equals(handler.getAccountsList())) {
- handler.setAccountsList(accounts);
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
- accountsList.addKeyListener(accountsListKeyListener);
- handler.setAccountsList(accountsList.getText());
- handler.setAccount(null);
- removeAll();
- add(accountsList);
- break;
- }
-
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/AmountSearchPanel.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,108 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.chorem.lima.enums.ComboBoxOperatorsEnum;
-
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-public class AmountSearchPanel extends JPanel {
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public AmountSearchPanel(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- refresh(ComboBoxOperatorsEnum.EQUAL);
- }
-
- static final long serialVersionUID = 1L;
-
- public void refresh(ComboBoxOperatorsEnum enums) {
-
- final JTextField amountTextField = new JTextField(16);
- amountTextField.setMinimumSize(amountTextField.getPreferredSize());
- KeyListener amountKeyListener = new KeyListener() {
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- String amount = amountTextField.getText();
- //to prevent useless call to service
- if (!amount.equals(handler.getAmount())) {
- handler.setAmount(amount);
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
- amountTextField.addKeyListener(amountKeyListener);
- handler.setAmount2("");
- handler.setOperator(enums.getSymbol());
- handler.refresh();
- removeAll();
- add(amountTextField);
-
- switch (enums) {
- case INTERVAL:
- final JTextField amount2TextField = new JTextField(16);
- amount2TextField.setMinimumSize(amount2TextField.getPreferredSize());
- KeyListener amount2KeyListener = new KeyListener() {
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
-
- String amount2 = amount2TextField.getText();
- //to prevent useless call to service
- if (!amount2.equals(handler.getAmount2())) {
- handler.setAmount2(amount2);
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
- amount2TextField.addKeyListener(amount2KeyListener);
- handler.setAmount("");
- add(amount2TextField);
- break;
- }
- amountTextField.setText(handler.getAmount());
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchComboBox.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,96 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.EntryBookComboBoxModel;
-import org.chorem.lima.util.EntryBookToString;
-import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-
-import javax.swing.JComboBox;
-import javax.swing.ListCellRenderer;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-public class EntryBookSearchComboBox extends JComboBox implements KeyListener {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log =
- LogFactory.getLog(EntryBookSearchComboBox.class);
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public EntryBookSearchComboBox(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- EntryBookComboBoxModel entryBookComboBoxModel = new EntryBookComboBoxModel();
- ListCellRenderer renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class);
- setModel(entryBookComboBoxModel);
- setRenderer(renderer);
- setEditable(true);
- AutoCompleteDecorator.decorate(this, EntryBookToString.getInstance());
- getEditor().getEditorComponent().addKeyListener(this);
- addActionListener(this);
- }
-
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Object object = getSelectedItem();
- if (object instanceof EntryBook) {
- handler.setEntryBook((EntryBook) getSelectedItem());
- }
- }
-
-
- @Override
- public void keyPressed(KeyEvent e) {
-
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- Object object = getSelectedItem();
- if (object instanceof EntryBook) {
- handler.setEntryBook((EntryBook) getSelectedItem());
- }
- // delegate popup list menu
- if (e.getKeyChar() == KeyEvent.VK_ENTER) {
- firePopupMenuCanceled();
- }
- }
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/EntryBookSearchPanel.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,58 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.chorem.lima.enums.ComboBoxEntryBooksEnum;
-
-import javax.swing.JPanel;
-
-public class EntryBookSearchPanel extends JPanel {
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public EntryBookSearchPanel(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- }
-
- public void refresh(ComboBoxEntryBooksEnum enums) {
-
- switch (enums) {
- case SELECT_ONE:
- EntryBookSearchComboBox entryBookSearchComboBox = new EntryBookSearchComboBox(handler);
- handler.setEntryBook(null);
- removeAll();
- add(entryBookSearchComboBox);
- break;
-
- case ALL:
- handler.setEntryBook(null);
- removeAll();
- break;
- }
-
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,190 +0,0 @@
-/*
- * #%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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.FinancialPeriod;
-import org.chorem.lima.entity.FiscalPeriod;
-import org.chorem.lima.enums.ComboBoxPeriodEnum;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.jdesktop.swingx.JXDatePicker;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.ListCellRenderer;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-public class FinancialTransactionPeriodSearchPanel extends JPanel {
-
- private static final Log log = LogFactory.getLog(FinancialTransactionPeriodSearchPanel.class);
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public FinancialTransactionPeriodSearchPanel(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
-
- //init date
- refresh(ComboBoxPeriodEnum.PERIOD);
- }
-
- public void refresh(ComboBoxPeriodEnum comboBoxPeriodEnum) {
-
- switch (comboBoxPeriodEnum) {
- case DATE:
- Calendar calendar = Calendar.getInstance();
- Date date = calendar.getTime();
- date = DateUtils.truncate(date, Calendar.DATE);
- final JXDatePicker datePicker = new JXDatePicker(date);
- PropertyChangeListener datePCListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- handler.setBeginDate(datePicker.getDate());
- handler.setEndDate(datePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(datePicker.getDate());
- handler.setEndDate(datePicker.getDate());
- handler.refresh();
- datePicker.addPropertyChangeListener(datePCListener);
- removeAll();
- add(datePicker);
- break;
-
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- PropertyChangeListener beginDatePCListener = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addPropertyChangeListener(beginDatePCListener);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- PropertyChangeListener endDatePCListener = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addPropertyChangeListener(endDatePCListener);
-
- if (log.isDebugEnabled()) {
- log.debug("Begin date : " + beginDate);
- log.debug("End date : " + endDate);
- }
-
- handler.refresh();
-
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel();
- ListCellRenderer renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(renderer);
-
- fiscalPeriod.setEditable(false);
-
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- if (log.isDebugEnabled()) {
- log.debug("Refreshing with this Fiscal period : " + fPeriod.getBeginDate() + " - " + fPeriod.getEndDate());
- }
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
- removeAll();
- add(fiscalPeriod);
-
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel();
- ListCellRenderer rendererFinancialPeriod =
- LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(rendererFinancialPeriod);
- financialPeriod.setEditable(false);
-
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
- }
-
- }
-
-}
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:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2013-06-27 13:37:16 UTC (rev 3690)
@@ -45,23 +45,6 @@
javaBean="new FinancialTransactionSearchViewHandler(this)"/>
<Boolean id="selectedRow" javaBean="false"/>
<Dimension id="fieldSize" javaBean="new java.awt.Dimension()"/>
- <!--script>
- <![CDATA[
- AccountSearchPanel accountSearchPanel = new AccountSearchPanel(handler);
- AmountSearchPanel amountSearchPanel = new AmountSearchPanel(handler);
- EntryBookSearchPanel entryBookSearchPanel = new EntryBookSearchPanel(handler);
- LetterSearchPanel letterSearchPanel = new LetterSearchPanel(handler);
- FinancialTransactionPeriodSearchPanel periodSearchPanel = new FinancialTransactionPeriodSearchPanel(handler);
-
- void $afterCompleteSetup() {
- handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription(
- (String) getAmountComboBox().getSelectedItem()));
- handler.setOperator(ComboBoxOperatorsEnum.valueOfDescription(
- (String) getOperatorComboBox().getSelectedItem()).getSymbol());
- }
-
- ]]>
- </script-->
<row>
<cell fill="both">
<JToolBar floatable="false">
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,104 +0,0 @@
-package org.chorem.lima.ui.financialtransactionsearch;
-/*
- * #%L
- * Lima :: Swing
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 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.ui.combobox.LetterComboBoxModel;
-import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
-
-import javax.swing.JComboBox;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-/**
- * Date: 13/08/12
- *
- * @author mallon <mallon(a)codelutin.com>
- * @since 0.6-alpha-2
- */
-public class LetterSearchComboBox extends JComboBox implements KeyListener {
-
- private static final long serialVersionUID = 1L;
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public LetterSearchComboBox(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
- setModel(letterComboBoxModel);
- setEditable(true);
- ObjectToStringConverter objectToStringConverter = new ObjectToStringConverter() {
- @Override
- public String getPreferredStringForItem(Object item) {
- String result = null;
- if (item != null) {
- if (item instanceof String) {
- result = item.toString();
- }
- }
- return result;
- }
- };
- AutoCompleteDecorator.decorate(this, objectToStringConverter);
- getEditor().getEditorComponent().addKeyListener(this);
- addActionListener(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Object object = getSelectedItem();
- if (object instanceof String) {
- handler.setLetter((String) getSelectedItem());
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
-
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- Object object = getSelectedItem();
- if (object instanceof String) {
- String letter = (String) getSelectedItem();
- //to prevent useless call to service
- if (!letter.equals(handler.getLetter())) {
- handler.setLetter(letter);
- }
-
- }
-
- // delegate popup list menu
- if (e.getKeyChar() == KeyEvent.VK_ENTER) {
- firePopupMenuCanceled();
- }
- }
-
- @Override
- public void keyTyped(KeyEvent e) {
-
- }
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2013-06-27 13:25:12 UTC (rev 3689)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchPanel.java 2013-06-27 13:37:16 UTC (rev 3690)
@@ -1,62 +0,0 @@
-/*
- * #%L
- * Lima Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric
- * %%
- * 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%
- */
-
-package org.chorem.lima.ui.financialtransactionsearch;
-
-import org.chorem.lima.enums.ComboBoxLetterEnum;
-
-import javax.swing.JPanel;
-
-public class LetterSearchPanel extends JPanel {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 7682668138031148237L;
-
- protected FinancialTransactionSearchViewHandler handler;
-
- public LetterSearchPanel(FinancialTransactionSearchViewHandler handler) {
- this.handler = handler;
- }
-
- public void refresh(ComboBoxLetterEnum comboBoxEnum) {
-
- switch (comboBoxEnum) {
- case ALL:
- handler.setLetter(null);
- handler.refresh();
- removeAll();
- break;
-
- case SELECT_ONE:
- LetterSearchComboBox comboBox = new LetterSearchComboBox(handler);
- removeAll();
- add(comboBox);
- break;
-
- }
-
- }
-
-}
1
0
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(a)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/li… $
+ %%
+ 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(a)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/li… $
+ %%
+ 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(a)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(a)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(a)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(a)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(a)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(a)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/li… $
+ %%
+ 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(a)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(a)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(a)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(a)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(a)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/li… $
+ %%
+ 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(a)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(a)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(a)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/li… $
+ %%
+ 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(a)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/li… $
+ %%
+ 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(a)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/li… $
+ %%
+ 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(a)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(a)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/li… $
+ %%
+ 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
1
0
r3688 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-callao/src/main/java/org/chorem/lima/entity
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 15:12:22 +0200 (Thu, 27 Jun 2013)
New Revision: 3688
Url: http://chorem.org/projects/lima/repository/revisions/3688
Log:
Modification dans les service du syst?\195?\168me de recherche avec filtre
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/GeneratorHQuery.java
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2013-06-27 13:08:13 UTC (rev 3687)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2013-06-27 13:12:22 UTC (rev 3688)
@@ -27,7 +27,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.beans.FinancialTransactionSearch;
+import org.chorem.lima.Filter.FilterGenerator;
+import org.chorem.lima.Filter.FinancialTransactionFilter;
+import org.chorem.lima.beans.FinancialTransactionCondition;
import org.chorem.lima.beans.LetteringFilter;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.LimaConfig;
@@ -40,7 +42,6 @@
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.business.utils.LetteringComparator;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
@@ -614,22 +615,18 @@
}
@Override
- public List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch) throws LimaException {
+ public List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionCondition financialTransactionCondition) throws LimaException {
List<FinancialTransaction> result;
- try {
- // first search on account dao
- String accountsList = financialTransactionSearch.getAccountList();
- List<Account> accounts = null;
- if (accountsList != null) {
- AccountDAO accountDAO = getDaoHelper().getAccountDAO();
- accounts = accountDAO.stringToListAccounts(accountsList, false);
- }
+ FilterGenerator generator = new FilterGenerator();
+ financialTransactionCondition.accept(generator);
+ FinancialTransactionFilter filter = generator.getFilter();
+
+ try {
// next on financial transaction dao
FinancialTransactionDAO financialTransactionDAO = getDaoHelper().getFinancialTransactionDAO();
- result = financialTransactionDAO.searchFinancialTransaction(
- financialTransactionSearch, accounts);
+ result = financialTransactionDAO.searchFinancialTransaction(filter);
} catch (Exception ex) {
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2013-06-27 13:08:13 UTC (rev 3687)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2013-06-27 13:12:22 UTC (rev 3688)
@@ -25,7 +25,7 @@
package org.chorem.lima.business.api;
-import org.chorem.lima.beans.FinancialTransactionSearch;
+import org.chorem.lima.beans.FinancialTransactionCondition;
import org.chorem.lima.beans.LetteringFilter;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Entry;
@@ -68,7 +68,7 @@
List<FinancialTransaction> getAllFinancialTransactions(FiscalPeriod period) throws LimaException;
- List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch) throws LimaException;
+ List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionCondition financialTransactionFilter) throws LimaException;
Entry createEntry(Entry entry) throws LimaException;
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2013-06-27 13:08:13 UTC (rev 3687)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2013-06-27 13:12:22 UTC (rev 3688)
@@ -25,18 +25,12 @@
package org.chorem.lima.entity;
-import org.apache.commons.collections.CollectionUtils;
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.Filter.Filter;
import org.hibernate.HibernateException;
import org.nuiton.topia.TopiaException;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.text.ParsePosition;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -271,145 +265,31 @@
/**
* Search financial transaction.
*
- * @param financialTransactionSearch search parameters
- * @param accounts search accounts
+ *
+ * @param filter filter parameters
* @return financial transaction
* @throws TopiaException
*/
- public List<FinancialTransaction> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch,
- List<Account> accounts) throws TopiaException {
- String query = "SELECT distinct T FROM " + FinancialTransaction.class.getName() + " T"+
- " JOIN T.entry AS E" +
- " WHERE 1=1 "; // to not manage first where in all condition
+ public List<FinancialTransaction> searchFinancialTransaction(Filter filter) throws TopiaException {
- List<Object> args = new ArrayList<Object>();
-
- // dates
- Date beginDate = financialTransactionSearch.getBeginDate();
- Date endDate = financialTransactionSearch.getEndDate();
- if (beginDate != null && endDate != null) {
- query += " AND (:beginDate <= T.transactionDate" +
- " AND T.transactionDate <= :endDate)";
- args.add("beginDate");
- args.add(beginDate);
- args.add("endDate");
- args.add(endDate);
+ GeneratorHQuery generator = new GeneratorHQuery();
+ filter.accept(generator);
- if (log.isDebugEnabled()) {
- log.debug("Begin date :" + beginDate);
- log.debug("End date :" + endDate);
- }
- } else if (beginDate != null) {
- query += " AND :beginDate = T.transactionDate";
- args.add(beginDate);
- args.add("beginDate");
- }
+ String query = generator.getHQuery();
+ List<Object> arguments = generator.getArguments();
- // voucher
- String voucher = financialTransactionSearch.getVoucher();
- if (voucher != null) {
- query += " AND E.voucher LIKE :voucher";
- args.add("voucher");
- args.add("%" + voucher + "%");
- }
-
- // description
- String description = financialTransactionSearch.getDescription();
- if (description != null) {
- query += " AND E.description LIKE :description";
- args.add("description");
- args.add("%" + description + "%");
- }
-
- // letter
- String lettering = financialTransactionSearch.getLettering();
- if (lettering != null) {
- query += " AND E.lettering = :lettering";
- args.add("lettering");
- args.add(lettering);
- if (log.isDebugEnabled()) {
- log.debug("Lettering filter : -" + lettering + "-");
- }
- }
-
- // accounts
- Account account = financialTransactionSearch.getAccount();
- //String accountsList = financialTransactionSearch.getAccountList();
- if (account != null) {
- query += " AND E.account = :account";
- args.add("account");
- args.add(account);
- } else if (CollectionUtils.isNotEmpty(accounts)) {
- StringBuffer accountNumbers = new StringBuffer();
- for (int i = 0; i < accounts.size(); i++) {
- accountNumbers.append(accounts.get(i - 1).getAccountNumber());
- if (i < accounts.size() - 1) {
- accountNumbers.append(",");
- }
- }
- if (accounts.size() > 0) {
- query += " AND E.accountNumber in (" + accountNumbers + ")";
- }
-
- }
-
- // entry book
- EntryBook entryBook = financialTransactionSearch.getEntryBook();
- if (entryBook != null) {
- query += " AND T." + FinancialTransaction.PROPERTY_ENTRY_BOOK + " = :entryBook";
- args.add("entryBook");
- args.add(entryBook);
- }
-
- // amounts
- String amount = financialTransactionSearch.getAmount();
- String amount2 = financialTransactionSearch.getAmount2();
- String operator = financialTransactionSearch.getOperator();
- FinancialStatementWayEnum fStWayEnum = financialTransactionSearch.getAmountWayEnum();
- if (amount != null) {
- DecimalFormat decimalFormat = new DecimalFormat();
- BigDecimal amountBigDecimal = new BigDecimal(decimalFormat.parse(amount, new ParsePosition(0)).toString());
- if (log.isDebugEnabled()) {
- log.debug("Value of first amount : " + amount);
- log.debug("Value of first amount - BigDecimal : " + amountBigDecimal);
- }
- if (amount2 != null) {
- BigDecimal secondAmountBigDecimal = new BigDecimal(decimalFormat.parse(amount2, new ParsePosition(0)).toString());
- if (log.isDebugEnabled()) {
- log.debug("Value of second amount : " + secondAmountBigDecimal);
- }
- query += " AND :amount <= E.amount AND E.amount <= :amount2";
- args.add("amount");
- args.add(amountBigDecimal);
- args.add("amount2");
- args.add(secondAmountBigDecimal);
- } else if (operator != null) {
- if (log.isDebugEnabled()) {
- log.debug("Value of first amount - BigDecimal, where operator not null : " + amountBigDecimal);
- }
- query += " AND E.amount " + operator + " :amount";
- args.add("amount");
- args.add(amountBigDecimal);
- }
- switch (fStWayEnum) {
- case CREDIT:
- query += " AND E.debit = false";
- break;
- case DEBIT:
- query += " AND E.debit = true";
- break;
- }
- }
-
- query += " order by T.transactionDate desc";
-
if (log.isDebugEnabled()) {
- log.debug("Generated query : " + query);
+ log.debug("Query : \n" + query + "\nArguments: " + arguments);
}
// perform query
- List<FinancialTransaction> result = context.findAll(query, args.toArray());
+ List<FinancialTransaction> result;
+ if (arguments.isEmpty()) {
+ result = context.findAll(query);
+ } else {
+ result = context.findAll(query, arguments.toArray());
+ }
if (log.isDebugEnabled()) {
log.debug("Number of founded transactions : " + result.size());
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/GeneratorHQuery.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/GeneratorHQuery.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/GeneratorHQuery.java 2013-06-27 13:12:22 UTC (rev 3688)
@@ -0,0 +1,333 @@
+package org.chorem.lima.entity;
+
+import org.chorem.lima.Clause.AndClause;
+import org.chorem.lima.Clause.BooleanClause;
+import org.chorem.lima.Clause.Clause;
+import org.chorem.lima.Clause.DateClause;
+import org.chorem.lima.Clause.NotClause;
+import org.chorem.lima.Clause.NumberClause;
+import org.chorem.lima.Clause.OrClause;
+import org.chorem.lima.Clause.SetClause;
+import org.chorem.lima.Clause.StringClause;
+import org.chorem.lima.Clause.SubFilterClause;
+import org.chorem.lima.Clause.VisitorClause;
+import org.chorem.lima.Filter.AccountFilter;
+import org.chorem.lima.Filter.EntryBookFilter;
+import org.chorem.lima.Filter.EntryFilter;
+import org.chorem.lima.Filter.Filter;
+import org.chorem.lima.Filter.FinancialTransactionFilter;
+import org.chorem.lima.Filter.VisitorFilter;
+
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class GeneratorHQuery implements VisitorFilter, VisitorClause {
+
+ protected String fromClause;
+
+ protected String whereClause;
+
+ protected Map<String, Object> parameters;
+
+ protected Map<String, Integer> parametersCount;
+
+ protected Map<Filter, String> aliasMap;
+
+ protected Map<String, Integer> aliasCount;
+
+ protected Deque<String> fromClauseStack;
+ protected Deque<String> whereClauseStak;
+
+ protected Deque<Filter> filterStack;
+
+ public GeneratorHQuery() {
+ fromClause = "";
+ whereClause = "";
+ parameters = new HashMap<String, Object>();
+ parametersCount = new HashMap<String, Integer>();
+ aliasMap = new HashMap<Filter, String>();
+ aliasCount = new HashMap<String, Integer>();
+ filterStack = new LinkedList<Filter>();
+ fromClauseStack = new LinkedList<String>();
+ whereClauseStak = new LinkedList<String>();
+ }
+
+ protected String addParameter(Object value) {
+ String type = value.getClass().getSimpleName();
+ Integer count;
+ if (parametersCount.containsKey(type)) {
+ count = parametersCount.get(type);
+ count++;
+ } else {
+ count = 1;
+ }
+ parametersCount.put(type, count);
+ String parameter = type + "_" + count;
+ parameters.put(parameter, value);
+ return type + "_" + count;
+ }
+
+ protected String newAlias(Filter filter) {
+ String name = filter.getEntityClass().getSimpleName();
+ Integer count;
+ if (aliasCount.containsKey(name)) {
+ count = aliasCount.get(name);
+ count++;
+ } else {
+ count = 1;
+ }
+ aliasCount.put(name, count);
+ String alias = name + count;
+ aliasMap.put(filter, alias);
+ return alias;
+ }
+
+ public List<Object> getArguments() {
+ List<Object> result = new ArrayList<Object>();
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ result.add(entry.getKey());
+ result.add(entry.getValue());
+ }
+ return result;
+ }
+
+ public String getHQuery() {
+ return fromClause + whereClause;
+ }
+
+ protected void visitFilter(Filter filter) {
+ String alias = newAlias(filter);
+ if (fromClause.isEmpty()) {
+ fromClause = "SELECT DISTINCT " + alias;
+ fromClause += "\nFROM " + filter.getEntityClass().getName() + " AS " + alias;
+ if (filter.getClause() != null) {
+ whereClause = "\nWHERE ";
+ }
+ } else {
+ fromClause += " AS " + alias;
+ }
+ if (filter.getClause() != null) {
+ filterStack.addFirst(filter);
+ filter.getClause().accept(this);
+ filterStack.removeFirst();
+ }
+ }
+
+ @Override
+ public void visitAccountFilter(AccountFilter accountFilter) {
+ visitFilter(accountFilter);
+ }
+
+ @Override
+ public void visitEntryBookFilter(EntryBookFilter entryBookFilter) {
+ visitFilter(entryBookFilter);
+ }
+
+ @Override
+ public void visitEntryFilter(EntryFilter entryFilter) {
+ visitFilter(entryFilter);
+ }
+
+ @Override
+ public void visitFinancialTransactionFilter(FinancialTransactionFilter financialTransactionFilter) {
+ visitFilter(financialTransactionFilter);
+ }
+
+ @Override
+ public void visitDateClause(DateClause dateClause) {
+ String parameter = addParameter(dateClause.getValue());
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+ String operand = " = " ;
+ switch (dateClause.getOperand()) {
+ case SAME:
+ operand = " = ";
+ break;
+ case PREVIOUS:
+ operand = " <= ";
+ break;
+ case AFTER:
+ operand = " >= ";
+ break;
+ case DIFFERENT:
+ operand = " != ";
+ break;
+ }
+ whereClause += alias + "." + dateClause.getProperty() + operand + ":" + parameter;
+ }
+
+ @Override
+ public void visitAndClause(AndClause andClause) {
+ boolean first = true;
+ whereClause += "(";
+ for (Clause clause: andClause) {
+ if (first) {
+ first = false;
+ } else {
+ whereClause += "\nAND ";
+ }
+ clause.accept(this);
+ }
+ whereClause += ")";
+ }
+
+ @Override
+ public void visitBooleanClause(BooleanClause booleanClause) {
+ String parameter = addParameter(true);
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+ whereClause += alias + "." + booleanClause.getProperty() + " = :" + parameter;
+ }
+
+ @Override
+ public void visitNumberClause(NumberClause numberClause) {
+ String parameter = addParameter(numberClause.getValue());
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+ String operand = " = " ;
+ switch (numberClause.getOperand()) {
+ case EQUAL:
+ operand = " = ";
+ break;
+ case NOT_EQUAL:
+ operand = " != ";
+ break;
+ case LOWER:
+ operand = " < ";
+ break;
+ case LOWER_OR_EQUAL:
+ operand = " <= ";
+ break;
+ case UPPER:
+ operand = " > ";
+ break;
+ case UPPER_OR_EQUAL:
+ operand = " >= ";
+ break;
+ }
+ whereClause += alias + "." + numberClause.getProperty() + operand + ":" + parameter;
+ }
+
+ @Override
+ public void visitOrClause(OrClause orClause) {
+ boolean first = true;
+ whereClause += "(";
+ for (Clause clause: orClause) {
+ if (first) {
+ first = false;
+ } else {
+ whereClause += "\nOR ";
+ }
+ clause.accept(this);
+ }
+ whereClause += ")";
+ }
+
+ @Override
+ public void visitNotClause(NotClause notClause) {
+ whereClause += "NOT ";
+ Clause clause = notClause.getClause();
+ clause.accept(this);
+ }
+
+ @Override
+ public void visitSetClause(SetClause setClause) {
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+ String operand = " = " ;
+ switch (setClause.getOperand()) {
+ case IN:
+ operand = " IN ";
+ break;
+ case NOT_IN:
+ operand = " NOT IN ";
+ break;
+ }
+ whereClause += alias + "." + setClause.getProperty() + operand + "(";
+
+ boolean first = true;
+ for (Object object : setClause) {
+ if (first) {
+ first = false;
+ } else {
+ whereClause += ", ";
+ }
+ String parameter = addParameter(object);
+ whereClause += ":" + parameter;
+ }
+ whereClause += ")";
+ }
+
+ @Override
+ public void visitStringClause(StringClause stringClause) {
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+ String operand = " = " ;
+ String value = stringClause.getValue();
+ switch (stringClause.getOperand()) {
+ case EQUAL:
+ operand = " = ";
+ value = stringClause.getValue();
+ break;
+ case NOT_EQUAL:
+ operand = " != ";
+ value = stringClause.getValue();
+ break;
+ case BEGIN:
+ operand = " LIKE ";
+ value = stringClause.getValue() + "%";
+ break;
+ case ENDING:
+ operand = " LIKE ";
+ value = "%" + stringClause.getValue();
+ break;
+ case CONTAIN:
+ operand = " LIKE ";
+ value = "%" + stringClause.getValue()+ "%";
+ break;
+ }
+ if (stringClause.isSensitiveCase()) {
+ whereClause += alias + "." + stringClause.getProperty() + operand + "'" + value + "'";
+ } else {
+ whereClause += "lower(" + alias + "." + stringClause.getProperty() + ")" + operand + "'" + value.toLowerCase() + "'";
+ }
+ }
+
+ @Override
+ public void visitSubFilterClause(SubFilterClause subFilterClause) {
+ Filter filter = filterStack.peek();
+ String alias = aliasMap.get(filter);
+
+ Filter subFilter;
+ switch (subFilterClause.getMultiplicity()) {
+ case ONE:
+ fromClauseStack.addFirst(fromClause);
+ fromClause = "";
+ whereClauseStak.addFirst(whereClause);
+ whereClause = "";
+
+ subFilter = subFilterClause.getSubFilter();
+ subFilter.accept(this);
+
+ String clause = alias + "." + subFilterClause.getProperty() +
+ " IN (" + fromClause + whereClause + ")";
+
+ fromClause = fromClauseStack.removeFirst();
+ whereClause = whereClauseStak.removeFirst() + clause;
+ break;
+ case MANY:
+ fromClause += "\nLEFT JOIN " + alias + "." + subFilterClause.getProperty();
+ subFilter = subFilterClause.getSubFilter();
+ subFilter.accept(this);
+ break;
+ }
+ }
+
+}
1
0
r3687 - in trunk/lima-callao/src/main/java/org/chorem/lima: . Clause Filter
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 15:08:13 +0200 (Thu, 27 Jun 2013)
New Revision: 3687
Url: http://chorem.org/projects/lima/repository/revisions/3687
Log:
Classes d?\195?\169ffinissants les filtres sur les entit?\195?\169s m?\195?\169tiers
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/AndClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/BooleanClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/Clause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/DateClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NotClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NumberClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/OrClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SetClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/StringClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SubFilterClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Clause/VisitorClause.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AbstractFilter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AccountFilter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryBookFilter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryFilter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/Filter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FilterGenerator.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FinancialTransactionFilter.java
trunk/lima-callao/src/main/java/org/chorem/lima/Filter/VisitorFilter.java
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/AndClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/AndClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/AndClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,14 @@
+package org.chorem.lima.Clause;
+
+import java.util.ArrayList;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class AndClause extends ArrayList<Clause> implements Clause {
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitAndClause(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/BooleanClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/BooleanClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/BooleanClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,26 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class BooleanClause implements Clause {
+
+ protected String property;
+
+ public BooleanClause(String property) {
+ this.property = property;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitBooleanClause(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/Clause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/Clause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/Clause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,11 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface Clause {
+
+ public void accept(VisitorClause v);
+
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/DateClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/DateClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/DateClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,57 @@
+package org.chorem.lima.Clause;
+
+import java.util.Date;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class DateClause implements Clause {
+
+ protected String property;
+
+ protected Date value;
+
+ protected Operand operand;
+
+ public DateClause(String property) {
+ this.property = property;
+ operand = Operand.SAME;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Date getValue() {
+ return value;
+ }
+
+ public void setValue(Date value) {
+ this.value = value;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitDateClause(this);
+ }
+
+ public enum Operand {
+ SAME,
+ AFTER,
+ PREVIOUS,
+ DIFFERENT;
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NotClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NotClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NotClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,22 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class NotClause implements Clause {
+
+ protected Clause clause;
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitNotClause(this);
+ }
+
+ public Clause getClause() {
+ return clause;
+ }
+
+ public void setClause(Clause clause) {
+ this.clause = clause;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NumberClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NumberClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/NumberClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,56 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class NumberClause implements Clause {
+
+ protected String property;
+
+ protected Operand operand;
+
+ protected Number value;
+
+ public NumberClause(String property) {
+ this.property = property;
+ setOperand(Operand.EQUAL);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ public Number getValue() {
+ return value;
+ }
+
+ public void setValue(Number value) {
+ this.value = value;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitNumberClause(this);
+ }
+
+ public enum Operand {
+ EQUAL,
+ NOT_EQUAL,
+ UPPER,
+ UPPER_OR_EQUAL,
+ LOWER,
+ LOWER_OR_EQUAL;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/OrClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/OrClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/OrClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,13 @@
+package org.chorem.lima.Clause;
+
+import java.util.ArrayList;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class OrClause extends ArrayList<Clause> implements Clause {
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitOrClause(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SetClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SetClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SetClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,46 @@
+package org.chorem.lima.Clause;
+
+import java.util.HashSet;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class SetClause<T> extends HashSet<T> implements Clause {
+
+ protected String property;
+
+ protected Operand operand;
+
+ public SetClause(String property) {
+ this.property = property;
+ setOperand(Operand.IN);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitSetClause(this);
+ }
+
+ public enum Operand {
+ IN,
+ NOT_IN;
+ }
+
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/StringClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/StringClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/StringClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,66 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class StringClause implements Clause {
+
+ protected String property;
+
+ protected Operand operand;
+
+ protected String value;
+
+ protected boolean sensitiveCase;
+
+ public StringClause(String property) {
+ this.property = property;
+ setOperand(Operand.EQUAL);
+ setSensitiveCase(true);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public boolean isSensitiveCase() {
+ return sensitiveCase;
+ }
+
+ public void setSensitiveCase(boolean sensitiveCase) {
+ this.sensitiveCase = sensitiveCase;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitStringClause(this);
+ }
+
+ public enum Operand {
+ EQUAL,
+ NOT_EQUAL,
+ BEGIN,
+ ENDING,
+ CONTAIN;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SubFilterClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SubFilterClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/SubFilterClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,56 @@
+package org.chorem.lima.Clause;
+
+import org.chorem.lima.Filter.Filter;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class SubFilterClause implements Clause {
+
+ protected String property;
+
+ protected Multiplicity multiplicity;
+
+ protected Filter subFilter;
+
+ public SubFilterClause(String property, Filter subFilter, Multiplicity multiplicity) {
+ this.property = property;
+ this.subFilter = subFilter;
+ this.multiplicity = multiplicity;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public Filter getSubFilter() {
+ return subFilter;
+ }
+
+ public void setSubFilter(Filter subFilter) {
+ this.subFilter = subFilter;
+ }
+
+ @Override
+ public void accept(VisitorClause v) {
+ v.visitSubFilterClause(this);
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+ public enum Multiplicity {
+ ONE,
+ MANY;
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Clause/VisitorClause.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Clause/VisitorClause.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Clause/VisitorClause.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,25 @@
+package org.chorem.lima.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface VisitorClause {
+
+ public void visitDateClause(DateClause dateClause);
+
+ public void visitAndClause(AndClause andClause);
+
+ public void visitBooleanClause(BooleanClause booleanClause);
+
+ public void visitNumberClause(NumberClause numberClause);
+
+ public void visitOrClause(OrClause orClause);
+
+ public void visitNotClause(NotClause notClause);
+
+ public void visitSetClause(SetClause setClause);
+
+ public void visitStringClause(StringClause stringClause);
+
+ public void visitSubFilterClause(SubFilterClause subFilterClause);
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AbstractFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AbstractFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AbstractFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,19 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public abstract class AbstractFilter implements Filter {
+
+ protected Clause clause;
+
+ public Clause getClause() {
+ return clause;
+ }
+
+ public void setClause(Clause clause) {
+ this.clause = clause;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AccountFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AccountFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/AccountFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,33 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.StringClause;
+import org.chorem.lima.entity.Account;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class AccountFilter extends AbstractFilter {
+
+ public StringClause newLabelClause() {
+ return new StringClause(Account.PROPERTY_LABEL);
+ }
+
+ public StringClause newAccountNumberClause() {
+ return new StringClause(Account.PROPERTY_ACCOUNT_NUMBER);
+ }
+
+ public StringClause newThirdPartyClause() {
+ return new StringClause(Account.PROPERTY_THIRD_PARTY);
+ }
+
+
+ @Override
+ public void accept(VisitorFilter v) {
+ v.visitAccountFilter(this);
+ }
+
+ @Override
+ public Class getEntityClass() {
+ return Account.class;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryBookFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryBookFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryBookFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,29 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.StringClause;
+import org.chorem.lima.entity.EntryBook;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class EntryBookFilter extends AbstractFilter {
+
+ public StringClause newLabelClause() {
+ return new StringClause(EntryBook.PROPERTY_LABEL);
+ }
+
+ public StringClause newCodeClause() {
+ return new StringClause(EntryBook.PROPERTY_CODE);
+ }
+
+ @Override
+ public void accept(VisitorFilter v) {
+ v.visitEntryBookFilter(this);
+ }
+
+ @Override
+ public Class getEntityClass() {
+ return EntryBook.class;
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/EntryFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,68 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.BooleanClause;
+import org.chorem.lima.Clause.NumberClause;
+import org.chorem.lima.Clause.SetClause;
+import org.chorem.lima.Clause.StringClause;
+import org.chorem.lima.Clause.SubFilterClause;
+import org.chorem.lima.entity.Entry;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class EntryFilter extends AbstractFilter {
+
+ public NumberClause newAmountClause() {
+ return new NumberClause(Entry.PROPERTY_AMOUNT);
+ }
+
+ public BooleanClause newDebitClause() {
+ return new BooleanClause(Entry.PROPERTY_DEBIT);
+ }
+
+ public StringClause newDetailClause() {
+ return new StringClause(Entry.PROPERTY_AMOUNT);
+ }
+
+ public StringClause newPositionClause() {
+ return new StringClause(Entry.PROPERTY_POSITION);
+ }
+
+ public StringClause newVoucherClause() {
+ return new StringClause(Entry.PROPERTY_VOUCHER);
+ }
+
+ public StringClause newDescriptionClause() {
+ return new StringClause(Entry.PROPERTY_DESCRIPTION);
+ }
+
+ public StringClause newLetteringClause() {
+ return new StringClause(Entry.PROPERTY_LETTERING);
+ }
+
+ public SubFilterClause newAccountFilterClause() {
+ return new SubFilterClause(Entry.PROPERTY_ACCOUNT, new AccountFilter(), SubFilterClause.Multiplicity.ONE);
+ }
+
+ public SetClause newAccountSetClause() {
+ return new SetClause(Entry.PROPERTY_ACCOUNT);
+ }
+
+ public SubFilterClause newFinancialTransactionFilterClause() {
+ return new SubFilterClause(Entry.PROPERTY_FINANCIAL_TRANSACTION, new FinancialTransactionFilter(), SubFilterClause.Multiplicity.ONE);
+ }
+
+ public SetClause newFinancialTransactionSetClause() {
+ return new SetClause(Entry.PROPERTY_FINANCIAL_TRANSACTION);
+ }
+
+ @Override
+ public void accept(VisitorFilter v) {
+ v.visitEntryFilter(this);
+ }
+
+ @Override
+ public Class getEntityClass() {
+ return Entry.class;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/Filter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/Filter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/Filter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,16 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.Clause;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface Filter {
+
+ public void accept(VisitorFilter v);
+
+ public Clause getClause();
+
+ public Class getEntityClass();
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FilterGenerator.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FilterGenerator.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FilterGenerator.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,351 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.AndClause;
+import org.chorem.lima.Clause.BooleanClause;
+import org.chorem.lima.Clause.Clause;
+import org.chorem.lima.Clause.DateClause;
+import org.chorem.lima.Clause.NotClause;
+import org.chorem.lima.Clause.NumberClause;
+import org.chorem.lima.Clause.OrClause;
+import org.chorem.lima.Clause.SetClause;
+import org.chorem.lima.Clause.StringClause;
+import org.chorem.lima.Clause.SubFilterClause;
+import org.chorem.lima.beans.AbstractBigDecimalCondition;
+import org.chorem.lima.beans.AbstractStringCondition;
+import org.chorem.lima.beans.AccountCondition;
+import org.chorem.lima.beans.Condition;
+import org.chorem.lima.beans.CreditCondition;
+import org.chorem.lima.beans.DateCondition;
+import org.chorem.lima.beans.DateIntervalCondition;
+import org.chorem.lima.beans.DebitCondition;
+import org.chorem.lima.beans.DescriptionCondition;
+import org.chorem.lima.beans.EntryBookCondition;
+import org.chorem.lima.beans.FinancialPeriodCondition;
+import org.chorem.lima.beans.FinancialTransactionCondition;
+import org.chorem.lima.beans.FiscalPeriodCondition;
+import org.chorem.lima.beans.LetteringCondition;
+import org.chorem.lima.beans.VisitorCondition;
+import org.chorem.lima.beans.VoucherCondition;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class FilterGenerator implements VisitorCondition {
+
+ protected List<Clause> clauses;
+ protected List<Clause> entryClauses;
+ protected FinancialTransactionFilter filter;
+ protected EntryFilter entryFilter;
+
+ public FilterGenerator() {
+ clauses = new ArrayList<Clause>();
+ entryClauses = new ArrayList<Clause>();
+ }
+
+
+ @Override
+ public void visitFinancialTransactionCondition(FinancialTransactionCondition condition) {
+
+ filter = new FinancialTransactionFilter();
+ for (Condition subCondition : condition.getConditions()) {
+ subCondition.accept(this);
+ }
+ if (clauses.size() == 1 ) {
+ filter.setClause(clauses.get(0));
+ } else if (clauses.size() > 1) {
+ if (condition.isAllConditions()) {
+ AndClause clause = new AndClause();
+ clause.addAll(clauses);
+ filter.setClause(clause);
+ } else {
+ OrClause clause = new OrClause();
+ clause.addAll(clauses);
+ filter.setClause(clause);
+ }
+ }
+
+ if (entryClauses.size() == 1 ) {
+ entryFilter.setClause(entryClauses.get(0));
+ } else if (entryClauses.size() > 1) {
+ if (condition.isAllConditions()) {
+ AndClause clause = new AndClause();
+ clause.addAll(entryClauses);
+ entryFilter.setClause(clause);
+ } else {
+ OrClause clause = new OrClause();
+ clause.addAll(entryClauses);
+ entryFilter.setClause(clause);
+ }
+ }
+ }
+
+ @Override
+ public void visitDateCondition(DateCondition condition) {
+ DateClause dateClause = getFilter().newTransactionDateClause();
+ switch (condition.getOperand()) {
+ case SAME:
+ dateClause.setOperand(DateClause.Operand.SAME);
+ break;
+ case AFTER:
+ dateClause.setOperand(DateClause.Operand.AFTER);
+ break;
+ case PREVIOUS:
+ dateClause.setOperand(DateClause.Operand.PREVIOUS);
+ break;
+ case DIFFERENT:
+ dateClause.setOperand(DateClause.Operand.DIFFERENT);
+ break;
+ }
+ dateClause.setValue(condition.getDate());
+ clauses.add(dateClause);
+ }
+
+ @Override
+ public void visitDateIntervalCondition(DateIntervalCondition condition) {
+ AndClause andClause = new AndClause();
+
+ DateClause beginDateClause = getFilter().newTransactionDateClause();
+ beginDateClause.setOperand(DateClause.Operand.AFTER);
+ beginDateClause.setValue(condition.getBeginDate());
+ andClause.add(beginDateClause);
+
+ DateClause endDateClause = getFilter().newTransactionDateClause();
+ endDateClause.setOperand(DateClause.Operand.PREVIOUS);
+ endDateClause.setValue(condition.getEndDate());
+ andClause.add(endDateClause);
+
+ clauses.add(andClause);
+ }
+
+ @Override
+ public void visitEntryBookCondition(EntryBookCondition condition) {
+
+ SetClause setClause = getFilter().newEntryBookSetClause();
+ setClause.addAll(condition.getEntryBooks());
+ clauses.add(setClause);
+ }
+
+ @Override
+ public void visitFinancialPeriodCondition(FinancialPeriodCondition condition) {
+ OrClause orClause = new OrClause();
+ for (FinancialPeriod period : condition.getFinancialPeriods()) {
+ AndClause andClause = new AndClause();
+
+ DateClause beginDateClause = getFilter().newTransactionDateClause();
+ beginDateClause.setOperand(DateClause.Operand.AFTER);
+ beginDateClause.setValue(period.getBeginDate());
+ andClause.add(beginDateClause);
+
+ DateClause endDateClause = getFilter().newTransactionDateClause();
+ endDateClause.setOperand(DateClause.Operand.PREVIOUS);
+ endDateClause.setValue(period.getEndDate());
+ andClause.add(endDateClause);
+
+ orClause.add(andClause);
+ }
+ if (orClause.size() == 1) {
+ clauses.add(orClause.get(0));
+ } else {
+ clauses.add(orClause);
+ }
+ }
+
+ @Override
+ public void visitFiscalPeriodCondition(FiscalPeriodCondition condition) {
+ OrClause orClause = new OrClause();
+ for (FiscalPeriod period : condition.getFiscalPeriods()) {
+ AndClause andClause = new AndClause();
+
+ DateClause beginDateClause = getFilter().newTransactionDateClause();
+ beginDateClause.setOperand(DateClause.Operand.AFTER);
+ beginDateClause.setValue(period.getBeginDate());
+ andClause.add(beginDateClause);
+
+ DateClause endDateClause = getFilter().newTransactionDateClause();
+ endDateClause.setOperand(DateClause.Operand.PREVIOUS);
+ endDateClause.setValue(period.getEndDate());
+ andClause.add(endDateClause);
+
+ orClause.add(andClause);
+ }
+ if (orClause.size() == 1) {
+ clauses.add(orClause.get(0));
+ } else {
+ clauses.add(orClause);
+ }
+ }
+
+ protected EntryFilter getEntryFilter() {
+ if (entryFilter == null) {
+ SubFilterClause subFilterClause = filter.newEntryFilterClause();
+ clauses.add(subFilterClause);
+ entryFilter = (EntryFilter) subFilterClause.getSubFilter();
+ }
+ return entryFilter;
+ }
+
+ protected StringClause.Operand getStringClauseOperand(AbstractStringCondition.Operand operand) {
+ StringClause.Operand result;
+ switch (operand) {
+ case NOT_EQUAL:
+ result = StringClause.Operand.NOT_EQUAL;
+ break;
+ case BEGIN:
+ result = StringClause.Operand.BEGIN;
+ break;
+ case ENDING:
+ result = StringClause.Operand.ENDING;
+ break;
+ case CONTAIN:
+ result = StringClause.Operand.CONTAIN;
+ break;
+ case EQUAL:
+ default:
+ result = StringClause.Operand.EQUAL;
+ break;
+ }
+ return result;
+ }
+
+ @Override
+ public void visitDescriptionCondition(DescriptionCondition descriptionCondition) {
+ getEntryFilter();
+ StringClause stringClause = entryFilter.newDescriptionClause();
+
+ AbstractStringCondition.Operand operand = descriptionCondition.getOperand();
+ StringClause.Operand stringClauseOperand = getStringClauseOperand(operand);
+ stringClause.setOperand(stringClauseOperand);
+
+ stringClause.setValue(descriptionCondition.getValue());
+
+ stringClause.setSensitiveCase(descriptionCondition.isSensitiveCase());
+
+ entryClauses.add(stringClause);
+ }
+
+ @Override
+ public void visitVoucherCondition(VoucherCondition voucherCondition) {
+ getEntryFilter();
+ StringClause stringClause = entryFilter.newVoucherClause();
+
+ AbstractStringCondition.Operand operand = voucherCondition.getOperand();
+ StringClause.Operand stringClauseOperand = getStringClauseOperand(operand);
+ stringClause.setOperand(stringClauseOperand);
+
+ stringClause.setValue(voucherCondition.getValue());
+
+ stringClause.setSensitiveCase(voucherCondition.isSensitiveCase());
+
+ entryClauses.add(stringClause);
+ }
+
+ @Override
+ public void visitLetteringCondition(LetteringCondition letteringCondition) {
+ getEntryFilter();
+ StringClause stringClause = entryFilter.newLetteringClause();
+
+ AbstractStringCondition.Operand operand = letteringCondition.getOperand();
+ StringClause.Operand stringClauseOperand = getStringClauseOperand(operand);
+ stringClause.setOperand(stringClauseOperand);
+
+ stringClause.setValue(letteringCondition.getValue());
+
+ stringClause.setSensitiveCase(letteringCondition.isSensitiveCase());
+
+ entryClauses.add(stringClause);
+ }
+
+ @Override
+ public void visitAccountCondition(AccountCondition accountCondition) {
+ getEntryFilter();
+ SubFilterClause subFilterClause = entryFilter.newAccountFilterClause();
+ AccountFilter accountFilter = (AccountFilter) subFilterClause.getSubFilter();
+ StringClause stringClause = accountFilter.newAccountNumberClause();
+ stringClause.setOperand(StringClause.Operand.BEGIN);
+ Account account = accountCondition.getAccount();
+ stringClause.setValue(account.getAccountNumber());
+
+ accountFilter.setClause(stringClause);
+ entryClauses.add(subFilterClause);
+ }
+
+ protected NumberClause.Operand getNumberClauseOperand(AbstractBigDecimalCondition.Operand operand) {
+ NumberClause.Operand result;
+ switch (operand) {
+ case NOT_EQUAL:
+ result = NumberClause.Operand.NOT_EQUAL;
+ break;
+ case LOWER:
+ result = NumberClause.Operand.LOWER;
+ break;
+ case LOWER_OR_EQUAL:
+ result = NumberClause.Operand.LOWER_OR_EQUAL;
+ break;
+ case UPPER:
+ result = NumberClause.Operand.UPPER;
+ break;
+ case UPPER_OR_EQUAL:
+ result = NumberClause.Operand.UPPER_OR_EQUAL;
+ break;
+ case EQUAL:
+ default:
+ result = NumberClause.Operand.EQUAL;
+ break;
+ }
+ return result;
+ }
+
+ @Override
+ public void visitDebitCondition(DebitCondition debitCondition) {
+ getEntryFilter();
+
+ BooleanClause debitClause = entryFilter.newDebitClause();
+
+ NumberClause amountClause = entryFilter.newAmountClause();
+
+ AbstractBigDecimalCondition.Operand operand = debitCondition.getOperand();
+ NumberClause.Operand clauseOperand = getNumberClauseOperand(operand);
+ amountClause.setOperand(clauseOperand);
+
+ amountClause.setValue(debitCondition.getValue());
+
+ AndClause andClause = new AndClause();
+ andClause.add(debitClause);
+ andClause.add(amountClause);
+
+ entryClauses.add(andClause);
+ }
+
+ @Override
+ public void visitCreditCondition(CreditCondition creditCondition) {
+ getEntryFilter();
+
+ BooleanClause debitClause = entryFilter.newDebitClause();
+ NotClause creditClause = new NotClause();
+ creditClause.setClause(debitClause);
+
+ NumberClause amountClause = entryFilter.newAmountClause();
+
+ AbstractBigDecimalCondition.Operand operand = creditCondition.getOperand();
+ NumberClause.Operand clauseOperand = getNumberClauseOperand(operand);
+ amountClause.setOperand(clauseOperand);
+
+ amountClause.setValue(creditCondition.getValue());
+
+ AndClause andClause = new AndClause();
+ andClause.add(creditClause);
+ andClause.add(amountClause);
+
+ entryClauses.add(andClause);
+ }
+
+ public FinancialTransactionFilter getFilter() {
+ return filter;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FinancialTransactionFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FinancialTransactionFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/FinancialTransactionFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,38 @@
+package org.chorem.lima.Filter;
+
+import org.chorem.lima.Clause.DateClause;
+import org.chorem.lima.Clause.SetClause;
+import org.chorem.lima.Clause.SubFilterClause;
+import org.chorem.lima.entity.FinancialTransaction;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class FinancialTransactionFilter extends AbstractFilter {
+
+ public DateClause newTransactionDateClause() {
+ return new DateClause(FinancialTransaction.PROPERTY_TRANSACTION_DATE);
+ }
+
+ public SubFilterClause newEntryBookFilterClause() {
+ return new SubFilterClause(FinancialTransaction.PROPERTY_ENTRY_BOOK, new EntryBookFilter(), SubFilterClause.Multiplicity.ONE);
+ }
+
+ public SetClause newEntryBookSetClause() {
+ return new SetClause(FinancialTransaction.PROPERTY_ENTRY_BOOK);
+ }
+
+ public SubFilterClause newEntryFilterClause () {
+ return new SubFilterClause(FinancialTransaction.PROPERTY_ENTRY, new EntryFilter(), SubFilterClause.Multiplicity.MANY);
+ }
+
+ @Override
+ public void accept(VisitorFilter v) {
+ v.visitFinancialTransactionFilter(this);
+ }
+
+ @Override
+ public Class getEntityClass() {
+ return FinancialTransaction.class;
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/Filter/VisitorFilter.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/Filter/VisitorFilter.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/Filter/VisitorFilter.java 2013-06-27 13:08:13 UTC (rev 3687)
@@ -0,0 +1,15 @@
+package org.chorem.lima.Filter;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface VisitorFilter {
+
+ public void visitAccountFilter(AccountFilter accountFilter);
+
+ public void visitEntryBookFilter(EntryBookFilter entryBookFilter);
+
+ public void visitEntryFilter(EntryFilter entryFilter);
+
+ public void visitFinancialTransactionFilter(FinancialTransactionFilter financialTransactionFilter);
+}
1
0
r3686 - trunk/lima-callao/src/main/java/org/chorem/lima/beans
by Bavencoff@users.chorem.org 27 Jun '13
by Bavencoff@users.chorem.org 27 Jun '13
27 Jun '13
Author: Bavencoff
Date: 2013-06-27 15:01:42 +0200 (Thu, 27 Jun 2013)
New Revision: 3686
Url: http://chorem.org/projects/lima/repository/revisions/3686
Log:
Beans d?\195?\169finissants les filtres de transaction dans l'?\195?\169cran de recherche des transaction
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/AccountCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/Condition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/CreditCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateIntervalCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/DebitCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/DescriptionCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/EntryBookCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialPeriodCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialTransactionCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/LetteringCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/VisitorCondition.java
trunk/lima-callao/src/main/java/org/chorem/lima/beans/VoucherCondition.java
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractBigDecimalCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,55 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public abstract class AbstractBigDecimalCondition implements Condition, Serializable {
+
+ protected BigDecimal value;
+
+ protected Operand operand;
+
+ public AbstractBigDecimalCondition() {
+ setOperand(Operand.EQUAL);
+ }
+
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ public void setValue(BigDecimal value) {
+ this.value = value;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ public static enum Operand {
+ EQUAL(_("lima.enum.BigDecimal.operand.equal")),
+ NOT_EQUAL(_("lima.BigDecimal.date.operand.notequal")),
+ LOWER(_("lima.enum.BigDecimal.operand.lower")),
+ LOWER_OR_EQUAL(_("lima.enum.BigDecimal.operand.lowerorequal")),
+ UPPER(_("lima.enum.BigDecimal.operand.upper")),
+ UPPER_OR_EQUAL(_("lima.enum.BigDecimal.operand.upperorequal"));
+
+ protected String label;
+
+ Operand(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/AbstractStringCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,65 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public abstract class AbstractStringCondition implements Condition, Serializable {
+
+ protected String value;
+
+ protected Operand operand;
+
+ protected boolean sensitiveCase;
+
+ public AbstractStringCondition() {
+ setOperand(Operand.EQUAL);
+ setSensitiveCase(false);
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ public boolean isSensitiveCase() {
+ return sensitiveCase;
+ }
+
+ public void setSensitiveCase(boolean sensitiveCase) {
+ this.sensitiveCase = sensitiveCase;
+ }
+
+ public static enum Operand {
+ EQUAL(_("lima.enum.string.operand.equal")),
+ NOT_EQUAL(_("lima.string.date.operand.notequal")),
+ BEGIN(_("lima.enum.string.operand.begin")),
+ ENDING(_("lima.enum.string.operand.ending")),
+ CONTAIN(_("lima.enum.string.operand.contain"));
+
+ protected String label;
+
+ Operand(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/AccountCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/AccountCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/AccountCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,26 @@
+package org.chorem.lima.beans;
+
+import org.chorem.lima.entity.Account;
+
+import java.io.Serializable;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class AccountCondition implements Condition, Serializable {
+
+ protected Account account;
+
+ public Account getAccount() {
+ return account;
+ }
+
+ public void setAccount(Account account) {
+ this.account = account;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitAccountCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/Condition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/Condition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/Condition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,9 @@
+package org.chorem.lima.beans;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface Condition {
+
+ public void accept(VisitorCondition v);
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/CreditCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/CreditCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/CreditCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,12 @@
+package org.chorem.lima.beans;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class CreditCondition extends AbstractBigDecimalCondition {
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitCreditCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,60 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class DateCondition implements Condition, Serializable {
+
+ protected Date date;
+
+ protected Operand operand;
+
+ public DateCondition() {
+ operand = Operand.SAME;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public void setOperand(Operand operand) {
+ this.operand = operand;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitDateCondition(this);
+ }
+
+ public static enum Operand {
+ SAME(_("lima.enum.date.operand.same")),
+ AFTER(_("lima.enum.date.operand.after")),
+ PREVIOUS(_("lima.enum.date.operand.previous")),
+ DIFFERENT(_("lima.enum.date.operand.different"));
+
+ protected String label;
+
+ Operand(String label) {
+ this.label = label;
+ }
+
+
+ public String getLabel() {
+ return label;
+ }
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateIntervalCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateIntervalCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/DateIntervalCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,35 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class DateIntervalCondition implements Condition, Serializable {
+
+ protected Date beginDate;
+
+ protected Date endDate;
+
+ public Date getBeginDate() {
+ return beginDate;
+ }
+
+ public void setBeginDate(Date beginDate) {
+ this.beginDate = beginDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitDateIntervalCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/DebitCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/DebitCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/DebitCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,12 @@
+package org.chorem.lima.beans;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class DebitCondition extends AbstractBigDecimalCondition {
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitDebitCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/DescriptionCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/DescriptionCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/DescriptionCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,15 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class DescriptionCondition extends AbstractStringCondition implements Serializable {
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitDescriptionCondition(this);
+ }
+
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/EntryBookCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/EntryBookCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/EntryBookCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,27 @@
+package org.chorem.lima.beans;
+
+import org.chorem.lima.entity.EntryBook;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class EntryBookCondition implements Condition, Serializable {
+
+ protected List<EntryBook> entryBooks;
+
+ public List<EntryBook> getEntryBooks() {
+ return entryBooks;
+ }
+
+ public void setEntryBooks(List<EntryBook> entryBooks) {
+ this.entryBooks = entryBooks;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitEntryBookCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialPeriodCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialPeriodCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialPeriodCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,27 @@
+package org.chorem.lima.beans;
+
+import org.chorem.lima.entity.FinancialPeriod;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class FinancialPeriodCondition implements Condition, Serializable {
+
+ protected List<FinancialPeriod> financialPeriods;
+
+ public List<FinancialPeriod> getFinancialPeriods() {
+ return financialPeriods;
+ }
+
+ public void setFinancialPeriods(List<FinancialPeriod> financialPeriods) {
+ this.financialPeriods = financialPeriods;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitFinancialPeriodCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialTransactionCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialTransactionCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FinancialTransactionCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,40 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class FinancialTransactionCondition implements Condition, Serializable {
+
+ protected boolean allConditions;
+
+ protected List<Condition> conditions;
+
+ public FinancialTransactionCondition() {
+ conditions = new ArrayList<Condition>();
+ }
+
+ public boolean isAllConditions() {
+ return allConditions;
+ }
+
+ public void setAllConditions(boolean allConditions) {
+ this.allConditions = allConditions;
+ }
+
+ public List<Condition> getConditions() {
+ return conditions;
+ }
+
+ public void setConditions(List<Condition> conditions) {
+ this.conditions = conditions;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitFinancialTransactionCondition(this);
+ }
+}
\ No newline at end of file
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,27 @@
+package org.chorem.lima.beans;
+
+import org.chorem.lima.entity.FiscalPeriod;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class FiscalPeriodCondition implements Condition, Serializable {
+
+ protected List<FiscalPeriod> fiscalPeriods;
+
+ public List<FiscalPeriod> getFiscalPeriods() {
+ return fiscalPeriods;
+ }
+
+ public void setFiscalPeriods(List<FiscalPeriod> fiscalPeriods) {
+ this.fiscalPeriods = fiscalPeriods;
+ }
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitFiscalPeriodCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/LetteringCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/LetteringCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/LetteringCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,13 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class LetteringCondition extends AbstractStringCondition implements Serializable {
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitLetteringCondition(this);
+ }
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/VisitorCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/VisitorCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/VisitorCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,31 @@
+package org.chorem.lima.beans;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public interface VisitorCondition {
+
+ public void visitDateCondition(DateCondition condition);
+
+ public void visitDateIntervalCondition(DateIntervalCondition condition);
+
+ public void visitEntryBookCondition(EntryBookCondition condition);
+
+ public void visitFinancialPeriodCondition(FinancialPeriodCondition condition);
+
+ public void visitFinancialTransactionCondition(FinancialTransactionCondition condition);
+
+ public void visitFiscalPeriodCondition(FiscalPeriodCondition condition);
+
+ public void visitDescriptionCondition(DescriptionCondition descriptionCondition);
+
+ public void visitVoucherCondition(VoucherCondition voucherCondition);
+
+ public void visitLetteringCondition(LetteringCondition letteringCondition);
+
+ public void visitAccountCondition(AccountCondition accountCondition);
+
+ public void visitDebitCondition(DebitCondition debitCondition);
+
+ public void visitCreditCondition(CreditCondition creditCondition);
+}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/VoucherCondition.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/VoucherCondition.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/VoucherCondition.java 2013-06-27 13:01:42 UTC (rev 3686)
@@ -0,0 +1,14 @@
+package org.chorem.lima.beans;
+
+import java.io.Serializable;
+
+/**
+ * @author Sylvain Bavencoff <bavencoff(a)codelutin.com>
+ */
+public class VoucherCondition extends AbstractStringCondition implements Serializable {
+
+ @Override
+ public void accept(VisitorCondition v) {
+ v.visitVoucherCondition(this);
+ }
+}
1
0