Author: sbavencoff Date: 2013-12-06 17:18:54 +0100 (Fri, 06 Dec 2013) New Revision: 3719 Url: http://chorem.org/projects/lima/repository/revisions/3719 Log: [Fiscal Period] : move button into toolBar add shortcuts add icons fix error in close or delete when selected row is empty or invalid Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/FiscalPeriodTableRenderer.java trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-close.png trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-new.png trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-remove.png Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodModelUI.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/FiscalPeriodTableRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/FiscalPeriodTableRenderer.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/FiscalPeriodTableRenderer.java 2013-12-06 16:18:54 UTC (rev 3719) @@ -0,0 +1,31 @@ +package org.chorem.lima.ui.celleditor; + +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.ui.fiscalperiod.FiscalPeriodTableModel; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.*; + +/** + * @author Sylvain Bavencoff <bavencoff@codelutin.com> + */ +public class FiscalPeriodTableRenderer extends DefaultTableCellRenderer { + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (table.getModel() instanceof FiscalPeriodTableModel) { + FiscalPeriodTableModel model = (FiscalPeriodTableModel) table.getModel(); + FiscalPeriod fiscalPeriod = model.getFiscalPeriodAt(row); + if (!isSelected && fiscalPeriod.getLocked()) { + component.setForeground(new Color(222, 0, 0)); + } + } + return component; + } + + +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/AddPeriod.jaxx 2013-12-06 16:18:54 UTC (rev 3719) @@ -31,8 +31,6 @@ <FiscalPeriodViewHandler id='handler' initializer='getContextValue(FiscalPeriodView.class,JAXXUtil.PARENT).getHandler()'/> - <FiscalPeriodTableModel id="modelFiscalPeriodTable"/> - <FiscalPeriod id="period" javaBean="new org.chorem.lima.entity.FiscalPeriodImpl()"/> <script> Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodModelUI.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodModelUI.java 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodModelUI.java 2013-12-06 16:18:54 UTC (rev 3719) @@ -1,66 +0,0 @@ -package org.chorem.lima.ui.fiscalperiod; -/* - * #%L - * Lima :: Swing - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.chorem.lima.entity.FiscalPeriod; -import org.jdesktop.beans.AbstractSerializableBean; - -public class FiscalPeriodModelUI extends AbstractSerializableBean { - - private static final long serialVersionUID = 1L; - - public static final String BLOCK_ENABLED_PROPERTY = "blockEnabled"; - - public static final String DELETE_ENABLED_PROPERTY = "deleteEnabled"; - - protected FiscalPeriod selectedFiscalPeriod; - protected boolean blockEnabled; - protected boolean deleteEnabled; - - public FiscalPeriodModelUI() { - } - - public boolean isDeleteEnabled() { - return deleteEnabled; - } - - public boolean isBlockEnabled() { - return blockEnabled; - } - - public void setBlockEnabled(boolean blockEnabled) { - Boolean oldValue = isBlockEnabled(); - this.blockEnabled = blockEnabled; - firePropertyChange(BLOCK_ENABLED_PROPERTY, oldValue, blockEnabled); - } - - public void setDeleteEnabled(boolean deleteEnabled) { - Boolean oldValue = isDeleteEnabled(); - this.deleteEnabled = deleteEnabled; - firePropertyChange(DELETE_ENABLED_PROPERTY, oldValue, deleteEnabled); - } - - - -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTable.java 2013-12-06 16:18:54 UTC (rev 3719) @@ -25,15 +25,10 @@ package org.chorem.lima.ui.fiscalperiod; -import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.ui.celleditor.FiscalPeriodTableRenderer; import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.jdesktop.swingx.decorator.Highlighter; -import java.awt.Color; -import java.awt.Component; +import javax.swing.table.TableCellRenderer; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; @@ -59,37 +54,14 @@ private static final long serialVersionUID = -8462838870024505659L; - protected FiscalPeriodTableModel model; + public FiscalPeriodTable() { + super(); - public FiscalPeriodTable(FiscalPeriodTableModel model) { - super(model); - this.model = model; - addKeyListener(this); addMouseListener(this); - // highlight financial financial transactions - addBlockColor(); } - /** - * Highlight locked period in RED. - */ - protected void addBlockColor() { - - HighlightPredicate predicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, - ComponentAdapter adapter) { - FiscalPeriod fiscalPeriod = model.getFiscalPeriodAt(adapter.row); - return fiscalPeriod.getLocked(); - } - }; - Highlighter colorTransaction = - new ColorHighlighter(predicate, null, new Color(222, 0, 0)); - addHighlighter(colorTransaction); - } - @Override public void mouseClicked(MouseEvent e) { } @@ -135,4 +107,9 @@ public void keyReleased(KeyEvent e) { } + @Override + public TableCellRenderer getCellRenderer(int row, int column) { + return new FiscalPeriodTableRenderer(); + } + } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2013-12-06 16:18:54 UTC (rev 3719) @@ -25,18 +25,17 @@ package org.chorem.lima.ui.fiscalperiod; -import static org.nuiton.i18n.I18n._; - -import java.text.SimpleDateFormat; -import java.util.List; - -import javax.swing.table.AbstractTableModel; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FiscalPeriod; +import javax.swing.table.AbstractTableModel; +import java.text.SimpleDateFormat; +import java.util.List; + +import static org.nuiton.i18n.I18n._; + /** * Modele de Fiscal period (rendu de list) * @@ -55,9 +54,8 @@ protected List<FiscalPeriod> fiscalPeriods; - public void setFiscalPeriods(List<FiscalPeriod> fiscalPeriods) { + public FiscalPeriodTableModel(List<FiscalPeriod> fiscalPeriods) { this.fiscalPeriods = fiscalPeriods; - fireTableDataChanged(); } @Override Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodView.jaxx 2013-12-06 16:18:54 UTC (rev 3719) @@ -27,16 +27,15 @@ <import> javax.swing.ListSelectionModel - javax.swing.DefaultListSelectionModel - org.chorem.lima.entity.FiscalPeriod - org.chorem.lima.entity.FinancialPeriod + javax.swing.DefaultListSelectionModel + static org.nuiton.i18n.I18n._ </import> <FiscalPeriodViewHandler id="handler" constructorParams="this"/> - <FiscalPeriodTableModel id="fiscalPeriodTableModel" /> - <ListSelectionModel id="selectionModel" initializer="new DefaultListSelectionModel()" onValueChanged="handler.onSelectionChanged(event)" selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/> - <FiscalPeriodModelUI id='model' javaBean='new FiscalPeriodModelUI()'/> + <Boolean id="blockEnabled" javaBean="false"/> + <Boolean id="deleteEnabled" javaBean="false"/> + <script><![CDATA[ void $afterCompleteSetup() { getHandler().init(); @@ -44,34 +43,44 @@ ]]></script> <row> - <cell fill="both" weightx="1" weighty="1" rows="5"> - <JScrollPane> - <FiscalPeriodTable - id="fiscalPeriodTable" sortable="false" rowHeight="24" - constructorParams="getFiscalPeriodTableModel()" - columnControlVisible="true" - selectionModel='{selectionModel}'/> - </JScrollPane> - </cell> - </row> - <row> <cell fill="horizontal"> - <JButton id="addButton" text="lima.charts.fiscalperiod.add" - onActionPerformed="getHandler().addFiscalPeriod()"/> + <JToolBar floatable="false"> + + <JButton id="addButton" + toolTipText="{ _("lima.charts.fiscalperiod.add") + " (Ctrl+N)"}" + actionIcon='fiscalPeriod-new' + onActionPerformed="handler.addFiscalPeriod()"/> + + <JButton id="blockButton" + toolTipText="{ _("lima.charts.fiscalperiod.block") + " (Ctrl+C)"}" + actionIcon='fiscalPeriod-close' + onActionPerformed="handler.blockFiscalPeriod()" + enabled="{isBlockEnabled()}"/> + + <JButton id="deleteButton" + toolTipText="{ _("lima.charts.fiscalperiod.delete") + " (Del)"}" + actionIcon='fiscalPeriod-remove' + onActionPerformed="handler.deleteFiscalPeriod()" + enabled="{isDeleteEnabled()}"/> + + </JToolBar> </cell> </row> + <row> - <cell fill="horizontal"> - <JButton id="blockButton" text="lima.charts.fiscalperiod.block" - enabled="{model.isBlockEnabled()}" - onActionPerformed="getHandler().blockFiscalPeriod()"/> + <cell fill="both" weightx="1" weighty="1"> + <JScrollPane> + <FiscalPeriodTable id="fiscalPeriodTable" + sortable="false" + rowHeight="24" + columnControlVisible="true" + selectionModel='{selectionModel}'/> + <ListSelectionModel id="selectionModel" + initializer="new DefaultListSelectionModel()" + onValueChanged="handler.onSelectionChanged(event)" + selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/> + + </JScrollPane> </cell> </row> - <row> - <cell fill="horizontal"> - <JButton id="deleteButton" text="lima.charts.fiscalperiod.delete" - enabled="{model.isDeleteEnabled()}" - onActionPerformed="getHandler().deleteFiscalPeriod()"/> - </cell> - </row> </Table> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2013-12-06 13:25:34 UTC (rev 3718) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodViewHandler.java 2013-12-06 16:18:54 UTC (rev 3719) @@ -25,16 +25,6 @@ package org.chorem.lima.ui.fiscalperiod; -import static org.nuiton.i18n.I18n._; - -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.swing.DefaultListSelectionModel; -import javax.swing.JOptionPane; -import javax.swing.event.ListSelectionEvent; - import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -47,9 +37,18 @@ import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; -import org.jdesktop.swingx.JXTable; import org.nuiton.util.DateUtil; +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import static org.nuiton.i18n.I18n._; + /** * Handler pour la gestion des exercices (creation/fermeture). * @@ -85,6 +84,41 @@ } public void init() { + + InputMap inputMap = view.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + ActionMap actionMap = view.getActionMap(); + + // add action on Ctrl + N + String binding = "new-FiscalPeriod"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK), binding); + actionMap.put(binding, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + addFiscalPeriod(); + } + }); + + // add action on Delete + binding = "remove-FiscalPeriod"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), binding); + actionMap.put(binding, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + deleteFiscalPeriod(); + } + }); + + // add action on Ctrl + B + binding = "close-FiscalPeriod"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK), binding); + actionMap.put(binding, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + blockFiscalPeriod(); + } + }); + + loadAllFiscalPeriod(); } @@ -93,7 +127,10 @@ */ public void loadAllFiscalPeriod() { List<FiscalPeriod> periods = fiscalPeriodService.getAllFiscalPeriods(); - view.getFiscalPeriodTableModel().setFiscalPeriods(periods); + + FiscalPeriodTableModel model = new FiscalPeriodTableModel(periods); + FiscalPeriodTable table = view.getFiscalPeriodTable(); + table.setModel(model); } /** @@ -101,7 +138,8 @@ */ public void addFiscalPeriod() { - FiscalPeriodTableModel model = (FiscalPeriodTableModel) view.getFiscalPeriodTable().getModel(); + FiscalPeriodTable table = view.getFiscalPeriodTable(); + FiscalPeriodTableModel model = (FiscalPeriodTableModel) table.getModel(); AddPeriod addPeriodDialog = new AddPeriod(view); addPeriodDialog.setLocationRelativeTo(view); @@ -133,25 +171,33 @@ */ public void deleteFiscalPeriod() { - JXTable fiscalPeriodeTable = view.getFiscalPeriodTable(); - FiscalPeriodTableModel model = (FiscalPeriodTableModel) view.getFiscalPeriodTable().getModel(); + FiscalPeriodTable table = view.getFiscalPeriodTable(); + FiscalPeriodTableModel model = (FiscalPeriodTableModel) table.getModel(); - //check if the user want to delete the fiscal year - int response = JOptionPane.showConfirmDialog(view, - _("lima.ui.fiscalperiod.delete.confirmation"), - _("lima.ui.fiscalperiod.delete.title"), JOptionPane.YES_NO_OPTION, - JOptionPane.WARNING_MESSAGE); + int selectedRow = table.getSelectedRow(); - int selectedRow = fiscalPeriodeTable.getSelectedRow(); - FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow); + if (selectedRow >=0 ) { - if (response == JOptionPane.YES_OPTION) { - fiscalPeriodService.deleteFiscalPeriod(selectedFiscalPeriod); + FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow); - model.deleteFiscalPeriod(selectedFiscalPeriod); - view.getModel().setBlockEnabled(false); - view.getModel().setDeleteEnabled(false); - } + if (!selectedFiscalPeriod.isLocked() + && financialTransactionService.getAllFinancialTransactions(selectedFiscalPeriod).isEmpty()) { + + //check if the user want to delete the fiscal year + int response = JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.delete.confirmation"), + _("lima.ui.fiscalperiod.delete.title"), JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); + + if (response == JOptionPane.YES_OPTION) { + fiscalPeriodService.deleteFiscalPeriod(selectedFiscalPeriod); + + model.deleteFiscalPeriod(selectedFiscalPeriod); + view.setBlockEnabled(false); + view.setDeleteEnabled(false); + } + } + } } /** @@ -194,63 +240,70 @@ * after user confirmations */ public void blockFiscalPeriod() { - JXTable fiscalPeriodeTable = view.getFiscalPeriodTable(); - FiscalPeriodTableModel model = view.getFiscalPeriodTableModel(); - - int selectedRow = fiscalPeriodeTable.getSelectedRow(); - FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow); + FiscalPeriodTable table = view.getFiscalPeriodTable(); + FiscalPeriodTableModel model = (FiscalPeriodTableModel) table.getModel(); - //check if the user want to block the fiscal year - int answerBlock = JOptionPane.showConfirmDialog(view, - _("lima.ui.fiscalperiod.block.confirmation"), - _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, - JOptionPane.WARNING_MESSAGE); - - if (answerBlock == JOptionPane.YES_OPTION) { - boolean retainedEarnings = false; - EntryBook entryBook = null; + int selectedRow = table.getSelectedRow(); - //check if the user wants to create a new fiscal year - int answerCreate = JOptionPane.showConfirmDialog(view, - _("lima.ui.fiscalperiod.block.newyear"), - _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); + if (selectedRow >= 0) { - // create a new fiscal year - if (answerCreate == JOptionPane.YES_OPTION) { - addFiscalPeriod(); + FiscalPeriod selectedFiscalPeriod = model.getFiscalPeriodAt(selectedRow); - //report if they are at least one transaction to be report - if (fiscalPeriodService.isRetainedEarnings(selectedFiscalPeriod)) { + if (!selectedFiscalPeriod.isLocked()) { - //check if the user wants to report datas - int answerRetainedEarnings = JOptionPane.showConfirmDialog(view, - _("lima.ui.fiscalperiod.block.addretainedearnings"), - _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); + //check if the user want to block the fiscal year + int answerBlock = JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.confirmation"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE); - if (answerRetainedEarnings == JOptionPane.YES_OPTION) { - retainedEarnings = true; + if (answerBlock == JOptionPane.YES_OPTION) { + boolean retainedEarnings = false; + EntryBook entryBook = null; - //Sets EntryBook - EntryBook newEntryBook = new EntryBookImpl(); - RetainedEarningsEntryBookForm entryBookForm = - new RetainedEarningsEntryBookForm(view); - entryBookForm.setEntryBook(newEntryBook); + //check if the user wants to create a new fiscal year + int answerCreate = JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.newyear"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); - // jaxx constructor don't call super() ? - entryBookForm.setLocationRelativeTo(view); - entryBookForm.setVisible(true); - entryBook = entryBookForm.getEntryBook(); + // create a new fiscal year + if (answerCreate == JOptionPane.YES_OPTION) { + addFiscalPeriod(); + + //report if they are at least one transaction to be report + if (fiscalPeriodService.isRetainedEarnings(selectedFiscalPeriod)) { + + //check if the user wants to report datas + int answerRetainedEarnings = JOptionPane.showConfirmDialog(view, + _("lima.ui.fiscalperiod.block.addretainedearnings"), + _("lima.ui.fiscalperiod.block.title"), JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + + if (answerRetainedEarnings == JOptionPane.YES_OPTION) { + retainedEarnings = true; + + //Sets EntryBook + EntryBook newEntryBook = new EntryBookImpl(); + RetainedEarningsEntryBookForm entryBookForm = + new RetainedEarningsEntryBookForm(view); + entryBookForm.setEntryBook(newEntryBook); + + // jaxx constructor don't call super() ? + entryBookForm.setLocationRelativeTo(view); + entryBookForm.setVisible(true); + entryBook = entryBookForm.getEntryBook(); + } + } } + + FiscalPeriod fiscalPeriodBlocked = fiscalPeriodService.retainedEarningsAndBlockFiscalPeriod(selectedFiscalPeriod, entryBook, retainedEarnings); + model.updateFiscalPeriod(fiscalPeriodBlocked); + + view.setBlockEnabled(false); + view.setDeleteEnabled(false); } } - - FiscalPeriod fiscalPeriodBlocked = fiscalPeriodService.retainedEarningsAndBlockFiscalPeriod(selectedFiscalPeriod, entryBook, retainedEarnings); - model.updateFiscalPeriod(fiscalPeriodBlocked); - - view.getModel().setBlockEnabled(false); - view.getModel().setDeleteEnabled(false); } } @@ -274,9 +327,10 @@ selectedRow = listSelectionEvent.getLastIndex(); } - FiscalPeriodTableModel fiscalPeriodTableModel = view.getFiscalPeriodTableModel(); - if (fiscalPeriodTableModel.getRowCount() != selectedRow) { - FiscalPeriod fiscalPeriodAt = fiscalPeriodTableModel.getFiscalPeriodAt(selectedRow); + FiscalPeriodTable table = view.getFiscalPeriodTable(); + FiscalPeriodTableModel model = (FiscalPeriodTableModel) table.getModel(); + if (model.getRowCount() != selectedRow) { + FiscalPeriod fiscalPeriodAt = model.getFiscalPeriodAt(selectedRow); List<FinancialTransaction> financialTransactionList = financialTransactionService.getAllFinancialTransactions(fiscalPeriodAt); @@ -303,8 +357,8 @@ enableDelete = financialTransactionList.size() <= 0; } } - view.getModel().setBlockEnabled(enableBlock); - view.getModel().setDeleteEnabled(enableDelete); + view.setBlockEnabled(enableBlock); + view.setDeleteEnabled(enableDelete); } } } Added: trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-close.png =================================================================== (Binary files differ) Property changes on: trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-close.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-new.png (from rev 3718, trunk/lima-swing/src/main/resources/icons/action-entryBook-new.png) =================================================================== (Binary files differ) Copied: trunk/lima-swing/src/main/resources/icons/action-fiscalPeriod-remove.png (from rev 3718, trunk/lima-swing/src/main/resources/icons/action-entryBook-remove.png) =================================================================== (Binary files differ)
participants (1)
-
sbavencoffļ¼ users.chorem.org