Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
July 2014
- 3 participants
- 155 discussions
01 Jul '14
Author: echatellier
Date: 2014-07-01 17:06:25 +0200 (Tue, 01 Jul 2014)
New Revision: 306
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/306
Log:
Clean dead code.
Clean i18n files.
Fix send mail with xfce.
Modified:
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/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx
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/attachment/ButtonAttachment.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java
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/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
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-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -97,7 +97,6 @@
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -54,10 +54,7 @@
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfAction;
import com.itextpdf.text.pdf.PdfContentByte;
-import com.itextpdf.text.pdf.PdfDictionary;
import com.itextpdf.text.pdf.PdfGState;
-import com.itextpdf.text.pdf.PdfName;
-import com.itextpdf.text.pdf.PdfNumber;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 2014-07-01 15:06:25 UTC (rev 306)
@@ -55,17 +55,6 @@
<JMenuItem id='menuFileExit' onActionPerformed="this.dispose()"/>
</JMenu>
- <!--<JMenu id='menuHelp'>-->
- <!--<JMenuItem id='menuShowHelp'-->
- <!--onActionPerformed="handler.showHelp()"/>-->
- <!--<JMenuItem id='menuHelpSite'-->
- <!--onActionPerformed='handler.gotoSite()'/>-->
- <!--<JMenuItem id='menuHelpAbout'/>-->
- <!--<JMenu id='menuChangeLocale'>-->
- <!--<JMenuItem id='menuChangeLocaleUK'/>-->
- <!--<JMenuItem id='menuChangeLocaleFR'/>-->
- <!--</JMenu>-->
- <!--</JMenu>-->
</JMenuBar>
<JToolBar id='bottomBar'>
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-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -25,7 +25,6 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.RunFaxToMail;
-import com.franciaflex.faxtomail.ui.swing.content.config.FaxToMailConfigUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI;
import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI;
@@ -142,13 +141,6 @@
}
});
- // installation layer de blocage en mode busy
-// SwingUtil.setLayerUI(ui.getBody(), ui.getBusyBlockLayerUI());
-//
- //FIXME-TC See why this binding is not setted ?
-// ui.applyDataBinding(MainUI.BINDING_MENU_CHANGE_LOCALE_FR_ENABLED);
-// ui.applyDataBinding(MainUI.BINDING_MENU_CHANGE_LOCALE_UK_ENABLED);
-
// Init SwingSession
SwingSession swingSession = getContext().getSwingSession();
swingSession.add(ui);
@@ -239,34 +231,16 @@
public void changeLocale(Locale locale) {
-// // change locale (and save configuration)
+ // change locale (and save configuration)
getModel().setLocale(locale);
-//
-// // change i18n locale
+
+ // change i18n locale
I18n.setDefaultLocale(getConfig().getI18nLocale());
-//
-// // reload decorator service (TODO Check if this is necessary)
-// getContext().reloadDecoratorService();
-//
-// // close reload
+
+ // close reload
reloadUI();
}
-// public void gotoSite() {
-// FaxToMailApplicationConfig config = context.getConfig();
-//
-// URL siteURL = config.getSiteUrl();
-//
-// if (log.isDebugEnabled()) {
-// log.debug("goto " + siteURL);
-// }
-// TuttiUIUtil.openLink(siteURL);
-// }
-
-// public void showHelp() {
-// getModel().showHelp(ui, ui.getBroker(), null);
-// }
-
@Override
public final void showInformationMessage(String message) {
ui.getStatus().setStatus("<html><body>" + message + "</body></html>");
@@ -368,16 +342,6 @@
break;
}
-// JButton showHelp = ui.getShowHelp();
-// if (rightDecoration == null) {
-// rightDecoration = new JToolBar();
-// rightDecoration.setFloatable(false);
-// rightDecoration.setOpaque(false);
-// rightDecoration.setBorderPainted(false);
-// } else {
-// rightDecoration.remove(showHelp);
-// }
-// rightDecoration.add(showHelp, 0);
this.currentBody = screenUI;
getContext().getSwingSession().add(currentBody, true);
ui.getBody().setTitle(screenTitle);
@@ -391,75 +355,10 @@
public void changeTitle() {
- String title = getTitle();
-
ui.setTitle(t("faxtomail.main.title.application",
- getConfig().getVersion(),
-// "0.1",
- title));
+ getConfig().getVersion()));
}
- protected String getTitle() {
-
-
- String title;
-
-// if (context.isDbLoaded()) {
-//
-// if (context.isProgramFilled()) {
-//
-// // selected program
-//
-// Program program = getDataContext().getProgram();
-//
-// title = _("tutti.main.title.selectedProgram", program.getName()) + " / ";
-//
-// if (context.isCruiseFilled()) {
-//
-// // selected cruise
-// Cruise cruise = getDataContext().getCruise();
-//
-// if (cruise != null) {
-// title += _("tutti.main.title.selectedCruise", cruise.getName());
-// }
-// } else {
-//
-// // no selected cruise
-//
-// title += _("tutti.main.title.noSelectedCruise");
-// }
-//
-// } else {
-//
-// // no program selected (so neither cruise)
-//
-// title = _("tutti.main.title.noSelectedProgram");
-//
-// }
-//
-// title += " / ";
-//
-// if (context.isProtocolFilled()) {
-//
-// // selected protocol
-// TuttiProtocol protocol = getDataContext().getProtocol();
-//
-// title += _("tutti.main.title.selectedProtocol", protocol.getName());
-// } else {
-//
-// // no selected protocol
-//
-// title += _("tutti.main.title.noSelectedProtocol");
-// }
-// } else {
-
- // no db loaded
-
- title = t("faxtomail.main.title.nodb");
-// }
- return title;
- }
-
public void setBodyTitle(String title) {
ui.getBody().setTitle(title);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -35,6 +35,7 @@
import java.util.List;
import static org.nuiton.i18n.I18n.t;
+import static org.nuiton.i18n.I18n.n;
/**
* Button to edit attachments.
@@ -68,7 +69,7 @@
};
public ButtonAttachment(AttachmentModelAware model) {
- this("faxtomail.attachmentEditor.text", model);
+ this(n("faxtomail.attachmentEditor.text"), model);
}
public ButtonAttachment(String textKey, AttachmentModelAware model) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -126,7 +126,7 @@
}
historyAsString.append("\n");
}
- FaxToMailUIUtil.mail(t("faxtomail.demande.history.send.subject", getModel().getTitle()), historyAsString.toString());
+ FaxToMailUIUtil.email(t("faxtomail.demande.history.send.subject", getModel().getTitle()), historyAsString.toString());
}
};
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -36,6 +36,7 @@
import java.util.Collection;
import static org.nuiton.i18n.I18n.t;
+import static org.nuiton.i18n.I18n.n;
/**
* Button to edit attachments.
@@ -56,7 +57,7 @@
};
public ButtonDemandReplies(DemandeUIModel model) {
- this("faxtomail.demandReplies.text", model);
+ this(n("faxtomail.demandReplies.text"), model);
}
public ButtonDemandReplies(String textKey, DemandeUIModel model) {
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-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -54,9 +54,6 @@
private static final Log log = LogFactory.getLog(AttachmentToPrintChooserUIHandler.class);
-
-
-
@Override
public void afterInit(AttachmentToPrintChooserUI attachmentToPrintChooserUI) {
initUI(attachmentToPrintChooserUI);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -197,9 +197,7 @@
}
public void setValid(boolean valid) {
- log.info("set valid " + valid);
Object oldValue = isValid();
- log.info("oldValue " + oldValue);
this.valid = valid;
firePropertyChange(PROPERTY_VALID, oldValue, valid);
}
@@ -207,9 +205,13 @@
// Do not remove the unused parameter, it is just for the validation
// to bind the totalAttachmentLength property
public boolean isAttachmentSizeValid(long totalAttachmentLength) {
- log.info(this.totalAttachmentLength + ", " + maxAttachmentLength + ", " + (this.totalAttachmentLength < maxAttachmentLength));
+ if (log.isDebugEnabled()) {
+ log.debug(this.totalAttachmentLength + ", " + maxAttachmentLength + ", " + (this.totalAttachmentLength < maxAttachmentLength));
+ }
boolean valid = maxAttachmentLength == 0 || this.totalAttachmentLength < maxAttachmentLength;
- log.info(valid);
+ if (log.isDebugEnabled()) {
+ log.debug(valid);
+ }
return valid;
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-07-01 15:06:25 UTC (rev 306)
@@ -31,6 +31,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -64,6 +65,7 @@
import javax.swing.tree.TreePath;
import com.google.common.collect.Lists;
+
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXUtil;
@@ -488,4 +490,23 @@
DesktopUtil.open(file);
}
}
+
+ /**
+ * Send email.
+ *
+ * @param subject
+ * @param body
+ */
+ public static void email(String subject, String body) {
+
+ try {
+ URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null);
+ DesktopUtil.mail(mailtoURI);
+
+ } catch (Exception e) {
+
+ throw new ApplicationTechnicalException(
+ t("jaxx.application.error.cannot.mail"), e);
+ }
+ }
}
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-07-01 14:08:48 UTC (rev 305)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-07-01 15:06:25 UTC (rev 306)
@@ -8,13 +8,6 @@
faxtomail.action.attachment.edit.tip=Edition du fichier %s
faxtomail.action.attachment.open.tip=Ouverture du fichier %s
faxtomail.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme
-faxtomail.action.configuration=Configuration
-faxtomail.action.configuration.mnemonic=
-faxtomail.action.configuration.tip=Menu configuration
-faxtomail.action.demandeList=Gestion des fax
-faxtomail.action.demandeList.tip=Gestion des fax
-faxtomail.action.exit=Quitter
-faxtomail.action.exit.tip=Quitter l'application
faxtomail.action.generateAnnotatedAttachment.tip=Générer le pdf annoté
faxtomail.action.goto.demand.tip=Aller au détail de l'élément
faxtomail.action.goto.demandList.tip=Aller à la liste des éléments
@@ -30,9 +23,6 @@
faxtomail.action.transmit.tip=Déplacer l'élément
faxtomail.alert.alreadyLockedBy.message=L'élément est déjà vérrouillé par %s, vous ne pouvez pas l'ouvrir.
faxtomail.alert.alreadyLockedBy.title=Document déjà vérrouillé
-faxtomail.alert.alreadyTakenBy.button.quit=Quitter
-faxtomail.alert.alreadyTakenBy.button.take=Prendre
-faxtomail.alert.alreadyTakenBy.button.view=Visualiser
faxtomail.alert.alreadyTakenBy.help=Voulez-vous le prendre ?<ul><li><strong>Annuler</strong> pour ne retourner à la liste</li><li><strong>Non</strong> pour visualiser l'élément en lecture seule</li><li><strong>Oui</strong> pour le prendre</li></ul>
faxtomail.alert.alreadyTakenBy.message=L'élément est déjà pris par %s.
faxtomail.alert.alreadyTakenBy.title=Document déjà pris
@@ -47,18 +37,12 @@
faxtomail.attachmentEditor.action.edit.tip=Editer la pièce jointe
faxtomail.attachmentEditor.action.open.tip=Ouvrir la pièce jointe
faxtomail.attachmentEditor.action.remove.tip=Supprimer la pièce jointe
-faxtomail.attachmentEditor.action.save.tip=Enregistrer la pièce jointe en local
faxtomail.attachmentEditor.action.tip=Pièces jointes
faxtomail.attachmentEditor.attachments.empty=Aucune pièce jointe
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.fileNotFound=Le fichier %s de la pièce jointe n'a pas été trouvé
faxtomail.attachmentEditor.none.tip=Aucune pièce-jointe
-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.chooseAttachmentToPrint.action.cancel=Annuler
@@ -77,11 +61,8 @@
faxtomail.common.by.label=par
faxtomail.common.none.label=Sans
faxtomail.common.on.label=le
-faxtomail.config.application=
-faxtomail.config.title=
faxtomail.demand.title=Détail
faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant
-faxtomail.demandGroup.empty=Aucune demande groupée
faxtomail.demandGroup.text=Groupe (%s)
faxtomail.demandGroup.title=Groupe
faxtomail.demandReplies.action.open.tip=Visualiser la réponse
@@ -102,7 +83,6 @@
faxtomail.demande.client.label=Code client
faxtomail.demande.clientBrand.label=Marque
faxtomail.demande.clientCode.label=Client
-faxtomail.demande.commandNumber.label=Numéro de commande
faxtomail.demande.comment.label=Message
faxtomail.demande.companyReference.label=Notre référence
faxtomail.demande.demandStatus.label=Statut
@@ -121,7 +101,6 @@
faxtomail.demande.lastAttachmentOpening.label=Dernière ouverture de pièce-jointe
faxtomail.demande.lastModified.label=Dernière modification
faxtomail.demande.localReference.label=Référence
-faxtomail.demande.mailBody.label=Corps du mail
faxtomail.demande.mailFolder.label=Dossier
faxtomail.demande.object.label=Objet
faxtomail.demande.print.button.label=Imprimer
@@ -147,8 +126,6 @@
faxtomail.demande.transmit.button.label=Déplacer
faxtomail.demandeList.action.archive=Archiver
faxtomail.demandeList.action.archive.tip=Archiver l'élément
-faxtomail.demandeList.action.attachment=Ajouter une pièce-jointe
-faxtomail.demandeList.action.attachment.tip=Ajouter une pièce-jointe
faxtomail.demandeList.action.computeQuantitiesByRange=Calculer les quantités par gamme
faxtomail.demandeList.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme
faxtomail.demandeList.action.newDemand=Créer une nouvelle demande
@@ -213,24 +190,16 @@
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
-faxtomail.main.action.configuration.mnemonic=
-faxtomail.main.action.configuration.tip=Menu configuration
faxtomail.main.action.demandeList=Gestion des fax
faxtomail.main.action.demandeList.tip=Gestion des fax
faxtomail.main.action.exit=Quitter
faxtomail.main.action.exit.tip=Quitter l'application
-faxtomail.main.action.goto.previousScreen.tip=
faxtomail.main.action.recherche=Recherche
faxtomail.main.action.recherche.tip=Recherche de demandes archivées
-faxtomail.main.action.reloadFaxToMail=
faxtomail.main.menu.file=Fichier
faxtomail.main.menu.file.tip=Menu fichier
faxtomail.main.title.application=FaxToMail
faxtomail.main.title.applicationName=FaxToMail
-faxtomail.main.title.nodb=
faxtomail.pdfEditor.action.cancel=Annuler
faxtomail.pdfEditor.action.cancel.tip=Ne pas enregistrer les changements et fermer
faxtomail.pdfEditor.action.validate=Enregistrer
@@ -300,16 +269,8 @@
faxtomail.validator.error.email.priority.required=
faxtomail.validator.error.email.projectReference.required=Référence chantier requise
faxtomail.validator.error.email.rangeRow.required=Tableau des gammes requis
-faxtomail.validator.error.reply.from.email=
-faxtomail.validator.error.reply.from.invalidDomain=
-faxtomail.validator.error.reply.from.required=
-faxtomail.validator.error.reply.to.email=
-faxtomail.validator.error.reply.to.required=
-faxtomail.validator.error.reply.totalAttachmentLength.required=
jaxx.application.error.cannot.print=
jaxx.application.error.desktop.not.supported=
jaxx.application.error.desktop.print.not.supported=
jaxx.application.error.noPrinter=
swing.error.cannot.copy.file=
-swing.error.cannot.open.file=
-test=
1
0
r305 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job
by echatellier@users.forge.codelutin.com 01 Jul '14
by echatellier@users.forge.codelutin.com 01 Jul '14
01 Jul '14
Author: echatellier
Date: 2014-07-01 16:08:48 +0200 (Tue, 01 Jul 2014)
New Revision: 305
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/305
Log:
Add try/catch (error) if html content can't converted to image
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-07-01 13:42:59 UTC (rev 304)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-07-01 14:08:48 UTC (rev 305)
@@ -25,6 +25,7 @@
*/
import static org.nuiton.i18n.I18n.t;
+import gui.ava.html.image.generator.HtmlImageGenerator;
import java.io.File;
import java.io.FileInputStream;
@@ -58,16 +59,6 @@
import javax.mail.internet.MimeUtility;
import javax.xml.parsers.ParserConfigurationException;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.MailFilter;
-
-import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
-import com.itextpdf.text.Document;
-import com.itextpdf.text.DocumentException;
-import com.itextpdf.text.PageSize;
-import com.itextpdf.text.Paragraph;
-import com.itextpdf.text.pdf.PdfWriter;
-import gui.ava.html.image.generator.HtmlImageGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
@@ -79,6 +70,7 @@
import org.nuiton.util.StringUtil;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
+import org.xml.sax.SAXException;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
@@ -90,14 +82,21 @@
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.services.DecoratorService;
import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
import com.franciaflex.faxtomail.services.service.ClientService;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
-import org.xml.sax.SAXException;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfWriter;
/**
* @author Kevin Morin (Code Lutin)
@@ -221,7 +220,7 @@
List<String> modifiedProperties = new ArrayList<>();
- if (log.isDebugEnabled()){
+ if (log.isDebugEnabled()) {
log.debug("Object: " + message.getSubject());
}
@@ -243,7 +242,7 @@
String recipient = address.toString();
- // some reciepient are like "toto tutu<toto.tutu73(a)gmail.com>"
+ // some recipient are like "toto tutu<toto.tutu73(a)gmail.com>"
// the regex is to extract email address from it
recipient = recipient.replaceFirst("^.*<(.*)>$", "$1");
recipient = recipient.toLowerCase();
@@ -377,8 +376,13 @@
if (message.isMimeType("multipart/*")) {
String htmlContent = decomposeMultipartEmail(attachments, message, email, emailService);
if (htmlContent != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Converting html content to pdf : " + message.getSubject());
+ }
Attachment attachment = convertHTMLToPdf(attachments, htmlContent, t("faxtomail.email.content.attachment.fileName"));
- attachments.add(attachment);
+ if (attachment != null) {
+ attachments.add(attachment);
+ }
}
} else {
@@ -537,7 +541,7 @@
/**
* Convert attachment to pdf.
*
- * @param attachment attchment to convert
+ * @param attachment attachment to convert
* @param extensionCommand command
* @return
* @throws IOException
@@ -594,13 +598,13 @@
}
// cleanup
- //file.delete();
- //outfile.delete();
+ file.delete();
+ outfile.delete();
return attachment;
}
- public Attachment convertTextToPdf(String content, String name) throws IOException, DocumentException {
+ protected Attachment convertTextToPdf(String content, String name) throws IOException, DocumentException {
File target = File.createTempFile("faxtomail-", ".tmp");
target.deleteOnExit();
@@ -626,52 +630,73 @@
attachment.setOriginalFile(attachmentFileNew);
attachment.setOriginalFileName(name);
attachment.setAddedByUser(false);
+
+ target.delete();
return attachment;
}
- public Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException, ParserConfigurationException, SAXException, DocumentException {
+ /**
+ * Convert html content to image.
+ *
+ * @param attachments attachment content to link content to
+ * @param content html content
+ * @param name result attachment name
+ * @return image attachment or {@code null} if content can't be converted
+ * @throws IOException
+ */
+ protected Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException {
File target = File.createTempFile("faxtomail-", ".png");
target.deleteOnExit();
- content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
- for (Attachment attachment : attachments) {
- String key = attachment.getContentId();
- if (key == null) {
- key = attachment.getOriginalFileName();
+ Attachment result = null;
+ try {
+ content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
+ for (Attachment attachment : attachments) {
+ String key = attachment.getContentId();
+ if (key == null) {
+ key = attachment.getOriginalFileName();
+ }
+
+ // get file content
+ AttachmentFile attachmentFile = attachment.getOriginalFile();
+ File file = attachmentFile.getFile();
+
+ // replace the inline attachments with the extracted attachment file url
+ // match les patterns:
+ // <td background="cid:bg.gif" height="52">
+ // <img border=0 src="cid:bg.gif" />
+ // <img src='cid:5e9ef859-ea65-4f9b-a9fa-30d4a2c5837c'
+ content = content.replaceAll("(\\w+)=([\"'])cid:" + Pattern.quote(key) + "([\"'])", "$1=$2file://" + file.getAbsolutePath() + "$3");
+
+ if (log.isDebugEnabled()) {
+ log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath());
+ }
}
-
- // get file content
- AttachmentFile attachmentFile = attachment.getOriginalFile();
- File file = attachmentFile.getFile();
-
- // replace the inline attachments with the extracted attachment file url
- // match les patterns:
- // <td background="cid:bg.gif" height="52">
- // <img border=0 src="cid:bg.gif" />
- // <img src='cid:5e9ef859-ea65-4f9b-a9fa-30d4a2c5837c'
- content = content.replaceAll("(\\w+)=([\"'])cid:" + Pattern.quote(key) + "([\"'])", "$1=$2file://" + file.getAbsolutePath() + "$3");
-
- if (log.isDebugEnabled()) {
- log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath());
+
+ HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
+ imageGenerator.loadHtml(content);
+ imageGenerator.saveAsImage(target);
+
+ // convert content to blob
+ EmailService emailService = serviceContext.newService(EmailService.class);
+ AttachmentFile attachmentFileNew = emailService.getAttachmentFileFromStream(new FileInputStream(target));
+ attachmentFileNew.setFilename(name + ".png");
+
+ result = new AttachmentImpl();
+ result.setOriginalFile(attachmentFileNew);
+ result.setOriginalFileName(name);
+ result.setAddedByUser(false);
+ } catch (OutOfMemoryError er) {
+ // certains mails (spam) très compliqué ne peuvent pas être convertit en images
+ if (log.isWarnEnabled()) {
+ log.warn("Can't convert html content to image", er);
}
}
- HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
- imageGenerator.loadHtml(content);
- imageGenerator.saveAsImage(target);
+ target.delete();
- // convert content to blob
- EmailService emailService = serviceContext.newService(EmailService.class);
- AttachmentFile attachmentFileNew = emailService.getAttachmentFileFromStream(new FileInputStream(target));
- attachmentFileNew.setFilename(name + ".png");
-
- Attachment attachment = new AttachmentImpl();
- attachment.setOriginalFile(attachmentFileNew);
- attachment.setOriginalFileName(name);
- attachment.setAddedByUser(false);
-
- return attachment;
+ return result;
}
}
1
0
r304 - trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities
by echatellier@users.forge.codelutin.com 01 Jul '14
by echatellier@users.forge.codelutin.com 01 Jul '14
01 Jul '14
Author: echatellier
Date: 2014-07-01 15:42:59 +0200 (Tue, 01 Jul 2014)
New Revision: 304
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/304
Log:
Fix debug message
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-07-01 13:09:57 UTC (rev 303)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-07-01 13:42:59 UTC (rev 304)
@@ -102,7 +102,7 @@
@Override
protected void finalize() throws Throwable {
try {
- if (tmpLocalFile != null) {
+ if (tmpLocalFile != null && tmpLocalFile.exists()) {
if (log.isDebugEnabled()) {
log.debug(String.format("Deleting file : %s", tmpLocalFile.getAbsolutePath()));
}
1
0
01 Jul '14
Author: echatellier
Date: 2014-07-01 15:09:57 +0200 (Tue, 01 Jul 2014)
New Revision: 303
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/303
Log:
V?\195?\169rrouillage des mails ?\195?\160 l'ouverture
Modified:
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/FaxToMailUIContext.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/SaveAndOpenDialogAction.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/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/demandgroup/DemandGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -48,6 +48,7 @@
import javax.mail.MessagingException;
import com.franciaflex.faxtomail.persistence.entities.Range;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.io.IOUtils;
@@ -463,6 +464,13 @@
return email;
}
+ /**
+ * Take email (takenBy).
+ *
+ * @param emailId
+ * @param user
+ * @return
+ */
public Email takeEmail(String emailId, FaxToMailUser user) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
Email email = emailDao.findByTopiaId(emailId);
@@ -481,6 +489,48 @@
}
/**
+ * Vérrouille une demande par un utilisateur empechant les autres de l'ouvrir.
+ *
+ * @param emailId topiaId de la demande à vérouiller
+ * @param currentUser user
+ * @return email
+ */
+ public Email lockEmail(String emailId, FaxToMailUser currentUser) {
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ Email email = emailDao.findByTopiaId(emailId);
+ email.setLockedBy(currentUser);
+ email = emailDao.update(email);
+ getPersistenceContext().commit();
+ if (log.isDebugEnabled()) {
+ log.debug("[LOCK] " + emailId + " locked by " + currentUser.getFirstName() + " " + currentUser.getLastName());
+ }
+
+ // TODO echatellier : les utilisateurs peuvent avoir plusieurs verrous actif dans le
+ // cas des interfaces à onglet et des demandes groupé
+ // on pourrait peut-etre supprimer automatiquement les locks sur les autres demande
+ // si elle ne sont pas groupées
+ return email;
+ }
+
+ /**
+ * Dévérrouille une demande.
+ *
+ * @param emailId topiaId de la demande à devérouiller
+ * @return email
+ */
+ public Email unlockEmail(String emailId) {
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ Email email = emailDao.findByTopiaId(emailId);
+ email.setLockedBy(null);
+ email = emailDao.update(email);
+ getPersistenceContext().commit();
+ if (log.isDebugEnabled()) {
+ log.debug("[UNLOCK] " + emailId + " unlocked ");
+ }
+ return email;
+ }
+
+ /**
* Calcule recursivement l'ensemble des répertoires lisible par un utilisateur récursivement.
*
* @param readMailFolders result mail folders
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -55,7 +55,6 @@
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.jaxx.application.ApplicationConfiguration;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.jaxx.application.swing.ApplicationUIContext;
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -29,13 +29,10 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import javax.swing.*;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
import static org.nuiton.i18n.I18n.t;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenDialogAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenDialogAction.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenDialogAction.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -24,8 +24,6 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI;
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -28,6 +28,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.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
@@ -50,11 +51,32 @@
}
@Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ if (result) {
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ FaxToMailUser lockedByUser = currentEmail.getLockedBy();
+ FaxToMailUser currentUser = getContext().getCurrentUser();
+
+ if (lockedByUser != null && !lockedByUser.equals(currentUser)) {
+ String htmlMessage = t("faxtomail.alert.alreadyLockedBy.message", decorate(lockedByUser));
+ JOptionPane.showMessageDialog(getHandler().getTopestUI(),
+ htmlMessage,
+ t("faxtomail.alert.alreadyLockedBy.title"),
+ JOptionPane.ERROR_MESSAGE);
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ @Override
public void doAction() throws Exception {
super.doAction();
DemandeUIModel currentEmail = getContext().getCurrentEmail();
- if (StringUtils.isNoneBlank(currentEmail.getTopiaId())) {
+ if (StringUtils.isNotBlank(currentEmail.getTopiaId())) {
Email email = getContext().getEmailService().getEmailById(currentEmail.getTopiaId());
currentEmail.setGroupedDemandes(email.getEmailGroup());
}
@@ -76,10 +98,9 @@
currentUser.getUserGroups()).isEmpty();
folder = folder.getParent();
}
-
+
if (currentEmail.getArchiveDate() != null || !canWrite) {
currentEmail.setEditable(false);
-
} else if (takenBy != null && !currentUser.equals(takenBy)) {
String htmlMessage = String.format(
AbstractApplicationUIHandler.CONFIRMATION_FORMAT,
@@ -108,5 +129,8 @@
break;
}
}
+
+ // au final, on a ouvert la demande, on peut locker la demande
+ getContext().getEmailService().lockEmail(currentEmail.getTopiaId(), currentUser);
}
}
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -37,8 +37,11 @@
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
+
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,6 +63,7 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellEditor;
+
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@@ -405,6 +409,7 @@
if (log.isDebugEnabled()) {
log.debug("closing: " + ui);
}
+
clearValidators();
}
@@ -424,6 +429,13 @@
t("faxtomail.demande.askSaveBeforeLeaving.save"),
getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class)
);
+
+ // mettre ca ici et non dans le close, car pour un onglet, le close n'est pas appelé
+ if (result) {
+ Email email = getContext().getEmailService().unlockEmail(getModel().getTopiaId());
+ getModel().fromEntity(email);
+ }
+
return result;
}
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -385,6 +385,16 @@
return editObject.getTakenBy();
}
+ public FaxToMailUser getLockedBy() {
+ return editObject.getLockedBy();
+ }
+
+ public void setLockedBy(FaxToMailUser faxToMailUser) {
+ Object oldValue = getLockedBy();
+ editObject.setLockedBy(faxToMailUser);
+ firePropertyChanged(Email.PROPERTY_LOCKED_BY, oldValue, faxToMailUser);
+ }
+
public Priority getPriority() {
return editObject.getPriority();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -32,7 +32,9 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
import com.google.common.collect.Iterables;
+
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -49,6 +51,7 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
+
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -155,42 +158,55 @@
FaxToMailUser takenBy = demande.getTakenBy();
FaxToMailUser currentUser = getContext().getCurrentUser();
+ FaxToMailUser lockedByUser = demande.getLockedBy();
//TODO kmorin 20140512 put this in an action
- if (demande.getArchiveDate() != null) {
- demande.setEditable(false);
+ if (lockedByUser != null && !lockedByUser.equals(currentUser)) {
+ String htmlMessage = t("faxtomail.alert.alreadyLockedBy.message", decorate(lockedByUser));
+ JOptionPane.showMessageDialog(getTopestUI(),
+ htmlMessage,
+ t("faxtomail.alert.alreadyLockedBy.title"),
+ JOptionPane.ERROR_MESSAGE);
- } else if (takenBy != null && !currentUser.equals(takenBy)) {
- String htmlMessage = String.format(
- AbstractApplicationUIHandler.CONFIRMATION_FORMAT,
- t("faxtomail.alert.alreadyTakenBy.message", decorate(takenBy)),
- t("faxtomail.alert.alreadyTakenBy.help"));
+ } else {
+ if (demande.getArchiveDate() != null) {
+ demande.setEditable(false);
+
+ } else if (takenBy != null && !currentUser.equals(takenBy)) {
+ String htmlMessage = String.format(
+ AbstractApplicationUIHandler.CONFIRMATION_FORMAT,
+ t("faxtomail.alert.alreadyTakenBy.message", decorate(takenBy)),
+ t("faxtomail.alert.alreadyTakenBy.help"));
+
+ int result = JOptionPane.showConfirmDialog(getTopestUI(),
+ htmlMessage,
+ t("faxtomail.alert.alreadyTakenBy.title"),
+ JOptionPane.YES_NO_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ switch (result) {
+ case JOptionPane.CANCEL_OPTION:
+ return;
+
+ case JOptionPane.NO_OPTION:
+ demande.setEditable(false);
+ break;
+
+ case JOptionPane.YES_OPTION:
+ Email email = getContext().getEmailService().takeEmail(demande.getTopiaId(), currentUser);
+ demande.fromEntity(email);
+ demande.setEditable(true);
+ break;
+ }
+ }
- int result = JOptionPane.showConfirmDialog(getTopestUI(),
- htmlMessage,
- t("faxtomail.alert.alreadyTakenBy.title"),
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- switch (result) {
- case JOptionPane.CANCEL_OPTION:
- return;
-
- case JOptionPane.NO_OPTION:
- demande.setEditable(false);
- break;
-
- case JOptionPane.YES_OPTION:
- Email email = getContext().getEmailService().takeEmail(demande.getTopiaId(), currentUser);
- demande.fromEntity(email);
- demande.setEditable(true);
- break;
- }
+ // au final, on a ouvert la demande, on peut locker la demande
+ getContext().getEmailService().lockEmail(demande.getTopiaId(), currentUser);
+
+ MainUIHandler mainUIHandler = context.getMainUI().getHandler();
+ DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody();
+ parentContainer.getModel().addDemand(demande);
}
-
- MainUIHandler mainUIHandler = context.getMainUI().getHandler();
- DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody();
- parentContainer.getModel().addDemand(demande);
}
protected class DemandGroupItemRenderer extends DemandGroupItem
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -223,7 +223,7 @@
public void searchDemandes() {
getModel().resetPaginationParameter();
try {
- SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
+ SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
searchAction.doAction();
} catch (Exception e) {
@@ -237,7 +237,7 @@
public void goToNextPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage());
try {
- SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
+ SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
searchAction.doAction();
} catch (Exception e) {
@@ -251,7 +251,7 @@
public void goToPreviousPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage());
try {
- SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
+ SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
searchAction.doAction();
} catch (Exception e) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -26,10 +26,8 @@
import com.franciaflex.faxtomail.persistence.entities.EmailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.services.service.ReferentielService;
-import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction;
import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java 2014-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java 2014-07-01 13:09:57 UTC (rev 303)
@@ -77,7 +77,7 @@
}
}
- showErrorDialog(cause.getMessage(), cause);
+ showErrorDialog(cause != null ? cause.getMessage() : "", cause);
if (backToScreen) {
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-07-01 06:34:20 UTC (rev 302)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-07-01 13:09:57 UTC (rev 303)
@@ -28,6 +28,8 @@
faxtomail.action.search.tip=Rechercher
faxtomail.action.start.tip=Démarrer FaxToMail
faxtomail.action.transmit.tip=Déplacer l'élément
+faxtomail.alert.alreadyLockedBy.message=L'élément est déjà vérrouillé par %s, vous ne pouvez pas l'ouvrir.
+faxtomail.alert.alreadyLockedBy.title=Document déjà vérrouillé
faxtomail.alert.alreadyTakenBy.button.quit=Quitter
faxtomail.alert.alreadyTakenBy.button.take=Prendre
faxtomail.alert.alreadyTakenBy.button.view=Visualiser
@@ -114,7 +116,7 @@
faxtomail.demande.gamme.label=Gamme
faxtomail.demande.group.button.label=Grouper
faxtomail.demande.group.successful=Groupement réussi avec l'élément %s
-faxtomail.demande.history.action.send.tip=
+faxtomail.demande.history.action.send.tip=Envoyer l'historique par email
faxtomail.demande.history.send.subject=Historique de %s
faxtomail.demande.lastAttachmentOpening.label=Dernière ouverture de pièce-jointe
faxtomail.demande.lastModified.label=Dernière modification
1
0
01 Jul '14
Author: kmorin
Date: 2014-07-01 08:34:20 +0200 (Tue, 01 Jul 2014)
New Revision: 302
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/302
Log:
- extraction des attributs dans le css
- am?\195?\169lioration du calcul des quantit?\195?\169s par gamme
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
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/ComputeQuantitiesByRangeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx
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/search/SearchToGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -373,4 +373,33 @@
List<Email> results = findAll(query);
return results;
}
+
+ public Map<Range, Long[]> computeQuantitiesByRange(List<MailFolder> folders) {
+ String query = "SELECT range, " +
+ "SUM(rangeRow." + RangeRow.PROPERTY_PRODUCT_QUANTITY + ") AS prodQ, " +
+ "SUM(rangeRow." + RangeRow.PROPERTY_SAV_QUANTITY + ") AS savQ, " +
+ "SUM(rangeRow." + RangeRow.PROPERTY_QUOTATION_QUANTITY + ") AS quotQ " +
+ "FROM " + Email.class.getName() + " AS email " +
+ "INNER JOIN email." + Email.PROPERTY_RANGE_ROW + " AS rangeRow " +
+ "INNER JOIN rangeRow." + RangeRow.PROPERTY_RANGE + " AS range " +
+ "WHERE email." + Email.PROPERTY_MAIL_FOLDER + " IN :folders " +
+ "GROUP BY range";
+
+ Map<String, Object> args = new HashMap<>();
+ args.put("folders", folders);
+
+ Map<Range, Long[]> result = new HashMap<>();
+
+ List<Object[]> queryResuts = findAll(query, args);
+ for (Object[] queryResut : queryResuts) {
+ Range range = (Range) queryResut[0];
+ Long[] sums = new Long[3];
+ sums[0] = (Long) queryResut[1];
+ sums[1] = (Long) queryResut[2];
+ sums[2] = (Long) queryResut[3];
+ result.put(range, sums);
+ }
+
+ return result;
+ }
}
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-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -47,6 +47,7 @@
import javax.activation.FileDataSource;
import javax.mail.MessagingException;
+import com.franciaflex.faxtomail.persistence.entities.Range;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.io.IOUtils;
@@ -428,21 +429,8 @@
return result;
}
- /**
- * @deprecated Ne pas recuperer trop de mails
- */
- @Deprecated
- public List<Email> getEmailForFolderAndSubfolders(MailFolder folder) {
- EmailTopiaDao dao = getPersistenceContext().getEmailDao();
+ public List<MailFolder> getChildrenRecursively(MailFolder folder) {
List<MailFolder> folders = new ArrayList<>();
- folders.addAll(getChildrenRecursively(folder));
- return new ArrayList<>(dao.forMailFolderIn(folders)
- .findAll());
- }
-
- @Deprecated
- protected List<MailFolder> getChildrenRecursively(MailFolder folder) {
- List<MailFolder> folders = new ArrayList<>();
folders.add(folder);
Collection<MailFolder> children = folder.getChildren();
for (MailFolder child : children) {
@@ -451,6 +439,12 @@
return folders;
}
+ public Map<Range, Long[]> computeQuantitiesByRange(MailFolder rootFolder) {
+ List<MailFolder> folders = getChildrenRecursively(rootFolder);
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ return emailDao.computeQuantitiesByRange(folders);
+ }
+
public Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
Email email = emailDao.findByTopiaId(emailId);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -36,6 +36,7 @@
import org.apache.commons.logging.LogFactory;
import java.awt.*;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -58,42 +59,37 @@
@Override
public void doAction() throws Exception {
- Map<Range, RangeRowModel> quantitiesByRange = new HashMap<Range, RangeRowModel>();
MailFolder folder = getModel().getRootFolder();
- List<Email> emails = getContext().getEmailService().getEmailForFolderAndSubfolders(folder);
+ Map<Range, Long[]> quantitiesByRange = getContext().getEmailService().computeQuantitiesByRange(folder);
- for (Email email : emails) {
- Collection<RangeRow> rangeRows = email.getRangeRow();
- if (rangeRows != null) {
- for (RangeRow rangeRow : rangeRows) {
- Range range = rangeRow.getRange();
- RangeRowModel row = quantitiesByRange.get(range);
- if (row == null) {
- row = new RangeRowModel();
- row.fromEntity(rangeRow);
- quantitiesByRange.put(range, row);
+ List<RangeRowModel> rangeRows = new ArrayList<>();
+ for (Range range : quantitiesByRange.keySet()) {
+ RangeRowModel row = new RangeRowModel();
+ row.setRange(range);
- } else {
- Integer productQuantity = rangeRow.getProductQuantity();
- if (productQuantity != null) {
- row.setProductQuantity(row.getProductQuantity() + productQuantity);
- }
+ Long[] quantities = quantitiesByRange.get(range);
- Integer savQuantity = rangeRow.getSavQuantity();
- if (savQuantity != null) {
- row.setSavQuantity(row.getSavQuantity() + savQuantity);
- }
+ Long productQuantity = quantities[0];
+ if (productQuantity == null) {
+ productQuantity = 0L;
+ }
+ row.setProductQuantity(productQuantity.intValue());
- Integer quotationQuantity = rangeRow.getQuotationQuantity();
- if (quotationQuantity != null) {
- row.setQuotationQuantity(row.getQuotationQuantity() + quotationQuantity);
- }
- }
+ Long savQuantity = quantities[1];
+ if (savQuantity == null) {
+ savQuantity = 0L;
+ }
+ row.setSavQuantity(savQuantity.intValue());
- }
+ Long quotationQuantity = quantities[2];
+ if (quotationQuantity == null) {
+ quotationQuantity = 0L;
}
+ row.setQuotationQuantity(quotationQuantity.intValue());
+
+ rangeRows.add(row);
}
- getModel().setRangeRows(quantitiesByRange.values());
+ getModel().setRangeRows(rangeRows);
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-07-01 06:34:20 UTC (rev 302)
@@ -110,4 +110,34 @@
text: "faxtomail.demandeList.action.archive";
toolTipText: "faxtomail.demandeList.action.archive.tip";
enabled: { model.isArchiveEnabled() };
+}
+
+#totalDemandCountLabel {
+ text: "faxtomail.demandeList.totalCount";
+}
+
+#totalDemandCountValue {
+ text: { String.valueOf(model.getPaginationResult().getCount()) };
+}
+
+#pageNumberLabel {
+ text: "faxtomail.demandeList.pages";
+}
+
+#previousPageButton {
+ text: "faxtomail.demandeList.goToPreviousPage";
+ enabled: { model.getPaginationResult().hasPreviousPage() };
+}
+
+#currentPageLabel {
+ text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) };
+}
+
+#totalPageNumberLabel {
+ text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) };
+}
+
+#nextPageButton {
+ text: "faxtomail.demandeList.goToNextPage";
+ enabled: { model.getPaginationResult().hasNextPage() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-07-01 06:34:20 UTC (rev 302)
@@ -86,23 +86,27 @@
<JLabel id="savNbLabel"/>
<JLabel id="savNbField"/>
</JPanel>
+
<JScrollPane constraints='BorderLayout.CENTER'>
<JXTable id='dataTable'
onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)'
onKeyPressed='handler.openRowMenu(event, tablePopup)'/>
</JScrollPane>
+
<JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'>
- <JLabel text="faxtomail.demandeList.totalCount" />
- <JLabel text="{String.valueOf(model.getPaginationResult().getCount())}" />
+ <JLabel id="totalDemandCountLabel" />
+ <JLabel id="totalDemandCountValue" />
+
<JLabel styleClass="horizontal-separator"/>
- <JLabel text="faxtomail.demandeList.pages" />
- <JButton text="faxtomail.demandeList.goToPreviousPage" onActionPerformed="handler.goToPreviousPage()"
- enabled="{model.getPaginationResult().hasPreviousPage()}" />
- <JLabel text="{String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1)}" />
+
+ <JLabel id="pageNumberLabel" />
+ <JButton id="previousPageButton"
+ onActionPerformed="handler.goToPreviousPage()"/>
+ <JLabel id="currentPageLabel" />
<JLabel styleClass="page-separator"/>
- <JLabel text="{String.valueOf(model.getPaginationResult().getLastPage().getPageNumber() + 1)}" />
- <JButton text="faxtomail.demandeList.goToNextPage" onActionPerformed="handler.goToNextPage()"
- enabled="{model.getPaginationResult().hasNextPage()}" />
+ <JLabel id="totalPageNumberLabel" />
+ <JButton id="nextPageButton"
+ onActionPerformed="handler.goToNextPage()" />
</JPanel>
</JPanel>
</JSplitPane>
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-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -130,29 +130,6 @@
Collection<MailFolder> folders = getContext().getMailFolderService().getRootMailFoldersWithReadingRights(getContext().getCurrentUser());
model.setFolders(new ArrayList<MailFolder>(folders));
- model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- // reset pagination when folder change
- getModel().resetPaginationParameter();
-
- MailFolder folder = (MailFolder) evt.getNewValue();
- while (folder.getAllowCreateDemandIntoFolder() == null
- && folder.getParent() != null) {
- folder = folder.getParent();
- }
- DemandeListUIModel model = getModel();
- model.setComputeQuantitiesByRangeEnabled(true);
- model.setNewDemandEnabled(folder != null && Boolean.TRUE.equals(folder.getAllowCreateDemandIntoFolder()));
-
- LoadFolderEmailsAction loadFolderEmailsAction =
- getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this,
- LoadFolderEmailsAction.class);
- getContext().getActionEngine().runAction(loadFolderEmailsAction);
- }
- });
-
this.ui.setContextValue(model);
}
@@ -265,7 +242,7 @@
});
// init tree
- Map<MailFolder, DefaultMutableTreeNode> nodesByFolder =
+ final Map<MailFolder, FolderTreeNode> nodesByFolder =
FaxToMailUIUtil.initFolderTree(getContext(), ui.getNavigationTree(), model.getFolders(), true);
ui.getNavigationTree().addTreeSelectionListener(new TreeSelectionListener() {
@@ -290,6 +267,34 @@
}
});
+ model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ // reset pagination when folder change
+ getModel().resetPaginationParameter();
+
+ MailFolder folder = (MailFolder) evt.getNewValue();
+
+ FolderTreeNode folderNode = nodesByFolder.get(folder);
+ boolean readable = folderNode.isCanRead();
+
+ while (folder.getAllowCreateDemandIntoFolder() == null
+ && folder.getParent() != null) {
+ folder = folder.getParent();
+ }
+
+ DemandeListUIModel model = getModel();
+ model.setComputeQuantitiesByRangeEnabled(readable);
+ model.setNewDemandEnabled(readable && folder != null && Boolean.TRUE.equals(folder.getAllowCreateDemandIntoFolder()));
+
+ LoadFolderEmailsAction loadFolderEmailsAction =
+ getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this,
+ LoadFolderEmailsAction.class);
+ getContext().getActionEngine().runAction(loadFolderEmailsAction);
+ }
+ });
+
MailFolder currentMailFolder = getContext().getCurrentMailFolder();
DemandeUIModel currentEmail = getContext().getCurrentEmail();
@@ -323,7 +328,7 @@
public void initDemandeTable(final JXTable table, boolean sortable) {
super.initDemandeTable(table, sortable);
- HighlightPredicate testPredicate = new HighlightPredicate() {
+ HighlightPredicate reportNotTakenPredicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
int viewRow = adapter.row;
@@ -341,7 +346,7 @@
}
};
Color color = Color.ORANGE;
- table.addHighlighter(new ColorHighlighter(testPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
+ table.addHighlighter(new ColorHighlighter(reportNotTakenPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-07-01 06:34:20 UTC (rev 302)
@@ -286,3 +286,34 @@
text: "faxtomail.searchToGroup.action.cancel";
toolTipText: "faxtomail.searchToGroup.action.cancel.tip";
}
+
+
+#totalDemandCountLabel {
+ text: "faxtomail.demandeList.totalCount";
+}
+
+#totalDemandCountValue {
+ text: { String.valueOf(model.getPaginationResult().getCount()) };
+}
+
+#pageNumberLabel {
+ text: "faxtomail.demandeList.pages";
+}
+
+#previousPageButton {
+ text: "faxtomail.demandeList.goToPreviousPage";
+ enabled: { model.getPaginationResult().hasPreviousPage() };
+}
+
+#currentPageLabel {
+ text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) };
+}
+
+#totalPageNumberLabel {
+ text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) };
+}
+
+#nextPageButton {
+ text: "faxtomail.demandeList.goToNextPage";
+ enabled: { model.getPaginationResult().hasNextPage() };
+}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx 2014-07-01 06:34:20 UTC (rev 302)
@@ -345,17 +345,19 @@
<JXTable id='dataTable'/>
</JScrollPane>
<JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'>
- <JLabel text="faxtomail.demandeList.totalCount" />
- <JLabel text="{String.valueOf(model.getPaginationResult().getCount())}" />
+ <JLabel id="totalDemandCountLabel" />
+ <JLabel id="totalDemandCountValue" />
+
<JLabel styleClass="horizontal-separator"/>
- <JLabel text="faxtomail.demandeList.pages" />
- <JButton text="faxtomail.demandeList.goToPreviousPage" onActionPerformed="handler.goToPreviousPage()"
- enabled="{model.getPaginationResult().hasPreviousPage()}" />
- <JLabel text="{String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1)}" />
+
+ <JLabel id="pageNumberLabel" />
+ <JButton id="previousPageButton"
+ onActionPerformed="handler.goToPreviousPage()"/>
+ <JLabel id="currentPageLabel" />
<JLabel styleClass="page-separator"/>
- <JLabel text="{String.valueOf(model.getPaginationResult().getLastPage().getPageNumber() + 1)}" />
- <JButton text="faxtomail.demandeList.goToNextPage" onActionPerformed="handler.goToNextPage()"
- enabled="{model.getPaginationResult().hasNextPage()}" />
+ <JLabel id="totalPageNumberLabel" />
+ <JButton id="nextPageButton"
+ onActionPerformed="handler.goToNextPage()" />
</JPanel>
</JPanel>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-07-01 06:34:20 UTC (rev 302)
@@ -312,4 +312,34 @@
#dataTable {
editable: true;
autoCreateRowSorter: true;
+}
+
+#totalDemandCountLabel {
+ text: "faxtomail.demandeList.totalCount";
+}
+
+#totalDemandCountValue {
+ text: { String.valueOf(model.getPaginationResult().getCount()) };
+}
+
+#pageNumberLabel {
+ text: "faxtomail.demandeList.pages";
+}
+
+#previousPageButton {
+ text: "faxtomail.demandeList.goToPreviousPage";
+ enabled: { model.getPaginationResult().hasPreviousPage() };
+}
+
+#currentPageLabel {
+ text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) };
+}
+
+#totalPageNumberLabel {
+ text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) };
+}
+
+#nextPageButton {
+ text: "faxtomail.demandeList.goToNextPage";
+ enabled: { model.getPaginationResult().hasNextPage() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-07-01 06:34:20 UTC (rev 302)
@@ -365,17 +365,19 @@
onKeyPressed='handler.openRowMenu(event, tablePopup)'/>
</JScrollPane>
<JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'>
- <JLabel text="faxtomail.demandeList.totalCount" />
- <JLabel text="{String.valueOf(model.getPaginationResult().getCount())}" />
+ <JLabel id="totalDemandCountLabel" />
+ <JLabel id="totalDemandCountValue" />
+
<JLabel styleClass="horizontal-separator"/>
- <JLabel text="faxtomail.demandeList.pages" />
- <JButton text="faxtomail.demandeList.goToPreviousPage" onActionPerformed="handler.goToPreviousPage()"
- enabled="{model.getPaginationResult().hasPreviousPage()}" />
- <JLabel text="{String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1)}" />
+
+ <JLabel id="pageNumberLabel" />
+ <JButton id="previousPageButton"
+ onActionPerformed="handler.goToPreviousPage()"/>
+ <JLabel id="currentPageLabel" />
<JLabel styleClass="page-separator"/>
- <JLabel text="{String.valueOf(model.getPaginationResult().getLastPage().getPageNumber() + 1)}" />
- <JButton text="faxtomail.demandeList.goToNextPage" onActionPerformed="handler.goToNextPage()"
- enabled="{model.getPaginationResult().hasNextPage()}" />
+ <JLabel id="totalPageNumberLabel" />
+ <JButton id="nextPageButton"
+ onActionPerformed="handler.goToNextPage()" />
</JPanel>
</JPanel>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -73,7 +73,7 @@
getRootMailFoldersWithMoveRights(getContext().getCurrentUser());
JTree navigationTree = ui.getNavigationTree();
- Map<MailFolder, DefaultMutableTreeNode> nodesByFolder =
+ Map<MailFolder, FolderTreeNode> nodesByFolder =
FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders, false);
MailFolder currentFolder = getModel().getMailFolder();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-30 16:35:30 UTC (rev 301)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-07-01 06:34:20 UTC (rev 302)
@@ -119,22 +119,22 @@
setApplicationContext(ui, parentUI.getHandler().getContext());
}
- public static Map<MailFolder, DefaultMutableTreeNode> initFolderTree(final FaxToMailUIContext context,
+ public static Map<MailFolder, FolderTreeNode> initFolderTree(final FaxToMailUIContext context,
JTree navigationTree,
Collection<MailFolder> folders,
final boolean colorNotAffectedFolders) {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
List<MailFolder> foldersToExpand = context.getExpandedFolders();
- Map<MailFolder, DefaultMutableTreeNode> nodesByFolder = new HashMap<MailFolder, DefaultMutableTreeNode>();
+ Map<MailFolder, FolderTreeNode> nodesByFolder = new HashMap<MailFolder, FolderTreeNode>();
for (MailFolder folder : folders) {
nodesByFolder.putAll(FaxToMailUIUtil.createFolderTree(root, folder));
- DefaultMutableTreeNode node = nodesByFolder.get(folder);
+ FolderTreeNode node = nodesByFolder.get(folder);
MailFolder parent = folder.getParent();
while (parent != null) {
- FolderTreeNode parentNode = (FolderTreeNode) nodesByFolder.get(parent);
+ FolderTreeNode parentNode = nodesByFolder.get(parent);
if (parentNode == null) {
parentNode = new FolderTreeNode(parent);
parentNode.setCanRead(false);
@@ -204,9 +204,9 @@
* @param folder the folder to add to the tree
* @return the map of the nodes by folder
*/
- protected static Map<MailFolder, DefaultMutableTreeNode> createFolderTree(DefaultMutableTreeNode parent,
+ protected static Map<MailFolder, FolderTreeNode> createFolderTree(DefaultMutableTreeNode parent,
MailFolder folder) {
- Map<MailFolder, DefaultMutableTreeNode> result = new HashMap<MailFolder, DefaultMutableTreeNode>();
+ Map<MailFolder, FolderTreeNode> result = new HashMap<MailFolder, FolderTreeNode>();
FolderTreeNode node = new FolderTreeNode(folder);
node.setCanSelect(true);
1
0