r43 - in trunk: faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-persistence/src/main/resources/i18n faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/d
Author: kmorin Date: 2014-04-24 14:44:23 +0200 (Thu, 24 Apr 2014) New Revision: 43 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/43 Log: refs #4654 [ECRAN] Liste des mails / fax actions du menu contextuel refs #4655 [ECRAN] D?\195?\169tail d'un mail / fax ajout du message Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.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/SaveDemandeFromListAction.java 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/demande/DemandeListUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.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/content/demande/replies/DemandRepliesUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.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 Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java 2014-04-24 12:44:23 UTC (rev 43) @@ -33,23 +33,31 @@ */ public enum HistoryType implements HasLabel { - CREATION(n("faxtomail.historyType.creation")), - OPENING(n("faxtomail.historyType.opening")), - MODIFICATION(n("faxtomail.historyType.modification")), - REPLY(n("faxtomail.historyType.reply")), - PRINTING(n("faxtomail.historyType.printing")), - ARCHIVED(n("faxtomail.historyType.archive")), - GROUP(n("faxtomail.historyType.group")), - ATTACHMENT_OPENING(n("faxtomail.historyType.attachmentOpening")), - ATTACHMENT_MODIFICATION(n("faxtomail.historyType.attachmentModification")); + CREATION(n("faxtomail.historyType.creation"), true), + OPENING(n("faxtomail.historyType.opening"), false), + MODIFICATION(n("faxtomail.historyType.modification"), true), + TRANSMISSION(n("faxtomail.historyType.transmission"), true), + REPLY(n("faxtomail.historyType.reply"), false), + PRINTING(n("faxtomail.historyType.printing"), false), + ARCHIVED(n("faxtomail.historyType.archive"), true), + GROUP(n("faxtomail.historyType.group"), true), + ATTACHMENT_OPENING(n("faxtomail.historyType.attachmentOpening"), false), + ATTACHMENT_MODIFICATION(n("faxtomail.historyType.attachmentModification"), true); protected String labelKey; - private HistoryType(String labelKey) { + protected boolean consideredAsModification; + + private HistoryType(String labelKey, boolean consideredAsModification) { this.labelKey = labelKey; + this.consideredAsModification = consideredAsModification; } public String getLabel() { return t(labelKey); } + + public boolean isConsideredAsModification() { + return consideredAsModification; + } } Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties =================================================================== --- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_en_GB.properties 2014-04-24 12:44:23 UTC (rev 43) @@ -36,6 +36,7 @@ faxtomail.historyType.opening= faxtomail.historyType.printing= faxtomail.historyType.reply= +faxtomail.historyType.transmission= faxtomail.persistence.loader.error= faxtomail.persistence.mkDir.error= faxtomail.service.config.deleteTempDirectory.error= Modified: trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties =================================================================== --- trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-04-24 12:44:23 UTC (rev 43) @@ -30,11 +30,12 @@ faxtomail.historyType.attachmentModification=Modification de pièce jointe faxtomail.historyType.attachmentOpening=Ouverture de pièce jointe faxtomail.historyType.creation=Création -faxtomail.historyType.group= +faxtomail.historyType.group=Groupement faxtomail.historyType.modification=Modification faxtomail.historyType.opening=Ouverture faxtomail.historyType.printing=Impression faxtomail.historyType.reply=Réponse +faxtomail.historyType.transmission=Transmission faxtomail.persistence.loader.error= faxtomail.persistence.mkDir.error= faxtomail.service.config.deleteTempDirectory.error= Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-24 12:44:23 UTC (rev 43) @@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.commons.mail.DefaultAuthenticator; import org.apache.commons.mail.MultiPartEmail; +import org.nuiton.topia.persistence.internal.AbstractTopiaDao; import javax.mail.internet.MailDateFormat; @@ -58,13 +59,6 @@ EmailTopiaDao dao = getPersistenceContext().getEmailDao(); HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - Set<String> fieldSet = Sets.newHashSet(modifiedFields); - if (email.getTakenBy() == null && - !fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) { - email.setTakenBy(user); - fieldSet.add(Email.PROPERTY_TAKEN_BY); - } - if (email.getAttachment() != null) { AttachmentTopiaDao attachmentDao = getPersistenceContext().getAttachmentDao(); for (Attachment attachment : email.getAttachment()) { @@ -95,6 +89,8 @@ email = dao.create(email); } + Set<String> fieldSet = Sets.newHashSet(modifiedFields); + if (email.getDemandStatus() == DemandStatus.UNTREATED && fieldSet.containsAll(Sets.newHashSet(Email.PROPERTY_CLIENT, Email.PROPERTY_DEMAND_TYPE, @@ -103,10 +99,29 @@ //TODO transmit to EDI } - History history = historyDao.create(History.PROPERTY_TYPE, email.isHistoryEmpty() ? HistoryType.CREATION : HistoryType.MODIFICATION, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_FIELDS, fieldSet, - History.PROPERTY_MODIFICATION_DATE, now); + History history; + if (fieldSet.contains(Email.PROPERTY_ARCHIVE_DATE)) { + history = historyDao.create(History.PROPERTY_TYPE, HistoryType.ARCHIVED, + History.PROPERTY_FAX_TO_MAIL_USER, user, + History.PROPERTY_MODIFICATION_DATE, now); + + } else if (fieldSet.contains(Email.PROPERTY_MAIL_FOLDER)) { + history = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION, + History.PROPERTY_FAX_TO_MAIL_USER, user, + History.PROPERTY_MODIFICATION_DATE, now); + + } else { + if (email.getTakenBy() == null && + !fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) { + email.setTakenBy(user); + fieldSet.add(Email.PROPERTY_TAKEN_BY); + } + + history = historyDao.create(History.PROPERTY_TYPE, email.isHistoryEmpty() ? HistoryType.CREATION : HistoryType.MODIFICATION, + History.PROPERTY_FAX_TO_MAIL_USER, user, + History.PROPERTY_FIELDS, fieldSet, + History.PROPERTY_MODIFICATION_DATE, now); + } email.addHistory(history); Email result = dao.update(email); Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java 2014-04-24 12:44:23 UTC (rev 43) @@ -39,6 +39,7 @@ DemandeUIModel model = getModel(); model.setArchiveDate(new Date()); model.setDemandStatus(DemandStatus.ARCHIVED); + model.setTakenBy(null); super.doAction(); } } Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java (from rev 35, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java) =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java 2014-04-24 12:44:23 UTC (rev 43) @@ -0,0 +1,61 @@ +package com.franciaflex.faxtomail.ui.swing.actions; + +import com.franciaflex.faxtomail.persistence.entities.DemandStatus; +import com.franciaflex.faxtomail.persistence.entities.Email; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; + +import javax.swing.*; +import java.util.Date; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ArchiveFromListAction extends SaveDemandeFromListAction { + + public ArchiveFromListAction(DemandeListUIHandler handler) { + super(handler); + } + + @Override + public boolean prepareAction() throws Exception { + int i = JOptionPane.showConfirmDialog( + null, + t("faxtomail.alert.archiveConfirmation.message"), + t("faxtomail.alert.archiveConfirmation.title"), + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + + boolean result = i == JOptionPane.YES_OPTION; + return result; + } + + @Override + public void doAction() throws Exception { + List<DemandeUIModel> currentEmails = getModel().getCurrentEmails(); + for (DemandeUIModel email : currentEmails) { + email.setArchiveDate(new Date()); + email.setDemandStatus(DemandStatus.ARCHIVED); + email.setTakenBy(null); + } + + modifiedProperties = new String[] { Email.PROPERTY_ARCHIVE_DATE }; + super.doAction(); + } + + @Override + public void postSuccessAction() { + super.postSuccessAction(); + getModel().setCurrentEmails(null); + getModel().removeEmails(getModel().getCurrentEmails()); + } + + @Override + protected void releaseAction() { + super.releaseAction(); + } +} Modified: 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 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-04-24 12:44:23 UTC (rev 43) @@ -66,9 +66,6 @@ } } -// Collection<Attachment> attachments = getUI().getAttachmentsButton().getBean().getAttachment(); -// model.setAttachment(attachments); - FaxToMailUser currentUser = context.getCurrentUser(); Email email = model.toEntity(persistedEmail); Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java 2014-04-24 12:44:23 UTC (rev 43) @@ -26,16 +26,18 @@ @Override public void doAction() throws Exception { - DemandeUIModel model = getModel().getCurrentEmail(); FaxToMailUIContext context = getContext(); - String topiaId = model.getTopiaId(); - Email persistedEmail = context.getEmailService().getEmailById(topiaId); + for (DemandeUIModel model : getModel().getCurrentEmails()) { - FaxToMailUser currentUser = context.getCurrentUser(); - Email email = model.toEntity(persistedEmail); + String topiaId = model.getTopiaId(); + Email persistedEmail = context.getEmailService().getEmailById(topiaId); - email = context.getEmailService().saveEmail(email, currentUser, modifiedProperties); - model.fromEntity(email); + FaxToMailUser currentUser = context.getCurrentUser(); + Email email = model.toEntity(persistedEmail); + + email = context.getEmailService().saveEmail(email, currentUser, modifiedProperties); + model.fromEntity(email); + } } } 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-04-24 12:44:23 UTC (rev 43) @@ -27,6 +27,7 @@ import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; import javax.swing.*; @@ -53,8 +54,10 @@ super.doAction(); DemandeUIModel currentEmail = getContext().getCurrentEmail(); - Email email = getContext().getEmailService().getEmailById(currentEmail.getTopiaId()); - currentEmail.setGroupedDemandes(email.getEmailGroup()); + if (StringUtils.isNoneBlank(currentEmail.getTopiaId())) { + Email email = getContext().getEmailService().getEmailById(currentEmail.getTopiaId()); + currentEmail.setGroupedDemandes(email.getEmailGroup()); + } } @Override @@ -65,7 +68,10 @@ FaxToMailUser takenBy = currentEmail.getTakenBy(); FaxToMailUser currentUser = getContext().getCurrentUser(); - if (takenBy != null && !currentUser.equals(takenBy)) { + if (currentEmail.getArchiveDate() != null) { + currentEmail.setEditable(false); + + } else if (takenBy != null && !currentUser.equals(takenBy)) { String htmlMessage = String.format( AbstractApplicationUIHandler.CONFIRMATION_FORMAT, t("faxtomail.alert.alreadyTakenBy.message", decorate(takenBy)), Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-04-24 12:44:23 UTC (rev 43) @@ -29,14 +29,16 @@ import com.franciaflex.faxtomail.persistence.entities.HistoryImpl; import com.franciaflex.faxtomail.persistence.entities.HistoryType; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.ui.swing.actions.ArchiveFromListAction; import com.franciaflex.faxtomail.ui.swing.actions.ComputeQuantitiesByRangeAction; import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeFromListAction; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; +import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler; import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode; import jaxx.runtime.validator.swing.SwingValidator; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; @@ -62,6 +64,8 @@ import java.util.List; import java.util.Map; +import static org.nuiton.i18n.I18n.t; + /** * Handler of UI {@link com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler}. * @@ -73,17 +77,19 @@ /** Logger. */ private static final Log log = LogFactory.getLog(DemandeListUIHandler.class); - protected final PropertyChangeListener selectedDemandeChangeListener = new PropertyChangeListener() { + public final PropertyChangeListener selectedDemandeChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if (Email.PROPERTY_PRIORITY.equals(propertyName)) { - SaveDemandeFromListAction saveAction = - getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, - SaveDemandeFromListAction.class); - saveAction.setModifiedProperties(propertyName); - getContext().getActionEngine().runAction(saveAction); + if (evt.getNewValue() != null || evt.getOldValue() != null) { + SaveDemandeFromListAction saveAction = + getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, + SaveDemandeFromListAction.class); + saveAction.setModifiedProperties(propertyName); + getContext().getActionEngine().runAction(saveAction); + } } } @@ -139,10 +145,15 @@ DemandeListUIModel model = getModel(); if (source.isSelectionEmpty()) { - model.setCurrentEmail(null); + model.setCurrentEmails(null); } else { - int rowIndex = source.getLeadSelectionIndex(); - model.setCurrentEmail(tableModel.getEntry(rowIndex)); + List<DemandeUIModel> selectedRows = new ArrayList<DemandeUIModel>(); + for (int i = source.getMinSelectionIndex() ; i <= source.getMaxSelectionIndex() ; i++) { + if (source.isSelectedIndex(i)) { + selectedRows.add(tableModel.getEntry(i)); + } + } + model.setCurrentEmails(selectedRows); } } }); @@ -169,18 +180,22 @@ } }); - model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_CURRENT_EMAIL, new PropertyChangeListener() { + model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_CURRENT_EMAILS, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - DemandeUIModel oldDemande = (DemandeUIModel) evt.getOldValue(); - if (oldDemande != null) { - oldDemande.removePropertyChangeListener(selectedDemandeChangeListener); + List<DemandeUIModel> oldDemands = (List<DemandeUIModel>) evt.getOldValue(); + if (oldDemands != null) { + for (DemandeUIModel demand : oldDemands) { + demand.removePropertyChangeListener(selectedDemandeChangeListener); + } } - DemandeUIModel newDemande = (DemandeUIModel) evt.getNewValue(); - if (newDemande != null) { - newDemande.addPropertyChangeListener(selectedDemandeChangeListener); + List<DemandeUIModel> newDemands = (List<DemandeUIModel>) evt.getNewValue(); + if (newDemands != null) { + for (DemandeUIModel demand : newDemands) { + demand.addPropertyChangeListener(selectedDemandeChangeListener); + } } } }); @@ -319,7 +334,6 @@ public void computeQuantitiesByRange() { QuantitiesByRangeUI dialogContent = new QuantitiesByRangeUI(ui); getContext().getActionEngine().runAction(new ComputeQuantitiesByRangeAction(dialogContent.getHandler())); -// openDialog(dialogContent, t("faxtomail.chooseMailFolder.title"), new Dimension(350, 500)); } public void newDemand() { @@ -353,13 +367,21 @@ } public void reply() { - //TODO - log.debug("reply"); + DemandeUIModel demand = getModel().getCurrentEmails().get(0); + getContext().setCurrentEmail(demand); + + ReplyFormUI dialogContent = new ReplyFormUI(ui); + ReplyFormUIModel model = dialogContent.getModel(); + model.setTo(demand.getSender()); + + openFrame(dialogContent, t("faxtomail.reply.title", demand.getSubject()), new Dimension(800, 600)); } public void archive() { - //TODO - log.debug("archive"); + ArchiveFromListAction saveAction = + getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, + ArchiveFromListAction.class); + getContext().getActionEngine().runAction(saveAction); } } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-04-24 12:44:23 UTC (rev 43) @@ -22,11 +22,11 @@ * #L% */ -import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import org.jdesktop.beans.AbstractSerializableBean; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** @@ -37,7 +37,7 @@ public static final String PROPERTY_FOLDERS = "folders"; public static final String PROPERTY_EMAILS = "emails"; - public static final String PROPERTY_CURRENT_EMAIL = "currentEmail"; + public static final String PROPERTY_CURRENT_EMAILS = "currentEmails"; public static final String PROPERTY_EMAIL_NB = "emailNb"; public static final String PROPERTY_SELECTED_FOLDER = "selectedFolder"; public static final String PROPERTY_QUOTATION_NB = "quotationNb"; @@ -50,7 +50,7 @@ protected List<DemandeUIModel> emails; - protected DemandeUIModel currentEmail; + protected List<DemandeUIModel> currentEmails; protected MailFolder selectedFolder; @@ -86,14 +86,14 @@ firePropertyChange(PROPERTY_EMAIL_NB, oldValue, newValue); } - public DemandeUIModel getCurrentEmail() { - return currentEmail; + public List<DemandeUIModel> getCurrentEmails() { + return currentEmails; } - public void setCurrentEmail(DemandeUIModel currentEmail) { - Object oldValue = getCurrentEmail(); - this.currentEmail = currentEmail; - firePropertyChange(PROPERTY_CURRENT_EMAIL, oldValue, currentEmail); + public void setCurrentEmails(List<DemandeUIModel> currentEmails) { + Object oldValue = getCurrentEmails(); + this.currentEmails = currentEmails; + firePropertyChange(PROPERTY_CURRENT_EMAILS, oldValue, currentEmails); } public int getEmailNb() { @@ -111,6 +111,16 @@ firePropertyChange(PROPERTY_EMAIL_NB, oldValue, newValue); } + public void removeEmails(List<DemandeUIModel> emails) { + if (emails != null) { + Object oldValue = getEmailNb(); + this.emails.removeAll(emails); + Object newValue = getEmailNb(); + firePropertyChange(PROPERTY_EMAILS, null, this.emails); + firePropertyChange(PROPERTY_EMAIL_NB, oldValue, newValue); + } + } + public MailFolder getSelectedFolder() { return selectedFolder; } 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-24 12:44:23 UTC (rev 43) @@ -30,7 +30,7 @@ _selectOnFocus: { true }; } -JTextField, JXTable, BeanFilterableComboBox, #messageField, ButtonAttachment { +JTextField, JXTable, BeanFilterableComboBox, #commentField, ButtonAttachment { editable: { model.isEditable() }; } @@ -74,7 +74,7 @@ } #clientField { - text: {model.getClientCode()}; + text: { model.getClientCode() }; _validatorLabel: { t("faxtomail.demande.clientCode.label") }; } @@ -142,11 +142,15 @@ _validatorLabel: { t("faxtomail.demande.companyReference.label") }; } -#messageLabel { - text: "faxtomail.demande.message.label"; +#commentLabel { + text: "faxtomail.demande.comment.label"; verticalAlignment: { SwingConstants.TOP }; } +#commentField { + text: { model.getComment() }; +} + #mailBodyLabel { text: "faxtomail.demande.mailBody.label"; verticalAlignment: { SwingConstants.TOP }; 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-24 12:44:23 UTC (rev 43) @@ -278,12 +278,12 @@ </JScrollPane> </JPanel> <JPanel layout="{new BorderLayout()}"> - <JLabel id='messageLabel' + <JLabel id='commentLabel' constraints="BorderLayout.NORTH"/> - <JScrollPane id='messagePane' + <JScrollPane id='commentPane' constraints="BorderLayout.CENTER"> - <JEditorPane id='messageField' - onKeyReleased='handler.setText(event, "message")'/> + <JEditorPane id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> </JScrollPane> </JPanel> </JSplitPane> 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-04-24 12:44:23 UTC (rev 43) @@ -130,8 +130,8 @@ DemandType newType = (DemandType) evt.getNewValue(); DemandType oldType = (DemandType) evt.getOldValue(); - if (oldType == null || - newType != null && !Objects.equals(oldType.getRangeNeeded(), newType.getRangeNeeded())) { + if (newType != null && (oldType == null + || !Objects.equals(oldType.getRangeNeeded(), newType.getRangeNeeded()))) { JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel(); if (Boolean.TRUE.equals(newType.getRangeNeeded())) { 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-24 12:44:23 UTC (rev 43) @@ -87,6 +87,10 @@ protected int savNb; + protected String clientCode; + + protected String clientBrand; + protected boolean editable = true; protected static Binder<DemandeUIModel, Email> toBeanBinder = @@ -212,19 +216,17 @@ public void setClientCode(String clientCode) { Object oldValue = getClientCode(); - Client client = editObject.getClient(); - if (client != null) { - client.setCode(clientCode); - firePropertyChanged(PROPERTY_CLIENT_CODE, oldValue, clientCode); - - } else { - firePropertyChanged(PROPERTY_CLIENT_CODE, oldValue, null); - } + this.clientCode = clientCode; + firePropertyChanged(PROPERTY_CLIENT_CODE, oldValue, clientCode); } public void setClient(Client client) { Object oldValue = getClient(); editObject.setClient(client); + if (client != null) { + this.clientCode = client.getCode(); + this.clientBrand = client.getBrand(); + } firePropertyChanged(Email.PROPERTY_CLIENT, oldValue, client); } @@ -233,25 +235,17 @@ } public String getClientCode() { - Client client = editObject.getClient(); - return client != null ? client.getCode() : null; + return clientCode; } public void setClientBrand(String clientBrand) { Object oldValue = getClientBrand(); - Client client = editObject.getClient(); - if (client != null) { - client.setBrand(clientBrand); - firePropertyChanged(PROPERTY_CLIENT_BRAND, oldValue, clientBrand); - - } else { - firePropertyChanged(PROPERTY_CLIENT_BRAND, oldValue, null); - } + this.clientBrand = clientBrand; + firePropertyChanged(PROPERTY_CLIENT_BRAND, oldValue, clientBrand); } public String getClientBrand() { - Client client = editObject.getClient(); - return client != null ? client.getBrand() : null; + return clientBrand; } public void setEtatAttente(EtatAttente etatAttente) { @@ -380,8 +374,7 @@ Collection<History> histories = getHistory(); if (histories != null) { for (History history : histories) { - if (HistoryType.MODIFICATION.equals(history.getType()) - || HistoryType.CREATION.equals(history.getType())) { + if (history.getType().isConsideredAsModification()) { if (date == null || date.before(history.getModificationDate())) { date = history.getModificationDate(); result = history; @@ -589,6 +582,16 @@ firePropertyChange(PROPERTY_EDITABLE, oldValue, editable); } + public void setComment(String comment) { + Object oldValue = getComment(); + editObject.setComment(comment); + firePropertyChange(Email.PROPERTY_COMMENT, oldValue, editable); + } + + public String getComment() { + return editObject.getComment(); + } + public void setGroupedDemandes(EmailGroup emailGroup) { Object oldValue = new ArrayList<DemandeUIModel>(getGroupedDemandes()); if (emailGroup != null) { Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-24 12:44:23 UTC (rev 43) @@ -161,7 +161,7 @@ } // FaxToMailUIContext context = getContext(); -// context.setCurrentEmail(demande); +// context.setCurrentEmails(demande); // context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler())); } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-04-24 12:44:23 UTC (rev 43) @@ -23,6 +23,8 @@ import java.util.HashSet; import java.util.Map; +import static org.nuiton.i18n.I18n.t; + /** * @author Kevin Morin (Code Lutin) * @since x.x @@ -39,8 +41,11 @@ DemandeUIModel model = getModel(); JPanel attachmentPanel = ui.getAttachmentPanel(); + JCheckBox checkBox = new JCheckBox(t("faxtomail.chooseMailFolder.element"), false); + attachmentPanel.add(checkBox); + for (Attachment attachment : model.getAttachment()) { - JCheckBox checkBox = new JCheckBox(attachment.getOriginalFile().getName(), true); + checkBox = new JCheckBox(attachment.getOriginalFile().getName(), true); attachmentPanel.add(checkBox); } } 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-04-24 12:44:23 UTC (rev 43) @@ -55,6 +55,7 @@ faxtomail.chooseAttachmentToPrint.action.validate= faxtomail.chooseAttachmentToPrint.action.validate.tip= faxtomail.chooseAttachmentToPrint.message= +faxtomail.chooseAttachmentToPrint.title= faxtomail.chooseMailFolder.action.cancel= faxtomail.chooseMailFolder.action.cancel.mnemonic= faxtomail.chooseMailFolder.action.cancel.tip= @@ -135,6 +136,7 @@ faxtomail.demande.client.label= faxtomail.demande.clientBrand.label= faxtomail.demande.clientCode.label= +faxtomail.demande.comment.label= faxtomail.demande.companyReference.label= faxtomail.demande.demandStatus.label= faxtomail.demande.demandType.label= 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-04-23 13:04:58 UTC (rev 42) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-24 12:44:23 UTC (rev 43) @@ -37,10 +37,12 @@ faxtomail.chooseAttachmentToPrint.action.validate=Valider faxtomail.chooseAttachmentToPrint.action.validate.tip=Valider et imprimer les pièces-jointes faxtomail.chooseAttachmentToPrint.message=Choisissez les pièces-jointes à imprimer \: +faxtomail.chooseAttachmentToPrint.title=Pièces-jointes à imprimer faxtomail.chooseMailFolder.action.cancel=Annuler faxtomail.chooseMailFolder.action.cancel.tip=Annuler et fermer la popup faxtomail.chooseMailFolder.action.validate=Valider faxtomail.chooseMailFolder.action.validate.tip=Valider et transférer l'élément +faxtomail.chooseMailFolder.element=Détails de l'élément faxtomail.chooseMailFolder.message=Choisissez le dossier où transférer l'élément \: faxtomail.chooseMailFolder.title=Dossier de destination faxtomail.common.by.label=par @@ -64,6 +66,7 @@ faxtomail.demande.client.label=Code client faxtomail.demande.clientBrand.label=Marque faxtomail.demande.clientCode.label=Client +faxtomail.demande.comment.label=Message faxtomail.demande.companyReference.label=Notre référence faxtomail.demande.demandStatus.label=Statut faxtomail.demande.demandType.label=Type @@ -78,7 +81,6 @@ faxtomail.demande.lastModified.label=Dernière modification faxtomail.demande.mailBody.label=Corps du mail faxtomail.demande.mailFolder.label=Dossier -faxtomail.demande.message.label=Message faxtomail.demande.print.button.label=Imprimer faxtomail.demande.priority.label=Priorité faxtomail.demande.projectReference.label=Référence chantier
participants (1)
-
kmorin@users.forge.codelutin.com