r3711 - in trunk: lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/lettering
Author: Bavencoff Date: 2013-10-11 17:17:27 +0200 (Fri, 11 Oct 2013) New Revision: 3711 Url: http://chorem.org/projects/lima/repository/revisions/3711 Log: [lettrage] change lettring/un lettring filter Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2013-10-11 13:56:17 UTC (rev 3710) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2013-10-11 15:17:27 UTC (rev 3711) @@ -197,12 +197,11 @@ " where E.financialTransaction = F" + " and E.account.accountNumber like :account "; - if (filter.getDisplayLettered() || filter.getDisplayUnlettred()){ - if (filter.getDisplayUnlettred()){ - query += " and E.lettering is null"; - }else { - query += " and E.lettering is not null"; - } + + if (!filter.getDisplayLettered() && filter.getDisplayUnlettred()){ + query += " and E.lettering is null"; + } else if (filter.getDisplayLettered() && !filter.getDisplayUnlettred()){ + query += " and E.lettering is not null"; } query += " and E.financialTransaction.transactionDate between :beginDate and :endDate " + Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2013-10-11 13:56:17 UTC (rev 3710) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2013-10-11 15:17:27 UTC (rev 3711) @@ -70,7 +70,7 @@ actionMap.put(binding, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { - handler.addLetter(); + handler.addLetter(); } }); @@ -94,7 +94,18 @@ } }); + // refresh + binding = "refresh"; + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), binding); + actionMap.put(binding, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + handler.updateAllEntries(); + } + }); + + //Get new date editor setDefaultEditor(Date.class, new DateTableCellEditor()); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2013-10-11 13:56:17 UTC (rev 3710) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2013-10-11 15:17:27 UTC (rev 3711) @@ -32,14 +32,11 @@ org.chorem.lima.entity.Account javax.swing.ListSelectionModel org.jdesktop.swingx.JXDatePicker - org.chorem.lima.beans.LetteringFilter - org.chorem.lima.beans.LetteringFilterImpl </import> <LetteringViewHandler id="handler" constructorParams="this"/> <LetteringTableModel id="tableModel"/> - <LetteringFilterImpl id='filterModel' initializer='new LetteringFilterImpl()'/> <LetteringEditModel id='editModel'/> <LettringSelectionModel id='lettringSelectionModel' constructorParams=' tableModel' @@ -84,7 +81,7 @@ model="{accountComboBoxModel}" toolTipText="lima.ui.lettering.account" renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}" - onItemStateChanged="filterModel.setAccount((Account)accountComboBoxModel.getSelectedItem())" /> + onItemStateChanged="handler.setAccount((Account)accountComboBoxModel.getSelectedItem())" /> <JButton id="back" actionIcon="previous" toolTipText="lima.ui.account.buttonback" onActionPerformed="handler.back(accountComboBox)"/> @@ -97,12 +94,12 @@ <JLabel text="lima.ui.lettering.beginFinancialPeriod" labelFor='{pickerDebut}'/> <JXDatePicker id="pickerDebut" - onActionPerformed="filterModel.setDateStart(pickerDebut.getDate())"/> + onActionPerformed="handler.setDateStart(pickerDebut.getDate())"/> <JLabel text="lima.ui.lettering.endFinancialPeriod" labelFor="{pickerFin}"/> <JXDatePicker id="pickerFin" - onActionPerformed="filterModel.setDateEnd(pickerFin.getDate())"/> + onActionPerformed="handler.setDateEnd(pickerFin.getDate())"/> <JToolBar.Separator/> @@ -112,7 +109,7 @@ genericType='TypeEntry' constructorParams='TypeEntry.class' toolTipText="lima.ui.lettering.entry" - onItemStateChanged="filterModel.setDisplayLettered(lettredEntryComboBox.getSelectedItem().isLettered()) ; filterModel.setDisplayUnlettred(lettredEntryComboBox.getSelectedItem().isNoLettered()) " /> + onItemStateChanged="handler.setTypeEntry(lettredEntryComboBox.getSelectedItem())" /> <JToolBar.Separator/> @@ -165,4 +162,4 @@ </JScrollPane> </cell> </row> -</Table> \ No newline at end of file +</Table> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2013-10-11 13:56:17 UTC (rev 3710) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2013-10-11 15:17:27 UTC (rev 3711) @@ -40,9 +40,7 @@ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; -import javax.swing.JComboBox; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; +import javax.swing.*; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; @@ -78,6 +76,7 @@ protected BigDecimal solde = BigDecimal.ZERO; protected LettringSelectionModel lettringSelectionModel; protected LetteringEditModel editModel; + protected enum ButtonMode {DELETTRED, LETTRED, EQUALIZED, ALL} private static final Log log = LogFactory.getLog(LetteringViewHandler.class); @@ -94,18 +93,10 @@ * Init all combo box in view. */ public void init() { - filter = view.getFilterModel(); + filter = new LetteringFilterImpl(); editModel = view.getEditModel(); lettringSelectionModel = view.getLettringSelectionModel(); loadComboAndRows(); - - filter.addPropertyChangeListener(new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - updateAllEntries(); - } - }); } public void balanceAndActions() { @@ -302,9 +293,30 @@ return null; } + public void setDateStart(Date date) { + filter.setDateStart(date); + updateAllEntries(); + } + + public void setDateEnd(Date date) { + filter.setDateEnd(date); + updateAllEntries(); + } + + public void setAccount(Account account) { + filter.setAccount(account); + updateAllEntries(); + } + + public void setTypeEntry(TypeEntry typeEntry) { + filter.setDisplayLettered(typeEntry.isLettered()); + filter.setDisplayUnlettred(typeEntry.isNoLettered()); + updateAllEntries(); + } + public void updateAllEntries() { - if (isFilterValid()) { + if (filter.getAccount() != null && filter.getDateStart() != null && filter.getDateEnd() != null) { List<Entry> entries = findAllEntries(filter); List<String> journalEntrees = new ArrayList<String>(); @@ -356,19 +368,6 @@ } } - /**To test if the filter contain an account and a period - * @return true if filter is valid - * */ - protected boolean isFilterValid() { - boolean valid = false; - - if (filter.getAccount() != null && filter.getDateStart() != null && filter.getDateEnd() != null) { - valid = true; - } - - return valid; - } - /** * Select previous value in combo box. *
participants (1)
-
Bavencoffļ¼ users.chorem.org