From echatellier@users.chorem.org Fri Apr 6 12:07:48 2012 From: echatellier@users.chorem.org To: lima-commits@list.chorem.org Subject: [Lima-commits] r3355 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/fiscalperiod resources/i18n Date: Fri, 06 Apr 2012 12:07:48 +0200 Message-ID: <20120406100748.4F12C5A5ED@nuiton.codelutin.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0363698295596891801==" --===============0363698295596891801== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: echatellier Date: 2012-04-06 12:07:48 +0200 (Fri, 06 Apr 2012) New Revision: 3355 Url: http://chorem.org/repositories/revision/lima/3355 Log: Debut du refactoring de gestion des exercices (le report ?\195?\160 nouveau e= st encore a gerer et ?\195?\160 d?\195?\169placer dans les services). Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookLi= stRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/package-inf= o.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.j= axx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPerio= dTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPerio= dTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPerio= dView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPerio= dViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEar= ningsEntryBookForm.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/ui/fiscalperiod/AddP= eriod.jaxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.= jaxx 2012-04-05 14:09:35 UTC (rev 3354) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.= jaxx 2012-04-06 10:07:48 UTC (rev 3355) @@ -22,84 +22,44 @@ . #L% --> - - java.util.Date - java.util.Calendar - org.apache.commons.lang3.time.DateUtils - org.jdesktop.swingx.JXDatePicker - org.chorem.lima.entity.FiscalPeriodImpl org.chorem.lima.entity.FiscalPeriod - org.chorem.lima.business.LimaException - org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable - org.chorem.lima.service.LimaServiceFactory - org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel + + + + + + + ]]> =20 - - - + @@ -107,7 +67,7 @@ - + Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBo= okListRenderer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookL= istRenderer.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/EntryBookL= istRenderer.java 2012-04-06 10:07:48 UTC (rev 3355) @@ -0,0 +1,62 @@ +/* + * #%L + *=20 + *=20 + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as=20 + * published by the Free Software Foundation, either version 3 of the=20 + * License, or (at your option) any later version. + *=20 + * 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 Lesser Public License for more details. + *=20 + * You should have received a copy of the GNU General Lesser Public=20 + * License along with this program. If not, see + * . + * #L% + */ + +package org.chorem.lima.ui.fiscalperiod; + +import java.awt.Component; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; + +import org.chorem.lima.entity.EntryBook; + +/** + * EntryBook renderer for fiscal period retaining earning list. + *=20 + * @author chatellier + * @version $Revision$ + *=20 + * Last update : $Date$ + * By : $Author$ + */ +public class EntryBookListRenderer extends DefaultListCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID =3D -9089182547408397051L; + + @Override + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + + EntryBook entryBook =3D (EntryBook)value; + Object newValue =3D entryBook; + if (entryBook !=3D null) { + newValue =3D entryBook.getCode() + " - " + entryBook.getLabel(); + } + return super.getListCellRendererComponent(list, value, index, isSele= cted, + cellHasFocus); + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscal= period/EntryBookListRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/Fisc= alPeriodTable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odTable.java 2012-04-05 14:09:35 UTC (rev 3354) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odTable.java 2012-04-06 10:07:48 UTC (rev 3355) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2008 - 2010 CodeLutin + * 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 @@ -39,6 +39,23 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; =20 +import javax.swing.table.TableModel; + +/** + * Fiscal period table add support for JXTable. + *=20 + * Including: + *
    + *
  • Locked period red highlight + *
  • + *
+ *=20 + * @author chatellier + * @version $Revision$ + *=20 + * Last update : $Date$ + * By : $Author$ + */ public class FiscalPeriodTable extends JXTable implements KeyListener, MouseListener { =20 @@ -50,26 +67,28 @@ =20 private Highlighter colorTransaction; =20 - public FiscalPeriodTable(FiscalPeriodViewHandler handler) { - + public FiscalPeriodTable(FiscalPeriodTableModel model) { + super(model); + this.model =3D model; this.handler =3D handler; =20 addKeyListener(this); addMouseListener(this); =20 - model =3D this.handler.getView().getModelFiscalPeriodTable(); - - //highlight financial financial transactions + // highlight financial financial transactions addBlockColor(); } =20 + /** + * Highlight locked period in RED. + */ protected void addBlockColor() { + HighlightPredicate predicate =3D new HighlightPredicate() { @Override public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - FiscalPeriod fiscalPeriod =3D (FiscalPeriod) model.getElemen= tAt(adapter.row); - // true if locked=20 + FiscalPeriod fiscalPeriod =3D model.getFiscalPeriodAt(adapte= r.row); return fiscalPeriod.getLocked(); } }; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/Fisc= alPeriodTableModel.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odTableModel.java 2012-04-05 14:09:35 UTC (rev 3354) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odTableModel.java 2012-04-06 10:07:48 UTC (rev 3355) @@ -25,34 +25,18 @@ =20 package org.chorem.lima.ui.fiscalperiod; =20 -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaException; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.ejbinterface.FinancialTransactionService; -import org.chorem.lima.business.ejbinterface.FiscalPeriodService; -import org.chorem.lima.business.monitorable.FinancialTransactionServiceMonit= orable; -import org.chorem.lima.business.monitorable.FiscalPeriodServiceMonitorable; -import org.chorem.lima.business.monitorable.ImportServiceMonitorable; -import org.chorem.lima.business.utils.FiscalPeriodComparator; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.util.ErrorHelper; -import org.nuiton.util.Resource; +import static org.nuiton.i18n.I18n._; =20 -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.table.AbstractTableModel; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; =20 -import static org.nuiton.i18n.I18n._; +import javax.swing.table.AbstractTableModel; =20 +import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.FiscalPeriod; + /** - * TODO add comment here. + * Modele de Fiscal period (rendu de list) * * @author chatellier * @version $Revision$ @@ -60,62 +44,24 @@ * Last update : $Date$ * By : $Author$ */ -public class FiscalPeriodTableModel extends AbstractTableModel implements Se= rviceListener { +public class FiscalPeriodTableModel extends AbstractTableModel { =20 /** serialVersionUID. */ private static final long serialVersionUID =3D 77027335135838258L; =20 - private static final Log log =3D LogFactory.getLog(FiscalPeriodTableMode= l.class); + protected List fiscalPeriods; =20 - protected FiscalPeriodService fiscalPeriodService; - - protected FinancialTransactionService financialTransactionService; - - /** data cache */ - protected List cacheDataList; - - public FiscalPeriodTableModel() { - fiscalPeriodService =3D - LimaServiceFactory.getService( - FiscalPeriodServiceMonitorable.class); - LimaServiceFactory.addServiceListener(fiscalPeriodService, this); - LimaServiceFactory.addServiceListener(ImportServiceMonitorable.class= , this); - financialTransactionService =3D - LimaServiceFactory.getService( - FinancialTransactionServiceMonitorable.class); - LimaServiceFactory.addServiceListener(financialTransactionService, t= his); - cacheDataList =3D null; - } - - protected List getDataList() { - List results =3D new ArrayList(); - try { - List fiscalPeriod =3D - fiscalPeriodService.getAllFiscalPeriods(); - Collections.sort(fiscalPeriod, new FiscalPeriodComparator()); - results.addAll(fiscalPeriod); - } catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.error("Can't update model", eee); - } - ErrorHelper.showErrorDialog(_("lima.fiscalperiod.listerror"), ee= e); - } - return results; - } - - public void refresh() { - cacheDataList =3D getDataList(); + public void setFiscalPeriods(List fiscalPeriods) { + this.fiscalPeriods =3D fiscalPeriods; fireTableDataChanged(); } =20 @Override public int getRowCount() { int result =3D 0; - - if (cacheDataList !=3D null) { - result =3D cacheDataList.size(); + if (fiscalPeriods !=3D null) { + result =3D fiscalPeriods.size(); } - return result; } =20 @@ -124,16 +70,9 @@ return 2; } =20 - - public Object getElementAt(int row) { - - Object currentRow =3D null; - - if (cacheDataList !=3D null) { - currentRow =3D cacheDataList.get(row); - } - - return currentRow; + public FiscalPeriod getFiscalPeriodAt(int row) { + FiscalPeriod result =3D fiscalPeriods.get(row); + return result; } =20 @Override @@ -143,10 +82,10 @@ =20 switch (columnIndex) { case 0: - result =3D _("lima.table.fiscalperiod"); + result =3D _("lima.ui.fiscalperiod.fiscalperiod"); break; case 1: - result =3D _("lima.table.closure"); + result =3D _("lima.ui.fiscalperiod.closure"); break; } =20 @@ -154,27 +93,14 @@ } =20 @Override - public Class getColumnClass(int columnIndex) { - // both String - return String.class; - } - - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return false; - } - - @Override public Object getValueAt(int rowIndex, int columnIndex) { =20 Object result =3D "n/a"; =20 - List periods; - periods =3D cacheDataList; - FiscalPeriod fiscalPeriod =3D (FiscalPeriod) periods.get(rowIndex); + FiscalPeriod fiscalPeriod =3D getFiscalPeriodAt(rowIndex); =20 if (fiscalPeriod !=3D null) { + // FIXME echatellier 20120405 i18n problem (hard coded) SimpleDateFormat simpleDateFormat =3D new SimpleDateFormat("dd M= MM yyyy"); =20 switch (columnIndex) { @@ -186,9 +112,9 @@ break; case 1: if (fiscalPeriod.getLocked()) { - result =3D _("lima.common.closed"); + result =3D _("lima.ui.fiscalperiod.closed"); } else { - result =3D _("lima.common.open"); + result =3D _("lima.ui.fiscalperiod.open"); } break; } @@ -197,35 +123,14 @@ return result; } =20 - public FiscalPeriod getFiscalPeriodAtRow(int row) throws LimaException { - FiscalPeriod fiscalPeriod; - fiscalPeriod =3D (FiscalPeriod) cacheDataList.get(row); - return fiscalPeriod; + public void addFiscalPeriod(FiscalPeriod fiscalPeriod) { + fiscalPeriods.add(fiscalPeriod); + int row =3D fiscalPeriods.indexOf(fiscalPeriod); + fireTableRowsInserted(row, row); } =20 - /** - * @param period - * @throws LimaException - */ - public void addFiscalPeriod(FiscalPeriod period) throws LimaException { - - try { - // Calling fiscal period service - fiscalPeriodService.createFiscalPeriod(period); - //on recharge la liste - cacheDataList =3D getDataList(); - int row =3D getDataList().indexOf(period); - fireTableRowsInserted(row, row); - } catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.error("Can't create FiscalPeriod", eee); - } - ErrorHelper.showErrorDialog(_("lima.fiscalperiod.creationerror")= , eee); - } - } - - public void blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaExce= ption { - List financialTransactionsUnbal =3D + public void updateFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaExc= eption { + /*List financialTransactionsUnbal =3D financialTransactionService.getAllInexactFinancialTransactio= ns(fiscalPeriod); if (financialTransactionsUnbal.size() > 0) { JFrame f =3D new JFrame(); @@ -239,14 +144,8 @@ } else { fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); refresh(); - } + }*/ + int row =3D fiscalPeriods.indexOf(fiscalPeriod); + fireTableRowsInserted(row, row); } - - @Override - public void notifyMethod(String serviceName, String methodeName) { - //refresh on import datas - if (methodeName.contains("importAll")) { - refresh(); - } - } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/Fisc= alPeriodView.jaxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odView.jaxx 2012-04-05 14:09:35 UTC (rev 3354) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeri= odView.jaxx 2012-04-06 10:07:48 UTC (rev 3355) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2008 - 2010 CodeLutin + 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 @@ -29,29 +29,24 @@ javax.swing.ListSelectionModel org.chorem.lima.entity.FiscalPeriod org.chorem.lima.entity.FinancialPeriod - org.chorem.lima.ui.fiscalperiod.FiscalPeriodTable - org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel - + + =20 - + ]]> + - + periods =3D fiscalPeriodService.getAllFiscalP= eriods(); + view.getFiscalPeriodTableModel().setFiscalPeriods(periods); + } catch (LimaException ex) { + throw new LimaRuntimeException("Cant get fiscal perdiods", ex); + } + } + + /** + * Display add period form and perform add. + */ public void addFiscalPeriod() { =20 - FiscalPeriodTableModel model =3D - (FiscalPeriodTableModel) getView().getFiscalPeriodTable().ge= tModel(); + FiscalPeriodTableModel model =3D (FiscalPeriodTableModel) view.getFi= scalPeriodTable().getModel(); =20 - AddPeriod addPeriodDialog =3D new AddPeriod(getView()); - // jaxx don't call super() ? - addPeriodDialog.setLocationRelativeTo(getView()); + AddPeriod addPeriodDialog =3D new AddPeriod(view); + addPeriodDialog.setLocationRelativeTo(view); addPeriodDialog.setVisible(true); =20 FiscalPeriod fiscalPeriod =3D addPeriodDialog.getPeriod(); // null =3D cancel if (fiscalPeriod !=3D null) { //check if fiscalperiod have 12 months, ask a confirmation - int nbMonth =3D - DateUtil.getDifferenceInMonths(fiscalPeriod.getBeginDate= (), - fiscalPeriod.getEndDate()= ); - int n =3D 0; + int nbMonth =3D DateUtil.getDifferenceInMonths(fiscalPeriod.getB= eginDate(), + fiscalPeriod.getEndDate()); + int response =3D JOptionPane.NO_OPTION; if (nbMonth !=3D 12) { - n =3D JOptionPane.showConfirmDialog(getView(), - _("lima.charts.fiscalperio= d.question.morethan12"), - _("lima.common.question"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSA= GE); + response =3D JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.addfiscalperiod.morethan12"), + _("lima.ui.fiscalperiod.addfiscalperiodtitle"), + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); } - if (n =3D=3D JOptionPane.YES_OPTION || nbMonth =3D=3D 11) { + // FIXME echatellier 20120405 je ne comprend pas le "|| nbMonth = =3D=3D 11" + if (response =3D=3D JOptionPane.YES_OPTION || nbMonth =3D=3D 11)= { try { + fiscalPeriod =3D fiscalPeriodService.createFiscalPeriod(= fiscalPeriod); model.addFiscalPeriod(fiscalPeriod); - } catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.error("Can't add fiscal period", eee); - } - DialogHelper.showErrorMessageDialog(view, eee); + } catch (LimaException ex) { + throw new LimaRuntimeException("Can't add fiscal period"= , ex); } } } } =20 + /** + * Init add period view. + *=20 + * @param addPeriod view to init + */ + public void init(AddPeriod addPeriod) { + addPeriod.getRootPane().setDefaultButton(addPeriod.getOkButton()); + + // set begin date picker + Date endDate =3D null; + Calendar calendarBegin =3D Calendar.getInstance(); + // set begindate to JAN 1 - 0:00.000 of this years + Date beginDate =3D calendarBegin.getTime(); + beginDate =3D DateUtils.truncate(beginDate, Calendar.DATE); + try { + FiscalPeriod result =3D fiscalPeriodService.getLastFiscalPeriod(= ); + if (result !=3D null){ + beginDate =3D result.getEndDate(); + } + } + catch (LimaException eee){ + if(log.isDebugEnabled()){ + log.debug("Can't get last fiscal period", eee); + } + } + beginDate =3D DateUtils.addDays(beginDate, 1); + addPeriod.getBeginDatePicker().setDate(beginDate); + =20 + // get end date + endDate =3D DateUtils.addYears(beginDate, 1); + endDate =3D DateUtils.addDays(endDate, -1); + addPeriod.getEndDatePicker().setDate(endDate); + } + + /** + * Block selected fiscal period after user confirmation. + */ public void blockFiscalPeriod() { - JXTable fiscalPeriodeTable =3D getView().getFiscalPeriodTable(); + JXTable fiscalPeriodeTable =3D view.getFiscalPeriodTable(); int selectedRow =3D fiscalPeriodeTable.getSelectedRow(); - FiscalPeriodTableModel model =3D - (FiscalPeriodTableModel) getView().getFiscalPeriodTable().ge= tModel(); - // blocked it + FiscalPeriodTableModel model =3D view.getFiscalPeriodTableModel(); + FiscalPeriod selectedFiscalPeriod =3D model.getFiscalPeriodAt(select= edRow); + try { - FiscalPeriod selectedFiscalPeriod =3D - model.getFiscalPeriodAtRow(selectedRow); + //check if the user want to block the fiscal year - int response =3D - JOptionPane.showConfirmDialog(getView(), - _("lima.charts.fiscalperio= d.question.blocked"), - _("lima.common.question"),= JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSA= GE); + int response =3D JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.confirmation"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_N= O_OPTION, + JOptionPane.WARNING_MESSAGE); if (response =3D=3D JOptionPane.YES_OPTION) { //use to tell if the user wants to create a new fiscal year boolean newyear =3D false; @@ -144,19 +199,22 @@ newyear =3D true; //two are open } else { //check if the user wants to create a new fiscal year - response =3D - JOptionPane.showConfirmDialog(getView(), - _("lima.charts.fis= calperiod.question.newyear"), - _("lima.common.que= stion"), JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTI= ON_MESSAGE); - //create a new fiscal year + response =3D JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.newyear"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane= .YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + // create a new fiscal year if (response =3D=3D JOptionPane.YES_OPTION) { addFiscalPeriod(); newyear =3D true; } } + + // FIXME report a nouveau et bloquage en une seule op=C3=A9r= ation + // transactionnelle addRetainedEarnings(selectedFiscalPeriod, newyear); - model.blockFiscalPeriod(selectedFiscalPeriod); + selectedFiscalPeriod =3D fiscalPeriodService.blockFiscalPeri= od(selectedFiscalPeriod); + model.updateFiscalPeriod(selectedFiscalPeriod); } } catch (LimaException eee) { if (log.isErrorEnabled()) { @@ -167,16 +225,15 @@ } =20 /** - * Sets EntryBook and Date to use + * Report =C3=A0 nouveau. * + * @deprecated a d=C3=A9placer en partie en metier * @param selectedFiscalPeriod * @param newyear */ + @Deprecated public void addRetainedEarnings(FiscalPeriod selectedFiscalPeriod, boole= an newyear) { -// JXTable fiscalPeriodeTable =3D getView().getFiscalPeriodTable(); -// int selectedRow =3D fiscalPeriodeTable.getSelectedRow(); -// FiscalPeriodTableModel model =3D -// (FiscalPeriodTableModel)getView().getFiscalPeriodTable().getMo= del(); + try { boolean found =3D false; List financialTransactionsList =3D @@ -199,11 +256,10 @@ //report if they are at least one transaction to be report if (found) { //check if the user wants to report datas - int response =3D - JOptionPane.showConfirmDialog(getView(), - _("lima.charts.fiscalp= eriod.question.addretainedearnings"), - _("lima.common.questio= n"), JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_M= ESSAGE); + int response =3D JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.addretainedearnings"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_N= O_OPTION, + JOptionPane.QUESTION_MESSAGE); //ask user for the entrybook to use for retained earnings if (response =3D=3D JOptionPane.YES_OPTION) { //Sets EntryBook @@ -230,13 +286,12 @@ =20 } } - - public FiscalPeriodView getView() { - return view; + =20 + @Override + public void notifyMethod(String serviceName, String methodeName) { + //refresh on import datas + if (methodeName.contains("importAll")) { + loadAllFiscalPeriod(); + } } - - public void refresh() { - tableModel =3D (FiscalPeriodTableModel) getView().getFiscalPeriodTab= le().getModel(); - tableModel.refresh(); - } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/Reta= inedEarningsEntryBookForm.jaxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEa= rningsEntryBookForm.jaxx 2012-04-05 14:09:35 UTC (rev 3354) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEa= rningsEntryBookForm.jaxx 2012-04-06 10:07:48 UTC (rev 3355) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2008 - 2011 CodeLutin + 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 @@ -22,22 +22,21 @@ . #L% --> - =20 javax.swing.text.Document org.chorem.lima.entity.EntryBook - org.chorem.lima.ui.LimaRendererUtil org.chorem.lima.ui.combobox.EntryBookComboBoxModel + =20