Author: jpepin Date: 2010-08-23 11:35:53 +0200 (Mon, 23 Aug 2010) New Revision: 3014 Url: http://chorem.org/repositories/revision/lima/3014 Log: Ajout dans les rapports choix de s?\195?\169lection de la p?\195?\169riod. Ajout nouveau splash-screen puzzle. Added: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java trunk/lima-swing/src/main/resources/images/puzzle_splash.png Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/PeriodSearchPanel.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.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/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 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-swing/src/main/java/org/chorem/lima/LimaMain.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -154,6 +154,7 @@ // update splash LimaSplash splash = new LimaSplash(); splash.initSplash(config.getVersion()); + splash.updateProgression(0.1, _("lima.splash.1")); // do init ui MainViewHandler uiHandler = context.getContextValue(MainViewHandler.class); @@ -165,7 +166,7 @@ // load accounts and test if there is an account plan defined // if not, call #loadDefaultAccount() - splash.updateProgression(0.5, _("Loading accounting...")); + splash.updateProgression(0.5, _("lima.splash.2")); //start http server LimaServiceFactory.getInstance().getService(HttpServerServiceMonitorable.class).start(); @@ -184,7 +185,7 @@ openingView.setLocationRelativeTo(null); openingView.setVisible(true); } - + splash.updateProgression(0.5, _("lima.splash.3")); // show ui SwingUtilities.invokeLater(new Runnable() { @Override Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSplash.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -20,6 +20,7 @@ import java.awt.AlphaComposite; import java.awt.Color; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.SplashScreen; @@ -69,7 +70,7 @@ public void initSplash(String version) { if (splashGraphics != null) { splashGraphics.setColor(Color.BLACK); - splashGraphics.drawString("Version : " + version, 300, 90); + splashGraphics.drawString("Version : " + version, 394, 42); } else { if (log.isWarnEnabled()) { @@ -89,16 +90,18 @@ public void updateProgression(double progress, String message) { if (splashGraphics != null) { - splashGraphics.setColor(Color.BLACK); - splashGraphics.drawRect(50, 130, 300, 10); - splashGraphics.fillRect(50, 130, (int)(300.0 * progress), 10); + splashGraphics.setColor(Color.GRAY); + splashGraphics.drawRect(65, 253, 300, 10); + splashGraphics.fillRect(65, 253, (int)(300.0 * progress), 10); if (message != null) { splashGraphics.setComposite(AlphaComposite.Clear); - splashGraphics.fillRect(50,150, 200, 40); + splashGraphics.fillRect(65, 238, 300, 15); splashGraphics.setPaintMode(); - splashGraphics.setColor(Color.BLACK); - splashGraphics.drawString(message + "...", 50, 160); + splashGraphics.setColor(new Color(255, 210, 55)); + Font font = new Font("Lucida Sans", Font.BOLD, 14); + splashGraphics.setFont(font); + splashGraphics.drawString(message + "...", 65, 248); } splash.update(); Added: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ComboBoxDatesEnum.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,61 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.enums; + +import static org.nuiton.i18n.I18n._; + + +public enum ComboBoxDatesEnum { + + FISCAL_PERIOD(_("lima.enum.comboboxperiod.fiscalperiod")), + FINANCIAL_PERIOD(_("lima.enum.comboboxperiod.financialperiod")), + PERIOD(_("lima.enum.comboboxperiod.period")); + + private final String description; + + private ComboBoxDatesEnum(String description) { + this.description = description; + } + + public String getDescription() { + return this.description; + } + + public static String[] descriptions(){ + int nbElts = ComboBoxDatesEnum.values().length; + String[] descriptions = new String[nbElts]; + ComboBoxDatesEnum[] enums = ComboBoxDatesEnum.values(); + for (int i = 0; i < nbElts; i++) { + descriptions[i] = enums[i].getDescription(); + } + return descriptions; + } + + public static ComboBoxDatesEnum valueOfDescription(String description){ + ComboBoxDatesEnum value = null; + + for (ComboBoxDatesEnum enums : ComboBoxDatesEnum.values()) { + if (description.equals(enums.description)){ + value = enums; + break; + } + } + return value; + } +} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsPeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,152 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.accountsreports; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import org.apache.commons.lang.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.ComboBoxDatesEnum; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +public class AccountsReportsPeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(AccountsReportsPeriodSearchPanel.class); + + protected AccountsReportsViewHandler handler; + + public AccountsReportsPeriodSearchPanel(AccountsReportsViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + static final long serialVersionUID = 1L; + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){ + + switch (comboBoxPeriodEnum) { + 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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod !=null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-08-23 09:35:53 UTC (rev 3014) @@ -22,47 +22,22 @@ <script> <![CDATA[ - import org.chorem.lima.entity.Account; - import org.apache.commons.lang.time.DateUtils; - import java.util.Calendar; + import org.chorem.lima.enums.ComboBoxDatesEnum; + AccountsReportsPeriodSearchPanel periodSearchPanel = new AccountsReportsPeriodSearchPanel(handler); - // 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); - getHandler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - getHandler().setEndDate(endDate); - - getBeginDatePicker().setDate(beginDate); - getEndDatePicker().setDate(endDate); - void $afterCompleteSetup() { - //getHandler().refresh(); } ]]> </script> <row weightx="1" weighty="0" anchor="center"> + <cell fill='both'><Table><row> + <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())" + onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); + validate(); repaint()"/></cell> + <cell><AccountsReportsPeriodSearchPanel javaBean="periodSearchPanel"/></cell> + </row></Table></cell> <cell anchor="east"> - <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" - onActionPerformed="getHandler().setBeginDate(beginDatePicker.getDate())" /> - </cell> - <cell anchor="east"> - <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="endDatePicker" - onActionPerformed="getHandler().setEndDate(endDatePicker.getDate())"/> - </cell> - <cell anchor="east"> <JLabel id="accountSelectorLabel" text="lima.account"/> </cell> <cell anchor="west"> Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalancePeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,153 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.balance; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import org.apache.commons.lang.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.ComboBoxDatesEnum; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +public class BalancePeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(BalancePeriodSearchPanel.class); + + protected BalanceViewHandler handler; + + public BalancePeriodSearchPanel(BalanceViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + static final long serialVersionUID = 1L; + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){ + + switch (comboBoxPeriodEnum) { + + 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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod !=null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod !=null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-08-23 09:35:53 UTC (rev 3014) @@ -22,48 +22,23 @@ <script> <![CDATA[ - import org.chorem.lima.entity.Account; - import org.apache.commons.lang.time.DateUtils; - import java.util.Calendar; - - // 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); + import org.chorem.lima.enums.ComboBoxDatesEnum; + BalancePeriodSearchPanel periodSearchPanel = new BalancePeriodSearchPanel(handler); - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - - getBeginDatePicker().setDate(beginDate); - getEndDatePicker().setDate(endDate); - getHandler().setBeginDate(beginDate); - getHandler().setEndDate(endDate); - void $afterCompleteSetup() { - getHandler().refresh(); } ]]> </script> <row weightx="1" weighty="0" anchor="center"> + <cell fill='both'><Table><row> + <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())" + onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); + validate(); repaint()"/></cell> + <cell><BalancePeriodSearchPanel javaBean="periodSearchPanel"/></cell> + </row></Table></cell> <cell anchor="east"> - <JLabel id="beginCalendarPanelLabel" text="lima.period.begindate"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" - onActionPerformed="getHandler().setBeginDate(beginDatePicker.getDate())"/> - </cell> - <cell anchor="east"> - <JLabel id="endCalendarPanelLabel" text="lima.period.enddate"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="endDatePicker" - onActionPerformed="getHandler().setEndDate(endDatePicker.getDate())"/> - </cell> - <cell anchor="east"> <JLabel text="lima.common.filter"/> </cell> <cell anchor="west"> Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsPeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,152 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.entrybooksreports; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import org.apache.commons.lang.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.ComboBoxDatesEnum; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +public class EntryBooksReportsPeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(EntryBooksReportsPeriodSearchPanel.class); + + protected EntryBooksReportsViewHandler handler; + + public EntryBooksReportsPeriodSearchPanel(EntryBooksReportsViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + static final long serialVersionUID = 1L; + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){ + + switch (comboBoxPeriodEnum) { + 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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-08-23 09:35:53 UTC (rev 3014) @@ -23,47 +23,22 @@ <script> <![CDATA[ - import org.chorem.lima.entity.EntryBook; - import org.apache.commons.lang.time.DateUtils; - import java.util.Calendar; + import org.chorem.lima.enums.ComboBoxDatesEnum; + EntryBooksReportsPeriodSearchPanel periodSearchPanel = new EntryBooksReportsPeriodSearchPanel(handler); - // 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); - getHandler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - getHandler().setEndDate(endDate); - - getBeginDatePicker().setDate(beginDate); - getEndDatePicker().setDate(endDate); - void $afterCompleteSetup() { - //getHandler().refresh(); } ]]> </script> <row weightx="1" weighty="0" anchor="center"> + <cell fill='both'><Table><row> + <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())" + onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); + validate(); repaint()"/></cell> + <cell><EntryBooksReportsPeriodSearchPanel javaBean="periodSearchPanel"/></cell> + </row></Table></cell> <cell anchor="east"> - <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" - onActionPerformed="getHandler().setBeginDate(beginDatePicker.getDate())" /> - </cell> - <cell anchor="east"> - <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="endDatePicker" - onActionPerformed="getHandler().setEndDate(endDatePicker.getDate())"/> - </cell> - <cell anchor="east"> <JLabel id="entryBookSelectorLabel" text="lima.entrybook"/> </cell> <cell anchor="west"> Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportPeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,152 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.financialstatementreport; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import org.apache.commons.lang.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.ComboBoxDatesEnum; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +public class FinancialStatementReportPeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(FinancialStatementReportPeriodSearchPanel.class); + + protected FinancialStatementReportViewHandler handler; + + public FinancialStatementReportPeriodSearchPanel(FinancialStatementReportViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + static final long serialVersionUID = 1L; + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){ + + switch (comboBoxPeriodEnum) { + 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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.model.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.model.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.model.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.model.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.model.setBeginDate(fPeriod.getBeginDate()); + handler.model.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod !=null){ + handler.model.setBeginDate(fPeriod.getBeginDate()); + handler.model.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -19,25 +19,15 @@ package org.chorem.lima.ui.financialtransaction; import static org.nuiton.i18n.I18n._; - import java.awt.Color; import java.awt.Component; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.math.BigDecimal; import java.util.Date; -import java.util.concurrent.ExecutionException; - import javax.swing.SwingWorker; -import javax.swing.table.TableColumn; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; @@ -45,7 +35,6 @@ import org.chorem.lima.ui.celleditor.AccountTableCellEditor; import org.chorem.lima.ui.celleditor.DateTableCellEditor; import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor; -import org.chorem.lima.util.DialogHelper; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.ColorHighlighter; import org.jdesktop.swingx.decorator.ComponentAdapter; Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java (from rev 3007, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/PeriodSearchPanel.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,169 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.financialtransactionsearch; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import org.apache.commons.lang.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.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +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); + } + + static final long serialVersionUID = 1L; + + 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); + ActionListener dateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(datePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(datePicker.getDate()); + handler.setEndDate(null); + handler.refresh(); + datePicker.addActionListener(dateActionListener); + this.removeAll(); + this.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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + 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(); + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + 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); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -20,8 +20,6 @@ import java.awt.Color; import java.awt.Component; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.math.BigDecimal; import java.util.Date; import org.chorem.lima.entity.Account; 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 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchView.jaxx 2010-08-23 09:35:53 UTC (rev 3014) @@ -30,7 +30,7 @@ AccountSearchPanel accountSearchPanel = new AccountSearchPanel(handler); AmountSearchPanel amountSearchPanel = new AmountSearchPanel(handler); EntryBookSearchPanel entryBookSearchPanel = new EntryBookSearchPanel(handler); - PeriodSearchPanel periodSearchPanel = new PeriodSearchPanel(handler); + FinancialTransactionPeriodSearchPanel periodSearchPanel = new FinancialTransactionPeriodSearchPanel(handler); void $afterCompleteSetup() { handler.setAmountWayEnum(FinancialStatementWayEnum.valueOfDescription( @@ -47,7 +47,7 @@ <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxPeriodEnum.descriptions())" onActionPerformed="periodSearchPanel.refresh(ComboBoxPeriodEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); validate(); repaint()"/></cell> - <cell><PeriodSearchPanel javaBean="periodSearchPanel"/></cell> + <cell><FinancialTransactionPeriodSearchPanel javaBean="periodSearchPanel"/></cell> </row></Table></cell> </row> <row> 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 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -18,23 +18,18 @@ package org.chorem.lima.ui.financialtransactionsearch; -import java.util.ArrayList; import java.util.Date; -import java.util.List; 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.business.FinancialTransactionServiceMonitorable; -import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ejbinterface.FinancialTransactionService; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; -import org.chorem.lima.util.ErrorHelper; /** * Handler associated with financial transaction view. Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/PeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/PeriodSearchPanel.java 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/PeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -1,169 +0,0 @@ -/* *##% Lima Swing - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%*/ - -package org.chorem.lima.ui.financialtransactionsearch; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Calendar; -import java.util.Date; -import static org.nuiton.i18n.I18n._; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.apache.commons.lang.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.combobox.FinancialPeriodComboBoxModel; -import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; -import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; -import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; -import org.jdesktop.swingx.JXDatePicker; - -public class PeriodSearchPanel extends JPanel { - - private static final Log log = - LogFactory.getLog(PeriodSearchPanel.class); - - protected FinancialTransactionSearchViewHandler handler; - - public PeriodSearchPanel(FinancialTransactionSearchViewHandler handler) { - this.handler = handler; - - //init date - refresh(ComboBoxPeriodEnum.PERIOD); - } - - static final long serialVersionUID = 1L; - - 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); - ActionListener dateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setBeginDate(datePicker.getDate()); - handler.refresh(); - } - }; - handler.setBeginDate(datePicker.getDate()); - handler.setEndDate(null); - handler.refresh(); - datePicker.addActionListener(dateActionListener); - this.removeAll(); - this.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); - //handler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - //handler().setEndDate(endDate); - JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); - final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); - ActionListener beginDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setBeginDate(beginDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setBeginDate(beginDatePicker.getDate()); - beginDatePicker.addActionListener(beginDateActionListener); - - JLabel endDateLabel = new JLabel(_("lima.period.enddate")); - final JXDatePicker endDatePicker = new JXDatePicker(endDate); - ActionListener endDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setEndDate(endDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setEndDate(endDatePicker.getDate()); - endDatePicker.addActionListener(endDateActionListener); - handler.refresh(); - - this.removeAll(); - this.add(beginDateLabel); - this.add(beginDatePicker); - this.add(endDateLabel); - this.add(endDatePicker); - break; - - case FISCAL_PERIOD: - FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); - FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); - final JComboBox fiscalPeriod = new JComboBox(fiscalModel); - fiscalPeriod.setRenderer(fiscalRenderer); - 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(); - } - }; - fiscalPeriod.addActionListener(fiscalPeriodActionListener); - - this.removeAll(); - this.add(fiscalPeriod); - break; - - case FINANCIAL_PERIOD: - FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); - FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); - final JComboBox financialPeriod = new JComboBox(financialModel); - financialPeriod.setRenderer(financialRenderer); - 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); - this.removeAll(); - this.add(financialPeriod); - break; - } - - } - -} Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerPeriodSearchPanel.java 2010-08-23 09:35:53 UTC (rev 3014) @@ -0,0 +1,152 @@ +/* *##% Lima Swing + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%*/ + +package org.chorem.lima.ui.ledger; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; +import static org.nuiton.i18n.I18n._; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import org.apache.commons.lang.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.ComboBoxDatesEnum; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer; +import org.jdesktop.swingx.JXDatePicker; + +public class LedgerPeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(LedgerPeriodSearchPanel.class); + + protected LedgerViewHandler handler; + + public LedgerPeriodSearchPanel(LedgerViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + static final long serialVersionUID = 1L; + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){ + + switch (comboBoxPeriodEnum) { + 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); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.period.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.period.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + this.removeAll(); + this.add(beginDateLabel); + this.add(beginDatePicker); + this.add(endDateLabel); + this.add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(); + FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer(); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(fiscalRenderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + this.removeAll(); + this.add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(); + FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer(); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(financialRenderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod != null){ + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + this.removeAll(); + this.add(financialPeriod); + break; + } + + } + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerView.jaxx 2010-08-23 09:35:53 UTC (rev 3014) @@ -22,47 +22,22 @@ <org.chorem.lima.ui.ledger.LedgerTableModel id="modelTable"/> <script> <![CDATA[ + import org.chorem.lima.enums.ComboBoxDatesEnum; + LedgerPeriodSearchPanel periodSearchPanel = new LedgerPeriodSearchPanel(handler); - import org.apache.commons.lang.time.DateUtils; - import java.util.Calendar; - - // 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); - getHandler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - getHandler().setEndDate(endDate); - - getBeginDatePicker().setDate(beginDate); - getEndDatePicker().setDate(endDate); - void $afterCompleteSetup() { - getHandler().refresh(); } ]]> </script> <row weightx="1" weighty="0" anchor="center"> + <cell fill='both'><Table><row> + <cell anchor="west"><JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())" + onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem())); + validate(); repaint()"/></cell> + <cell><LedgerPeriodSearchPanel javaBean="periodSearchPanel"/></cell> + </row></Table></cell> <cell anchor="east"> - <JLabel id="beginCalendarPanelLabel" text="lima.period.begindate"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="beginDatePicker" - onActionPerformed="getHandler().setBeginDate(beginDatePicker.getDate())" /> - </cell> - <cell anchor="east"> - <JLabel id="endCalendarPanelLabel" text="lima.period.enddate"/> - </cell> - <cell anchor="west"> - <org.jdesktop.swingx.JXDatePicker id="endDatePicker" - onActionPerformed="getHandler().setEndDate(endDatePicker.getDate())"/> - </cell> - <cell anchor="east"> <JLabel text="lima.common.filter"/> </cell> <cell anchor="west"> Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-08-23 09:35:53 UTC (rev 3014) @@ -2,12 +2,6 @@ DEBUG\ delete\ all= Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?= Global\ lima\ exception= -LIMA= -Loading\ accounting...= -blabla= -export= -hello\ world= -import= lima.about.message= lima.account=Account lima.account.label=Label @@ -226,6 +220,9 @@ lima.solde= lima.soldecredit= lima.soldedebit= +lima.splash.1=Loading services... +lima.splash.2="Loading accounting... +lima.splash.3=Ready \! lima.structure=Structure lima.subledger.code=Code lima.tab.home=Home @@ -300,4 +297,3 @@ limahome.transaction.unbalanced= limahome.transactionbalanced= limahome.transactionunbalanced= -update= Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-08-22 19:14:52 UTC (rev 3013) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-08-23 09:35:53 UTC (rev 3014) @@ -2,10 +2,6 @@ DEBUG\ delete\ all= Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?= Global\ lima\ exception= -LIMA= -Loading\ accounting...= -export= -hello\ world= lima.about.message=\u00C0 propos de Lima lima.account=Compte lima.account.label= @@ -210,6 +206,9 @@ lima.solde=Solde lima.soldecredit=Solde Cr\u00E9diteur lima.soldedebit=Solde D\u00E9biteur +lima.splash.1=Chargement des services... +lima.splash.2=Chargement de la comptabilit\u00E9 +lima.splash.3=Application pr\u00EAte \! lima.structure=Structure lima.subledger.code=Code lima.tab.home=Accueil @@ -269,4 +268,3 @@ limahome.transaction.modifiy.unbalanced=Modifier les \u00E9critures incorrect limahome.transaction.nothing=Aucune \u00E9criture limahome.transaction.unbalanced=\u00E9critures ne sont pas \u00E9quilibr\u00E9es \! -update= Added: trunk/lima-swing/src/main/resources/images/puzzle_splash.png =================================================================== (Binary files differ) Property changes on: trunk/lima-swing/src/main/resources/images/puzzle_splash.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream