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
August 2014
- 4 participants
- 141 discussions
r467 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/content java/com/franciaflex/faxtomail/ui/swing/content/attachment java/com/franciaflex/faxtomail/ui/swing/content/demande java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor java/com/franciaflex/faxtomail/ui/swing/util resources/i18n
by echatellier@users.forge.codelutin.com 05 Aug '14
by echatellier@users.forge.codelutin.com 05 Aug '14
05 Aug '14
Author: echatellier
Date: 2014-08-05 10:22:38 +0200 (Tue, 05 Aug 2014)
New Revision: 467
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/467
Log:
fixes #5533: la fen?\195?\170tre d'ajout d'annotations contient une croix (fermeture de fen?\195?\170tre) sous windows, le probl?\195?\168me est que si l'on clique dessus, rien n'est sauv?\195?\169
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/attachment/AttachmentEditorUIModel.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/pdfeditor/PDFEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
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-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -33,11 +33,13 @@
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI;
import com.franciaflex.faxtomail.ui.swing.util.RemoveablePropertyChangeListener;
import com.google.common.base.Preconditions;
+
import jaxx.runtime.JAXXBinding;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.JAXXWidgetUtil;
import jaxx.runtime.swing.session.SwingSession;
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,6 +47,7 @@
import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
import javax.swing.*;
+
import java.awt.Cursor;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -60,16 +60,6 @@
super(fromBeanBinder, toBeanBinder);
}
- /*public File getFile() {
- return file;
- }
-
- public void setFile(File file) {
- Object oldValue = getFile();
- this.file = file;
- firePropertyChange(PROPERTY_FILE, oldValue, file);
- }*/
-
public boolean isEditable() {
return editable;
}
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-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -40,7 +40,6 @@
import java.util.Set;
import javax.swing.JComponent;
-import javax.swing.JOptionPane;
import javax.swing.JSplitPane;
import javax.swing.JTextPane;
import javax.swing.ListSelectionModel;
@@ -59,8 +58,6 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.jdesktop.swingx.table.TableColumnModelExt;
-import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction;
-import org.nuiton.jaxx.application.swing.action.ApplicationUIAction;
import org.nuiton.jaxx.application.swing.tab.TabHandler;
import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableCellAction;
@@ -458,59 +455,6 @@
return result;
}
- /**
- * Gros copier/coller de quitScreen() pour appeler runActionAndWait au lieu de saveAction.actionPerformed(null); par defaut
- * pour tenter de corriger un problème de concurrence entre l'action de sauvegarde de l'email
- * et l'action de rechargement de l'arbre qui fait un closeTransaction au même moment.
- *
- * @param modelIsValid
- * @param modelIsModify
- * @param askGiveUpMessage
- * @param askSaveMessage
- * @param saveAction
- * @return
- */
- protected boolean quitScreen2(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage,
- SaveDemandeAction saveAction) {
- boolean result;
-
- if (!modelIsValid) {
-
- // model is not valid
- // ask user to qui or not
- result = askCancelEditBeforeLeaving(askGiveUpMessage);
-
- } else if (modelIsModify) {
-
- // something is modify ask user what to do
- int answer = askSaveBeforeLeaving(askSaveMessage);
- switch (answer) {
- case JOptionPane.YES_OPTION:
-
- // ok save
- //saveAction.actionPerformed(null);
- //XXX echatellier 2010731 : action bloquante
- getContext().getActionEngine().runActionAndWait(saveAction);
- result = true;
- break;
- case JOptionPane.NO_OPTION:
-
- // do not save but can still quit the screen (so nothing to do)
- result = true;
- break;
- default:
- // do not save and stay here (so nothing to do)
- result = false;
-
- }
- } else {
-
- // model is valid and not modify, can safely quit screen
- result = true;
- }
- return result;
- }
-
@Override
public SwingValidator<DemandeUIModel> getValidator() {
return ui.getValidator();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -24,6 +24,8 @@
* #L%
*/
+import static org.nuiton.i18n.I18n.t;
+
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
@@ -53,11 +55,6 @@
import javax.swing.JComponent;
import javax.swing.JPanel;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.HistoryType;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
import jaxx.runtime.swing.ComponentMover;
import jaxx.runtime.swing.ComponentResizer;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -67,9 +64,16 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.HistoryType;
+import com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
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.util.JImagePanel;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
@@ -82,13 +86,11 @@
import com.sun.pdfview.PDFFile;
import com.sun.pdfview.PDFPage;
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author Kevin Morin (Code Lutin)
*
*/
-public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIModel, PDFEditorUI> {
+public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIModel, PDFEditorUI> implements CloseableUI {
private static final Log log = LogFactory.getLog(PDFEditorUIHandler.class);
@@ -237,8 +239,20 @@
}
@Override
+ public boolean quitUI() {
+ boolean result = quitScreen2(
+ true,
+ getModel().isModify(),
+ null,
+ t("faxtomail.pdfEditor.askSaveBeforeLeaving.save"),
+ getContext().getActionFactory().createLogicAction(this, GenerateAnnotatedAttachmentAction.class)
+ );
+ return result;
+ }
+
+ @Override
public void onCloseUI() {
-// getModel()
+
}
public void addNote() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -24,10 +24,13 @@
* #L%
*/
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -64,10 +67,12 @@
public void addNote(PDFEditorNoteUI note) {
notes.add(note);
+ setModify(true);
}
public void removeNote(PDFEditorNoteUI note) {
notes.remove(note);
+ setModify(true);
}
public List<PDFEditorCrossUI> getCrosses() {
@@ -76,10 +81,12 @@
public void addCross(PDFEditorCrossUI cross) {
crosses.add(cross);
+ setModify(true);
}
public void removeCross(PDFEditorCrossUI cross) {
crosses.remove(cross);
+ setModify(true);
}
public List<PDFEditorLineUI> getLines() {
@@ -88,10 +95,12 @@
public void addLine(PDFEditorLineUI line) {
lines.add(line);
+ setModify(true);
}
public void removeLine(PDFEditorLineUI line) {
lines.remove(line);
+ setModify(true);
}
public List<PDFEditorHighlighterUI> getHighlighters() {
@@ -100,10 +109,12 @@
public void addHighlighter(PDFEditorHighlighterUI highlighter) {
highlighters.add(highlighter);
+ setModify(true);
}
public void removeHighlighter(PDFEditorHighlighterUI highlighter) {
highlighters.remove(highlighter);
+ setModify(true);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-05 08:22:38 UTC (rev 467)
@@ -22,45 +22,66 @@
* #L%
*/
-import com.franciaflex.faxtomail.FaxToMailConfiguration;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.HasLabel;
-import com.franciaflex.faxtomail.services.DecoratorService;
-import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
-import com.franciaflex.faxtomail.ui.swing.content.MainUI;
-import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
+import static org.nuiton.i18n.I18n.t;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.ComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import javax.swing.WindowConstants;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.text.JTextComponent;
+
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.bean.BeanUIUtil;
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.decorator.Decorator;
import org.nuiton.jaxx.application.ApplicationDataUtil;
import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
import org.nuiton.jaxx.application.swing.ApplicationUI;
+import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction;
import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
+import org.nuiton.jaxx.application.swing.util.Cancelable;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
-import javax.swing.*;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.*;
+import com.franciaflex.faxtomail.FaxToMailConfiguration;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.HasLabel;
+import com.franciaflex.faxtomail.services.DecoratorService;
+import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.content.MainUI;
+import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
-import static org.nuiton.i18n.I18n.t;
-
/**
* Contract of any UI handler.
*
@@ -251,7 +272,128 @@
SwingUtil.center(getContext().getMainUI(), result);
result.setVisible(true);
}
+
+ /**
+ * Surchargée pour temporairement ajouter un appel à ApplicationUI#onCloseUI on windowClosing.
+ *
+ * @deprecated overriden during waiting response for issue : http://nuiton.org/issues/3415
+ */
+ @Deprecated
+ @Override
+ public void openDialog(final ApplicationUI dialogContent, String title, Dimension dim) {
+ Component topestUI = getTopestUI();
+ final JDialog result;
+ if (topestUI instanceof Frame) {
+ result = new JDialog((Frame) topestUI, title, true);
+ } else {
+ result = new JDialog((Dialog) topestUI, title, true);
+ }
+
+ result.add((Component) dialogContent);
+ result.setResizable(true);
+
+ result.setSize(dim);
+
+ final AbstractApplicationUIHandler handler = dialogContent.getHandler();
+
+ if (handler instanceof Cancelable) {
+
+ // add a auto-close action
+ JRootPane rootPane = result.getRootPane();
+
+ KeyStroke shortcutClosePopup = getContext().getConfiguration().getShortcutClosePopup();
+
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(shortcutClosePopup, "close");
+ rootPane.getActionMap().put("close", new AbstractAction() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ((Cancelable) handler).cancel();
+ }
+ });
+ }
+
+ result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+ result.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ boolean canClose = true;
+ if (handler instanceof CloseableUI) {
+ canClose = ((CloseableUI)handler).quitUI();
+ }
+ if (canClose) {
+ result.setVisible(false);
+ }
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ Component ui = (Component) e.getSource();
+ if (log.isDebugEnabled()) {
+ log.debug("Destroy ui " + ui);
+ }
+ JAXXUtil.destroy(ui);
+ }
+ });
+ SwingUtil.center(getContext().getMainUI(), result);
+ result.setVisible(true);
+ }
+
+ /**
+ * Gros copier/coller de quitScreen() pour appeler runActionAndWait au lieu de saveAction.actionPerformed(null); par defaut
+ * pour tenter de corriger un problème de concurrence entre l'action de sauvegarde de l'email
+ * et l'action de rechargement de l'arbre qui fait un closeTransaction au même moment.
+ *
+ * @param modelIsValid
+ * @param modelIsModify
+ * @param askGiveUpMessage
+ * @param askSaveMessage
+ * @param saveAction
+ * @return
+ */
+ protected boolean quitScreen2(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage,
+ AbstractApplicationAction saveAction) {
+ boolean result;
+
+ if (!modelIsValid) {
+
+ // model is not valid
+ // ask user to qui or not
+ result = askCancelEditBeforeLeaving(askGiveUpMessage);
+
+ } else if (modelIsModify) {
+
+ // something is modify ask user what to do
+ int answer = askSaveBeforeLeaving(askSaveMessage);
+ switch (answer) {
+ case JOptionPane.YES_OPTION:
+
+ // ok save
+ //saveAction.actionPerformed(null);
+ //XXX echatellier 2010731 : action bloquante
+ getContext().getActionEngine().runActionAndWait(saveAction);
+ result = true;
+ break;
+ case JOptionPane.NO_OPTION:
+
+ // do not save but can still quit the screen (so nothing to do)
+ result = true;
+ break;
+ default:
+ // do not save and stay here (so nothing to do)
+ result = false;
+
+ }
+ } else {
+
+ // model is valid and not modify, can safely quit screen
+ result = true;
+ }
+ return result;
+ }
+
public void closeFrame() {
getParentContainer(JFrame.class).setVisible(false);
}
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-08-04 15:59:45 UTC (rev 466)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-05 08:22:38 UTC (rev 467)
@@ -209,6 +209,7 @@
faxtomail.pdfEditor.action.cancel.tip=Ne pas enregistrer les changements et fermer
faxtomail.pdfEditor.action.validate=Enregistrer
faxtomail.pdfEditor.action.validate.tip=Enregistrer les changements et fermer
+faxtomail.pdfEditor.askSaveBeforeLeaving.save=Les modifications apportées n'ont pas été sauvegardées.
faxtomail.pdfEditor.button.addCross.tip=Ajouter une croix
faxtomail.pdfEditor.button.addHighlighter.tip=Ajouter un surlignement
faxtomail.pdfEditor.button.addLine.tip=Ajouter une ligne
1
0
r466 - in trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content: demande search
by echatellier@users.forge.codelutin.com 04 Aug '14
by echatellier@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: echatellier
Date: 2014-08-04 17:59:45 +0200 (Mon, 04 Aug 2014)
New Revision: 466
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/466
Log:
Lors du changement du nombre de resultat par page, ne faire la recherche qu'une seule fois
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/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
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-08-04 15:55:51 UTC (rev 465)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-08-04 15:59:45 UTC (rev 466)
@@ -353,13 +353,15 @@
}
public void updateResultPerPage(ItemEvent event) {
- //FIXME echatellier 20140801 this produce transasction exception
- int resultPerPage = (Integer)event.getItem();
- getModel().setResultPerPage(resultPerPage);
- getConfig().setResultPerPage(resultPerPage);
- getConfig().save();
- getModel().resetPaginationParameter();
- runListAction();
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ //FIXME echatellier 20140801 this produce transasction exception
+ int resultPerPage = (Integer)event.getItem();
+ getModel().setResultPerPage(resultPerPage);
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().resetPaginationParameter();
+ runListAction();
+ }
}
protected void runListAction() {
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-08-04 15:55:51 UTC (rev 465)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-08-04 15:59:45 UTC (rev 466)
@@ -251,13 +251,15 @@
}
public void updateResultPerPage(ItemEvent event) {
- getContext().createNewTransaction();
- int resultPerPage = (Integer)event.getItem();
- getConfig().setResultPerPage(resultPerPage);
- getConfig().save();
- getModel().setResultPerPage(resultPerPage);
- getModel().resetPaginationParameter();
- runSearchAction();
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ getContext().createNewTransaction();
+ int resultPerPage = (Integer)event.getItem();
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().setResultPerPage(resultPerPage);
+ getModel().resetPaginationParameter();
+ runSearchAction();
+ }
}
protected void runSearchAction() {
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-08-04 15:55:51 UTC (rev 465)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-08-04 15:59:45 UTC (rev 466)
@@ -214,13 +214,15 @@
}
public void updateResultPerPage(ItemEvent event) {
- getContext().createNewTransaction();
- int resultPerPage = (Integer)event.getItem();
- getConfig().setResultPerPage(resultPerPage);
- getConfig().save();
- getModel().setResultPerPage(resultPerPage);
- getModel().resetPaginationParameter();
- runSearchAction();
+ if (event.getStateChange() == ItemEvent.SELECTED) {
+ getContext().createNewTransaction();
+ int resultPerPage = (Integer)event.getItem();
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().setResultPerPage(resultPerPage);
+ getModel().resetPaginationParameter();
+ runSearchAction();
+ }
}
protected void runSearchAction() {
1
0
r465 - trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply
by kmorin@users.forge.codelutin.com 04 Aug '14
by kmorin@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: kmorin
Date: 2014-08-04 17:55:51 +0200 (Mon, 04 Aug 2014)
New Revision: 465
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/465
Log:
fixes #5447 La validation de la fen?\195?\170tre de r?\195?\169ponse ne fonctionne pas
Modified:
trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml
Modified: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-04 15:42:08 UTC (rev 464)
+++ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-04 15:55:51 UTC (rev 465)
@@ -30,7 +30,7 @@
<validators>
<field name="to">
- <field-validator type="required" short-circuit="true">
+ <field-validator type="requiredstring" short-circuit="true">
<message>faxtomail.validator.error.reply.to.required</message>
</field-validator>
<field-validator type="email" short-circuit="true">
@@ -60,7 +60,7 @@
</field>
<field name="subject">
- <field-validator type="required" short-circuit="true">
+ <field-validator type="requiredstring" short-circuit="true">
<message>faxtomail.validator.error.reply.subject.required</message>
</field-validator>
</field>
1
0
r464 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions
by kmorin@users.forge.codelutin.com 04 Aug '14
by kmorin@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: kmorin
Date: 2014-08-04 17:42:08 +0200 (Mon, 04 Aug 2014)
New Revision: 464
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/464
Log:
fixes #5584 Cliquer rapidement sur les boutons "Gestion des fax" et "Recherche" cause une exception
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-08-04 15:01:23 UTC (rev 463)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java 2014-08-04 15:42:08 UTC (rev 464)
@@ -24,6 +24,7 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
+import com.franciaflex.faxtomail.ui.swing.content.MainUI;
import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
@@ -72,6 +73,9 @@
@Override
public boolean prepareAction() throws Exception {
boolean result = super.prepareAction();
+
+ setTopBarButtonEnabled(false);
+
result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen();
return result;
}
@@ -100,10 +104,20 @@
@Override
public void postFailedAction(Throwable error) {
- if (error != null) {
+ setTopBarButtonEnabled(true);
+ }
-// getContext().setFallBackScreen();
- }
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ setTopBarButtonEnabled(true);
}
+ protected void setTopBarButtonEnabled(boolean enabled) {
+ MainUI ui = getUI();
+ ui.getSearchButton().setEnabled(enabled);
+ ui.getDemandListButton().setEnabled(enabled);
+ ui.getExitButton().setEnabled(enabled);
+ }
+
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-08-04 15:01:23 UTC (rev 463)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-08-04 15:42:08 UTC (rev 464)
@@ -44,8 +44,6 @@
@Override
public void postSuccessAction() {
super.postSuccessAction();
-
- GoToPreviousScreenAction action = getContext().getActionFactory().createLogicAction(getContext().getMainUI().getHandler(), GoToPreviousScreenAction.class);
- getActionEngine().runInternalAction(action);
+ getActionEngine().runInternalAction(getContext().getMainUI().getHandler(), GoToPreviousScreenAction.class);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-08-04 15:01:23 UTC (rev 463)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-08-04 15:42:08 UTC (rev 464)
@@ -54,9 +54,8 @@
DemandesUI parentUI = (DemandesUI) getUI().getContextValue(JAXXContext.class, JAXXUtil.PARENT);
DemandeUI demandeUI = (DemandeUI) parentUI.getDemandsTabPane().getSelectedComponent();
- SaveDemandeAction action = getContext().getActionFactory().createLogicAction(demandeUI.getHandler(),
- SaveDemandeAndExitAction.class);
- getContext().getActionEngine().runInternalAction(action);
+ getContext().getActionEngine().runInternalAction(demandeUI.getHandler(),
+ SaveDemandeAndExitAction.class);
}
}
1
0
r463 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail
by echatellier@users.forge.codelutin.com 04 Aug '14
by echatellier@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: echatellier
Date: 2014-08-04 17:01:23 +0200 (Mon, 04 Aug 2014)
New Revision: 463
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/463
Log:
Remove init version (not always needed)
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java 2014-08-04 14:27:36 UTC (rev 462)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java 2014-08-04 15:01:23 UTC (rev 463)
@@ -96,8 +96,6 @@
// it's set here for only web application to migrate schema, not client
Map<String, String> properties = new HashMap<>();
properties.put("topia.service.migration", FaxtomailFlywayMigrationService.class.getName());
- // init base version with 1.0.0.429 (1.0-rc-2)
- properties.put("topia.service.migration." + TopiaFlywayService.FLYWAY_INIT_VERSION, "1.0.0.429");
properties.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "false");
// add configuration properties after to allow override
1
0
r462 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions
by kmorin@users.forge.codelutin.com 04 Aug '14
by kmorin@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: kmorin
Date: 2014-08-04 16:27:36 +0200 (Mon, 04 Aug 2014)
New Revision: 462
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/462
Log:
run internal action instead of just run action
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-08-04 14:03:00 UTC (rev 461)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-08-04 14:27:36 UTC (rev 462)
@@ -46,6 +46,6 @@
super.postSuccessAction();
GoToPreviousScreenAction action = getContext().getActionFactory().createLogicAction(getContext().getMainUI().getHandler(), GoToPreviousScreenAction.class);
- getActionEngine().runAction(action);
+ getActionEngine().runInternalAction(action);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-08-04 14:03:00 UTC (rev 461)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-08-04 14:27:36 UTC (rev 462)
@@ -56,7 +56,7 @@
DemandeUI demandeUI = (DemandeUI) parentUI.getDemandsTabPane().getSelectedComponent();
SaveDemandeAction action = getContext().getActionFactory().createLogicAction(demandeUI.getHandler(),
SaveDemandeAndExitAction.class);
- getContext().getActionEngine().runAction(action);
+ getContext().getActionEngine().runInternalAction(action);
}
}
1
0
r461 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/content/demande/replies java/com/franciaflex/faxtomail/ui/swing/content/reply resources/i18n
by echatellier@users.forge.codelutin.com 04 Aug '14
by echatellier@users.forge.codelutin.com 04 Aug '14
04 Aug '14
Author: echatellier
Date: 2014-08-04 16:03:00 +0200 (Mon, 04 Aug 2014)
New Revision: 461
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/461
Log:
fixes #5556: Pouvoir reforwarder un mail envoy?\195?\169 en plus de pouvoir le visualiser
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/DemandReplyItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
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-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-08-04 14:03:00 UTC (rev 461)
@@ -86,14 +86,6 @@
private final static Log log = LogFactory.getLog(DemandRepliesUIHandler.class);
-// @Override
-// public void beforeInit(DemandRepliesUI ui) {
-// super.beforeInit(ui);
-//
-// DemandeUIModel currentEmail = getContext().getCurrentEmail();
-// this.ui.setContextValue(currentEmail);
-// }
-
@Override
public void afterInit(DemandRepliesUI ui) {
super.afterInit(ui);
@@ -197,7 +189,9 @@
// TODO echatellier 20140804 : c'est très technique et très bas niveau, ca devrait se trouver dans les services
Message message = new MimeMessage(null, new ByteArrayInputStream(reply.getEmailSource().getBytes()));
ReplyFormUIModel replyModel = dialogContent.getModel();
+ replyModel.setOriginalDemand(ui.getModel());
replyModel.setReadonly(true);
+ replyModel.setReadSentDate(reply.getSentDate());
replyModel.setSubject(message.getSubject());
replyModel.setTo(message.getRecipients(RecipientType.TO)[0].toString());
replyModel.setFrom(message.getFrom()[0].toString());
@@ -219,14 +213,46 @@
openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600));
} catch (Exception e) {
- getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"));
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), e);
}
-// FaxToMailUIContext context = getContext();
-// context.setCurrentEmails(demande);
-// context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
}
+
+ public void openForward(Reply reply) {
+ closeEditor();
+ try {
+ ReplyFormUI dialogContent = new ReplyFormUI(ui);
+ // TODO echatellier 20140804 : c'est très technique et très bas niveau, ca devrait se trouver dans les services
+ Message message = new MimeMessage(null, new ByteArrayInputStream(reply.getEmailSource().getBytes()));
+ ReplyFormUIModel replyModel = dialogContent.getModel();
+ replyModel.setOriginalDemand(ui.getModel());
+ replyModel.setReadSentDate(reply.getSentDate());
+ replyModel.setSubject(t("faxtomail.reply.forwardsubject", message.getSubject()));
+
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(message, replyModel, reply.getTopiaId());
+
+ } else {
+ String content = IOUtils.toString(message.getInputStream());
+ replyModel.setMessage(content);
+ }
+
+ // XXX: à verifier pour le format, et si on quote ou pas encore le forward
+ String quotedReply = t("faxtomail.reply.message",
+ decorate(reply.getSentDate()),
+ message.getRecipients(RecipientType.TO)[0].toString(),
+ replyModel.getMessage().replaceAll("\n", "\n> "));
+ replyModel.setMessage(quotedReply);
+
+ openFrame(dialogContent, t("faxtomail.reply.forward", message.getSubject()), new Dimension(800, 600));
+
+ } catch (Exception e) {
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), e);
+ }
+
+ }
+
/**
* Decompose a multipart part.
* - sets the email content if the part contains a text bodypart
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css 2014-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css 2014-08-04 14:03:00 UTC (rev 461)
@@ -39,6 +39,11 @@
floatable: false;
}
+#openForwardButton {
+ actionIcon: "transmit";
+ toolTipText: "faxtomail.demandReplies.action.forward.tip";
+}
+
#openReplyButton {
actionIcon: "open";
toolTipText: "faxtomail.demandReplies.action.open.tip";
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx 2014-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx 2014-08-04 14:03:00 UTC (rev 461)
@@ -46,6 +46,8 @@
<JLabel id='replySubjectLabel' constraints='BorderLayout.CENTER'/>
<JToolBar id='toolbar' constraints='BorderLayout.EAST'>
+ <JButton id='openForwardButton'
+ onActionPerformed='handler.openForward(reply)'/>
<JButton id='openReplyButton'
onActionPerformed='handler.openReply(reply)'/>
</JToolBar>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-08-04 14:03:00 UTC (rev 461)
@@ -119,6 +119,12 @@
selected: { String.valueOf(model.isReadonly()) };
}
+#forwardButton {
+ actionIcon: transmit;
+ text: "faxtomail.reply.action.forward";
+ toolTipText: "faxtomail.reply.action.forward.tip";
+}
+
#closeButton {
actionIcon: cancel;
text: "faxtomail.reply.action.close";
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-08-04 14:03:00 UTC (rev 461)
@@ -162,6 +162,7 @@
constraints='BorderLayout.SOUTH'>
<JPanel constraints='"true"'
layout='{new GridLayout(1, 0)}'>
+ <JButton id='forwardButton' onActionPerformed='handler.forward()'/>
<JButton id='closeButton' onActionPerformed='handler.cancel()'/>
</JPanel>
<JPanel constraints='"false"'
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-08-04 14:03:00 UTC (rev 461)
@@ -27,18 +27,23 @@
import static org.nuiton.i18n.I18n.t;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
-
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.google.common.base.Strings;
+
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
import java.awt.Component;
+import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
@@ -46,6 +51,14 @@
import java.util.Collection;
import java.util.List;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.Part;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimeMessage.RecipientType;
import javax.swing.ComboBoxEditor;
import javax.swing.JComboBox;
import javax.swing.JComponent;
@@ -63,6 +76,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
@@ -400,4 +414,42 @@
editorComponent.removeActionListener(l);
}
}
+
+ /**
+ * Close current dialog ui, and reopen a new one for transfering repons to new recipient.
+ */
+ public void forward() {
+ closeFrame();
+
+ try {
+ // display a new ui with a copy of original ui model
+ ReplyFormUI dialogContent = new ReplyFormUI(ui);
+ ReplyFormUIModel replyModel = dialogContent.getModel();
+ replyModel.fromModel(ui.getModel());
+
+ // XXX: à verifier pour le format, et si on quote ou pas encore le forward
+ String quotedReply = t("faxtomail.reply.message",
+ decorate(replyModel.getReadSentDate()),
+ replyModel.getFrom(),
+ replyModel.getMessage().replaceAll("\n", "\n> "));
+ replyModel.setMessage(quotedReply);
+ replyModel.setSubject(t("faxtomail.reply.forwardsubject", replyModel.getSubject()));
+
+ // clear fields that need to be filled by hand
+ replyModel.setReadonly(false);
+ replyModel.setReadSentDate(null);
+ replyModel.setTo(null);
+ replyModel.setCc(null);
+ replyModel.setCci(null);
+
+ openFrame(dialogContent, t("faxtomail.reply.forward", getModel().getSubject()), new Dimension(800, 600));
+
+ } catch (Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't display forward frame", ex);
+ }
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), ex);
+ }
+
+ }
}
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-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-08-04 14:03:00 UTC (rev 461)
@@ -24,18 +24,21 @@
* #L%
*/
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.google.common.base.Preconditions;
+import java.io.File;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
-import java.io.File;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.google.common.base.Preconditions;
/**
* @author Kevin Morin (Code Lutin)
@@ -53,12 +56,13 @@
public static final String PROPERTY_MESSAGE = "message";
public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand";
public static final String PROPERTY_ATTACHMENT = "attachment";
- public static final String PROPERTY_READONLY = "readonly";
public static final String PROPERTY_MAX_ATTACHMENT_LENGTH = "maxAttachmentLength";
public static final String PROPERTY_TOTAL_ATTACHMENT_LENGTH = "totalAttachmentLength";
public static final String PROPERTY_VALID = "valid";
public static final String PROPERTY_SENDER_ALLOWED_DOMAINS = "senderAllowedDomains";
public static final String PROPERTY_SENDER_ALLOWED_ADDRESSES = "senderAllowedAddresses";
+ public static final String PROPERTY_READONLY = "readonly";
+ public static final String PROPERTY_READ_SENT_DATE = "readSentDate";
protected String to;
protected String cc;
@@ -70,7 +74,13 @@
protected long maxAttachmentLength = 0;
protected long totalAttachmentLength = 0;
protected boolean valid = true;
+
+ /** Flag pour marquer les champs non editables dans le cas d'une lecture d'une réponse déjà envoyée. */
protected boolean readonly = false;
+
+ /** Date d'envoi d'une réponse ouverte en lecture seule (peut être {@code null}). */
+ protected Date readSentDate;
+
protected List<String> senderAllowedDomains;
protected List<String> senderAllowedAddresses;
@@ -79,6 +89,12 @@
protected File lastVisitedDirectory = FileUtils.getUserDirectory();
+ protected Binder<ReplyFormUIModel, ReplyFormUIModel> copyBinder = BinderFactory.newBinder(ReplyFormUIModel.class);
+
+ public void fromModel(ReplyFormUIModel other) {
+ copyBinder.copyExcluding(other, this);
+ }
+
public String getTo() {
return to;
}
@@ -164,6 +180,14 @@
setTotalAttachmentLength(totalAttachmentLength - attachment.getLength());
}
+
+ public void setAttachments(Set<ReplyAttachmentModel> attachments) {
+ this.attachments = attachments;
+ if (availableAttachments != null) {
+ availableAttachments.removeAll(attachments);
+ }
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments());
+ }
public Set<ReplyAttachmentModel> getAvailableAttachments() {
return availableAttachments;
@@ -195,6 +219,16 @@
firePropertyChange(PROPERTY_READONLY, oldValue, readonly);
}
+ public void setReadSentDate(Date readSentDate) {
+ Object oldValue = this.readSentDate;
+ this.readSentDate = readSentDate;
+ firePropertyChange(PROPERTY_READ_SENT_DATE, oldValue, readSentDate);
+ }
+
+ public Date getReadSentDate() {
+ return readSentDate;
+ }
+
public long getMaxAttachmentLength() {
return maxAttachmentLength / 1024;
}
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-08-04 09:42:59 UTC (rev 460)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-04 14:03:00 UTC (rev 461)
@@ -67,6 +67,7 @@
faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant
faxtomail.demandGroup.text=Groupe (%s)
faxtomail.demandGroup.title=Groupe
+faxtomail.demandReplies.action.forward.tip=
faxtomail.demandReplies.action.open.tip=Visualiser la réponse
faxtomail.demandReplies.action.tip=Réponses envoyées
faxtomail.demandReplies.empty=Aucune réponse envoyée
@@ -232,11 +233,15 @@
faxtomail.reply.action.cancel.tip=Annuler et fermer la popup
faxtomail.reply.action.close=Fermer
faxtomail.reply.action.close.tip=Fermer
+faxtomail.reply.action.forward=Transférer
+faxtomail.reply.action.forward.tip=Retransférer la réponse vers une autre adresse email
faxtomail.reply.action.validate=Envoyer
faxtomail.reply.action.validate.tip=Envoyer la réponse au mail
faxtomail.reply.attachment.label=%1$s (%2$s ko)
faxtomail.reply.attachments.add.label=Ajouter des pièces jointes
faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés)
+faxtomail.reply.forward=Tranfer de la réponse \: %s
+faxtomail.reply.forwardsubject=Tr\: %s
faxtomail.reply.label.cc=Copie \:
faxtomail.reply.label.cci=Copie cachée \:
faxtomail.reply.label.from=De \:
1
0
04 Aug '14
Author: echatellier
Date: 2014-08-04 11:42:59 +0200 (Mon, 04 Aug 2014)
New Revision: 460
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/460
Log:
fixes #5557: Pouvoir lors de l?\226?\128?\153envoi d?\226?\128?\153un mail mettre un Cc, Cci
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/ReplyAction.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/reply/ReplyFormUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java
trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml
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-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-08-04 09:42:59 UTC (rev 460)
@@ -705,7 +705,26 @@
return result;
}
- public Email reply(String from, String to, String subject,
+ /**
+ * Envoi une réponse et retourne l'email.
+ *
+ * FIXME echatellier 20140804 : pourquoi retourner l'email ? la réponse ne devrait absolument pas modifier l'email
+ *
+ * @param from from
+ * @param to to
+ * @param cc cc
+ * @param bcc bcc
+ * @param subject subject
+ * @param content content
+ * @param attachments attachement
+ * @param originalEmailId mail topia id
+ * @param user user to add new history entry for user
+ * @return modified email
+ * @throws EmailException if message can't be sent
+ * @throws MessagingException if message can't be sent
+ * @throws IOException if message can't be sent
+ */
+ public Email reply(String from, String to, String cc, String bcc, String subject,
String content, Collection<AttachmentFile> attachments,
String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException {
@@ -726,6 +745,12 @@
message.setCharset(EmailConstants.UTF_8);
message.setFrom(from);
message.addTo(to);
+ if (StringUtils.isNotBlank(cc)) {
+ message.addCc(cc);
+ }
+ if (StringUtils.isNotBlank(bcc)) {
+ message.addBcc(bcc);
+ }
message.setSubject(subject);
message.setMsg(content);
@@ -736,7 +761,7 @@
message.attach(source, attachmentFile.getFilename(), null);
}
- String emailId = message.send();
+ message.send();
ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao();
Date now = new Date();
@@ -747,6 +772,7 @@
String headerLine = headerLines.nextElement();
emailSource.append(headerLine).append("\n");
}
+ // TODO echatellier 20140804 : est volontaire et sûr de stocker l'email sous forme textuelle ?
emailSource.append("\n").append(IOUtils.toString(message.getMimeMessage().getInputStream()));
Reply reply = replyTopiaDao.create(Reply.PROPERTY_EMAIL_SOURCE, emailSource.toString(),
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-08-04 09:42:59 UTC (rev 460)
@@ -71,6 +71,8 @@
});
Email email = emailService.reply(model.getFrom(),
model.getTo(),
+ model.getCc(),
+ model.getCci(),
model.getSubject(),
model.getMessage(),
attachmentFiles,
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-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-08-04 09:42:59 UTC (rev 460)
@@ -39,6 +39,7 @@
import javax.mail.Message;
import javax.mail.Part;
import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMessage.RecipientType;
import javax.mail.internet.MimeMultipart;
import javax.swing.AbstractCellEditor;
import javax.swing.JComponent;
@@ -56,10 +57,12 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyAttachmentModel;
+
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -191,12 +194,19 @@
try {
ReplyFormUI dialogContent = new ReplyFormUI(ui);
+ // TODO echatellier 20140804 : c'est très technique et très bas niveau, ca devrait se trouver dans les services
Message message = new MimeMessage(null, new ByteArrayInputStream(reply.getEmailSource().getBytes()));
ReplyFormUIModel replyModel = dialogContent.getModel();
replyModel.setReadonly(true);
replyModel.setSubject(message.getSubject());
- replyModel.setTo(message.getAllRecipients()[0].toString());
+ replyModel.setTo(message.getRecipients(RecipientType.TO)[0].toString());
replyModel.setFrom(message.getFrom()[0].toString());
+ if (ArrayUtils.isNotEmpty(message.getRecipients(RecipientType.CC))) {
+ replyModel.setCc(message.getRecipients(RecipientType.CC)[0].toString());
+ }
+ if (ArrayUtils.isNotEmpty(message.getRecipients(RecipientType.BCC))) {
+ replyModel.setCci(message.getRecipients(RecipientType.BCC)[0].toString());
+ }
if (message.isMimeType("multipart/*")) {
decomposeMultipartEmail(message, replyModel, reply.getTopiaId());
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-08-04 09:42:59 UTC (rev 460)
@@ -48,6 +48,24 @@
editable: { !model.isReadonly() };
}
+#ccLabel {
+ text: "faxtomail.reply.label.cc";
+}
+
+#ccField {
+ text: { model.getCc() };
+ editable: { !model.isReadonly() };
+}
+
+#cciLabel {
+ text: "faxtomail.reply.label.cci";
+}
+
+#cciField {
+ text: { model.getCci() };
+ editable: { !model.isReadonly() };
+}
+
#subjectLabel {
text: "faxtomail.reply.label.subject";
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-08-04 09:42:59 UTC (rev 460)
@@ -92,6 +92,24 @@
</row>
<row>
<cell>
+ <JLabel id="ccLabel"/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id="ccField"
+ onKeyReleased='handler.setText(event, "cc")'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="cciLabel"/>
+ </cell>
+ <cell weightx='1'>
+ <JTextField id="cciField"
+ onKeyReleased='handler.setText(event, "cci")'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
<JLabel id="subjectLabel"/>
</cell>
<cell weightx='1'>
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-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-08-04 09:42:59 UTC (rev 460)
@@ -46,6 +46,8 @@
private static final Log log = LogFactory.getLog(ReplyFormUIModel.class);
public static final String PROPERTY_TO = "to";
+ public static final String PROPERTY_CC = "cc";
+ public static final String PROPERTY_CCI = "cci";
public static final String PROPERTY_FROM = "from";
public static final String PROPERTY_SUBJECT = "subject";
public static final String PROPERTY_MESSAGE = "message";
@@ -59,6 +61,8 @@
public static final String PROPERTY_SENDER_ALLOWED_ADDRESSES = "senderAllowedAddresses";
protected String to;
+ protected String cc;
+ protected String cci;
protected String from;
protected String subject;
protected String message;
@@ -85,6 +89,25 @@
firePropertyChange(PROPERTY_TO, oldValue, to);
}
+ public String getCc() {
+ return cc;
+ }
+ public void setCc(String cc) {
+ Object oldValue = this.cc;
+ this.cc = cc;
+ firePropertyChange(PROPERTY_CC, oldValue, cc);
+ }
+
+ public String getCci() {
+ return cci;
+ }
+
+ public void setCci(String cci) {
+ Object oldValue = this.cci;
+ this.cci = cci;
+ firePropertyChange(PROPERTY_CCI, oldValue, cci);
+ }
+
public String getFrom() {
return from;
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml 2014-08-04 09:42:59 UTC (rev 460)
@@ -37,6 +37,18 @@
<message>faxtomail.validator.error.reply.to.email</message>
</field-validator>
</field>
+
+ <field name="cc">
+ <field-validator type="email" short-circuit="true">
+ <message>faxtomail.validator.error.reply.cc.email</message>
+ </field-validator>
+ </field>
+
+ <field name="cci">
+ <field-validator type="email" short-circuit="true">
+ <message>faxtomail.validator.error.reply.cci.email</message>
+ </field-validator>
+ </field>
<field name="from">
<field-validator type="fieldexpression" short-circuit="true">
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-08-01 16:25:18 UTC (rev 459)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-04 09:42:59 UTC (rev 460)
@@ -237,6 +237,8 @@
faxtomail.reply.attachment.label=%1$s (%2$s ko)
faxtomail.reply.attachments.add.label=Ajouter des pièces jointes
faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés)
+faxtomail.reply.label.cc=Copie \:
+faxtomail.reply.label.cci=Copie cachée \:
faxtomail.reply.label.from=De \:
faxtomail.reply.label.subject=Objet \:
faxtomail.reply.label.to=À \:
@@ -273,12 +275,14 @@
faxtomail.validator.error.email.priority.required=Priorité requise
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.cc.email=Le champ 'Copie\:' doit être une adresse email valide \!
+faxtomail.validator.error.reply.cci.email=Le champ 'opie cachée\:' doit être une adresse email valide \!
faxtomail.validator.error.reply.from.invalidDomain=
faxtomail.validator.error.reply.from.required=
faxtomail.validator.error.reply.subject.required=
-faxtomail.validator.error.reply.to.email=
-faxtomail.validator.error.reply.to.required=
-faxtomail.validator.error.reply.totalAttachmentLength.required=
+faxtomail.validator.error.reply.to.email=Le champ 'A\:' doit être une adresse email valide \!
+faxtomail.validator.error.reply.to.required=Le champ 'A\:' est requis \!
+faxtomail.validator.error.reply.totalAttachmentLength.required=La taille totale des pièces jointes dépasse la limite acceptée
jaxx.application.error.cannot.mail=
jaxx.application.error.cannot.print=
jaxx.application.error.desktop.not.supported=
1
0
r459 - in trunk: faxtomail-persistence/src/main/java/com/franciaflex/faxtomail faxtomail-persistence/src/main/resources/i18n faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing 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/search faxtomail-ui-swing/src/main/resources/i18n
by echatellier@users.forge.codelutin.com 01 Aug '14
by echatellier@users.forge.codelutin.com 01 Aug '14
01 Aug '14
Author: echatellier
Date: 2014-08-01 18:25:18 +0200 (Fri, 01 Aug 2014)
New Revision: 459
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/459
Log:
fixes #5558: Pouvoir configurer le nombre de mails lors de la pagination (dans l'UI swing)
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java
trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties
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/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/demande/DemandeListUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.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/SearchToGroupUIHandler.java
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/search/SearchUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -405,6 +405,14 @@
return applicationConfig.getOptionAsColor(FaxToMailConfigurationOption.COLOR_SELECTED_ROW.getKey());
}
+ public int getResultPerPage() {
+ return applicationConfig.getOptionAsInt(FaxToMailConfigurationOption.RESULT_PER_PAGE.getKey());
+ }
+
+ public void setResultPerPage(int resultPerPage) {
+ applicationConfig.setOption(FaxToMailConfigurationOption.RESULT_PER_PAGE.getKey(), String.valueOf(resultPerPage));
+ }
+
@Override
public KeyStroke getShortcutClosePopup() {
return applicationConfig.getOptionAsKeyStroke(FaxToMailConfigurationOption.SHORTCUT_CLOSE_POPUP.getKey());
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java 2014-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -297,6 +297,13 @@
n("faxtomail.config.option.ui.dateFormat.description"),
"dd/MM/yyyy",
String.class
+ ),
+
+ RESULT_PER_PAGE(
+ "faxtomail.ui.resultPerPage",
+ n("faxtomail.config.option.ui.resultPerPage.description"),
+ "50",
+ Integer.class
);
/** Configuration key. */
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties 2014-08-01 16:25:18 UTC (rev 459)
@@ -18,6 +18,7 @@
faxtomail.config.option.ui.color.selectedRow.description=
faxtomail.config.option.ui.config.file.description=
faxtomail.config.option.ui.dateFormat.description=
+faxtomail.config.option.ui.resultPerPage.description=
faxtomail.config.option.ui.shortcut.closePopup.description=
faxtomail.config.option.ui.showNumberEditorButton.description=
faxtomail.config.option.version.description=
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -425,7 +425,7 @@
}
/**
- * Retourne l'utilsateur connecté sur la session utilsateur (ou a defaut un utilisateur de test).
+ * Retourne l'utilsateur connecté sur la session utilisateur (ou a defaut un utilisateur de test).
*
* @return trigramme
*/
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-08-01 16:25:18 UTC (rev 459)
@@ -121,6 +121,10 @@
text: { String.valueOf(model.getPaginationResult().getCount()) };
}
+#resultsPerPageLabel {
+ text: "faxtomail.demandeList.resultPerPage";
+}
+
#pageNumberLabel {
text: "faxtomail.demandeList.pages";
}
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-08-01 16:25:18 UTC (rev 459)
@@ -97,6 +97,10 @@
<JLabel id="totalDemandCountLabel" />
<JLabel id="totalDemandCountValue" />
+ <JLabel styleClass="horizontal-separator" />
+ <JLabel id="resultsPerPageLabel" />
+ <JComboBox id="resultPerPageCombo" genericType="Integer" />
+
<JLabel styleClass="horizontal-separator"/>
<JLabel id="pageNumberLabel" />
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -27,9 +27,12 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.ObjectInputStream.GetField;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -39,6 +42,7 @@
import java.util.List;
import java.util.Map;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JComponent;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
@@ -54,10 +58,6 @@
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
-import com.franciaflex.faxtomail.ui.swing.actions.PrintOnDefaultPrinterAction;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -87,6 +87,7 @@
import com.franciaflex.faxtomail.ui.swing.actions.ArchiveFromListAction;
import com.franciaflex.faxtomail.ui.swing.actions.ComputeQuantitiesByRangeAction;
import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction;
+import com.franciaflex.faxtomail.ui.swing.actions.PrintOnDefaultPrinterAction;
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;
@@ -94,6 +95,8 @@
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 com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
/**
* Handler of UI {@link com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler}.
@@ -143,8 +146,6 @@
this.ui.setContextValue(model);
}
- private boolean loading = false;
-
@Override
public void afterInit(DemandeListUI ui) {
@@ -317,6 +318,18 @@
}
});
+ // int combo box for result per page
+ ui.getResultPerPageCombo().setModel(new DefaultComboBoxModel<Integer>(new Integer[] {10, 20, 30, 40, 50}));
+ int resultPerPage = getConfig().getResultPerPage();
+ ui.getModel().setResultPerPage(resultPerPage);
+ ui.getResultPerPageCombo().setSelectedItem(resultPerPage);
+ ui.getResultPerPageCombo().addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ updateResultPerPage(e);
+ }
+ });
+
MailFolder currentMailFolder = getContext().getCurrentMailFolder();
DemandeUIModel currentEmail = getContext().getCurrentEmail();
@@ -327,24 +340,36 @@
DefaultMutableTreeNode node = nodesByFolder.get(currentMailFolder);
navigationTree.setSelectionPath(new TreePath(node.getPath()));
}
-
}
public void goToNextPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage());
- LoadFolderEmailsAction loadFolderEmailsAction =
- getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this,
- LoadFolderEmailsAction.class);
- getContext().getActionEngine().runAction(loadFolderEmailsAction);
+ runListAction();
}
public void goToPreviousPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage());
- LoadFolderEmailsAction loadFolderEmailsAction =
- getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this,
- LoadFolderEmailsAction.class);
- getContext().getActionEngine().runAction(loadFolderEmailsAction);
+ runListAction();
}
+
+ public void updateResultPerPage(ItemEvent event) {
+ //FIXME echatellier 20140801 this produce transasction exception
+ int resultPerPage = (Integer)event.getItem();
+ getModel().setResultPerPage(resultPerPage);
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().resetPaginationParameter();
+ runListAction();
+ }
+
+ protected void runListAction() {
+ if (getModel().getSelectedFolder() != null) { // can be when update result per page
+ LoadFolderEmailsAction loadFolderEmailsAction =
+ getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this,
+ LoadFolderEmailsAction.class);
+ getContext().getActionEngine().runAction(loadFolderEmailsAction);
+ }
+ }
@Override
public void initDemandeTable(final JXTable table, boolean sortable) {
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -53,13 +53,16 @@
public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled";
public static final String PROPERTY_COMPUTE_QUANTITIES_BY_RANGE_ENABLED = "computeQuantitiesByRangeEnabled";
public static final String PROPERTY_NEW_DEMAND_ENABLED = "newDemandEnabled";
+ public static final String PROPERTY_RESULT_PER_PAGE = "resultPerPage";
protected List<MailFolder> folders;
protected List<DemandeUIModel> emails;
- protected PaginationParameter paginationParameter = PaginationParameter.of(0, 50, Email.PROPERTY_RECEPTION_DATE, false);
+ protected int resultPerPage = 50;
+ protected PaginationParameter paginationParameter = PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false);
+
protected PaginationResult<Email> paginationResult = PaginationResult.of(null, 0, paginationParameter);
protected List<DemandeUIModel> filteredEmails;
@@ -113,7 +116,7 @@
}
public void resetPaginationParameter() {
- setPaginationParameter(PaginationParameter.of(0, 50, Email.PROPERTY_RECEPTION_DATE, false));
+ setPaginationParameter(PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false));
}
public void setPaginationResult(PaginationResult<Email> paginationResult) {
@@ -254,4 +257,14 @@
this.savNb = savNb;
firePropertyChange(PROPERTY_SAV_NB, oldValue, savNb);
}
+
+ public void setResultPerPage(int resultPerPage) {
+ int oldValue = this.resultPerPage;
+ this.resultPerPage = resultPerPage;
+ firePropertyChange(PROPERTY_RESULT_PER_PAGE, oldValue, resultPerPage);
+ }
+
+ public int getResultPerPage() {
+ return resultPerPage;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -40,8 +40,10 @@
import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
+
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
@@ -53,6 +55,7 @@
import org.nuiton.jaxx.application.swing.tab.TabHandler;
import javax.swing.*;
+
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-08-01 16:25:18 UTC (rev 459)
@@ -296,6 +296,10 @@
text: { String.valueOf(model.getPaginationResult().getCount()) };
}
+#resultsPerPageLabel {
+ text: "faxtomail.demandeList.resultPerPage";
+}
+
#pageNumberLabel {
text: "faxtomail.demandeList.pages";
}
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx 2014-08-01 16:25:18 UTC (rev 459)
@@ -347,6 +347,10 @@
<JLabel id="totalDemandCountLabel" />
<JLabel id="totalDemandCountValue" />
+ <JLabel styleClass="horizontal-separator" />
+ <JLabel id="resultsPerPageLabel" />
+ <JComboBox id="resultPerPageCombo" genericType="Integer" />
+
<JLabel styleClass="horizontal-separator"/>
<JLabel id="pageNumberLabel" />
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -30,6 +30,7 @@
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.GroupAction;
+import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
import com.franciaflex.faxtomail.ui.swing.actions.SearchToGroupAction;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler;
@@ -50,6 +51,8 @@
import javax.swing.event.ListSelectionListener;
import java.awt.*;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@@ -219,40 +222,47 @@
};
dataTable.addHighlighter(new ColorHighlighter(rowAlreadyInGroupPredicate, null, Color.GRAY, Color.GRAY, Color.WHITE));
+ // int combo box for result per page
+ ui.getResultPerPageCombo().setModel(new DefaultComboBoxModel<Integer>(new Integer[] {10, 20, 30, 40, 50}));
+ int resultPerPage = getConfig().getResultPerPage();
+ ui.getModel().setResultPerPage(resultPerPage);
+ ui.getResultPerPageCombo().setSelectedItem(resultPerPage);
+ ui.getResultPerPageCombo().addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ updateResultPerPage(e);
+ }
+ });
}
public void searchDemandes() {
getModel().resetPaginationParameter();
- try {
- SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
- searchAction.doAction();
-
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("error while searching", e);
- }
- getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
- }
+ runSearchAction();
}
public void goToNextPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage());
- try {
- SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
- searchAction.doAction();
-
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("error while searching", e);
- }
- getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
- }
+ runSearchAction();
}
public void goToPreviousPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage());
+ runSearchAction();
+ }
+
+ public void updateResultPerPage(ItemEvent event) {
+ getContext().createNewTransaction();
+ int resultPerPage = (Integer)event.getItem();
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().setResultPerPage(resultPerPage);
+ getModel().resetPaginationParameter();
+ runSearchAction();
+ }
+
+ protected void runSearchAction() {
try {
- SearchToGroupAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchToGroupAction.class);
+ SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
searchAction.doAction();
} catch (Exception e) {
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-08-01 16:25:18 UTC (rev 459)
@@ -322,6 +322,10 @@
text: { String.valueOf(model.getPaginationResult().getCount()) };
}
+#resultsPerPageLabel {
+ text: "faxtomail.demandeList.resultPerPage";
+}
+
#pageNumberLabel {
text: "faxtomail.demandeList.pages";
}
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-08-01 16:25:18 UTC (rev 459)
@@ -367,11 +367,16 @@
<JLabel id="totalDemandCountLabel" />
<JLabel id="totalDemandCountValue" />
+ <JLabel styleClass="horizontal-separator" />
+ <JLabel id="resultsPerPageLabel" />
+ <JComboBox id="resultPerPageCombo" genericType="Integer" />
+
<JLabel styleClass="horizontal-separator"/>
<JLabel id="pageNumberLabel" />
<JButton id="previousPageButton"
onActionPerformed="handler.goToPreviousPage()"/>
+
<JLabel id="currentPageLabel" />
<JLabel styleClass="page-separator"/>
<JLabel id="totalPageNumberLabel" />
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -24,14 +24,16 @@
import static org.nuiton.i18n.I18n.t;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JComponent;
import javax.swing.ListSelectionModel;
@@ -96,7 +98,6 @@
initUI(ui);
- long before = System.currentTimeMillis();
final ReferentielService referentielService = getContext().getReferentielService();
// this loading take 1,5 seconds
@@ -182,41 +183,47 @@
getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
}
}
- long after = System.currentTimeMillis();
- System.out.println("Time = " + (after - before) + " ms");
+
+ // int combo box for result per page
+ ui.getResultPerPageCombo().setModel(new DefaultComboBoxModel<Integer>(new Integer[] {10, 20, 30, 40, 50}));
+ int resultPerPage = getConfig().getResultPerPage();
+ ui.getModel().setResultPerPage(resultPerPage);
+ ui.getResultPerPageCombo().setSelectedItem(resultPerPage);
+ ui.getResultPerPageCombo().addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ updateResultPerPage(e);
+ }
+ });
}
public void searchDemandes() {
getContext().createNewTransaction();
getModel().resetPaginationParameter();
- try {
- SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
- searchAction.doAction();
-
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("error while searching", e);
- }
- getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
- }
+ runSearchAction();
}
public void goToNextPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage());
- try {
- SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
- searchAction.doAction();
-
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("error while searching", e);
- }
- getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
- }
+ runSearchAction();
}
public void goToPreviousPage() {
getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage());
+ runSearchAction();
+ }
+
+ public void updateResultPerPage(ItemEvent event) {
+ getContext().createNewTransaction();
+ int resultPerPage = (Integer)event.getItem();
+ getConfig().setResultPerPage(resultPerPage);
+ getConfig().save();
+ getModel().setResultPerPage(resultPerPage);
+ getModel().resetPaginationParameter();
+ runSearchAction();
+ }
+
+ protected void runSearchAction() {
try {
SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
searchAction.doAction();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-08-01 16:25:18 UTC (rev 459)
@@ -56,10 +56,12 @@
public static final String PROPERTY_GROUP_ENABLED = "groupEnabled";
public static final String PROPERTY_PAGINATION_PARAMETER = "paginationParameter";
public static final String PROPERTY_PAGINATION_RESULT = "paginationResult";
+ public static final String PROPERTY_RESULT_PER_PAGE = "resultPerPage";
protected final EmailFilter editObject = new EmailFilter();
- protected PaginationParameter paginationParameter = PaginationParameter.of(0, 50, Email.PROPERTY_RECEPTION_DATE, false);
+ protected int resultPerPage = 50;
+ protected PaginationParameter paginationParameter = PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false);
protected PaginationResult<Email> paginationResult = PaginationResult.of(null, 0, paginationParameter);
protected List<DemandeUIModel> results;
@@ -393,6 +395,16 @@
firePropertyChanged(PROPERTY_RESULTS, null, results);
}
+ public void setResultPerPage(int resultPerPage) {
+ int oldValue = this.resultPerPage;
+ this.resultPerPage = resultPerPage;
+ firePropertyChanged(PROPERTY_RESULT_PER_PAGE, oldValue, resultPerPage);
+ }
+
+ public int getResultPerPage() {
+ return resultPerPage;
+ }
+
public void setPaginationParameter(PaginationParameter paginationParameter) {
Object oldValue = this.paginationParameter;
this.paginationParameter = paginationParameter;
@@ -404,7 +416,7 @@
}
public void resetPaginationParameter() {
- setPaginationParameter(PaginationParameter.of(0, 50, Email.PROPERTY_RECEPTION_DATE, false));
+ setPaginationParameter(PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false));
}
public void setPaginationResult(PaginationResult<Email> paginationResult) {
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-08-01 15:47:29 UTC (rev 458)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-08-01 16:25:18 UTC (rev 459)
@@ -143,6 +143,7 @@
faxtomail.demandeList.pages=Pages \:
faxtomail.demandeList.pfNbLabel=Nombre de produits finis
faxtomail.demandeList.quotationNbLabel=Nombre de devis
+faxtomail.demandeList.resultPerPage=Nombre de résultat par page \:
faxtomail.demandeList.savNbLabel=Nombre de SAV
faxtomail.demandeList.table.header.attachment=PJ
faxtomail.demandeList.table.header.attachment.tip=Pièces-jointes
1
0
r458 - trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail
by echatellier@users.forge.codelutin.com 01 Aug '14
by echatellier@users.forge.codelutin.com 01 Aug '14
01 Aug '14
Author: echatellier
Date: 2014-08-01 17:47:29 +0200 (Fri, 01 Aug 2014)
New Revision: 458
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/458
Log:
Move mail check frequency to every minutes
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java 2014-08-01 08:01:57 UTC (rev 457)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java 2014-08-01 15:47:29 UTC (rev 458)
@@ -137,7 +137,7 @@
JOB_MAIL_EXPRESSION(
"faxtomail.job.mail.expression",
- "Expression cron de lancement du job Mail", "0 */5 * * * ?", String.class),
+ "Expression cron de lancement du job Mail", "0 * * * * ?", String.class),
JOB_CLIENT_EXPRESSION(
"faxtomail.job.client.expression",
1
0