r12 - in trunk: . faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports faxtomail-service/src/main/resources/i18n faxtomail-ui-swing faxtomail-ui-swing/src/license faxtomail-ui-swing/src/main/java/com/fr
Author: kmorin Date: 2014-02-25 10:19:54 +0100 (Tue, 25 Feb 2014) New Revision: 12 Url: http://codelutin.com/projects/faxtomail/repository/revisions/12 Log: refs #4231 Faire les UI de tous les ?\195?\169crans Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FaxToMailUserImpl.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellRenderer.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentModelAware.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/SaveAttachmentAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItemModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties trunk/faxtomail-ui-swing/pom.xml trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties trunk/faxtomail-ui-swing/src/main/resources/log4j.properties trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java trunk/pom.xml Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FaxToMailUserImpl.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FaxToMailUserImpl.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FaxToMailUserImpl.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,9 @@ +package com.franciaflex.faxtomail.persistence.entities; + +public class FaxToMailUserImpl extends FaxToMailUserAbstract { + + @Override + public String toString() { + return getTrigraph() + " - " + getFirstName() + " " + getLastName(); + } +} Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java 2014-02-25 09:19:54 UTC (rev 12) @@ -32,6 +32,7 @@ import com.franciaflex.faxtomail.services.service.FaxToMailWebApplicationContext; import com.franciaflex.faxtomail.services.service.MailFilterService; import com.franciaflex.faxtomail.services.service.MailFolderService; +import com.franciaflex.faxtomail.services.service.ReferentielService; import java.util.Date; @@ -83,4 +84,8 @@ public EmailService getEmailService() { return newService(EmailService.class); } + + public ReferentielService getReferentielService() { + return newService(ReferentielService.class); + } } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-02-25 09:19:54 UTC (rev 12) @@ -1,5 +1,7 @@ package com.franciaflex.faxtomail.services.service; +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; @@ -7,6 +9,8 @@ import com.franciaflex.faxtomail.persistence.entities.HistoryTopiaDao; import com.franciaflex.faxtomail.persistence.entities.HistoryType; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.RangeRow; +import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -24,6 +28,43 @@ private static final Log log = LogFactory.getLog(EmailService.class); + public Email saveEmail(Email email, FaxToMailUser user) { + + if (email.getAttachment() != null) { + AttachmentTopiaDao attachmentDao = getPersistenceContext().getAttachmentDao(); + for (Attachment attachment : email.getAttachment()) { + if (!attachment.isPersisted()) { + attachmentDao.create(attachment); + } else { + attachmentDao.update(attachment); + } + } + } + + if (email.getRangeRow() != null) { + RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); + for (RangeRow rangeRow : email.getRangeRow()) { + if (!rangeRow.isPersisted()) { + rangeRowDao.create(rangeRow); + } else { + rangeRowDao.update(rangeRow); + } + } + } + + HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); + History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, + History.PROPERTY_FAX_TO_MAIL_USER, user, + History.PROPERTY_MODIFICATION_DATE, new Date()); + email.addHistory(history); + + EmailTopiaDao dao = getPersistenceContext().getEmailDao(); + Email result = dao.update(email); + getPersistenceContext().commit(); + + return result; + } + public List<Email> getEmailForFolder(MailFolder folder) { EmailTopiaDao dao = getPersistenceContext().getEmailDao(); return new ArrayList<>(dao.forMailFolderEquals(folder).findAll()); Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-02-25 09:19:54 UTC (rev 12) @@ -25,6 +25,7 @@ */ import com.franciaflex.faxtomail.FaxToMailConfiguration; +import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.Company; import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao; import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; @@ -34,6 +35,8 @@ import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.EtatAttente; +import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; @@ -46,6 +49,8 @@ import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.RangeRow; +import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao; import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.collect.Lists; @@ -55,6 +60,10 @@ import org.nuiton.jaxx.application.ApplicationTechnicalException; import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -127,40 +136,100 @@ long count = demandTypeDao.count(); if (count == 0) { + List<Client> clients; + try { + File clientFile = new File(ClassLoader.getSystemResource("fx_clients.csv").toURI()); + clients = getReferentielService().importClients(clientFile); + + } catch(IOException | URISyntaxException e) { + clients = new ArrayList<>(); + } + List<DemandType> types = Lists.newArrayList( demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "SAV") + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation"), + demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres") ); DemandStatusTopiaDao demandStatusDao = getPersistenceContext().getDemandStatusDao(); List<DemandStatus> statuses = Lists.newArrayList( - demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Non traîtée"), + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Non traîté"), demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "En cours"), - demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Validée") + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Transmis EDI"), + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Transféré"), + demandStatusDao.create(DemandStatus.PROPERTY_LABEL, "Archive") ); + EtatAttenteTopiaDao etatAttenteDao = getPersistenceContext().getEtatAttenteDao(); + List<EtatAttente> etatAttentes = Lists.newArrayList( + etatAttenteDao.create(Range.PROPERTY_LABEL, "REM Attente Remise-accord expo"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "ODC attente Ouverture de Compte"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "GRA attente accord gratuit"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "CLT attente réponse client"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "PPC attente chiffrage BEI PPC"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "SIGN attente réponse BEI signature"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "PROFORMA attente paiement proforma"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "BAT attente retour BAT lettrage-logo"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "GAB attente reception gabarit"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "PROTO attente accord proto"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "DAC attente pour assistance chantier"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "DAV attente analyse avoir"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "RET attente retour materiel"), + etatAttenteDao.create(Range.PROPERTY_LABEL, "EXP attente expertise") + ); + PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao(); List<Priority> priorities = Lists.newArrayList( - priorityDao.create(Priority.PROPERTY_LABEL, "Basse"), - priorityDao.create(Priority.PROPERTY_LABEL, "Normale"), - priorityDao.create(Priority.PROPERTY_LABEL, "Haute"), - priorityDao.create(Priority.PROPERTY_LABEL, "Urgente") + priorityDao.create(Priority.PROPERTY_LABEL, "-"), + priorityDao.create(Priority.PROPERTY_LABEL, "!"), + priorityDao.create(Priority.PROPERTY_LABEL, "F") ); RangeTopiaDao rangeDao = getPersistenceContext().getRangeDao(); List<Range> ranges = Lists.newArrayList( - rangeDao.create(Range.PROPERTY_LABEL, "Menuiserie"), - rangeDao.create(Range.PROPERTY_LABEL, "Volets roulants"), - rangeDao.create(Range.PROPERTY_LABEL, "Accessoires") + rangeDao.create(Range.PROPERTY_LABEL, "FFE VR"), + rangeDao.create(Range.PROPERTY_LABEL, "FFE AUTRE"), + rangeDao.create(Range.PROPERTY_LABEL, "FME FX DROIT"), + rangeDao.create(Range.PROPERTY_LABEL, "FME FX CINTRE"), + rangeDao.create(Range.PROPERTY_LABEL, "FME NOEL"), + rangeDao.create(Range.PROPERTY_LABEL, "FSE BANNE"), + rangeDao.create(Range.PROPERTY_LABEL, "FSE ROCH AUTRE"), + rangeDao.create(Range.PROPERTY_LABEL, "FSE CHECY"), + rangeDao.create(Range.PROPERTY_LABEL, "FSI"), + rangeDao.create(Range.PROPERTY_LABEL, "FSI FMI") ); FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser marc = userDao.create(FaxToMailUser.PROPERTY_NAME, "Marc Lefebvre", FaxToMailUser.PROPERTY_LOGIN, "mlefebvre"); - FaxToMailUser cyril = userDao.create(FaxToMailUser.PROPERTY_NAME, "Cyril Baillet", FaxToMailUser.PROPERTY_LOGIN, "cbaillet"); - FaxToMailUser frederic = userDao.create(FaxToMailUser.PROPERTY_NAME, "Frédéric Viala", FaxToMailUser.PROPERTY_LOGIN, "fviala"); - FaxToMailUser claire = userDao.create(FaxToMailUser.PROPERTY_NAME, "Claire Marquis", FaxToMailUser.PROPERTY_LOGIN, "cmarquis"); - FaxToMailUser agathe = userDao.create(FaxToMailUser.PROPERTY_NAME, "Agathe Borde", FaxToMailUser.PROPERTY_LOGIN, "aborde"); - FaxToMailUser jeanne = userDao.create(FaxToMailUser.PROPERTY_NAME, "Jeanne Bourgoin", FaxToMailUser.PROPERTY_LOGIN, "jbourgoin"); + FaxToMailUser marc = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Lefèbvre", + FaxToMailUser.PROPERTY_FIRST_NAME, "Marc", + FaxToMailUser.PROPERTY_LOGIN, "mlefebvre", + FaxToMailUser.PROPERTY_TRIGRAPH, "MLE"); + FaxToMailUser cyril = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Baillet", + FaxToMailUser.PROPERTY_FIRST_NAME, "Cyril", + FaxToMailUser.PROPERTY_LOGIN, "cbaillet", + FaxToMailUser.PROPERTY_TRIGRAPH, "CBA"); + FaxToMailUser frederic = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Viala", + FaxToMailUser.PROPERTY_FIRST_NAME, "Frédéric", + FaxToMailUser.PROPERTY_LOGIN, "fviala", + FaxToMailUser.PROPERTY_TRIGRAPH, "FVI"); + FaxToMailUser claire = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Marquis", + FaxToMailUser.PROPERTY_FIRST_NAME, "Claire", + FaxToMailUser.PROPERTY_LOGIN, "cmarquis", + FaxToMailUser.PROPERTY_TRIGRAPH, "CMA"); + FaxToMailUser agathe = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Borde", + FaxToMailUser.PROPERTY_FIRST_NAME, "Agathe", + FaxToMailUser.PROPERTY_LOGIN, "aborde", + FaxToMailUser.PROPERTY_TRIGRAPH, "ABO"); + FaxToMailUser jeanne = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Bourgoin", + FaxToMailUser.PROPERTY_FIRST_NAME, "Jeanne", + FaxToMailUser.PROPERTY_LOGIN, "jbourgoin", + FaxToMailUser.PROPERTY_TRIGRAPH, "JBO"); MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao(); List<MailFolder> folders = new ArrayList<>(); @@ -168,69 +237,24 @@ Random random = new Random(); EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); + RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril"); int r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, cyrilFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, cyril, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, cyrilFolder, cyril); } MailFolder claireFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Claire"); r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, claireFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, claire, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, claireFolder, claire); } MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe"); r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, agatheFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, agathe, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, agatheFolder, agathe); } folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle", @@ -239,64 +263,19 @@ MailFolder marcFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Marc"); r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, marcFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, marc, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, marcFolder, marc); } MailFolder fredericFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric"); r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, fredericFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, frederic, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, fredericFolder, frederic); } MailFolder jeanneFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne"); r = random.nextInt(10) + 5; for (int i = 0 ; i < r ; i++) { - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, RandomStringUtils.randomAlphabetic(8) + "@" + RandomStringUtils.randomAlphabetic(5) + ".fr", - Email.PROPERTY_OBJECT, RandomStringUtils.randomAlphabetic(10), - Email.PROPERTY_RECEPTION_DATE, new Date(), - Email.PROPERTY_MAIL_FOLDER, jeanneFolder, - Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), - Email.PROPERTY_DEMAND_STATUS, statuses.get(random.nextInt(statuses.size())), - Email.PROPERTY_PRIORITY, priorities.get(random.nextInt(priorities.size())), - Email.PROPERTY_RANGE, Lists.newArrayList(ranges.get(random.nextInt(ranges.size()))), - Email.PROPERTY_HISTORY, Lists.newArrayList(history)); - - if (random.nextBoolean()) { - getEmailService().addToOpeningHistory(email, jeanne, new Date()); - } + createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, statuses, priorities, jeanneFolder, jeanne); } folders.add(folderDao.create(MailFolder.PROPERTY_NAME, "SAV", MailFolder.PROPERTY_CHILDREN, Lists.newArrayList(marcFolder, fredericFolder, jeanneFolder))); @@ -318,4 +297,53 @@ } } + protected void createEmail(Random random, + HistoryTopiaDao historyDao, + RangeRowTopiaDao rangeRowDao, + EmailTopiaDao emailDao, + List<Range> ranges, + List<Client> clients, + List<DemandType> types, + List<DemandStatus> statuses, + List<Priority> priorities, + MailFolder folder, + FaxToMailUser user) { + + History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, + History.PROPERTY_MODIFICATION_DATE, new Date()); + + List<RangeRow> rangeRows = new ArrayList<>(); + for (int j = 0 ; j < random.nextInt(4) + 1 ; j++) { + RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())), + RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), + RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100), + RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100)); + rangeRows.add(rangeRow); + } + + Client client = clients.get(random.nextInt(clients.size())); + String senderEmail = client.getEmailAddress(); + if (senderEmail == null && client.getFaxNumber() != null) { + senderEmail = client.getFaxNumber().replace(" ", "") + "@franciaflex.fax"; + } + + boolean opened = random.nextBoolean(); + Email email = emailDao.create(Email.PROPERTY_SENDER_EMAIL_ADDRESS, senderEmail, + Email.PROPERTY_CLIENT_CODE, client.getCode(), + Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + + SimpleDateFormat.getDateTimeInstance().format(new Date()), + Email.PROPERTY_RECEPTION_DATE, new Date(), + Email.PROPERTY_MAIL_FOLDER, folder, + Email.PROPERTY_DEMAND_TYPE, types.get(random.nextInt(types.size())), + Email.PROPERTY_DEMAND_STATUS, statuses.get(opened ? 1 : 0), + Email.PROPERTY_PRIORITY, priorities.get(0), + Email.PROPERTY_RANGE_ROW, rangeRows, + Email.PROPERTY_HISTORY, Lists.newArrayList(history)); + + + if (opened) { + getEmailService().addToOpeningHistory(email, user, new Date()); + } + } + } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-02-25 09:19:54 UTC (rev 12) @@ -1,18 +1,34 @@ package com.franciaflex.faxtomail.services.service; +import com.franciaflex.faxtomail.persistence.entities.Client; +import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; import com.franciaflex.faxtomail.persistence.entities.DemandStatus; import com.franciaflex.faxtomail.persistence.entities.DemandStatusTopiaDao; import com.franciaflex.faxtomail.persistence.entities.DemandType; import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.EtatAttente; +import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; +import com.franciaflex.faxtomail.services.service.imports.ClientImportModel; +import com.google.common.base.Charsets; +import com.google.common.io.Files; +import org.apache.commons.io.IOUtils; +import org.nuiton.csv.Import; +import org.nuiton.csv.ImportRuntimeException; +import org.nuiton.jaxx.application.ApplicationTechnicalException; +import java.io.File; +import java.io.IOException; +import java.io.Reader; import java.util.ArrayList; import java.util.List; +import static org.nuiton.i18n.I18n.t; + /** * @author kmorin <kmorin@codelutin.com> * @since x.x @@ -38,4 +54,51 @@ RangeTopiaDao dao = getPersistenceContext().getRangeDao(); return new ArrayList<>(dao.findAll()); } + + public List<EtatAttente> getAllEtatAttente() { + EtatAttenteTopiaDao dao = getPersistenceContext().getEtatAttenteDao(); + return new ArrayList<>(dao.findAll()); + } + + public List<Client> getAllClients() { + ClientTopiaDao dao = getPersistenceContext().getClientDao(); + return new ArrayList<>(dao.findAll()); + } + + public List<Client> importClients(File csvFile) throws IOException { + List<Client> result = new ArrayList<>(); + ClientTopiaDao dao = getPersistenceContext().getClientDao(); + + Reader reader = Files.newReader(csvFile, Charsets.UTF_8); + ClientImportModel clientImportModel = new ClientImportModel(';'); + try { + Import<Client> importer = Import.newImport(clientImportModel, reader); + try { + for (Client client : importer) { + result.add(dao.create(client)); + } + getPersistenceContext().commit(); + + } finally { + IOUtils.closeQuietly(importer); + } + reader.close(); + + } catch (IOException e) { + throw new IOException(t("faxtomail.service.referential.import.clients.error", csvFile), e); + + } catch (ImportRuntimeException e) { + String message; + if (e.getCause() != null) { + message = e.getCause().getMessage(); + } else { + message = e.getMessage(); + } + throw new ApplicationTechnicalException(message, e); + + } finally { + IOUtils.closeQuietly(reader); + } + return result; + } } Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,47 @@ +package com.franciaflex.faxtomail.services.service.imports; + +import com.franciaflex.faxtomail.persistence.entities.Client; +import com.franciaflex.faxtomail.persistence.entities.ClientImpl; +import org.nuiton.csv.ValueParser; +import org.nuiton.csv.ext.AbstractImportModel; + +import java.text.ParseException; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ClientImportModel extends AbstractImportModel<Client> { + + public ClientImportModel(char separator) { + super(separator); + + ValueParser<String> nullParser = new ValueParser<String>() { + @Override + public String parse(String s) throws ParseException { + if ("NULL".equals(s)) { + s = null; + } + return s; + } + }; + newMandatoryColumn("Id_Correspondance", Client.PROPERTY_ID); + newMandatoryColumn("Nom", Client.PROPERTY_NAME); + newMandatoryColumn("Caracteristique1", Client.PROPERTY_CARACTERISTIC1, nullParser); + newMandatoryColumn("Caracteristique2", Client.PROPERTY_CARACTERISTIC2, nullParser); + newMandatoryColumn("Caracteristique3", Client.PROPERTY_CARACTERISTIC3, nullParser); + newMandatoryColumn("Numero_Fax", Client.PROPERTY_FAX_NUMBER, nullParser); + newMandatoryColumn("Adresse_Mail", Client.PROPERTY_EMAIL_ADDRESS, nullParser); + newMandatoryColumn("Code_Client", Client.PROPERTY_CODE); + + newIgnoredColumn("Societe"); + newIgnoredColumn("Client_Top"); + newIgnoredColumn("Objet_Message"); + newIgnoredColumn("Destination"); + } + + @Override + public Client newEmptyInstance() { + return new ClientImpl(); + } +} Modified: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties =================================================================== --- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -10,6 +10,7 @@ faxtomail.service.compressZipFile.error= faxtomail.service.config.deleteTempDirectory.error= faxtomail.service.mkDir.error= +faxtomail.service.referential.import.clients.error= tutti.config.option.basedir.description= tutti.config.option.csv.separator.description= tutti.config.option.inceptionYear.description= Modified: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties =================================================================== --- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -10,6 +10,7 @@ faxtomail.service.compressZipFile.error= faxtomail.service.config.deleteTempDirectory.error= faxtomail.service.mkDir.error= +faxtomail.service.referential.import.clients.error= tutti.config.option.basedir.description= tutti.config.option.csv.separator.description= tutti.config.option.inceptionYear.description= Modified: trunk/faxtomail-ui-swing/pom.xml =================================================================== --- trunk/faxtomail-ui-swing/pom.xml 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/pom.xml 2014-02-25 09:19:54 UTC (rev 12) @@ -228,7 +228,26 @@ <scope>runtime</scope> </dependency> + <!--<dependency>--> + <!--<groupId>net.atlanticbb.tantlinger</groupId>--> + <!--<artifactId>shef</artifactId>--> + <!--</dependency>--> + <!--<dependency>--> + <!--<groupId>jtidy</groupId>--> + <!--<artifactId>jtidy</artifactId>--> + <!--</dependency>--> + + <!--<dependency>--> + <!--<groupId>org.bushe</groupId>--> + <!--<artifactId>sam</artifactId>--> + <!--</dependency>--> + + <!--<dependency>--> + <!--<groupId>novaworx</groupId>--> + <!--<artifactId>novaworx-syntax</artifactId>--> + <!--</dependency>--> + </dependencies> <build> Modified: trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties =================================================================== --- trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -1,24 +1,3 @@ -### -# #%L -# FaxToMail :: UI -# %% -# Copyright (C) 2014 Franciaflex -# %% -# 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% -### # Generated by org.codehaus.mojo.license.AddThirdPartyMojo #------------------------------------------------------------------------------- # Already used licenses in project : @@ -42,11 +21,12 @@ # - MPL 1.1 # - New BSD License # - The Apache Software License, Version 2.0 +# - The H2 License, Version 1.0 # - license.txt #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Fri Jan 31 09:36:44 CET 2014 +#Tue Feb 25 10:11:09 CET 2014 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD License Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,31 @@ +package com.franciaflex.faxtomail.ui.swing.actions; + +import com.franciaflex.faxtomail.ui.swing.content.demande.ReplyFormUI; +import com.franciaflex.faxtomail.ui.swing.content.demande.ReplyFormUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.demande.ReplyFormUIModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ReplyAction extends AbstractFaxToMailAction<ReplyFormUIModel, ReplyFormUI, ReplyFormUIHandler> { + + private static final Log log = LogFactory.getLog(ReplyAction.class); + + public ReplyAction(ReplyFormUIHandler handler) { + super(handler, false); + } + + @Override + public void doAction() throws Exception { + log.warn("do reply"); + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + handler.closeDialog(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,43 @@ +package com.franciaflex.faxtomail.ui.swing.actions; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class SaveDemandeAction extends ShowDemandeListAction { + + protected DemandeUIModel demandeModel; + + public SaveDemandeAction(MainUIHandler handler) { + super(handler); + } + + public SaveDemandeAction(DemandeUIHandler handler) { + super(handler.getContext().getMainUI().getHandler()); + } + + public DemandeUIModel getDemandeModel() { + return demandeModel; + } + + public void setDemandeModel(DemandeUIModel demandeModel) { + this.demandeModel = demandeModel; + } + + @Override + public void doAction() throws Exception { + FaxToMailUser currentUser = getContext().getCurrentUser(); + Email currentEmail = getContext().getCurrentEmail(); + Email email = demandeModel.toEntity(currentEmail); + getContext().getEmailService().saveEmail(email, currentUser); + + super.doAction(); + } + +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -52,7 +52,7 @@ Email currentEmail = getContext().getCurrentEmail(); if (!getContext().getCurrentUser().equals(currentEmail.getTakenBy())) { displayWarningMessage(t("faxtomail.alert.alreadyTakenBy.title"), - t("faxtomail.alert.alreadyTakenBy.message", currentEmail.getTakenBy().getName())); + t("faxtomail.alert.alreadyTakenBy.message", currentEmail.getTakenBy().toString())); } } } Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,23 @@ +package com.franciaflex.faxtomail.ui.swing.actions; + +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; +import com.franciaflex.faxtomail.ui.swing.content.demande.MailFolderChooserUI; +import com.franciaflex.faxtomail.ui.swing.content.demande.MailFolderChooserUIHandler; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class TransmitAction extends AbstractFaxToMailAction<DemandeUIModel, MailFolderChooserUI, MailFolderChooserUIHandler> { + + public TransmitAction(MailFolderChooserUIHandler handler) { + super(handler, false); + } + + @Override + public void doAction() throws Exception { + SaveDemandeAction action = getContext().getActionFactory().createLogicAction(getContext().getMainUI().getHandler(), SaveDemandeAction.class); + action.setDemandeModel(getModel()); + getContext().getActionEngine().runAction(action); + } +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -341,6 +341,7 @@ Email currentEmail = getContext().getCurrentEmail(); screenTitle = currentEmail.getObject(); icon = JAXXWidgetUtil.createActionIcon("email"); + rightDecoration = ((DemandeUI) screenUI).getTopToolBar(); break; default: @@ -366,10 +367,7 @@ ui.getBody().setTitle(screenTitle); ui.getBody().add(currentBody); ui.getBody().setLeftDecoration(new JLabel(icon)); -// ui.getBody().setRightDecoration(rightDecoration); - // Fix #2510: [AIDE] perte de l'aide contextuelle sur ecran campagne - //FIXME tchemit-2013-05-28 Find out why -// ui.getBody().getRightDecoration().setVisible(true); + ui.getBody().setRightDecoration(rightDecoration); } } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeTableModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -66,9 +66,9 @@ n("faxtomail.demandeList.table.header.receptionDate"), n("faxtomail.demandeList.table.header.receptionDate"))); - put(Email.PROPERTY_CLIENT, + put(Email.PROPERTY_CLIENT_CODE, ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_CLIENT, + Email.PROPERTY_CLIENT_CODE, n("faxtomail.demandeList.table.header.client"), n("faxtomail.demandeList.table.header.client"))); @@ -126,9 +126,9 @@ n("faxtomail.demandeList.table.header.projectReference"), n("faxtomail.demandeList.table.header.projectReference"))); - put(Email.PROPERTY_RANGE, + put(Email.PROPERTY_RANGE_ROW, ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_RANGE, + Email.PROPERTY_RANGE_ROW, n("faxtomail.demandeList.table.header.range"), n("faxtomail.demandeList.table.header.range"))); @@ -140,7 +140,7 @@ }}; - protected DemandeTableModel(TableColumnModelExt columnModel) { + public DemandeTableModel(TableColumnModelExt columnModel) { super(columnModel, false, false); } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -20,7 +20,8 @@ * #L% */ BeanFilterableComboBox { - showReset: true; + showReset: false; + showDecorator: false; bean: {model}; } @@ -32,6 +33,17 @@ _selectOnFocus: {true}; } +.rightLabel { + horizontalAlignment: {SwingConstants.RIGHT}; + font-style: "italic"; +} + +#topToolBar { + floatable: false; + opaque: false; + borderPainted: false; +} + #objectLabel { text: "faxtomail.demande.object.label"; } @@ -60,6 +72,10 @@ text: "faxtomail.demande.client.label"; } +#clientField { + text: {model.getClientCode()}; +} + #docTypeLabel { text: "faxtomail.demande.docType.label"; } @@ -69,14 +85,6 @@ selectedItem: {model.getDemandType()}; } -#demandeNumberLabel { - text: "faxtomail.demande.demandeNumber.label"; -} - -#demandeNumberField { - text: {model.getCommandNb()}; -} - #ediCodeNumberLabel { text: "faxtomail.demande.ediCodeNumber.label"; } @@ -99,9 +107,8 @@ text: "faxtomail.demande.status.label"; } -#statusComboBox { - property: demandStatus; - selectedItem: {model.getDemandStatus()}; +#statusField { + text: { model.getDemandStatus().getLabel() }; } #etatAttenteLabel { @@ -116,28 +123,9 @@ text: {model.getProjectReference()}; } -#savNumberLabel { - text: "faxtomail.demande.savNumber.label"; -} - -#savNumberField { - text: {model.getSavNumber()}; -} - -#finishedProductsLabel { - text: "faxtomail.demande.finishedProducts.label"; -} - -//#finishedProductsField { -// -//} - -#gammeLabel { - text: "faxtomail.demande.gamme.label"; -} - #messageLabel { text: "faxtomail.demande.message.label"; + verticalAlignment: {SwingConstants.TOP}; } #takenByLabel { @@ -145,7 +133,7 @@ } #takenByField { - text: {model.getTakenBy().getName()}; + text: {String.valueOf(model.getTakenBy())}; } #firstOpenedByLabel { @@ -153,7 +141,7 @@ } #firstOpenedByField { - text: {model.getFirstOpeningUserName()}; + text: {model.getFirstOpeningUser()}; } #firstOpeningDateLabel { @@ -169,7 +157,7 @@ } #lastModifiedByField { - text: {model.getLastModificationUserName()}; + text: {model.getLastModificationUser()}; } #lastModificationDateLabel { @@ -180,27 +168,42 @@ text: {SimpleDateFormat.getDateTimeInstance().format(model.getLastModificationDate())}; } +#rangeTable { + selectionMode: {ListSelectionModel.SINGLE_SELECTION}; +} + #backButton { - text: "faxtomail.demande.back.button.label"; - actionIcon: cancel; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction.class}; + text: "faxtomail.demande.back.button.label"; + i18nMnemonic : "faxtomail.demande.back.button.mnemonic"; + actionIcon: cancel; + _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction.class}; } #saveButton { - text: "faxtomail.demande.save.button.label"; - actionIcon: save; + text: "faxtomail.demande.save.button.label"; + i18nMnemonic : "faxtomail.demande.save.button.mnemonic"; + actionIcon: save; } #transmitButton { - text: "faxtomail.demande.transmit.button.label"; - actionIcon: transmit; + text: "faxtomail.demande.transmit.button.label"; + i18nMnemonic : "faxtomail.demande.transmit.button.mnemonic"; + actionIcon: transmit; } #printButton { text: "faxtomail.demande.print.button.label"; - actionIcon: print; + i18nMnemonic : "faxtomail.demande.print.button.mnemonic"; + actionIcon: print; } #archiveButton { text: "faxtomail.demande.archive.button.label"; + i18nMnemonic : "faxtomail.demande.archive.button.mnemonic"; } + +#replyButton { + text: "faxtomail.demande.reply.button.label"; + i18nMnemonic : "faxtomail.demande.reply.button.mnemonic"; + actionIcon: reply; +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -26,18 +26,25 @@ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + com.franciaflex.faxtomail.ui.swing.util.attachment.ButtonAttachment + com.franciaflex.faxtomail.ui.swing.util.history.ButtonHistory com.franciaflex.faxtomail.persistence.entities.Email com.franciaflex.faxtomail.persistence.entities.DemandType com.franciaflex.faxtomail.persistence.entities.DemandStatus com.franciaflex.faxtomail.persistence.entities.Range com.franciaflex.faxtomail.persistence.entities.Priority + com.franciaflex.faxtomail.persistence.entities.EtatAttente jaxx.runtime.swing.editor.bean.BeanFilterableComboBox org.jdesktop.swingx.JXDatePicker org.jdesktop.swingx.JXTitledPanel + org.jdesktop.swingx.JXTable + javax.swing.ListSelectionModel + javax.swing.SwingConstants + java.text.SimpleDateFormat java.util.Date </import> @@ -53,209 +60,189 @@ <DemandeUIModel id='model' initializer='getContextValue(DemandeUIModel.class)'/> - <JScrollPane id='demandeScrollPane' constraints='BorderLayout.CENTER'> - <JPanel layout='{new GridLayout(0,1)}'> + <JToolBar id='topToolBar'> + <ButtonHistory id="historyButton"/> + <ButtonAttachment id="attachmentsButton" + constructorParams="model"/> + </JToolBar> - <Table fill='horizontal'> - <row> - <cell> - <JLabel id='receivedDateLabel'/> - </cell> - <cell> - <JLabel id='receivedDateField'/> - </cell> + <JSplitPane constraints='BorderLayout.CENTER' + orientation="{JSplitPane.VERTICAL_SPLIT}"> - <cell> - <JLabel id='senderLabel'/> - </cell> - <cell> - <JLabel id='senderField'/> - </cell> + <JSplitPane orientation="{JSplitPane.HORIZONTAL_SPLIT}"> - <cell> - <JLabel id='clientLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='clientField'/><!-- TODO list of clients --> - </cell> - </row> - </Table> + <JScrollPane> - <Table fill='horizontal'> - <row> - <cell anchor='east'> - <JLabel id='objectLabel'/> - </cell> - <cell weightx='1' columns="5"> - <JTextField id='objectField' - onKeyReleased='handler.setText(event, "object")'/> - </cell> - </row> + <Table fill='horizontal'> + <row> + <cell> + <JLabel id='receivedDateLabel'/> + </cell> + <cell> + <JLabel id='receivedDateField'/> + </cell> + </row> + <row> + <cell> + <JLabel id='senderLabel'/> + </cell> + <cell> + <JLabel id='senderField'/> + </cell> + </row> + <row> + <cell> + <JLabel id='objectLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='objectField' + onKeyReleased='handler.setText(event, "object")'/> + </cell> + </row> + <row> + <cell> + <JLabel id='clientLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='clientField' + onKeyReleased='handler.setText(event, "clientCode")'/> + </cell> + </row> + <row> + <cell> + <JLabel id='docTypeLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='docTypeComboBox' + constructorParams='this' + genericType="DemandType"/> + </cell> + </row> + <row> + <cell> + <JLabel id='ediCodeNumberLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='ediCodeNumberField'/> + </cell> + </row> + <row> + <cell> + <JLabel id='projectReferenceLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='projectReferenceField'/> + </cell> + </row> + <row> + <cell> + <JLabel id='priorityLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='priorityComboBox' + constructorParams='this' + genericType="Priority"/> + </cell> + </row> + <row> + <cell> + <JLabel id='statusLabel'/> + </cell> + <cell weightx='1'> + <JLabel id='statusField'/> + </cell> + </row> + <row> + <cell> + <JLabel id='etatAttenteLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='etatAttenteComboBox' + constructorParams='this' + genericType="EtatAttente"/> + </cell> + </row> - <row> - <cell anchor='east'> - <JLabel id='docTypeLabel'/> - </cell> - <cell weightx='1'> - <BeanFilterableComboBox id='docTypeComboBox' - constructorParams='this' - genericType="DemandType"/> - </cell> + <!--<row>--> + <!--<cell anchor='east'>--> + <!--<JLabel id='gammeLabel'/>--> + <!--</cell>--> + <!--<cell weightx='1' columns='6'>--> + <!--<BeanFilterableComboBox id='gammeComboBox'--> + <!--constructorParams='this'--> + <!--genericType="Range"/>--> + <!--</cell>--> + <!--</row>--> + <row> + <cell> + <JLabel id="takenByLabel"/> + </cell> + <cell weightx='1' > + <JLabel id="takenByField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="firstOpenedByLabel"/> + </cell> + <cell> + <JLabel id="firstOpenedByField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="firstOpeningDateLabel"/> + </cell> + <cell weightx='1'> + <JLabel id="firstOpeningDateField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="lastModifiedByLabel"/> + </cell> + <cell> + <JLabel id="lastModifiedByField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="lastModificationDateLabel"/> + </cell> + <cell weightx='1'> + <JLabel id="lastModificationDateField"/> + </cell> + </row> - <cell anchor='east'> - <JLabel id='demandeNumberLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='demandeNumberField' - onKeyReleased='handler.setText(event, "commandNb")'/> - </cell> + </Table> - <cell anchor='east'> - <JLabel id='ediCodeNumberLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='ediCodeNumberField'/> - </cell> - </row> + </JScrollPane> - <row> - <cell anchor='east'> - <JLabel id='priorityLabel'/> - </cell> - <cell weightx='1'> - <BeanFilterableComboBox id='priorityComboBox' - constructorParams='this' - genericType="Priority"/> - </cell> + <JPanel layout="{new BorderLayout()}"> + <JLabel id='messageLabel' + constraints="BorderLayout.NORTH"/> + <JScrollPane id='commentPane' + constraints="BorderLayout.CENTER"> + <JEditorPane id='messageField'/> + </JScrollPane> + </JPanel> - <cell anchor='east'> - <JLabel id='statusLabel'/> - </cell> - <cell weightx='1'> - <BeanFilterableComboBox id='statusComboBox' - constructorParams='this' - genericType="DemandStatus"/> - </cell> + </JSplitPane> - <cell anchor='east'> - <JLabel id='etatAttenteLabel'/> - </cell> - <cell weightx='1'> - <BeanFilterableComboBox id='etatAttenteComboBox' - constructorParams='this' - genericType="DemandStatus"/> - </cell> - </row> + <JScrollPane> + <JXTable id='rangeTable'/> + </JScrollPane> - <row> - <cell anchor='east'> - <JLabel id='projectReferenceLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='projectReferenceField'/> - </cell> + </JSplitPane> - <cell anchor='east'> - <JLabel id='savNumberLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='savNumberField'/> - </cell> - - <cell anchor='east'> - <JLabel id='finishedProductsLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='finishedProductsField'/> - </cell> - </row> - - <row> - <cell anchor='east'> - <JLabel id='gammeLabel'/> - </cell> - <cell weightx='1' columns='6'> - <BeanFilterableComboBox id='gammeComboBox' - constructorParams='this' - genericType="Range"/> - </cell> - </row> - - <row> - <cell anchor='east'> - <JLabel id='messageLabel'/> - </cell> - <cell weightx='1' columns='5'> - <JScrollPane id='commentPane'> - <JTextArea id='messageField'/> - </JScrollPane> - </cell> - </row> - </Table> - - <Table fill='horizontal'> - <row> - <cell> - <JLabel id="takenByLabel"/> - </cell> - <cell weightx='1' > - <JLabel id="takenByField"/> - </cell> - <cell> - <JLabel id="firstOpenedByLabel"/> - </cell> - <cell> - <JLabel id="firstOpenedByField"/> - </cell> - <cell> - <JLabel id="firstOpeningDateLabel"/> - </cell> - <cell weightx='1' > - <JLabel id="firstOpeningDateField"/> - </cell> - <cell> - <JLabel id="lastModifiedByLabel"/> - </cell> - <cell> - <JLabel id="lastModifiedByField"/> - </cell> - <cell> - <JLabel id="lastModificationDateLabel"/> - </cell> - <cell weightx='1'> - <JLabel id="lastModificationDateField"/> - </cell> - </row> - - </Table> - - <JPanel id="attachmentsPanel" - border='{BorderFactory.createTitledBorder("Pièces jointes")}' - layout='{new GridLayout(0,1)}'> - <JPanel layout="{new java.awt.FlowLayout(java.awt.FlowLayout.LEADING)}"> - <JLabel text="Fax - TIF (25ko)"/> - <JButton text="Voir"/> - <JButton text="Editer"/> - <JButton text="Supprimer"/> - </JPanel> - <JPanel layout="{new java.awt.FlowLayout(java.awt.FlowLayout.LEADING)}"> - <JLabel text="Plans - DXF (254ko)"/> - <JButton text="Voir"/> - <JButton text="Supprimer"/> - </JPanel> - - <JButton text="Ajouter"/> - </JPanel> - - </JPanel> - </JScrollPane> - - <JPanel constraints='BorderLayout.SOUTH'> + <JPanel layout='{new GridLayout(1,0)}' + constraints='BorderLayout.SOUTH'> <JButton id="backButton"/> - <JButton id="saveButton"/> - <JButton id="transmitButton"/> + <JButton id="saveButton" onActionPerformed="handler.saveDemande()"/> + <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/> <JButton id="printButton"/> <JButton id="archiveButton"/> + <JButton id="replyButton" onActionPerformed="handler.reply()"/> </JPanel> </JPanel> \ No newline at end of file Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -23,24 +23,51 @@ */ +import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.Company; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.RangeRow; import com.franciaflex.faxtomail.services.service.ReferentielService; +import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction; +import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction; import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.table.DefaultTableColumnModelExt; +import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; +import org.nuiton.jaxx.application.swing.table.MoveToNextEditableCellAction; +import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction; +import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableCellAction; +import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction; import javax.swing.*; +import javax.swing.event.ChangeListener; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableCellEditor; +import javax.swing.text.Document; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.StyleSheet; +import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Collection; +import java.util.Date; import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -63,6 +90,8 @@ */ // private final PersistenceService persistenceService; + protected RangeTableModel rangeTableModel; + @Override public void beforeInit(DemandeUI ui) { @@ -83,9 +112,144 @@ ReferentielService referentielService = getContext().getReferentielService(); initBeanFilterableComboBox(ui.getDocTypeComboBox(), referentielService.getAllDemandType(), model.getDemandType()); - initBeanFilterableComboBox(ui.getStatusComboBox(), referentielService.getAllDemandStatus(), model.getDemandStatus()); initBeanFilterableComboBox(ui.getPriorityComboBox(), referentielService.getAllPriority(), model.getPriority()); - initBeanFilterableComboBox(ui.getGammeComboBox(), referentielService.getAllRange(), null); + initBeanFilterableComboBox(ui.getEtatAttenteComboBox(), referentielService.getAllEtatAttente(), model.getEtatAttente()); + +// HTMLEditorPane editor = ui.getMessageField(); +// HTMLEditorActionFactory.createFontSizeActionList(); +// HTMLEditorActionFactory.createInlineActionList(); +// HTMLEditorActionFactory.createBlockElementActionList(); + + // create some simple html as a string +// String htmlString = "<html>\n" +// + "<body>\n" +// + "<h1>Welcome!</h1>\n" +// + "<h2>This is an H2 header</h2>\n" +// + "<p>This is some sample text</p>\n" +// + "<p><a href=\"http://devdaily.com/blog/\">devdaily blog</a></p>\n" +// + "</body>\n"; + + // create a document, set it on the jeditorpane, then add the html +// editor.setText(htmlString); + + // init table + final JXTable table = ui.getRangeTable(); + + TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); + addComboDataColumnToModel(columnModel, + RangeTableModel.RANGE_COLUMN, + getDecorator(Range.class, null), + referentielService.getAllRange()); + addColumnToModel(columnModel, + RangeTableModel.COMMAND_NUMBER_COLUMN); + addIntegerColumnToModel(columnModel, + RangeTableModel.PRODUCT_QUANTITY_COLUMN, + null, + table); + addIntegerColumnToModel(columnModel, + RangeTableModel.SAV_QUANTITY_COLUMN, + null, + table); + + rangeTableModel = new RangeTableModel(columnModel); + rangeTableModel.setRows(new ArrayList<RangeRow>(model.getRangeRow())); + table.setModel(rangeTableModel); + table.setColumnModel(columnModel); + table.getTableHeader().setReorderingAllowed(false); + + final MoveToNextEditableCellAction nextCellAction = + MoveToNextEditableCellAction.newAction(rangeTableModel, table); + final MoveToPreviousEditableCellAction previousCellAction = + MoveToPreviousEditableCellAction.newAction(rangeTableModel, table); + + final MoveToNextEditableRowAction nextRowAction = + MoveToNextEditableRowAction.newAction(rangeTableModel, table); + final MoveToPreviousEditableRowAction previousRowAction = + MoveToPreviousEditableRowAction.newAction(rangeTableModel, table); + + KeyAdapter keyAdapter = new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + TableCellEditor editor = table.getCellEditor(); + + int keyCode = e.getKeyCode(); + if (keyCode == KeyEvent.VK_LEFT || + (keyCode == KeyEvent.VK_TAB && e.isShiftDown())) { + e.consume(); + if (editor != null) { + editor.stopCellEditing(); + } + previousCellAction.actionPerformed(null); + + } else if (keyCode == KeyEvent.VK_RIGHT || + keyCode == KeyEvent.VK_TAB) { + e.consume(); + if (editor != null) { + editor.stopCellEditing(); + } + nextCellAction.actionPerformed(null); + + } else if (keyCode == KeyEvent.VK_UP || + (keyCode == KeyEvent.VK_ENTER && e.isShiftDown())) { + e.consume(); + if (editor != null) { + editor.stopCellEditing(); + } + previousRowAction.actionPerformed(null); + + } else if (e.getKeyCode() == KeyEvent.VK_ENTER || + keyCode == KeyEvent.VK_DOWN) { + e.consume(); + if (editor != null) { + editor.stopCellEditing(); + } + nextRowAction.actionPerformed(null); + } + } + }; + + table.addKeyListener(keyAdapter); + +// Highlighter highlighter = new Highlighter() { +// @Override +// public Component highlight(Component renderer, ComponentAdapter adapter) { +// int viewRow = adapter.row; +// int modelRow = adapter.convertRowIndexToModel(viewRow); +// Email row = (Email) tableModel.getEntry(modelRow); +// boolean highlight = row.getTakenBy() == null; +// if (highlight) { +// Font font = renderer.getFont(); +// renderer.setFont(font.deriveFont(Font.BOLD)); +// } +// return renderer; +// } +// +// @Override +// public void addChangeListener(ChangeListener l) { +// } +// +// @Override +// public void removeChangeListener(ChangeListener l) { +// } +// +// @Override +// public ChangeListener[] getChangeListeners() { +// return new ChangeListener[0]; +// } +// }; +// table.addHighlighter(highlighter); + + rangeTableModel.addTableModelListener(new TableModelListener() { + @Override + public void tableChanged(TableModelEvent e) { + if (e.getType() == TableModelEvent.INSERT) { + RangeRow row = rangeTableModel.getEntry(e.getFirstRow()); + getModel().addRangeRow(row); + } + } + }); + } @Override @@ -119,4 +283,25 @@ public SwingValidator<DemandeUIModel> getValidator() { return null; } + + public void saveDemande() { + SaveDemandeAction action = getContext().getActionFactory().createLogicAction(this, SaveDemandeAction.class); + action.setDemandeModel(getModel()); + getContext().getActionEngine().runAction(action); + } + + public void transmitDemande() { + MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui); + dialogContent.setModel(getModel()); + openDialog(dialogContent, t("faxtomail.chooseMailFolder.title"), new Dimension(300, 500)); + } + + public void reply() { + ReplyFormUI dialogContent = new ReplyFormUI(ui); + ReplyFormUIModel model = dialogContent.getModel(); + String client = getModel().getClientCode(); + model.setObject(client == null ? null : client); + model.setTo(getModel().getSenderEmailAddress()); + openFrame(dialogContent, t("faxtomail.reply.title", getModel().getObject()), new Dimension(800, 600)); + } } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -22,6 +22,7 @@ * #L% */ +import com.franciaflex.faxtomail.persistence.entities.Attachment; import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.DemandStatus; import com.franciaflex.faxtomail.persistence.entities.DemandType; @@ -31,15 +32,20 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.History; import com.franciaflex.faxtomail.persistence.entities.HistoryType; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.Priority; +import com.franciaflex.faxtomail.persistence.entities.RangeRow; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; +import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; +import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -47,7 +53,7 @@ * @author kmorin <kmorin@codelutin.com> * @since x.x */ -public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> { +public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> implements AttachmentModelAware { private static final Log log = LogFactory.getLog(DemandeUIModel.class); @@ -68,6 +74,11 @@ super(fromBeanBinder, toBeanBinder); } + public Email toEntity(Email email) { + toBeanBinder.copy((DemandeUIModel) this, email); + return email; + } + @Override public void fromEntity(Email entity) { super.fromEntity(entity); @@ -125,14 +136,14 @@ return editObject.getObject(); } - public void setClient(Client client) { - Object oldValue = getClient(); - editObject.setClient(client); - firePropertyChanged(Email.PROPERTY_CLIENT, oldValue, client); + public void setClientCode(String clientCode) { + Object oldValue = getClientCode(); + editObject.setClientCode(clientCode); + firePropertyChanged(Email.PROPERTY_CLIENT_CODE, oldValue, clientCode); } - public Client getClient() { - return editObject.getClient(); + public String getClientCode() { + return editObject.getClientCode(); } public void setEtatAttente(EtatAttente etatAttente) { @@ -270,8 +281,8 @@ return firstOpeningHistory; } - public String getFirstOpeningUserName() { - return getFirstOpeningHistory().getFaxToMailUser().getName(); + public String getFirstOpeningUser() { + return String.valueOf(getFirstOpeningHistory().getFaxToMailUser()); } public Date getFirstOpeningDate() { @@ -285,11 +296,11 @@ return lastModificationHistory; } - public String getLastModificationUserName() { + public String getLastModificationUser() { String result; FaxToMailUser user = getLastModificationHistory().getFaxToMailUser(); if (user != null) { - result = user.getName(); + result = user.toString(); } else { result = t("faxtomail.systemUser"); } @@ -300,8 +311,67 @@ return getLastModificationHistory().getModificationDate(); } + @Override + public Collection<Attachment> getAttachment() { + return editObject.getAttachment(); + } @Override + public void addAllAttachment(Collection<Attachment> attachment) { + editObject.addAllAttachment(attachment); + firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + @Override + public void addAttachment(Attachment attachment) { + editObject.addAttachment(attachment); + firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + @Override + public void removeAttachment(Attachment attachment) { + editObject.removeAttachment(attachment); + firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + public void setAttachment(Collection<Attachment> attachment) { + editObject.setAttachment(attachment); + firePropertyChange(Email.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + public Collection<RangeRow> getRangeRow() { + return editObject.getRangeRow(); + } + + public void addRangeRow(RangeRow rangeRow) { + editObject.addRangeRow(rangeRow); + firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow()); + } + + public void addAllRangeRow(Collection<RangeRow> rangeRow) { + editObject.addAllRangeRow(rangeRow); + firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow()); + } + + public void removeRangeRow(RangeRow rangeRow) { + editObject.removeRangeRow(rangeRow); + firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow()); + } + + public void setRangeRow(Collection<RangeRow> rangeRow) { + editObject.setRangeRow(rangeRow); + firePropertyChange(Email.PROPERTY_RANGE_ROW, null, getRangeRow()); + } + + public MailFolder getMailFolder() { + return editObject.getMailFolder(); + } + + public void setMailFolder(MailFolder mailFolder) { + editObject.setMailFolder(mailFolder); + } + + @Override protected Email newEntity() { return new EmailImpl(); } Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,20 @@ +#navigationTree { + font-size: "11"; + rootVisible: false; + showsRootHandles: true; +} + +#cancelButton { + actionIcon: cancel; + text: "faxtomail.chooseMailFolder.action.cancel"; + toolTipText: "faxtomail.chooseMailFolder.action.cancel.tip"; + i18nMnemonic: "faxtomail.chooseMailFolder.action.cancel.mnemonic"; +} + +#validateButton { + actionIcon: validate; + text: "faxtomail.chooseMailFolder.action.validate"; + toolTipText: "faxtomail.chooseMailFolder.action.validate.tip"; + i18nMnemonic: "faxtomail.chooseMailFolder.action.validate.mnemonic"; + _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.TransmitAction.class}; +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,30 @@ +<JPanel id='mailFolderChooser' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, MailFolderChooserUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + + javax.swing.tree.DefaultTreeModel + </import> + + <script><![CDATA[ + + public MailFolderChooserUI(FaxToMailUI parentUI) { + FaxToMailUIUtil.setParentUI(this, parentUI); + } + + ]]></script> + + <DemandeUIModel id='model' javaBean='null'/> + + <JScrollPane constraints='BorderLayout.CENTER'> + <JTree id="navigationTree"/> + </JScrollPane> + + <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='validateButton'/> + </JPanel> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/MailFolderChooserUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,103 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.persistence.entities.Company; +import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.Cancelable; +import jaxx.runtime.validator.swing.SwingValidator; + +import javax.swing.*; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class MailFolderChooserUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, MailFolderChooserUI> implements Cancelable { + + @Override + public void afterInit(MailFolderChooserUI mailFolderChooserUI) { + initUI(mailFolderChooserUI); + + JTree navigationTree = ui.getNavigationTree(); + // init tree + DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + + Company franciaflex = getContext().getCurrentCompany(); + Collection<MailFolder> folders = franciaflex.getMailFolder(); + List<MailFolder> foldersToExpand = getContext().getExpandedFolders(); + Map<MailFolder, DefaultMutableTreeNode> nodesByFolder = new HashMap<MailFolder, DefaultMutableTreeNode>(); + for (MailFolder folder : folders) { + nodesByFolder.putAll(createFolderTree(root, folder)); + } + + DefaultTreeModel treeModel = new DefaultTreeModel(root); + navigationTree.setModel(treeModel); + + // use the folder icon for the leaf + DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); + Icon folderIcon = renderer.getDefaultClosedIcon(); + renderer.setLeafIcon(folderIcon); + navigationTree.setCellRenderer(renderer); + + navigationTree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(TreeSelectionEvent e) { + FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); + MailFolder folder = folderNode.getMailFolder(); + getModel().setMailFolder(folder); + } + }); + } + + @Override + public void onCloseUI() { + } + + @Override + public SwingValidator<DemandeUIModel> getValidator() { + return null; + } + + @Override + public void cancel() { + closeDialog(); + } + + @Override + protected JComponent getComponentToFocus() { + return ui.getNavigationTree(); + } + + /** + * Creates the tree nodes and returns a map of the nodes by folder + * @param parent the node parent + * @param folder the folder to add to the tree + * @return the map of the nodes by folder + */ + protected Map<MailFolder, DefaultMutableTreeNode> createFolderTree(DefaultMutableTreeNode parent, MailFolder folder) { + Map<MailFolder, DefaultMutableTreeNode> result = new HashMap<MailFolder, DefaultMutableTreeNode>(); + + DefaultMutableTreeNode node = new FolderTreeNode(folder); + result.put(folder, node); + + parent.add(node); + if (folder.isChildrenNotEmpty()) { + for (MailFolder child : folder.getChildren()) { + result.putAll(createFolderTree(node, child)); + } + } + return result; + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,46 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.persistence.entities.RangeRow; +import com.franciaflex.faxtomail.persistence.entities.RangeRowImpl; +import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; +import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; + +import static org.nuiton.i18n.I18n.n; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class RangeTableModel extends AbstractApplicationTableModel<RangeRow> { + + public static final ColumnIdentifier<RangeRow> RANGE_COLUMN = ColumnIdentifier.newId( + RangeRow.PROPERTY_RANGE, + n("faxtomail.rangeRows.table.header.range"), + n("faxtomail.rangeRows.table.header.range")); + + public static final ColumnIdentifier<RangeRow> COMMAND_NUMBER_COLUMN = ColumnIdentifier.newId( + RangeRow.PROPERTY_COMMAND_NUMBER, + n("faxtomail.rangeRows.table.header.command_number"), + n("faxtomail.rangeRows.table.header.command_number")); + + public static final ColumnIdentifier<RangeRow> PRODUCT_QUANTITY_COLUMN = ColumnIdentifier.newId( + RangeRow.PROPERTY_PRODUCT_QUANTITY, + n("faxtomail.rangeRows.table.header.product_column"), + n("faxtomail.rangeRows.table.header.product_column")); + + public static final ColumnIdentifier<RangeRow> SAV_QUANTITY_COLUMN = ColumnIdentifier.newId( + RangeRow.PROPERTY_SAV_QUANTITY, + n("faxtomail.rangeRows.table.header.sav_quantity"), + n("faxtomail.rangeRows.table.header.sav_quantity")); + + public RangeTableModel(TableColumnModelExt columnModel) { + super(columnModel, true, true); + setNoneEditableCols(); + } + + @Override + public RangeRow createNewRow() { + return new RangeRowImpl(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,38 @@ +#fromLabel { + text: "faxtomail.reply.from"; +} + +#toLabel { + text: "faxtomail.reply.to"; +} + +#toField { + text: {model.getTo()}; +} + +#objectLabel { + text: "faxtomail.reply.object"; +} + +#objectField { + text: {model.getObject()}; +} + +#attachmentLabel { + text: "faxtomail.reply.attachment"; +} + +#cancelButton { + actionIcon: cancel; + text: "faxtomail.reply.action.cancel"; + toolTipText: "faxtomail.reply.action.cancel.tip"; + i18nMnemonic: "faxtomail.reply.action.cancel.mnemonic"; +} + +#validateButton { + actionIcon: validate; + text: "faxtomail.reply.action.validate"; + toolTipText: "faxtomail.reply.action.validate.tip"; + i18nMnemonic: "faxtomail.reply.action.validate.mnemonic"; + _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class}; +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,105 @@ +<!-- + #%L + FaxToMail :: UI + %% + Copyright (C) 2014 Franciaflex + %% + 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% + --> +<JPanel id='replyPanel' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + com.franciaflex.faxtomail.ui.swing.util.attachment.ButtonAttachment + + com.franciaflex.faxtomail.persistence.entities.Email + com.franciaflex.faxtomail.persistence.entities.DemandType + com.franciaflex.faxtomail.persistence.entities.DemandStatus + com.franciaflex.faxtomail.persistence.entities.Range + com.franciaflex.faxtomail.persistence.entities.Priority + + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox + + org.jdesktop.swingx.JXDatePicker + org.jdesktop.swingx.JXTitledPanel + + java.text.SimpleDateFormat + java.util.Date + </import> + + <script><![CDATA[ + + public ReplyFormUI(FaxToMailUI parentUI) { + FaxToMailUIUtil.setParentUI(this, parentUI); + } + + ]]></script> + + <ReplyFormUIModel id='model' + initializer='getContextValue(ReplyFormUIModel.class)'/> + + <Table constraints='BorderLayout.CENTER' + fill='both'> + <row> + <cell> + <JLabel id="fromLabel"/> + </cell> + <cell weightx='1'> + <JTextField id="fromField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="toLabel"/> + </cell> + <cell weightx='1'> + <JTextField id="toField"/> + </cell> + </row> + <row> + <cell> + <JLabel id="objectLabel"/> + </cell> + <cell weightx='1'> + <JTextField id="objectField"/> + </cell> + </row> + <row weighty='1'> + <cell columns='2'> + <JEditorPane id="message" /> + </cell> + </row> + <row> + <cell columns='2'> + <JPanel layout='{new BorderLayout()}'> + <JLabel id="attachmentLabel" constraints="BorderLayout.CENTER"/> + <ButtonAttachment id="attachmentButton" + constructorParams="model" + constraints="BorderLayout.EAST"/> + </JPanel> + </cell> + </row> + </Table> + + <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='validateButton'/> + </JPanel> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,54 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.ui.swing.actions.ReplyAction; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.Cancelable; +import jaxx.runtime.validator.swing.SwingValidator; + +import javax.swing.*; +import javax.swing.text.html.HTMLEditorKit; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIModel, ReplyFormUI> implements Cancelable { + + @Override + public void beforeInit(ReplyFormUI ui) { + + super.beforeInit(ui); + + ReplyFormUIModel model = new ReplyFormUIModel(); + + this.ui.setContextValue(model); + } + + @Override + public void afterInit(ReplyFormUI replyFormUIModel) { + initUI(ui); + + JEditorPane editor = ui.getMessage(); + editor.setEditorKitForContentType("text/html", new HTMLEditorKit()); + editor.setContentType("text/html"); + } + + @Override + public void cancel() { + getParentContainer(JFrame.class).setVisible(false); + } + + @Override + public void onCloseUI() { + } + + @Override + public SwingValidator<ReplyFormUIModel> getValidator() { + return null; + } + + @Override + protected JComponent getComponentToFocus() { + return null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ReplyFormUIModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,90 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware; +import org.jdesktop.beans.AbstractSerializableBean; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ReplyFormUIModel extends AbstractSerializableBean implements AttachmentModelAware { + + public static final String PROPERTY_TO = "to"; + public static final String PROPERTY_FROM = "from"; + public static final String PROPERTY_OBJECT = "object"; + public static final String PROPERTY_MESSAGE = "message"; + + protected String to; + protected String from; + protected String object; + protected String message; + protected List<Attachment> attachments = new ArrayList<Attachment>(); + + public String getTo() { + return to; + } + + public void setTo(String to) { + Object oldValue = getTo(); + this.to = to; + firePropertyChange(PROPERTY_TO, oldValue, to); + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + Object oldValue = getFrom(); + this.from = from; + firePropertyChange(PROPERTY_FROM, oldValue, from); + } + + public String getObject() { + return object; + } + + public void setObject(String object) { + Object oldValue = getObject(); + this.object = object; + firePropertyChange(PROPERTY_OBJECT, oldValue, object); + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + Object oldValue = getMessage(); + this.message = message; + firePropertyChange(PROPERTY_MESSAGE, oldValue, message); + } + + @Override + public Collection<Attachment> getAttachment() { + return attachments; + } + + @Override + public void addAllAttachment(Collection<Attachment> attachments) { + this.attachments.addAll(attachments); + firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + @Override + public void addAttachment(Attachment attachment) { + attachments.add(attachment); + firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment()); + } + + @Override + public void removeAttachment(Attachment attachment) { + attachments.remove(attachment); + firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, null, getAttachment()); + } +} Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -30,13 +30,21 @@ import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; import com.google.common.base.Preconditions; import com.google.common.collect.Sets; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; +import org.nuiton.jaxx.application.swing.ApplicationUI; import org.nuiton.jaxx.application.swing.action.ApplicationActionUI; +import org.nuiton.jaxx.application.swing.util.*; -import java.awt.Component; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; @@ -222,4 +230,51 @@ } return labelList; } + + public void openFrame(ApplicationUI dialogContent, + String title, Dimension dim) { + Component topestUI = getTopestUI(); + + JFrame result = new JFrame(title); + + result.add((Component) dialogContent); + result.setResizable(true); + + result.setSize(dim); + + final AbstractApplicationUIHandler handler = dialogContent.getHandler(); + + if (handler instanceof org.nuiton.jaxx.application.swing.util.Cancelable) { + + // add a auto-close action + JRootPane rootPane = result.getRootPane(); + + KeyStroke shortcutClosePopup = getContext().getConfiguration().getShortcutClosePopup(); + + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( + shortcutClosePopup, "close"); + rootPane.getActionMap().put("close", new AbstractAction() { + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + ((org.nuiton.jaxx.application.swing.util.Cancelable) handler).cancel(); + } + }); + } + + result.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent e) { + Component ui = (Component) e.getSource(); + if (log.isDebugEnabled()) { + log.debug("Destroy ui " + ui); + } + JAXXUtil.destroy(ui); + } + }); + SwingUtil.center(getContext().getMainUI(), result); + result.setVisible(true); + } } Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,98 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import jaxx.runtime.SwingUtil; +import org.jdesktop.beans.AbstractSerializableBean; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.List; +import java.awt.event.HierarchyBoundsAdapter; +import java.awt.event.HierarchyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.*; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public abstract class AbstractToolbarPopupButton<UI extends AbstractToolbarPopupUI> extends JToggleButton { + + private static final long serialVersionUID = 1L; + + protected final UI popup; + + protected boolean popupMoving; + + public AbstractToolbarPopupButton() { + + setIcon(SwingUtil.createActionIcon(getActionIcon())); + + popup = createNewPopup(); + + popup.addWindowListener(new WindowAdapter() { + + @Override + public void windowOpened(WindowEvent e) { + setSelected(true); + } + + @Override + public void windowClosing(WindowEvent e) { + setSelected(false); + } + + @Override + public void windowClosed(WindowEvent e) { + setSelected(false); + } + }); + + addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (isSelected()) { + if (!popup.isVisible()) { + popup.openEditor(AbstractToolbarPopupButton.this); + } + } else { + popup.closeEditor(); + } + } + }); + + addHierarchyBoundsListener(new HierarchyBoundsAdapter() { + + @Override + public void ancestorMoved(HierarchyEvent e) { + if (popup.isShowing()) { + + // place dialog just under the button + Point point = new Point(getLocationOnScreen()); + point.translate(-popup.getWidth() + getWidth(), getHeight()); + popupMoving = true; + try { + popup.setLocation(point); + } finally { + popupMoving = false; + } + } + } + }); + } + + protected abstract String getActionIcon(); + + protected abstract UI createNewPopup(); + + public void onCloseUI() { + setSelected(false); + } +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,124 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.ComponentMover; +import jaxx.runtime.swing.ComponentResizer; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public abstract class AbstractToolbarPopupHandler<M, UI extends AbstractToolbarPopupUI<M, ?>> extends AbstractFaxToMailUIHandler<M,UI> { + + public static final String CLOSE_DIALOG_ACTION = "closeDialog"; + + public static final String SHOW_DIALOG_ACTION = "showDialog"; + + @Override + public void afterInit(UI ui) { + + ui.pack(); + ui.setResizable(true); + + ComponentResizer cr = new ComponentResizer(); + cr.registerComponent(ui); + ComponentMover cm = new ComponentMover(); + cm.setDragInsets(cr.getDragInsets()); + cm.registerComponent(ui); + + JRootPane rootPane = ui.getRootPane(); + + KeyStroke shortcutClosePopup = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); + + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( + shortcutClosePopup, CLOSE_DIALOG_ACTION); + + closeAction = new AbstractAction() { + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + AbstractToolbarPopupHandler.this.ui.dispose(); + AbstractToolbarPopupHandler.this.ui.setVisible(false); + } + }; + + openAction = new AbstractAction() { + + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + AbstractToolbarPopupHandler.this.ui.setVisible(true); + } + }; + + ImageIcon actionIcon = SwingUtil.createActionIcon("close-dialog"); + closeAction.putValue(Action.SMALL_ICON, actionIcon); + closeAction.putValue(Action.LARGE_ICON_KEY, actionIcon); + closeAction.putValue(Action.ACTION_COMMAND_KEY, "close"); + closeAction.putValue(Action.NAME, "close"); + closeAction.putValue(Action.SHORT_DESCRIPTION, t("faxtomail.attachmentEditor.action.closeAttachment.tip")); + + rootPane.getActionMap().put(CLOSE_DIALOG_ACTION, closeAction); + rootPane.getActionMap().put(SHOW_DIALOG_ACTION, openAction); + + JButton closeButton = new JButton(closeAction); + closeButton.setText(null); + closeButton.setFocusPainted(false); + closeButton.setRequestFocusEnabled(false); + closeButton.setFocusable(false); + + JToolBar jToolBar = new JToolBar(); + jToolBar.setOpaque(false); + jToolBar.add(closeAction); + jToolBar.setBorderPainted(false); + jToolBar.setFloatable(false); + ui.getBody().setRightDecoration(jToolBar); + } + + protected Action closeAction; + + protected Action openAction; + + public void closeEditor() { + + closeAction.actionPerformed(null); + } + + public void openEditor(JComponent component) { + + if (component != null) { + place(component); + } + openAction.actionPerformed(null); + } + + public void place(JComponent component) { + // Computes the location of bottom left corner of the cell + Component comp = component; + int x = 0; + int y = component.getHeight(); + while (comp != null) { + x += comp.getX(); + y += comp.getY(); + comp = comp.getParent(); + } + + ui.pack(); + // if the editor is too big on the right, + // then align its right side to the right side of the cell + if (x + ui.getWidth() > ui.getOwner().getX() + ui.getOwner().getWidth()) { + x = x - ui.getWidth() + component.getWidth(); + } + ui.setLocation(x, y); + } + +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,4 @@ +#dialog { + undecorated: true; + alwaysOnTop: true; +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,33 @@ +<JDialog layout='{new BorderLayout()}' + id='dialog' + abstract='true' + genericType="M, H extends AbstractToolbarPopupHandler<M, ?>" + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<M, H>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil + + org.jdesktop.swingx.JXTitledPanel + javax.swing.JComponent + </import> + + <script><![CDATA[ + +public AbstractToolbarPopupUI(FaxToMailUIContext context) { + super(context.getMainUI()); + FaxToMailUIUtil.setApplicationContext(this, context); +} + +public void openEditor(JComponent component) { + getHandler().openEditor(component); +} + +public void closeEditor() { + getHandler().closeEditor(); +} + ]]></script> + + <JXTitledPanel id='body' constraints='BorderLayout.CENTER'> + </JXTitledPanel> +</JDialog> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellEditor.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,142 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +/* + * #%L + * Tutti :: UI + * $Id: AttachmentCellEditor.java 1564 2014-01-31 10:56:26Z tchemit $ + * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java/... $ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * 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 com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.google.common.base.Preconditions; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import javax.swing.event.CellEditorListener; +import javax.swing.event.ChangeEvent; +import javax.swing.table.TableCellEditor; +import java.awt.*; +import java.util.EventObject; + +/** + * To edit attachments from a table cell. + * + * @author tchemit <chemit@codelutin.com> + * @author kmorin <morin@codelutin.com> + * @since 1.0.2 + */ +public class AttachmentCellEditor extends AbstractCellEditor implements TableCellEditor { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(AttachmentCellEditor.class); + + public static TableCellEditor newEditor(FaxToMailUI ui) { + + return new AttachmentCellEditor(FaxToMailUIContext.getApplicationContext()); + } + + protected JTable table; + + protected AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel> tableModel; + + protected Integer rowIndex; + + protected Integer columnIndex; + + protected final ButtonAttachment editorButton; + + public AttachmentCellEditor(FaxToMailUIContext context) { + + this.editorButton = new ButtonAttachment(null); + this.editorButton.setBorder(new LineBorder(Color.BLACK)); + addCellEditorListener(new CellEditorListener() { + @Override + public void editingStopped(ChangeEvent e) { + editorButton.setSelected(false); + } + + @Override + public void editingCanceled(ChangeEvent e) { + editorButton.setSelected(false); + } + }); + } + + @Override + public Component getTableCellEditorComponent(JTable table, + Object value, + boolean isSelected, + int row, + int column) { + this.table = table; + this.tableModel = (AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel>) table.getModel(); + + rowIndex = row; + columnIndex = column; + + AttachmentModelAware model = + (AttachmentModelAware) tableModel.getEntry(row); + + editorButton.init(model); + + return editorButton; + } + + @Override + public boolean shouldSelectCell(EventObject anEvent) { + return false; + } + + @Override + public Object getCellEditorValue() { + + AttachmentModelAware model = editorButton.getBean(); + Preconditions.checkNotNull(model, "No model found in editor."); + + Object result = model.getAttachment(); + if (log.isDebugEnabled()) { + log.debug("editor value: " + result); + } + + return result; + } + + @Override + public boolean stopCellEditing() { + boolean b = super.stopCellEditing(); + if (b) { + editorButton.setBean(null); + } + return b; + } + + @Override + public void cancelCellEditing() { + editorButton.setBean(null); + super.cancelCellEditing(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellRenderer.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellRenderer.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentCellRenderer.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,102 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import jaxx.runtime.SwingUtil; +import org.apache.commons.collections.CollectionUtils; +import org.nuiton.decorator.Decorator; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.*; +import java.util.List; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Renderer of a attachement editor in a table cell. + * + * @author kmorin <morin@codelutin.com> + * @author tchemit <chemit@codelutin.com> + * @since 1.0.2 + */ +public class AttachmentCellRenderer extends DefaultTableCellRenderer { + + public static final String TEXT_PATTERN = "<html><body>%s</body></html>"; + + private static final long serialVersionUID = 1L; + + private final String noneText; + + private final Decorator<Attachment> decorator; + + private Font defaulfFont; + + private Font selectedFont; + + public static AttachmentCellRenderer newRender(Decorator<Attachment> decorator) { + return new AttachmentCellRenderer(decorator); + } + + protected AttachmentCellRenderer(Decorator<Attachment> decorator) { + setHorizontalAlignment(CENTER); + setIcon(SwingUtil.createActionIcon("edit-attachment")); + this.noneText = n("faxtomail.attachmentEditor.none.tip"); + this.decorator = decorator; + } + + @Override + protected void setValue(Object value) { + // do nothing + } + + @Override + public JComponent getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + + if (defaulfFont == null) { + defaulfFont = UIManager.getFont("Table.font"); + selectedFont = defaulfFont.deriveFont(Font.BOLD); + } + + List<Attachment> attachments = (List<Attachment>) value; + + String toolTipTextValue; + + if (CollectionUtils.isEmpty(attachments)) { + + // use HTML to show the tooltip in italic + toolTipTextValue = "<i>" + t(noneText) + "</i>"; + + + } else { + + StringBuilder sb = new StringBuilder(); + for (Attachment attachment : attachments) { + sb.append("<br/>").append(decorator.toString(attachment)); + } + // use html to display the tooltip on several lines + toolTipTextValue = sb.substring(5); + } + String textValue = ButtonAttachment.getButtonText(attachments); + boolean editable = table.isCellEditable(row, column); + toolTipTextValue = String.format(TEXT_PATTERN, toolTipTextValue); + setEnabled(editable); + setText(textValue); + setToolTipText(toolTipTextValue); + setBackground(null); + setForeground(Color.BLACK); + + if (isSelected) { + setFont(selectedFont); + } else { + setFont(defaulfFont); + } + + return this; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,25 @@ +#body { + title: "faxtomail.attachmentEditor.title"; +} + +#fileLabel { + text: "faxtomail.attachmentEditor.field.file"; + labelFor: {file}; +} + +#fileNameLabel { + text: "faxtomail.attachmentEditor.field.fileName"; + labelFor: {fileName}; +} + +#fileCommentLabel { + text: "faxtomail.attachmentEditor.field.fileComment"; + labelFor: {fileComment}; +} + +#addButton { + actionIcon: add; + toolTipText: "faxtomail.attachmentEditor.action.add.tip"; + i18nMnemonic: "faxtomail.attachmentEditor.action.add.mnemonic"; +} + Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,70 @@ +<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI + superGenericType="FaxToMailUIContext, AttachmentEditorUIHandler" + id='attachmentDialog'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + + jaxx.runtime.swing.editor.FileEditor + org.jdesktop.swingx.JXTitledPanel + javax.swing.JComponent + </import> + + <!-- if true, display the form to add attachments + and the button to remove existing attachments --> + <Boolean id='editable' javaBean='true'/> + + <!-- bean property --> + <AttachmentModelAware id='bean' javaBean='null'/> + + <FaxToMailUIContext id='model' + initializer='getContextValue(FaxToMailUIContext.class)'/> + + <JXTitledPanel id='body'> + <JScrollPane id='attachmentBodyScrollPane'> + <Table id='mainPanel'> + + <row fill='both' weighty='1'> + <cell fill='both' weightx='1' columns='3'> + <JPanel id='attachments' layout='{new GridLayout(0, 1)}'></JPanel> + </cell> + </row> + <row fill='both'> + <cell fill='both' weightx='1' columns='3'> + <JSeparator/> + </cell> + </row> + <row fill='both'> + <cell fill='both' weightx='1'> + <JLabel id='fileLabel'/> + </cell> + <cell fill='both' weightx='1'> + <FileEditor id='file'/> + </cell> + <cell fill='both' rows='3'> + <JButton id='addButton' + onActionPerformed='handler.addAttachment()'/> + </cell> + </row> + <!--<row fill='both'>--> + <!--<cell fill='both' weightx='1'>--> + <!--<JLabel id='fileNameLabel'/>--> + <!--</cell>--> + <!--<cell fill='both' weightx='1'>--> + <!--<JTextField id='fileName'/>--> + <!--</cell>--> + <!--</row>--> + <!--<row fill='both' weighty='1'>--> + <!--<cell fill='both' weightx='1'>--> + <!--<JLabel id='fileCommentLabel'/>--> + <!--</cell>--> + <!--<cell fill='both' weightx='1'>--> + <!--<JScrollPane>--> + <!--<JTextArea id='fileComment' rows='3'/>--> + <!--</JScrollPane>--> + <!--</cell>--> + <!--</row>--> + </Table> + </JScrollPane> + </JXTitledPanel> +</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,190 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.ComponentMover; +import jaxx.runtime.swing.ComponentResizer; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.jaxx.application.ApplicationTechnicalException; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author kmorin <morin@codelutin.com> + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class AttachmentEditorUIHandler extends AbstractToolbarPopupHandler<FaxToMailUIContext, AttachmentEditorUI> { + + @Override + public void beforeInit(AttachmentEditorUI ui) { + super.beforeInit(ui); + + getUI().addPropertyChangeListener(AttachmentEditorUI.PROPERTY_BEAN, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + init(); + } + }); + } + + @Override + public void afterInit(AttachmentEditorUI ui) { + ui.getFile().setDialogOwner(ui); + super.afterInit(ui); + } + + @Override + protected JComponent getComponentToFocus() { + return getUI().getFile(); + } + + @Override + public void onCloseUI() { + } + + @Override + public SwingValidator<FaxToMailUIContext> getValidator() { + return null; + } + + public void init() { + resetFields(); + ui.getAttachments().removeAll(); + AttachmentModelAware bean = ui.getBean(); + if (bean != null) { + Collection<Attachment> attachments = bean.getAttachment(); + if (attachments != null) { + for (Attachment attachment : attachments) { + addAttachment(attachment); + } + } + } + } + + public void place(JComponent component) { + // Computes the location of bottom left corner of the cell + Component comp = component; + int x = 0; + int y = component.getHeight(); + while (comp != null) { + x += comp.getX(); + y += comp.getY(); + comp = comp.getParent(); + } + + ui.pack(); + // if the editor is too big on the right, + // then align its right side to the right side of the cell + if (x + ui.getWidth() > ui.getOwner().getX() + ui.getOwner().getWidth()) { + x = x - ui.getWidth() + component.getWidth(); + } + ui.setLocation(x, y); + } + + public void addAttachment() { + AttachmentModelAware bean = ui.getBean(); + Attachment attachment = new AttachmentImpl(); + + File file = ui.getFile().getSelectedFile(); + if (file != null) { +// String name = ui.getFileName().getText(); +// if (StringUtils.isEmpty(name)) { + String name = file.getName(); +// } +// attachment.setObjectType(bean.getObjectType()); +// attachment.setObjectId(bean.getObjectId()); +// attachment.setName(name); +// attachment.setComment(ui.getFileComment().getText()); + attachment.setFile(file); + +// attachment = getPersistenceService().createAttachment(attachment, file); + bean.addAttachment(attachment); + + resetFields(); + addAttachment(attachment); + + ui.pack(); + } + } + + protected void addAttachment(final Attachment attachment) { + AttachmentItem item = new AttachmentItem(); + item.setAttachment(attachment); + item.setHandler(this); + ui.getAttachments().add(item); + } + + protected void resetFields() { + ui.getFile().setSelectedFilePath(null); +// ui.getFileName().setText(""); +// ui.getFileComment().setText(""); + } + + public void openAttachment(Attachment attachment) { +// File file = getPersistenceService().getAttachmentFile(attachment.getId()); + File file = attachment.getFile(); + + if (!file.exists()) { + throw new ApplicationTechnicalException(t("faxtomail.attachmentEditor.fileNotFound", file.getAbsolutePath())); + } + + Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse(); + try { + desktop.browse(file.toURI()); + + } catch (IOException e) { + getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file")); + } + } + + public void saveAttachment(Attachment attachment) { + + SaveAttachmentAction action = getContext().getActionFactory().createLogicAction( + this, SaveAttachmentAction.class); + action.setAttachment(attachment); + getContext().getActionEngine().runAction(action); + } + + public void removeAttachment(AttachmentItem attachmentItem) { + Attachment attachment = attachmentItem.getAttachment(); + boolean hackDialog = ui.isAlwaysOnTop(); + if (hackDialog) { + ui.setAlwaysOnTop(false); + } + int answer = JOptionPane.showConfirmDialog(ui, + t("faxtomail.attachmentEditor.deleteAttachment.message", attachment.getFile()), + t("faxtomail.attachmentEditor.deleteAttachment.title"), + JOptionPane.YES_NO_OPTION); + if (hackDialog) { + ui.setAlwaysOnTop(true); + } + + if (answer == JOptionPane.YES_OPTION) { + AttachmentModelAware bean = ui.getBean(); + +// getPersistenceService().deleteAttachment(attachment.getId()); + bean.removeAttachment(attachment); + ui.getAttachments().remove(attachmentItem); + + ui.pack(); + } + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,26 @@ +#attachmentNameLabel { + text: {attachment != null ? getAttachment().getFile().getName() : null}; +} + +#toolbar { + borderPainted: false; + floatable: false; +} + +#openAttachmentButton { + actionIcon: "open-file"; + toolTipText: "faxtomail.attachmentEditor.action.open.tip"; + i18nMnemonic: "faxtomail.attachmentEditor.action.open.mnemonic"; +} + +#saveAttachmentButton { + actionIcon: "import"; + toolTipText: "faxtomail.attachmentEditor.action.save.tip"; + i18nMnemonic: "faxtomail.attachmentEditor.action.save.mnemonic"; +} + +#removeAttachmentButton { + actionIcon: "delete"; + toolTipText: "faxtomail.attachmentEditor.action.remove.tip"; + i18nMnemonic: "faxtomail.attachmentEditor.action.remove.mnemonic"; +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentItem.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,24 @@ +<JPanel id='attachmentPanel' layout='{new BorderLayout()}'> + + <import> + com.franciaflex.faxtomail.persistence.entities.Attachment + static org.nuiton.i18n.I18n.t + static jaxx.runtime.JAXXUtil.getStringValue + </import> + + <Attachment id='attachment' javaBean='null'/> + + <AttachmentEditorUIHandler id='handler' javaBean='null'/> + + <JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/> + + <JToolBar id='toolbar' constraints='BorderLayout.EAST'> + <JButton id='openAttachmentButton' + onActionPerformed='handler.openAttachment(attachment)'/> + <JButton id='saveAttachmentButton' + onActionPerformed='handler.saveAttachment(attachment)'/> + <JButton id='removeAttachmentButton' + onActionPerformed='handler.removeAttachment(this)'/> + </JToolBar> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentModelAware.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentModelAware.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/AttachmentModelAware.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,33 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; + +/** + * To place on model wich supports attachments. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.2 + */ +public interface AttachmentModelAware extends Serializable { + + String PROPERTY_ATTACHMENT = "attachment"; + + String PROPERTY_OBJECT_ID = "objectId"; + +// AttachementObjectTypeEnum getObjectType(); + +// Integer getObjectId(); + + Collection<Attachment> getAttachment(); + + void addAllAttachment(Collection<Attachment> attachments); + + void addAttachment(Attachment attachment); + + void removeAttachment(Attachment attachment); + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/ButtonAttachment.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,98 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; +import jaxx.runtime.SwingUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.jdesktop.beans.AbstractSerializableBean; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.HierarchyBoundsAdapter; +import java.awt.event.HierarchyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Collection; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +/** + * Button to edit attachments. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ButtonAttachment extends AbstractToolbarPopupButton<AttachmentEditorUI> { + + private transient PropertyChangeListener listenAttachmentsChanged; + + public ButtonAttachment(AttachmentModelAware model) { + setToolTipText(t("faxtomail.attachmentEditor.action.tip")); + setBean(model); + } + + @Override + protected String getActionIcon() { + return "edit-attachment"; + } + + @Override + protected AttachmentEditorUI createNewPopup() { + return new AttachmentEditorUI(FaxToMailUIContext.getApplicationContext()); + } + + public static String getButtonText(Collection<Attachment> attachments) { + int attachmentNb = CollectionUtils.size(attachments); + return t("faxtomail.attachmentEditor.text", attachmentNb); + } + + public void init() { + popup.getHandler().init(); + } + + public void init(AttachmentModelAware model) { + setBean(model); + init(); + } + + public AttachmentModelAware getBean() { + return popup.getBean(); + } + + protected void setBean(AttachmentModelAware model) { + AttachmentModelAware bean = popup.getBean(); + if (bean != null) { + ((AbstractSerializableBean) bean).removePropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, getListenAttachmentsChanged()); + } + popup.setBean(model); + + if (model != null) { + + ((AbstractSerializableBean) model).addPropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, getListenAttachmentsChanged()); + Collection<Attachment> attachments = model.getAttachment(); + setText(ButtonAttachment.getButtonText(attachments)); + } + } + + protected PropertyChangeListener getListenAttachmentsChanged() { + if (listenAttachmentsChanged == null) { + listenAttachmentsChanged = new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + List<Attachment> attachment = (List<Attachment>) evt.getNewValue(); + setText(getButtonText(attachment)); + if (!popup.isVisible()) { + init(); + } + } + }; + } + return listenAttachmentsChanged; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/SaveAttachmentAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/SaveAttachmentAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/attachment/SaveAttachmentAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,81 @@ +package com.franciaflex.faxtomail.ui.swing.util.attachment; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import org.nuiton.jaxx.application.ApplicationIOUtil; + +import java.io.File; + +import static org.nuiton.i18n.I18n.t; + +/** + * To persist a attachment. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.4 + */ +public class SaveAttachmentAction extends AbstractFaxToMailAction<FaxToMailUIContext, AttachmentEditorUI, AttachmentEditorUIHandler> { + + private Attachment attachment; + + public SaveAttachmentAction(AttachmentEditorUIHandler handler) { + super(handler, false); + } + + protected File file; + + protected File attachmentFile; + + @Override + public boolean prepareAction() throws Exception { + boolean doAction = super.prepareAction(); + if (doAction) { + + attachmentFile = attachment.getFile(); + + file = saveFile( + ApplicationIOUtil.getBaseName(attachmentFile.getName()), + ApplicationIOUtil.getExtension(attachmentFile.getName()), + t("faxtomail.attachmentEditor.saveAttachment.title"), + t("faxtomail.attachmentEditor.saveAttachment.button")); + doAction = file != null; + } + return doAction; + } + + @Override + public void doAction() throws Exception { + + AttachmentEditorUI ui = getUI(); + + boolean hackDialog = ui.isAlwaysOnTop(); + if (hackDialog) { + ui.setAlwaysOnTop(false); + } + try { + + ApplicationIOUtil.copyFile(attachmentFile, file, + t("faxtomail.attachmentEditor.saveAttachment.error.message", attachmentFile, file.getName())); + sendMessage( + t("faxtomail.attachmentEditor.saveAttachment.success.message", file.getName())); + + } finally { + if (hackDialog) { + ui.setAlwaysOnTop(true); + } + } + } + + public void setAttachment(Attachment attachment) { + this.attachment = attachment; + } + + @Override + public void releaseAction() { + super.releaseAction(); + attachmentFile = null; + attachment = null; + file = null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/ButtonHistory.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,49 @@ +package com.franciaflex.faxtomail.ui.swing.util.history; + +import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; +import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentEditorUI; +import com.franciaflex.faxtomail.ui.swing.util.attachment.AttachmentModelAware; +import jaxx.runtime.SwingUtil; +import org.jdesktop.beans.AbstractSerializableBean; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.HierarchyBoundsAdapter; +import java.awt.event.HierarchyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +/** + * Button to edit attachments. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ButtonHistory extends AbstractToolbarPopupButton<HistoryListUI> { + + public ButtonHistory() { + setToolTipText(t("faxtomail.historyList.action.tip")); + int historySize = popup.getModel().sizeHistory(); + setText(t("faxtomail.historyList.text", historySize)); + } + + @Override + protected String getActionIcon() { + return "view-history"; + } + + @Override + protected HistoryListUI createNewPopup() { + return new HistoryListUI(FaxToMailUIContext.getApplicationContext()); + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,11 @@ +#type { + text : { model.getTypeAsString() }; +} + +#user { + text : { model.getFaxToMailUserAsString() }; +} + +#date { + text : { model.getModificationDateAsString() }; +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItem.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,28 @@ +<JPanel id='historyItemPanel' layout="{new GridLayout(0,1)}"> + + <import> + com.franciaflex.faxtomail.persistence.entities.History + + static org.nuiton.i18n.I18n.t + static jaxx.runtime.JAXXUtil.getStringValue + </import> + + <HistoryItemModel id='model' initializer="new HistoryItemModel(getContextValue(History.class))" /> + + <HistoryListUIHandler id="handler" initializer="getContextValue(HistoryListUIHandler.class)" /> + + <script><![CDATA[ +public HistoryItem(History history, HistoryListUIHandler handler) { + setContextValue(history); + setContextValue(handler); +} + ]]></script> + + <JLabel id='type'/> + + <JPanel> + <JLabel id='user'/> + <JLabel id='date'/> + </JPanel> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItemModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItemModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryItemModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,93 @@ +package com.franciaflex.faxtomail.ui.swing.util.history; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.persistence.entities.History; +import com.franciaflex.faxtomail.persistence.entities.HistoryImpl; +import com.franciaflex.faxtomail.persistence.entities.HistoryType; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import java.text.DateFormat; +import java.util.Date; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class HistoryItemModel extends AbstractFaxToMailBeanUIModel<History, HistoryItemModel> { + + protected static Binder<HistoryItemModel, History> toBeanBinder = + BinderFactory.newBinder(HistoryItemModel.class, + History.class); + + protected static Binder<History, HistoryItemModel> fromBeanBinder = + BinderFactory.newBinder(History.class, HistoryItemModel.class); + + protected final History editObject = new HistoryImpl(); + + public HistoryItemModel(History history) { + super(fromBeanBinder, toBeanBinder); + fromEntity(history); + } + + public String getTypeAsString() { + HistoryType type = editObject.getType(); + if (type == null) { + return null; + } + return type.toString(); + } + + public HistoryType getType() { + return editObject.getType(); + } + + public void setType(HistoryType type) { + Object oldValue = editObject.getType(); + editObject.setType(type); + firePropertyChanged(History.PROPERTY_TYPE + "AsString", oldValue, type); + } + + public String getModificationDateAsString() { + Date date = editObject.getModificationDate(); + if (date == null) { + return null; + } + return DateFormat.getDateTimeInstance().format(date); + } + + public Date getModificationDate() { + return editObject.getModificationDate(); + } + + public void setModificationDate(Date modificationDate) { + Object oldValue = editObject.getModificationDate(); + editObject.setModificationDate(modificationDate); + firePropertyChanged(History.PROPERTY_MODIFICATION_DATE + "AsString", oldValue, modificationDate); + } + + public String getFaxToMailUserAsString() { + FaxToMailUser user = editObject.getFaxToMailUser(); + if (user == null) { + return "faxtomail.systemUser"; + } + return user.toString(); + } + + public FaxToMailUser getFaxToMailUser() { + return editObject.getFaxToMailUser(); + } + + public void setFaxToMailUser(FaxToMailUser faxToMailUser) { + Object oldValue = editObject.getFaxToMailUser(); + editObject.setFaxToMailUser(faxToMailUser); + firePropertyChanged(History.PROPERTY_FAX_TO_MAIL_USER + "AsString", oldValue, faxToMailUser); + } + + @Override + protected History newEntity() { + return new HistoryImpl(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.css 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,3 @@ +#body { + title: "faxtomail.historyList.title"; +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUI.jaxx 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,18 @@ +<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI + superGenericType="HistoryListUIModel, HistoryListUIHandler" + id='historyListDialog'> + + <import> + org.jdesktop.swingx.JXTitledPanel + </import> + + <HistoryListUIModel id='model' + initializer='getContextValue(HistoryListUIModel.class)'/> + + <JXTitledPanel id='body'> + <JScrollPane id='attachmentBodyScrollPane'> + <JPanel id='histories' layout='{new GridLayout(0, 1)}'></JPanel> + </JScrollPane> + </JXTitledPanel> + +</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIHandler.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,57 @@ +package com.franciaflex.faxtomail.ui.swing.util.history; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.History; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class HistoryListUIHandler extends AbstractToolbarPopupHandler<HistoryListUIModel, HistoryListUI> { + + private final static Log log = LogFactory.getLog(HistoryListUIHandler.class); + + @Override + public void beforeInit(HistoryListUI ui) { + super.beforeInit(ui); + + Email currentEmail = getContext().getCurrentEmail(); + HistoryListUIModel model = new HistoryListUIModel(); + model.fromBean(currentEmail); + + this.ui.setContextValue(model); + } + + @Override + public void afterInit(HistoryListUI ui) { + super.afterInit(ui); + + for (History history : getModel().getHistory()) { + HistoryItem item = new HistoryItem(history, this); + ui.getHistories().add(item); + } + } + + @Override + public void onCloseUI() { + } + + @Override + public SwingValidator<HistoryListUIModel> getValidator() { + return null; + } + + @Override + protected JComponent getComponentToFocus() { + return null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/history/HistoryListUIModel.java 2014-02-25 09:19:54 UTC (rev 12) @@ -0,0 +1,55 @@ +package com.franciaflex.faxtomail.ui.swing.util.history; + +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.persistence.entities.EmailImpl; +import com.franciaflex.faxtomail.persistence.entities.History; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import java.util.Collection; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class HistoryListUIModel extends AbstractFaxToMailBeanUIModel<Email, HistoryListUIModel> { + + protected static Binder<HistoryListUIModel, Email> toBeanBinder = + BinderFactory.newBinder(HistoryListUIModel.class, + Email.class); + + protected static Binder<Email, HistoryListUIModel> fromBeanBinder = + BinderFactory.newBinder(Email.class, HistoryListUIModel.class); + + protected final Email editObject = new EmailImpl(); + + public HistoryListUIModel() { + super(fromBeanBinder, toBeanBinder); + } + + public void setHistory(Collection<History> history) { + editObject.setHistory(history); + } + + public Collection<History> getHistory() { + return editObject.getHistory(); + } + + public int sizeHistory() { + return editObject.sizeHistory(); + } + + public boolean isHistoryEmpty() { + return editObject.isHistoryEmpty(); + } + + public boolean isHistoryNotEmpty() { + return editObject.isHistoryNotEmpty(); + } + + @Override + protected Email newEntity() { + return new EmailImpl(); + } +} Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -16,7 +16,35 @@ faxtomail.alert.alreadyTakenBy.message= faxtomail.alert.alreadyTakenBy.title= faxtomail.archive.button.label= +faxtomail.attachmentEditor.action.add.mnemonic= +faxtomail.attachmentEditor.action.add.tip= +faxtomail.attachmentEditor.action.closeAttachment.tip= +faxtomail.attachmentEditor.action.open.mnemonic= +faxtomail.attachmentEditor.action.open.tip= +faxtomail.attachmentEditor.action.remove.mnemonic= +faxtomail.attachmentEditor.action.remove.tip= +faxtomail.attachmentEditor.action.save.mnemonic= +faxtomail.attachmentEditor.action.save.tip= +faxtomail.attachmentEditor.action.tip= +faxtomail.attachmentEditor.deleteAttachment.message= +faxtomail.attachmentEditor.deleteAttachment.title= +faxtomail.attachmentEditor.field.file= +faxtomail.attachmentEditor.fileNotFound= +faxtomail.attachmentEditor.none.tip= +faxtomail.attachmentEditor.saveAttachment.button= +faxtomail.attachmentEditor.saveAttachment.error.message= +faxtomail.attachmentEditor.saveAttachment.success.message= +faxtomail.attachmentEditor.saveAttachment.title= +faxtomail.attachmentEditor.text= +faxtomail.attachmentEditor.title= faxtomail.back.button.label= +faxtomail.chooseMailFolder.action.cancel= +faxtomail.chooseMailFolder.action.cancel.mnemonic= +faxtomail.chooseMailFolder.action.cancel.tip= +faxtomail.chooseMailFolder.action.validate= +faxtomail.chooseMailFolder.action.validate.mnemonic= +faxtomail.chooseMailFolder.action.validate.tip= +faxtomail.chooseMailFolder.title= faxtomail.common.askBeforeDelete.help= faxtomail.common.askCancelEditBeforeLeaving.help= faxtomail.common.askCancelEditBeforeLeaving.title= @@ -66,7 +94,9 @@ faxtomail.demand.alreadyTakenBy= faxtomail.demande.alreadyTakenBy= faxtomail.demande.archive.button.label= +faxtomail.demande.archive.button.mnemonic= faxtomail.demande.back.button.label= +faxtomail.demande.back.button.mnemonic= faxtomail.demande.client.label= faxtomail.demande.demandeNumber.label= faxtomail.demande.docType.label= @@ -81,19 +111,24 @@ faxtomail.demande.message.label= faxtomail.demande.object.label= faxtomail.demande.print.button.label= +faxtomail.demande.print.button.mnemonic= faxtomail.demande.priority.label= faxtomail.demande.projectReference.label= faxtomail.demande.received.label= faxtomail.demande.receivedDate.label= faxtomail.demande.ref.label= +faxtomail.demande.reply.button.label= +faxtomail.demande.reply.button.mnemonic= faxtomail.demande.savNumber.label= faxtomail.demande.save.button.label= +faxtomail.demande.save.button.mnemonic= faxtomail.demande.sender.label= faxtomail.demande.status.label= faxtomail.demande.takenBy.label= faxtomail.demande.tcc.label= faxtomail.demande.title= faxtomail.demande.transmit.button.label= +faxtomail.demande.transmit.button.mnemonic= faxtomail.demandeList.action.attachment= faxtomail.demandeList.action.attachment.mnemonic= faxtomail.demandeList.action.attachment.tip= @@ -125,6 +160,9 @@ faxtomail.error.ui.business.error= faxtomail.error.ui.business.warning= faxtomail.error.ui.other.error= +faxtomail.historyList.action.tip= +faxtomail.historyList.text= +faxtomail.historyList.title= faxtomail.i18n.deleteCache.error= faxtomail.i18n.mkDir.error= faxtomail.main.action.configuration= @@ -152,6 +190,21 @@ faxtomail.print.button.label= faxtomail.property.get.error= faxtomail.property.set.error= +faxtomail.rangeRows.table.header.command_number= +faxtomail.rangeRows.table.header.product_column= +faxtomail.rangeRows.table.header.range= +faxtomail.rangeRows.table.header.sav_quantity= +faxtomail.reply.action.cancel= +faxtomail.reply.action.cancel.mnemonic= +faxtomail.reply.action.cancel.tip= +faxtomail.reply.action.validate= +faxtomail.reply.action.validate.mnemonic= +faxtomail.reply.action.validate.tip= +faxtomail.reply.attachment= +faxtomail.reply.from= +faxtomail.reply.object= +faxtomail.reply.title= +faxtomail.reply.to= faxtomail.save.button.label= faxtomail.search.between2ndPart.label= faxtomail.search.button.label= @@ -171,12 +224,36 @@ faxtomail.systemUser= faxtomail.transmit.button.label= swing.error.cannot.mail= +swing.error.cannot.open.file= swing.error.cannot.open.link= swing.error.desktop.browse.not.supported= swing.error.desktop.mail.not.supported= swing.error.desktop.not.supported= test= tutti.action.create.error= +tutti.attachmentEditor.action.add.mnemonic= +tutti.attachmentEditor.action.add.tip= +tutti.attachmentEditor.action.closeAttachment.tip= +tutti.attachmentEditor.action.open.mnemonic= +tutti.attachmentEditor.action.open.tip= +tutti.attachmentEditor.action.remove.mnemonic= +tutti.attachmentEditor.action.remove.tip= +tutti.attachmentEditor.action.save.mnemonic= +tutti.attachmentEditor.action.save.tip= +tutti.attachmentEditor.action.tip= +tutti.attachmentEditor.deleteAttachment.message= +tutti.attachmentEditor.deleteAttachment.title= +tutti.attachmentEditor.field.file= +tutti.attachmentEditor.field.fileComment= +tutti.attachmentEditor.field.fileName= +tutti.attachmentEditor.fileNotFound= +tutti.attachmentEditor.none.tip= +tutti.attachmentEditor.saveAttachment.button= +tutti.attachmentEditor.saveAttachment.error.message= +tutti.attachmentEditor.saveAttachment.success.message= +tutti.attachmentEditor.saveAttachment.title= +tutti.attachmentEditor.text= +tutti.attachmentEditor.title= tutti.common.datefield.tip= tutti.config.title= tutti.db.deleteCache.error= Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -14,10 +14,42 @@ application.error.ui.business.warning= faxtomail.alert.alreadyTakenBy.message=Le document est déjà attribué à l'utilisateur %s. faxtomail.alert.alreadyTakenBy.title=Document déjà attribué +faxtomail.attachmentEditor.action.add.mnemonic=A +faxtomail.attachmentEditor.action.add.tip=Ajouter une pièce jointe +faxtomail.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes +faxtomail.attachmentEditor.action.open.mnemonic=O +faxtomail.attachmentEditor.action.open.tip=Ouvrir la pièce jointe +faxtomail.attachmentEditor.action.remove.mnemonic=u +faxtomail.attachmentEditor.action.remove.tip=Supprimer la pièce jointe +faxtomail.attachmentEditor.action.save.mnemonic=E +faxtomail.attachmentEditor.action.save.tip=Enregistrer la pièce jointe en local +faxtomail.attachmentEditor.action.tip=Pièces jointes +faxtomail.attachmentEditor.deleteAttachment.message=Êtes-vous sûr de vouloir supprimer la pièce-jointe %s ? +faxtomail.attachmentEditor.deleteAttachment.title=Suppression de pièce-jointe +faxtomail.attachmentEditor.field.file=Fichier +faxtomail.attachmentEditor.field.fileComment=Commentaire +faxtomail.attachmentEditor.field.fileName=Nom +faxtomail.attachmentEditor.fileNotFound=Le fichier %s de la pièce jointe n'a pas été trouvé +faxtomail.attachmentEditor.none.tip=Pas de pièce-jointes +faxtomail.attachmentEditor.saveAttachment.button=Enregistrer +faxtomail.attachmentEditor.saveAttachment.error.message=Erreur lors de l'enregistrement de la pièce jointe %1s dans le fichier %2s +faxtomail.attachmentEditor.saveAttachment.success.message=Le fichier %s a été sauvegardé sur votre machine +faxtomail.attachmentEditor.saveAttachment.title=Enregistrer la pièce-jointe +faxtomail.attachmentEditor.text=Pièces jointes (%s) +faxtomail.attachmentEditor.title=Pièces jointes +faxtomail.chooseMailFolder.action.cancel=Annuler +faxtomail.chooseMailFolder.action.cancel.mnemonic=A +faxtomail.chooseMailFolder.action.cancel.tip=Annuler et fermer la popup +faxtomail.chooseMailFolder.action.validate=Valider +faxtomail.chooseMailFolder.action.validate.mnemonic=V +faxtomail.chooseMailFolder.action.validate.tip=Valider et transférer le mail +faxtomail.chooseMailFolder.title=Choisissez le dossier où transférer le mail faxtomail.config.application= faxtomail.config.title= faxtomail.demande.archive.button.label=Archiver +faxtomail.demande.archive.button.mnemonic=V faxtomail.demande.back.button.label=Annuler +faxtomail.demande.back.button.mnemonic=A faxtomail.demande.client.label=Client faxtomail.demande.demandeNumber.label=N° Devis/Cde faxtomail.demande.docType.label=Type @@ -32,15 +64,20 @@ faxtomail.demande.message.label=Message faxtomail.demande.object.label=Objet faxtomail.demande.print.button.label=Imprimer +faxtomail.demande.print.button.mnemonic=I faxtomail.demande.priority.label=Priorité faxtomail.demande.projectReference.label=Référence travaux faxtomail.demande.receivedDate.label=Reçu le +faxtomail.demande.reply.button.label=Répondre +faxtomail.demande.reply.button.mnemonic=R faxtomail.demande.savNumber.label=SAV faxtomail.demande.save.button.label=Enregistrer +faxtomail.demande.save.button.mnemonic=E faxtomail.demande.sender.label=Émetteur faxtomail.demande.status.label=Statut faxtomail.demande.takenBy.label=Pris par faxtomail.demande.transmit.button.label=Transmettre +faxtomail.demande.transmit.button.mnemonic=T faxtomail.demandeList.action.attachment=Ajouter une pièce-jointe faxtomail.demandeList.action.attachment.mnemonic=A faxtomail.demandeList.action.attachment.tip=Ajouter une pièce-jointe @@ -66,6 +103,9 @@ faxtomail.demandeList.table.header.user=Pris pas faxtomail.demandeList.table.header.waitingState=État attente faxtomail.demandeList.title=Gestion des fax +faxtomail.historyList.action.tip=Historique +faxtomail.historyList.text=Historique (%s) +faxtomail.historyList.title=Historique faxtomail.i18n.deleteCache.error= faxtomail.i18n.mkDir.error= faxtomail.main.action.configuration=Configuration @@ -88,6 +128,21 @@ faxtomail.main.title.application=FaxToMail faxtomail.main.title.applicationName=FaxToMail faxtomail.main.title.nodb= +faxtomail.rangeRows.table.header.command_number=Numéro de commande / devis +faxtomail.rangeRows.table.header.product_column=Quantité de produits +faxtomail.rangeRows.table.header.range=Gamme +faxtomail.rangeRows.table.header.sav_quantity=Quantité de SAV +faxtomail.reply.action.cancel=Annuler +faxtomail.reply.action.cancel.mnemonic=A +faxtomail.reply.action.cancel.tip=Annuler et fermer la popup +faxtomail.reply.action.validate=Valider +faxtomail.reply.action.validate.mnemonic=V +faxtomail.reply.action.validate.tip=Valider et répondre au mail +faxtomail.reply.attachment= +faxtomail.reply.from=De \: +faxtomail.reply.object=Objet \: +faxtomail.reply.title=Réponse à \: %s +faxtomail.reply.to=À \: faxtomail.search.between2ndPart.label=et le faxtomail.search.button.label=Rechercher faxtomail.search.chantier.label=Chantier @@ -104,3 +159,4 @@ faxtomail.search.status.label=Statut faxtomail.search.title=Recherche faxtomail.systemUser=Système +swing.error.cannot.open.file= Modified: trunk/faxtomail-ui-swing/src/main/resources/log4j.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-02-25 09:19:54 UTC (rev 12) @@ -26,7 +26,7 @@ log4j.appender.console.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %M %m%n # global level -log4j.logger.com.franciaflex.faxtomail=DEBUG +log4j.logger.com.franciaflex.faxtomail.ui.swing=DEBUG ### persistence level # log4j.logger.org.nuiton.topia=TRACE Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-02-25 09:19:54 UTC (rev 12) @@ -158,13 +158,14 @@ result.put(Email.PROPERTY_PROJECT_REFERENCE, "Référence travaux"); result.put(Email.PROPERTY_PRIORITY, "Priorité"); result.put(Email.PROPERTY_SAV_NUMBER, "Numéro SAV"); - result.put(Email.PROPERTY_RANGE, "Gamme"); + result.put(Email.PROPERTY_RANGE_ROW, "Gamme"); result.put(Email.PROPERTY_MAIL_FOLDER, "Dossier"); result.put(Email.PROPERTY_CLIENT, "Client"); result.put(Email.PROPERTY_DEMAND_STATUS, "Statut"); result.put(Email.PROPERTY_DEMAND_TYPE, "Type"); result.put(Email.PROPERTY_TAKEN_BY, "Pris par"); result.put(Email.PROPERTY_ETAT_ATTENTE, "État attente"); + result.put(Email.PROPERTY_ATTACHMENT, "Pièces jointes"); return result; } Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-02-18 09:55:51 UTC (rev 11) +++ trunk/pom.xml 2014-02-25 09:19:54 UTC (rev 12) @@ -449,6 +449,30 @@ <scope>compile</scope> </dependency> + <!--<dependency>--> + <!--<groupId>net.atlanticbb.tantlinger</groupId>--> + <!--<artifactId>shef</artifactId>--> + <!--<version>2009-05-12</version>--> + <!--</dependency>--> + + <!--<dependency>--> + <!--<groupId>jtidy</groupId>--> + <!--<artifactId>jtidy</artifactId>--> + <!--<version>8.0</version>--> + <!--</dependency>--> + + <!--<dependency>--> + <!--<groupId>org.bushe</groupId>--> + <!--<artifactId>sam</artifactId>--> + <!--<version>1.0</version>--> + <!--</dependency>--> + + <!--<dependency>--> + <!--<groupId>novaworx</groupId>--> + <!--<artifactId>novaworx-syntax</artifactId>--> + <!--<version>0.0.7</version>--> + <!--</dependency>--> + </dependencies> </dependencyManagement>
participants (1)
-
kmorin@users.forge.codelutin.com