branch feature/ReplaceComboByList updated (9e92914 -> e6112d7)
This is an automated email from the git hooks/post-receive script. New change to branch feature/ReplaceComboByList in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 9e92914 Handle selection in client's combo new 4d4a1fc Plug new service for the search new 369d034 Add count new e6112d7 Don't select if the combo conatains only one element The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit e6112d730928c79f605ddc5ca86602a453c33ad4 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:54:29 2016 +0200 Don't select if the combo conatains only one element commit 369d034f7a24ed7829195585d17c69756dfc517c Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:47:07 2016 +0200 Add count commit 4d4a1fcf55d2e60f11d496b0cb283bba20d6016e Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:20:00 2016 +0200 Plug new service for the search Summary of changes: .../persistence/entities/ClientTopiaDao.java | 16 +++++++++++ .../faxtomail/services/service/ClientService.java | 6 ++++ .../services/service/ClientServiceImpl.java | 18 ++++++++++++ .../ui/swing/content/demande/DemandeUI.jaxx | 3 ++ .../ui/swing/content/demande/DemandeUIHandler.java | 32 ++++++++++++++++------ 5 files changed, 66 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/ReplaceComboByList in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 4d4a1fcf55d2e60f11d496b0cb283bba20d6016e Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:20:00 2016 +0200 Plug new service for the search --- .../persistence/entities/ClientTopiaDao.java | 16 +++++++++++++ .../faxtomail/services/service/ClientService.java | 6 +++++ .../services/service/ClientServiceImpl.java | 18 ++++++++++++++ .../ui/swing/content/demande/DemandeUIHandler.java | 28 +++++++++++++++------- 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java index eea5560..1a9a061 100644 --- a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java @@ -30,6 +30,8 @@ import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { @@ -53,5 +55,19 @@ public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { List<Client> result = forPropertyJsonLike(Client.PROPERTY_FAX_NUMBERS_JSON, faxNumber); return result; } + + public PaginationResult<Client> search(String company, String codeOrName, PaginationParameter pagination) { + String query = "FROM " + Client.class.getName() + + " WHERE (" + Client.PROPERTY_CODE + " LIKE :code OR " + + Client.PROPERTY_NAME + " LIKE :name) AND " + + Client.PROPERTY_COMPANY + " = :company"; + + Map<String, Object> args = new HashMap<>(); + args.put("code", "%" + codeOrName + "%"); + args.put("name", "%" + codeOrName + "%"); + args.put("company", company); + PaginationResult<Client> result = findPage(query, args, pagination); + return result; + } } //ClientTopiaDao diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java index 29c436a..9fc77f1 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java @@ -31,6 +31,8 @@ import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.services.FaxToMailService; import java.util.List; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; /** * @author Kevin Morin (Code Lutin) @@ -42,6 +44,10 @@ public interface ClientService extends FaxToMailService { Client getClientForCode(String code, String company); List<Client> getClientsForFolder(MailFolder folder); + + String getCompany(MailFolder folder); + + PaginationResult<Client> searchClients(String company, String codeOrName, PaginationParameter pagination); void updateNewClients(); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java index 7382c76..aa28264 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java @@ -57,6 +57,8 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; /** * Service de gestion des clients. @@ -161,6 +163,22 @@ public class ClientServiceImpl extends FaxToMailServiceSupport implements Client return result; } + @Override + public String getCompany(MailFolder folder) { + while (!folder.isUseCurrentLevelCompany() && folder.getParent() != null) { + folder = folder.getParent(); + } + + String company = folder.getCompany(); + return company; + } + + @Override + public PaginationResult<Client> searchClients(String company, String codeOrName, PaginationParameter pagination) { + ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); + return clientDao.search(company, codeOrName, pagination); + } + /** * Récupère les information de la table NewClient pour mettre à jour la table Client. */ diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index d032fab..f670119 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -35,6 +35,7 @@ import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.RangeRow; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; +import com.franciaflex.faxtomail.services.service.ClientService; import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentListener; import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveDemandeAction; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; @@ -71,14 +72,10 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; -import java.awt.event.InputMethodEvent; -import java.awt.event.InputMethodListener; -import java.awt.event.ItemListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.text.AttributedCharacterIterator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -92,6 +89,8 @@ import javax.swing.text.JTextComponent; import jaxx.runtime.swing.model.JaxxFilterableComboBoxModel; import static org.nuiton.i18n.I18n.t; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; /** * Handler of UI {@link DemandeUIHandler}. @@ -451,6 +450,11 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, final JComboBox comboBox = clientComboBox.getCombobox(); final JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent(); + FaxToMailServiceContext serviceContext = getContext().newServiceContext(); + final ClientService clientService = serviceContext.getClientService(); + final String company = clientService.getCompany(folder); + + editorComponent.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -466,12 +470,17 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, public void keyReleased(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER) { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - MailFolder folder = getModel().getMailFolder(); + PaginationParameter pagination = PaginationParameter.of(0, 15); + PaginationResult<Client> allowedClients = clientService.searchClients(company, clientSearch, pagination); + List<Client> elements = allowedClients.getElements(); + long count = allowedClients.getCount(); - List<Client> allowedClients = serviceContext.getClientService().getClientsForFolder(folder); - getModel().setAllowedClients(allowedClients); - clientComboBox.setData(allowedClients); + getModel().setAllowedClients(elements); + clientComboBox.setData(elements); + + if (count == 1) { + comboBox.setSelectedIndex(0); + } } } }); @@ -483,6 +492,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, JaxxFilterableComboBoxModel model = (JaxxFilterableComboBoxModel) comboBox.getModel(); model.setFilterText(clientSearch); editorComponent.setText(clientSearch); + comboBox.showPopup(); } } }); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/ReplaceComboByList in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 369d034f7a24ed7829195585d17c69756dfc517c Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:47:07 2016 +0200 Add count --- .../com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx | 3 +++ .../faxtomail/ui/swing/content/demande/DemandeUIHandler.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx index 1c7883d..54d8d90 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx @@ -137,6 +137,9 @@ constructorParams='this' genericType="Client"/> </cell> + <cell> + <JLabel id='countClient' text='(0)'/> + </cell> <!--<cell>--> <!--<JLabel id='brandLabel'/>--> <!--</cell>--> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index f670119..008310c 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -449,12 +449,12 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, final JComboBox comboBox = clientComboBox.getCombobox(); final JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent(); + final JLabel countClient = ui.getCountClient(); FaxToMailServiceContext serviceContext = getContext().newServiceContext(); final ClientService clientService = serviceContext.getClientService(); final String company = clientService.getCompany(folder); - editorComponent.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -481,6 +481,8 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, if (count == 1) { comboBox.setSelectedIndex(0); } + + countClient.setText("(" + count + ")"); } } }); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/ReplaceComboByList in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit e6112d730928c79f605ddc5ca86602a453c33ad4 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jun 8 15:54:29 2016 +0200 Don't select if the combo conatains only one element --- .../faxtomail/ui/swing/content/demande/DemandeUIHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index 008310c..827de2d 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -85,6 +85,7 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; +import javax.swing.plaf.PanelUI; import javax.swing.text.JTextComponent; import jaxx.runtime.swing.model.JaxxFilterableComboBoxModel; @@ -450,6 +451,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, final JComboBox comboBox = clientComboBox.getCombobox(); final JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent(); final JLabel countClient = ui.getCountClient(); + clientComboBox.setEnterToSelectUniqueUniverse(false); FaxToMailServiceContext serviceContext = getContext().newServiceContext(); final ClientService clientService = serviceContext.getClientService(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm