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
May 2014
- 3 participants
- 78 discussions
r83 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/actions java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor resources/i18n resources/icons
by kmorin@users.forge.codelutin.com 20 May '14
by kmorin@users.forge.codelutin.com 20 May '14
20 May '14
Author: kmorin
Date: 2014-05-20 23:03:58 +0200 (Tue, 20 May 2014)
New Revision: 83
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/83
Log:
fixes #5112 Permettre le surlignement
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx
trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
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/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-20 21:03:58 UTC (rev 83)
@@ -41,6 +41,7 @@
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorHighlighterUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
@@ -56,6 +57,7 @@
import com.itextpdf.text.pdf.PdfAction;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfDictionary;
+import com.itextpdf.text.pdf.PdfGState;
import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfNumber;
import com.itextpdf.text.pdf.PdfReader;
@@ -212,6 +214,25 @@
cb.stroke();
cb.restoreState();
}
+
+ for (PDFEditorHighlighterUI panel : model.getPages()[i].getHighlighters()) {
+
+ Point location = panel.getLocation();
+ int width = (int) (panel.getWidth() / zoom);
+ int height = (int) (panel.getHeight() / zoom);
+ int x = (int) (location.x / zoom);
+ int y = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - height;
+
+ cb.saveState();
+ PdfGState gs1 = new PdfGState();
+ gs1.setFillOpacity(0.4f);
+ cb.setGState(gs1);
+
+ cb.setColorFill(BaseColor.YELLOW);
+ cb.rectangle(x, y, width, height);
+ cb.fill();
+ cb.restoreState();
+ }
}
pdfStamper.close();
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css (from rev 81, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css 2014-05-20 21:03:58 UTC (rev 83)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * FaxToMail :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+#highlighterPanel {
+ //scaleImageToFitPanel: { true };
+ border: { BorderFactory.createDashedBorder(null) };
+ background: { new Color(255, 255, 0, 100) };
+ size: { new Dimension(500, 200) };
+}
+
+#removeButton {
+ text: "X";
+ //borderPainted: { false };
+ //border: { null };
+ //opaque : { false };
+ //background: { null };
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx (from rev 81, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx 2014-05-20 21:03:58 UTC (rev 83)
@@ -0,0 +1,51 @@
+<!--
+ #%L
+ FaxToMail :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2014 Franciaflex, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='highlighterPanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'>
+
+ <import>
+ java.awt.BasicStroke
+ java.awt.Color
+ java.awt.Dimension
+ java.awt.FlowLayout
+ java.awt.Font
+ java.awt.Graphics
+ java.awt.Graphics2D
+ javax.swing.BorderFactory
+ javax.swing.JPanel
+ </import>
+
+ <script><![CDATA[
+
+ protected void removeCross() {
+ JPanel container = getParentContainer(JPanel.class);
+ container.remove(this);
+ container.updateUI();
+ }
+
+ ]]></script>
+
+ <JButton id="removeButton"
+ onActionPerformed="removeCross()"/>
+
+</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-20 21:03:58 UTC (rev 83)
@@ -46,6 +46,11 @@
toolTipText: "faxtomail.pdfEditor.button.addLine.tip";
}
+#highlighterButton {
+ actionIcon: highlighter;
+ toolTipText: "faxtomail.pdfEditor.button.addHighlighter.tip";
+}
+
#prevPageButton {
actionIcon: left;
enabled: { getModel().getCurrentPageIndex() > 1 };
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-20 21:03:58 UTC (rev 83)
@@ -55,6 +55,8 @@
onActionPerformed="handler.addCross()"/>
<JButton id='lineButton'
onActionPerformed="handler.addLine()"/>
+ <JButton id='highlighterButton'
+ onActionPerformed="handler.addHighlighter()"/>
<JSeparator constructorParams="SwingConstants.VERTICAL"/>
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-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-05-20 21:03:58 UTC (rev 83)
@@ -114,6 +114,9 @@
} else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) {
currentPage.addLine((PDFEditorLineUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) {
+ currentPage.addHighlighter((PDFEditorHighlighterUI) child);
}
}
@@ -129,6 +132,9 @@
} else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) {
currentPage.removeLine((PDFEditorLineUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) {
+ currentPage.removeHighlighter((PDFEditorHighlighterUI) child);
}
}
});
@@ -249,6 +255,12 @@
cr.registerComponent(ComponentResizer.DIRECTION_HORIZONTAL, line);
}
+ public void addHighlighter() {
+ PDFEditorHighlighterUI highlighter = new PDFEditorHighlighterUI();
+ addPanel(highlighter);
+ cr.registerComponent(highlighter);
+ }
+
protected void addPanel(JPanel panel) {
JPanel container = ui.getContainer();
container.add(panel, 0);
@@ -415,6 +427,35 @@
panel);
}
+ for (PDFEditorHighlighterUI panel : p.getHighlighters()) {
+ panel.setVisible(true);
+
+ Rectangle bounds = panel.getBounds();
+
+ int newWidth = orientation180 ? bounds.width : bounds.height;
+ int newHeight = orientation180 ? bounds.height : bounds.width;
+
+ int x, y;
+
+ if (rotationDiff == 0) {
+ x = bounds.x;
+ y = bounds.y;
+
+ } else if (rotationDiff == 90 || rotationDiff == -270) {
+ x = rect.width - newWidth - bounds.y;
+ y = bounds.x;
+
+ } else {
+ x = bounds.y;
+ y = rect.height - newHeight - bounds.x;
+ }
+
+ panel.setBounds((int) (zoomRatio * x) + insets.left,
+ (int) (zoomRatio * y) + insets.top,
+ (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight));
+
+ }
+
container.updateUI();
}
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-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-05-20 21:03:58 UTC (rev 83)
@@ -56,6 +56,7 @@
protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>();
protected List<PDFEditorCrossUI> crosses = new ArrayList<PDFEditorCrossUI>();
protected List<PDFEditorLineUI> lines = new ArrayList<PDFEditorLineUI>();
+ protected List<PDFEditorHighlighterUI> highlighters = new ArrayList<PDFEditorHighlighterUI>();
public List<PDFEditorNoteUI> getNotes() {
return notes;
@@ -92,6 +93,18 @@
public void removeLine(PDFEditorLineUI line) {
lines.remove(line);
}
+
+ public List<PDFEditorHighlighterUI> getHighlighters() {
+ return highlighters;
+ }
+
+ public void addHighlighter(PDFEditorHighlighterUI highlighter) {
+ highlighters.add(highlighter);
+ }
+
+ public void removeHighlighter(PDFEditorHighlighterUI highlighter) {
+ highlighters.remove(highlighter);
+ }
}
protected Page[] pages;
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-05-20 14:25:32 UTC (rev 82)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-20 21:03:58 UTC (rev 83)
@@ -200,6 +200,7 @@
faxtomail.pdfEditor.action.validate=Enregistrer
faxtomail.pdfEditor.action.validate.tip=Enregistrer les changements et fermer
faxtomail.pdfEditor.button.addCross.tip=Ajouter une croix
+faxtomail.pdfEditor.button.addHighlighter.tip=Ajouter un surlignement
faxtomail.pdfEditor.button.addLine.tip=Ajouter une ligne
faxtomail.pdfEditor.button.addNote.tip=Ajouter une note
faxtomail.pdfEditor.button.nextPage=Page suivante
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png
===================================================================
(Binary files differ)
1
0
20 May '14
Author: echatellier
Date: 2014-05-20 16:25:32 +0200 (Tue, 20 May 2014)
New Revision: 82
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/82
Log:
refs #4666: Stockage des pi?\195?\168ces jointes dans la base de donn?\195?\169es (byte[])
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.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/attachment/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.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/content/print/AttachmentToPrintChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.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/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-swing/src/main/resources/log4j.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -0,0 +1,95 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AttachmentFileImpl extends AttachmentFileAbstract {
+
+ private static final Log log = LogFactory.getLog(AttachmentFileImpl.class);
+
+ /** Transient file instance with blob content on local file system. */
+ protected transient File tmpLocalFile;
+
+ @Override
+ public File getFile() {
+ if (tmpLocalFile == null && getContent() != null) {
+ try {
+ // create temp file
+ tmpLocalFile = File.createTempFile("faxtomail-", ".tmp");
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Copy blob content to file : %s", tmpLocalFile.getAbsolutePath()));
+ }
+ tmpLocalFile.deleteOnExit();
+
+ // copy blob content
+ // be sure that "is" is not closed because is can be a local fileinputstream
+ // that hibernate must read to put in database
+ InputStream is = new ByteArrayInputStream(getContent());
+ FileOutputStream fos = new FileOutputStream(tmpLocalFile);
+ IOUtils.copy(is, fos);
+ fos.close();
+
+ } catch (IOException ex) {
+ throw new RuntimeException("Can't create file on local file system", ex);
+ }
+ }
+ return tmpLocalFile;
+ }
+
+ @Override
+ public long getLength() {
+ long result = 0;
+ if (getFile() != null) {
+ result = getFile().length();
+ }
+ return result;
+ }
+
+ /**
+ * Overwrite finalize to delete local tmp file if necessary.
+ */
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ if (tmpLocalFile != null) {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Deleting file : %s", tmpLocalFile.getAbsolutePath()));
+ }
+ tmpLocalFile.delete();
+ }
+ } finally {
+ super.finalize();
+ }
+ }
+}
Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,5 +24,14 @@
model.tagValue.notGenerateToString=true
model.tagValue.constantPrefix=PROPERTY_
model.tagValue.java.lang.String=text
+#model.tagvalue.java.sql.Blob=blob
+#model.tagvalue.byte=binary
model.tagValue.useEnumerationName=true
model.tagValue.doNotGenerateBooleanGetMethods=true
+
+# Attachment
+com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFile.tagvalue.notNull=true
+
+# AttachmentFile
+com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.filename.tagvalue.notNull=true
+com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,17 +24,18 @@
* #L%
*/
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.nuiton.decorator.Decorator;
+import org.nuiton.decorator.DecoratorProvider;
+
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
import com.franciaflex.faxtomail.persistence.entities.Reply;
-import org.nuiton.decorator.Decorator;
-import org.nuiton.decorator.DecoratorProvider;
-import java.io.File;
-import java.text.DateFormat;
-import java.util.Date;
-
/**
* FaxToMail decorator service.
*
@@ -112,7 +113,7 @@
return DateFormat.getDateInstance(DateFormat.MEDIUM).format(bean);
}
});
- registerDecorator(new Decorator<File>(File.class) {
+ /*registerDecorator(new Decorator<File>(File.class) {
private static final long serialVersionUID = 1L;
@Override
@@ -122,13 +123,45 @@
}
return ((File) bean).getName();
}
+ });*/
+ /*registerDecorator(new Decorator<AttachmentFile>(AttachmentFile.class) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(Object bean) {
+ if (bean == null) {
+ return "";
+ }
+ return ((AttachmentFile) bean).getFilename();
+ }
+ });*/
+ registerMultiJXPathDecorator(HasLabel.class, "${label}$s", SEPARATOR, " - ");
+ //registerMultiJXPathDecorator(Attachment.class, "${originalFile}$s", SEPARATOR, " - ");
+ registerDecorator(new Decorator<Attachment>(Attachment.class) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(Object bean) {
+ if (bean == null) {
+ return "";
+ }
+ return ((Attachment) bean).getOriginalFile().getFilename();
+ }
});
- registerMultiJXPathDecorator(HasLabel.class, "${label}$s", SEPARATOR, " - ");
- registerMultiJXPathDecorator(Attachment.class, "${originalFile}$s", SEPARATOR, " - ");
+ registerDecorator(new Decorator<AttachmentFile>(AttachmentFile.class) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(Object bean) {
+ if (bean == null) {
+ return "";
+ }
+ return ((AttachmentFile) bean).getFilename();
+ }
+ });
registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - ");
registerMultiJXPathDecorator(FaxToMailUser.class, "${trigraph}$s#${firstName}$s#${lastName}$s", SEPARATOR, " ");
}
};
}
-
}
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,22 +24,33 @@
* #L%
*/
+import static org.nuiton.i18n.I18n.t;
+
import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Writer;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.MessagingException;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,9 +58,15 @@
import org.apache.commons.mail.EmailConstants;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.MultiPartEmail;
+import org.nuiton.topia.persistence.TopiaEntities;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
@@ -71,12 +88,9 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import javax.mail.MessagingException;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
@@ -85,6 +99,9 @@
private static final Log log = LogFactory.getLog(EmailService.class);
+ protected Binder<Attachment, Attachment> attachmentBinder =
+ BinderFactory.newBinder(Attachment.class, Attachment.class);
+
public Email getEmailById(String id) {
Email email = getPersistenceContext().getEmailDao().findByTopiaId(id);
return email;
@@ -100,10 +117,10 @@
* @throws InvalidClientException if client code is not valid
*/
public Email saveEmail(Email email, FaxToMailUser user, String... modifiedFields) throws InvalidClientException {
- return saveEmail(email, null, user, modifiedFields);
+ return saveEmail(email, null, null, user, modifiedFields);
}
- public Email saveEmail(Email email, String clientCode, FaxToMailUser user, String... modifiedFields) throws InvalidClientException {
+ public Email saveEmail(Email email, Collection<Attachment> attachments, String clientCode, FaxToMailUser user, String... modifiedFields) throws InvalidClientException {
Date now = getNow();
ClientTopiaDao clientDao = getPersistenceContext().getClientDao();
EmailTopiaDao dao = getPersistenceContext().getEmailDao();
@@ -119,15 +136,47 @@
email.setClient(client);
}
- if (email.getAttachment() != null) {
- AttachmentTopiaDao attachmentDao = getPersistenceContext().getAttachmentDao();
- for (Attachment attachment : email.getAttachment()) {
- if (!attachment.isPersisted()) {
- attachmentDao.create(attachment);
+ if (attachments != null) {
+ Collection<Attachment> currentAttachments = CollectionUtils.emptyIfNull(email.getAttachment());
+ Map<String, Attachment> currentAttachmentIndex = new HashMap<>(Maps.uniqueIndex(currentAttachments, TopiaEntities.getTopiaIdFunction()));
+
+ AttachmentFileTopiaDao attachementFileTopiaDao = getPersistenceContext().getAttachmentFileDao();
+ for (Attachment attachment : attachments) {
+ // get session attachment from id
+ Attachment currentAttachment;
+ if (StringUtils.isNoneBlank(attachment.getTopiaId())) {
+ currentAttachment = currentAttachmentIndex.remove(attachment.getTopiaId());
} else {
- attachmentDao.update(attachment);
+ currentAttachment = new AttachmentImpl();
}
+
+ // copy new data
+ attachmentBinder.copy(attachment, currentAttachment);
+
+ // persist
+ if (currentAttachment.getEditedFile() != null) {
+ if (!currentAttachment.getEditedFile().isPersisted()) {
+ attachementFileTopiaDao.create(currentAttachment.getEditedFile());
+ } else {
+ attachementFileTopiaDao.update(currentAttachment.getEditedFile());
+ }
+ }
+ if (currentAttachment.getOriginalFile() != null) {
+ if (!currentAttachment.getOriginalFile().isPersisted()) {
+ attachementFileTopiaDao.create(currentAttachment.getOriginalFile());
+ } else {
+ attachementFileTopiaDao.update(currentAttachment.getOriginalFile());
+ }
+ }
+
+ if (!attachment.isPersisted()) {
+ // persist using cascade
+ currentAttachments.add(currentAttachment);
+ }
}
+
+ // delete not found attachments
+ currentAttachments.removeAll(currentAttachmentIndex.values());
}
if (email.getRangeRow() != null) {
@@ -411,7 +460,7 @@
}
public Email reply(String from, String to, String subject,
- String content, Collection<File> attachments,
+ String content, Collection<AttachmentFile> attachments,
String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException {
Email email = getEmailById(originalEmailId);
@@ -429,12 +478,17 @@
final String smtpUser = properties.getProperty("mail.user");
final String password = properties.getProperty("mail.password");
+ final String useSsl = properties.getProperty("mail.ssl");
MultiPartEmail message = new MultiPartEmail();
message.setHostName(properties.getProperty("mail.smtp.host"));
message.setSmtpPort(Integer.parseInt(properties.getProperty("mail.smtp.port")));
- message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
- message.setSSLOnConnect(true);
+ if (StringUtils.isNotBlank(smtpUser) && password != null) {
+ message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
+ }
+ if ("true".equalsIgnoreCase(useSsl)) {
+ message.setSSLOnConnect(true);
+ }
message.setCharset(EmailConstants.UTF_8);
message.setFrom(from);
@@ -442,9 +496,11 @@
message.setSubject(subject);
message.setMsg(content);
- for (File attachment : attachments) {
+ for (AttachmentFile attachmentFile : attachments) {
// Create the attachment
- message.attach(attachment);
+ File file = attachmentFile.getFile();
+ DataSource source = new FileDataSource(file);
+ message.attach(source, attachmentFile.getFilename(), null);
}
String emailId = message.send();
@@ -476,5 +532,24 @@
return email;
}
+
+ /**
+ * Save content stream into attachment file content.
+ *
+ * @param contentStream content
+ * @return attachmentFile filled by content
+ */
+ public AttachmentFile getAttachmentFileFromStream(InputStream contentStream) {
+ AttachmentFile attachmentFile = new AttachmentFileImpl();
+ try {
+ //Session hibernateSession = getPersistenceContext().getHibernateSupport().getHibernateSession();
+ //Blob contentBlob = Hibernate.getLobCreator(hibernateSession).createBlob(contentStream, contentStream.available());
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ IOUtils.copy(contentStream, output);
+ attachmentFile.setContent(output.toByteArray());
+ } catch (Exception ex) {
+ throw new RuntimeException("Can't save content", ex);
+ }
+ return attachmentFile;
+ }
}
-
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -481,7 +481,7 @@
email.setDemandType(demandType);
email.setPriority(priorities.get(random.nextInt(priorities.size())));
email.setRangeRow(rangeRows);
- getEmailService().saveEmail(email, email.getClient().getCode(), user,
+ getEmailService().saveEmail(email, null, email.getClient().getCode(), user,
Email.PROPERTY_DEMAND_TYPE, Email.PROPERTY_PRIORITY, Email.PROPERTY_RANGE_ROW);
}
}
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -46,17 +46,20 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.swing.session.BeanDoubleListState;
import jaxx.runtime.swing.session.BeanFilterableComboBoxState;
import jaxx.runtime.swing.session.State;
import jaxx.runtime.swing.session.SwingSession;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractBean;
import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.ClassPathI18nInitializer;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.jaxx.application.ApplicationConfiguration;
@@ -71,6 +74,7 @@
import javax.swing.*;
import javax.swing.event.RowSorterEvent;
import javax.swing.tree.TreePath;
+
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -401,9 +405,15 @@
log.info(String.format("Starts i18n with locale [%s] at [%s]",
i18nLocale, i18nDirectory));
}
- I18n.init(new UserI18nInitializer(
+
+ try {
+ I18n.init(new UserI18nInitializer(
i18nDirectory, new DefaultI18nInitializer("faxtomail-i18n")),
i18nLocale);
+ } catch (RuntimeException ex) {
+ // strange ide behaviour case (eclipse)
+ I18n.init(new ClassPathI18nInitializer(), i18nLocale);
+ }
// //--------------------------------------------------------------------//
// // init help
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,21 +24,33 @@
* #L%
*/
+import java.awt.Insets;
+import java.awt.Point;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import javax.swing.JTextArea;
+
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
+
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Image;
-import com.itextpdf.text.PageSize;
import com.itextpdf.text.Phrase;
-import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfAction;
@@ -54,26 +66,11 @@
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.SeekableStream;
import com.sun.pdfview.PDFFile;
-import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.SwingUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.css.Rect;
-import javax.media.jai.PlanarImage;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.image.RenderedImage;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -89,9 +86,12 @@
@Override
public void doAction() throws Exception {
+ AttachmentFile attachmentFile = getModel().getNotNullFile();
+ File file = attachmentFile.getFile();
+
PDFEditorUIModel model = getModel();
- File file = model.getNotNullFile();
+ //File file = model.getNotNullFile();
// InputStream inputStream;
// if (FaxToMailUIUtil.isFileAPDF(file)) {
@@ -109,7 +109,10 @@
PdfReader pdfReader = new PdfReader(inputStream);
- File target = new File(FileUtils.getTempDirectory(), model.getOriginalFile().getName() + "-annoté.pdf");
+ //File target = new File(FileUtils.getTempDirectory(), getModel().getOriginalFile().getName() + "-annoté.pdf");
+ File target = File.createTempFile("faxtomail-", ".tmp");
+ target.deleteOnExit();
+
FileOutputStream fos = new FileOutputStream(target);
PdfStamper pdfStamper = new PdfStamper(pdfReader, fos);
@@ -219,7 +222,11 @@
PdfAction action = new PdfAction(PdfAction.PRINTDIALOG);
writer.setOpenAction(action);
- getModel().setEditedFile(target);
+ // convert content to blob
+ InputStream is = new BufferedInputStream(new FileInputStream(target));
+ AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(is);
+ attachmentFileNew.setFilename(getModel().getOriginalFile().getFilename() + "-annoté.pdf");
+ getModel().setEditedFile(attachmentFileNew);
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,6 +24,16 @@
* #L%
*/
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.topia.persistence.TopiaEntities;
+import org.nuiton.util.beans.BeanMonitor;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -37,20 +47,6 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.RangeTableModel;
import com.google.common.collect.Maps;
-import org.apache.commons.lang3.StringUtils;
-import org.nuiton.jaxx.application.swing.action.ApplicationActionException;
-import org.nuiton.topia.persistence.TopiaEntities;
-import org.nuiton.util.beans.BeanMonitor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -96,12 +92,13 @@
FaxToMailUser currentUser = context.getCurrentUser();
Email email = model.toEntity(persistedEmail);
+ Collection<Attachment> attachments = model.getAttachment();
String clientCode = model.getClientCode();
BeanMonitor monitor = getHandler().getMonitor();
String[] modifiedProperties = monitor.getModifiedProperties();
- email = context.getEmailService().saveEmail(email, clientCode, currentUser, modifiedProperties);
+ email = context.getEmailService().saveEmail(email, attachments, clientCode, currentUser, modifiedProperties);
model.fromEntity(email);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -112,7 +112,7 @@
HistoryType.ATTACHMENT_OPENING,
context.getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getName());
+ attachment.getOriginalFile().getFilename());
model.fromEntity(email);
}
}
@@ -124,7 +124,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
context.getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getName());
+ attachment.getOriginalFile().getFilename());
model.fromEntity(email);
}
};
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -26,7 +26,6 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.ui.swing.content.MainUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
@@ -38,10 +37,25 @@
import org.apache.commons.collections4.CollectionUtils;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.util.FileUtil;
-import javax.swing.*;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Desktop;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;
@@ -51,13 +65,9 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
-import java.awt.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+
import static org.nuiton.i18n.I18n.t;
/**
@@ -148,7 +158,15 @@
attachment.setAddedByUser(true);
File file = ui.getFile().getSelectedFile();
if (file != null) {
- attachment.setOriginalFile(file);
+ try {
+ // warning, this not NOT be closed (will be by blob on commit)
+ InputStream is = new FileInputStream(file);
+ AttachmentFile attachmentFile = getContext().getEmailService().getAttachmentFileFromStream(is);
+ attachmentFile.setFilename(file.getName());
+ attachment.setOriginalFile(attachmentFile);
+ } catch (Exception e) {
+ getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.copy.file"), e);
+ }
getModel().addAttachment(attachment);
resetFields();
}
@@ -159,37 +177,28 @@
}
public void openAttachment(Attachment attachment) {
-// File file = getPersistenceService().getAttachmentFile(attachment.getId());
- File file = attachment.getOriginalFile();
- if (!file.exists()) {
- throw new ApplicationTechnicalException(t("faxtomail.attachmentEditor.fileNotFound", file.getAbsolutePath()));
- }
getModel().fireAttachmentOpened(attachment);
+ File file = attachment.getOriginalFile().getFile();
Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
try {
-// desktop.browse(file.toURI());
desktop.open(file);
-
} catch (IOException e) {
getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
}
}
public void editAttachment(Attachment attachment) {
- File file = attachment.getEditedFile();
- if (file == null) {
- file = attachment.getOriginalFile();
+ AttachmentFile attachmentFile = attachment.getEditedFile();
+ if (attachmentFile == null) {
+ attachmentFile = attachment.getOriginalFile();
}
- if (!file.exists()) {
- throw new ApplicationTechnicalException(t("faxtomail.attachmentEditor.fileNotFound", file.getAbsolutePath()));
- }
-
+ File file = attachmentFile.getFile();
getModel().fireAttachmentEdited(attachment);
- String extension = FileUtil.extension(file);
+ String extension = FileUtil.extension(attachmentFile.getFilename());
if (getModel().isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
MainUI mainUI = getContext().getMainUI();
@@ -203,9 +212,7 @@
} else {
Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
-// desktop.browse(file.toURI());
desktop.open(file);
-
} catch (IOException e) {
getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
}
@@ -220,7 +227,7 @@
}
int answer = JOptionPane.showConfirmDialog(ui,
t("faxtomail.attachmentEditor.deleteAttachment.message",
- attachment.getOriginalFile().getName()),
+ attachment.getOriginalFile().getFilename()),
t("faxtomail.attachmentEditor.deleteAttachment.title"),
JOptionPane.YES_NO_OPTION
);
@@ -239,7 +246,7 @@
}
public boolean isAttachmentEditable(Attachment attachment) {
- String extension = FileUtil.extension(attachment.getOriginalFile());
+ String extension = FileUtil.extension(attachment.getOriginalFile().getFilename());
return EDITABLE_EXTENSIONS.contains(extension.toUpperCase());
}
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -40,10 +40,10 @@
*/
public class AttachmentEditorUIModel extends AbstractFaxToMailBeanUIModel<AttachmentModelAware, AttachmentEditorUIModel> {
- public static final String PROPERTY_FILE = "file";
+ //public static final String PROPERTY_FILE = "file";
public static final String PROPERTY_EDITABLE = "editable";
- protected File file;
+ //protected File file;
protected boolean editable = true;
protected final Collection<Attachment> attachments = new ArrayList<Attachment>();
@@ -61,7 +61,7 @@
super(fromBeanBinder, toBeanBinder);
}
- public File getFile() {
+ /*public File getFile() {
return file;
}
@@ -69,7 +69,7 @@
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/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-20 14:25:32 UTC (rev 82)
@@ -26,7 +26,7 @@
}
#attachmentNameLabel {
- text: { attachment != null ? getAttachment().getOriginalFile().getName() : null };
+ text: { attachment != null ? getAttachment().getOriginalFile().getFilename() : null };
}
#toolbar {
@@ -41,7 +41,7 @@
#editAttachmentButton {
actionIcon: "edit";
- toolTipText: "faxtomail.attachmentEditor.action.open.tip";
+ toolTipText: "faxtomail.attachmentEditor.action.edit.tip";
enabled: { handler != null && handler.isAttachmentEditable(getAttachment()) };
visible: { isEditable() };
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -25,9 +25,7 @@
*/
import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
import org.apache.commons.collections4.CollectionUtils;
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -22,7 +22,6 @@
* #L%
*/
-import com.ezware.oxbow.swingbits.table.filter.AbstractTableFilter;
import com.ezware.oxbow.swingbits.table.filter.DistinctColumnItem;
import com.ezware.oxbow.swingbits.table.filter.ITableFilter;
import com.ezware.oxbow.swingbits.table.filter.JTableFilter;
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -22,7 +22,6 @@
* #L%
*/
-
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
@@ -33,20 +32,12 @@
import com.franciaflex.faxtomail.persistence.entities.Range;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.services.service.ReferentielService;
-import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
-import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenDialogAction;
import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction;
-import com.franciaflex.faxtomail.ui.swing.content.print.AttachmentToPrintChooserUI;
-import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
-import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
-import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI;
-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 com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -62,7 +53,6 @@
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction;
import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableCellAction;
import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction;
-import org.nuiton.jaxx.application.swing.util.ApplicationErrorHelper;
import org.nuiton.util.beans.BeanMonitor;
import javax.swing.*;
@@ -74,7 +64,6 @@
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -341,7 +330,7 @@
HistoryType.ATTACHMENT_OPENING,
getContext().getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getName());
+ attachment.getOriginalFile().getFilename());
getModel().setHistory(email.getHistory());
}
}
@@ -354,7 +343,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
getContext().getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getName());
+ attachment.getOriginalFile().getFilename());
getModel().setHistory(email.getHistory());
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -23,6 +23,7 @@
*/
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
@@ -42,6 +43,7 @@
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
+
import org.apache.commons.io.Charsets;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
@@ -60,6 +62,7 @@
import javax.mail.internet.ContentType;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
+
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayInputStream;
@@ -133,6 +136,9 @@
protected static Binder<Email, DemandeUIModel> fromBeanBinder =
BinderFactory.newBinder(Email.class, DemandeUIModel.class);
+ protected static Binder<Attachment, Attachment> fromAttachmentBinder =
+ BinderFactory.newBinder(Attachment.class, Attachment.class);
+
public DemandeUIModel() {
super(fromBeanBinder, toBeanBinder);
addPropertyChangeListener(Email.PROPERTY_HISTORY, new PropertyChangeListener() {
@@ -177,6 +183,40 @@
}
+ /**
+ * Surcharge pour dupliquer correctement les pieces jointes.
+ *
+ * FIXME echatellier 20140520 c'est pas terrible, mais c'est comme ca :p
+ */
+ @Override
+ public void fromEntity(Email entity) {
+ //super.fromEntity(entity);
+ fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT);
+ // specific attachment copy
+ Collection<Attachment> attachmentCopy = new ArrayList<Attachment>();
+ if (entity.getAttachment() != null) {
+ for (Attachment attachment : entity.getAttachment()) {
+ Attachment clone = new AttachmentImpl();
+ fromAttachmentBinder.copy(attachment, clone);
+ attachmentCopy.add(clone);
+ }
+ }
+ setAttachment(attachmentCopy);
+ }
+
+ @Override
+ public Email toEntity() {
+ Email result = newEntity();
+ toBeanBinder.copyExcluding(this, result, Email.PROPERTY_ATTACHMENT);
+ return result;
+ }
+
+ @Override
+ public Email toEntity(Email entity) {
+ toBeanBinder.copyExcluding(this, entity, Email.PROPERTY_ATTACHMENT);
+ return entity;
+ }
+
public Boolean getFax() {
return editObject.getFax();
}
@@ -790,6 +830,7 @@
protected void decomposeEmail() {
try {
+ // ce code peut provoquer une NPE avec les données de test
Message message = new MimeMessage(null, new ByteArrayInputStream(getOriginalEmail().getBytes()));
subject = message.getSubject();
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,33 +24,25 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.Reply;
-import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
-import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
-import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
-import com.google.common.collect.Iterables;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.mail.MultiPartEmail;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.HighlighterFactory;
+import static org.nuiton.i18n.I18n.t;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
-import javax.mail.MessagingException;
import javax.mail.Part;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
-import javax.swing.*;
+import javax.swing.AbstractCellEditor;
+import javax.swing.JComponent;
+import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;
@@ -60,15 +52,25 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
-import java.awt.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import static org.nuiton.i18n.I18n.t;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlighterFactory;
+
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.Reply;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
+import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
+import com.google.common.collect.Iterables;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -243,17 +245,21 @@
}
log.debug("FileName : " + fileName);
- File dir = new File(FileUtils.getTempDirectory(), topiaId);
+ /*File dir = new File(FileUtils.getTempDirectory(), topiaId);
if (!dir.exists()) {
dir.mkdir();
}
- File file = new File(dir, fileName);
- FileOutputStream fos = new FileOutputStream(file);
+ File file = new File(dir, fileName);*/
+ ByteArrayOutputStream fos = new ByteArrayOutputStream();
+
DataHandler dh = bp.getDataHandler();
dh.writeTo(fos);
- reply.addAttachment(file);
+ // copy content into an empty attachment
+ AttachmentFile attachment = new AttachmentFileImpl();
+ attachment.setContent(fos.toByteArray());
+ reply.addAttachment(attachment);
}
}
}
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,35 +24,14 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import com.itextpdf.text.*;
-import com.itextpdf.text.pdf.PdfWriter;
-import com.sun.media.jai.codec.ByteArraySeekableStream;
-import com.sun.media.jai.codec.ImageCodec;
-import com.sun.media.jai.codec.ImageDecoder;
-import com.sun.media.jai.codec.SeekableStream;
-import com.sun.pdfview.PDFFile;
-import com.sun.pdfview.PDFPage;
-import jaxx.runtime.swing.ComponentMover;
-import jaxx.runtime.swing.ComponentResizer;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.jaxx.application.ApplicationDataUtil;
-
-import javax.media.jai.PlanarImage;
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.awt.Font;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
import java.awt.Image;
+import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
-import java.awt.event.KeyEvent;
import java.awt.geom.Rectangle2D;
import java.awt.image.RenderedImage;
import java.beans.PropertyChangeEvent;
@@ -70,6 +49,34 @@
import java.util.Date;
import java.util.List;
+import javax.media.jai.PlanarImage;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import jaxx.runtime.swing.ComponentMover;
+import jaxx.runtime.swing.ComponentResizer;
+import jaxx.runtime.validator.swing.SwingValidator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfWriter;
+import com.sun.media.jai.codec.ByteArraySeekableStream;
+import com.sun.media.jai.codec.ImageCodec;
+import com.sun.media.jai.codec.ImageDecoder;
+import com.sun.media.jai.codec.SeekableStream;
+import com.sun.pdfview.PDFFile;
+import com.sun.pdfview.PDFPage;
+
import static org.nuiton.i18n.I18n.t;
/**
@@ -144,10 +151,11 @@
|| Attachment.PROPERTY_EDITED_FILE.equals(evt.getPropertyName())) {
PDFEditorUIModel model = (PDFEditorUIModel) evt.getSource();
- File file = model.getNotNullFile();
+ AttachmentFile attachmentFile = model.getNotNullFile();
- if (file != null) {
- if (!FaxToMailUIUtil.isFileAPDF(file)) {
+ if (attachmentFile != null) {
+ File file = attachmentFile.getFile();
+ if (!FaxToMailUIUtil.isFileAPDF(attachmentFile)) {
try {
file = convertFileToPdf(file);
@@ -164,7 +172,7 @@
getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.convertToPdf.error"));
}
}
- if (FaxToMailUIUtil.isFileAPDF(file)) {
+ if (FaxToMailUIUtil.isFileAPDF(attachmentFile)) {
try {
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel channel = raf.getChannel();
@@ -411,8 +419,11 @@
}
public File convertFileToPdf(File file) throws IOException, DocumentException {
- File target = File.createTempFile(file.getName(), ".pdf");
+ AttachmentFile attachmentFile = getModel().getNotNullFile();
+ File target = File.createTempFile("faxtomail-", ".tmp");
+ target.deleteOnExit();
+
Document document = new Document();
FileOutputStream fos = new FileOutputStream(target);
PdfWriter writer = PdfWriter.getInstance(document, fos);
@@ -421,7 +432,7 @@
document.setPageSize(PageSize.A4);
document.open();
- if (FaxToMailUIUtil.isFileATxt(file)) {
+ if (FaxToMailUIUtil.isFileATxt(attachmentFile)) {
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
StringBuilder text = new StringBuilder();
@@ -430,7 +441,7 @@
}
document.add(new Paragraph(text.toString()));
- } else if (FaxToMailUIUtil.isFileATif(file)) {
+ } else if (FaxToMailUIUtil.isFileATif(attachmentFile)) {
FileInputStream fis = new FileInputStream(file);
FileChannel channel = fis.getChannel();
ByteBuffer buffer = ByteBuffer.allocate((int) channel.size());
@@ -459,9 +470,12 @@
document.close();
writer.close();
+
+ // convert content to blob
+ AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(new FileInputStream(target));
+ attachmentFileNew.setFilename(attachmentFile.getFilename() + ".pdf");
+ getModel().setEditedFile(attachmentFileNew);
- getModel().setEditedFile(target);
-
return target;
}
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,18 +24,20 @@
* #L%
*/
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JPanel;
+
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.util.JImagePanel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-import javax.swing.*;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -112,28 +114,28 @@
super(fromBeanBinder, toBeanBinder);
}
- public void setOriginalFile(File file) {
+ public void setOriginalFile(AttachmentFile file) {
Object oldValue = getOriginalFile();
editObject.setOriginalFile(file);
firePropertyChange(Attachment.PROPERTY_ORIGINAL_FILE, oldValue, file);
}
- public File getOriginalFile() {
+ public AttachmentFile getOriginalFile() {
return editObject.getOriginalFile();
}
- public void setEditedFile(File file) {
+ public void setEditedFile(AttachmentFile file) {
Object oldValue = getEditedFile();
editObject.setEditedFile(file);
firePropertyChange(Attachment.PROPERTY_EDITED_FILE, oldValue, file);
}
- public File getEditedFile() {
+ public AttachmentFile getEditedFile() {
return editObject.getEditedFile();
}
- public File getNotNullFile() {
- File file = getEditedFile();
+ public AttachmentFile getNotNullFile() {
+ AttachmentFile file = getEditedFile();
if (file == null) {
file = getOriginalFile();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,19 +24,25 @@
* #L%
*/
+import static org.nuiton.i18n.I18n.t;
+
+import java.sql.Blob;
+
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import jaxx.runtime.validator.swing.SwingValidator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
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;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import javax.swing.*;
-import java.io.File;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -57,13 +63,12 @@
attachmentPanel.add(checkBox);
for (Attachment attachment : model.getAttachment()) {
- File originalFile = attachment.getOriginalFile();
- checkBox = new JCheckBox(originalFile.getName(), true);
+ checkBox = new JCheckBox(attachment.getOriginalFile().getFilename(), true);
attachmentPanel.add(checkBox);
- File file = attachment.getEditedFile();
+ AttachmentFile file = attachment.getEditedFile();
if (file != null) {
- checkBox = new JCheckBox(file.getName(), true);
+ checkBox = new JCheckBox(file.getFilename(), true);
attachmentPanel.add(checkBox);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-05-20 14:25:32 UTC (rev 82)
@@ -27,7 +27,7 @@
#attachmentNameLabel {
actionIcon: "attachment";
- text: { t("faxtomail.reply.attachment.label", getAttachment().getName(), getAttachment().length() / 1024) };
+ text: { t("faxtomail.reply.attachment.label", getAttachmentFile().getFilename(), getAttachmentFile().getLength() / 1024) };
border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,7 +24,7 @@
<JPanel id='attachmentPanel' layout='{new BorderLayout()}'>
<import>
- com.franciaflex.faxtomail.persistence.entities.Attachment
+ com.franciaflex.faxtomail.persistence.entities.AttachmentFile
java.awt.Color
java.io.File
@@ -34,7 +34,7 @@
static jaxx.runtime.JAXXUtil.getStringValue
</import>
- <File id='attachment' javaBean='null'/>
+ <AttachmentFile id='attachmentFile' javaBean='null'/>
<ReplyFormUIHandler id='handler' javaBean='null'/>
@@ -42,9 +42,9 @@
<JToolBar id='toolbar' constraints='BorderLayout.EAST'>
<JButton id='openAttachmentButton'
- onActionPerformed='handler.openAttachment(attachment)'/>
+ onActionPerformed='handler.openAttachment(attachmentFile)'/>
<JButton id='removeAttachmentButton'
- onActionPerformed='handler.removeAttachment(attachment)'/>
+ onActionPerformed='handler.removeAttachment(attachmentFile)'/>
</JToolBar>
</JPanel>
\ No newline at end of file
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,42 +24,46 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-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;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.google.common.collect.Lists;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.swing.editor.FileEditor;
-import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n.t;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
-import javax.swing.*;
-import javax.swing.plaf.basic.BasicComboBoxEditor;
-
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Desktop;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
-import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import static org.nuiton.i18n.I18n.t;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import jaxx.runtime.validator.swing.SwingValidator;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+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.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import com.google.common.collect.Lists;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -100,16 +104,16 @@
for (DemandeUIModel demandeUIModel : models) {
for (Attachment attachment : demandeUIModel.getAttachment()) {
- final File originalFile = attachment.getOriginalFile();
+ AttachmentFile originalFile = attachment.getOriginalFile();
model.addAvailableAttachment(originalFile);
- File file = attachment.getEditedFile();
+ AttachmentFile file = attachment.getEditedFile();
if (file != null) {
model.addAvailableAttachment(file);
}
}
}
- JComboBox addAttachmentFile = ui.getAddAttachmentFile();
+ JComboBox<AttachmentFile> addAttachmentFile = ui.getAddAttachmentFile();
addAttachmentFile.setModel(newComboModel(model.getAvailableAttachments().toArray()));
addAttachmentFile.setSelectedItem(null);
@@ -143,7 +147,7 @@
model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_ATTACHMENT, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- updateAttachmentPanel((Collection<File>) evt.getNewValue());
+ updateAttachmentPanel((Collection<AttachmentFile>) evt.getNewValue());
}
});
@@ -155,7 +159,7 @@
});
JComboBox addAttachmentFile = ui.getAddAttachmentFile();
- addAttachmentFile.setRenderer(new DecoratorListCellRenderer(getDecorator(File.class, null)));
+ addAttachmentFile.setRenderer(new DecoratorListCellRenderer(getDecorator(AttachmentFile.class, null)));
addAttachmentFile.setEditor(new FileComboBoxEditor());
getValidator().addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() {
@@ -192,7 +196,7 @@
return getUI().getMessage();
}
- public void removeAttachment(File attachment) {
+ public void removeAttachment(AttachmentFile attachment) {
ReplyFormUIModel model = getModel();
model.removeAttachment(attachment);
@@ -203,7 +207,7 @@
public void addAttachment() {
JComboBox addAttachmentFile = ui.getAddAttachmentFile();
- File file = (File) addAttachmentFile.getSelectedItem();
+ AttachmentFile file = (AttachmentFile) addAttachmentFile.getSelectedItem();
if (file != null) {
ReplyFormUIModel model = getModel();
model.addAttachment(file);
@@ -215,13 +219,13 @@
}
}
- protected void updateAttachmentPanel(Collection<File> attachments) {
+ protected void updateAttachmentPanel(Collection<AttachmentFile> attachments) {
JPanel attachmentsPanel = ui.getAttachmentsPanel();
attachmentsPanel.removeAll();
- for (File attachment : attachments) {
+ for (AttachmentFile attachment : attachments) {
AttachmentItem item = new AttachmentItem();
item.setHandler(this);
- item.setAttachment(attachment);
+ item.setAttachmentFile(attachment);
attachmentsPanel.add(item);
}
attachmentsPanel.updateUI();
@@ -251,10 +255,13 @@
}
}
- public void openAttachment(File attachment) {
+ public void openAttachment(AttachmentFile attachment) {
+
+ File file = attachment.getFile();
+
Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
- desktop.open(attachment);
+ desktop.open(file);
} catch (IOException e) {
getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
@@ -263,7 +270,7 @@
protected class FileComboBoxEditor implements ComboBoxEditor {
- protected File oldValue;
+ protected AttachmentFile oldValue;
protected JTextField editorComponent = new JTextField();
@@ -275,7 +282,7 @@
@Override
public void setItem(Object anObject) {
String text;
- File file = (File) anObject;
+ AttachmentFile file = (AttachmentFile) anObject;
if ( anObject != null ) {
text = decorate(file);
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,8 +24,12 @@
* #L%
*/
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+
import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractSerializableBean;
import java.io.File;
@@ -38,6 +42,8 @@
*/
public class ReplyFormUIModel extends AbstractSerializableBean {
+ private static final Log log = LogFactory.getLog(ReplyFormUIModel.class);
+
public static final String PROPERTY_TO = "to";
public static final String PROPERTY_FROM = "from";
public static final String PROPERTY_SUBJECT = "subject";
@@ -59,8 +65,8 @@
protected boolean valid = true;
protected boolean readonly = false;
- protected Set<File> attachments = new HashSet<File>();
- protected Set<File> availableAttachments = new HashSet<File>();
+ protected Set<AttachmentFile> attachments = new HashSet<AttachmentFile>();
+ protected Set<AttachmentFile> availableAttachments = new HashSet<AttachmentFile>();
protected File lastVisitedDirectory = FileUtils.getUserDirectory();
@@ -114,41 +120,41 @@
firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand);
}
- public Set<File> getAttachments() {
+ public Set<AttachmentFile> getAttachments() {
return attachments;
}
- public void addAttachment(File attachment) {
+ public void addAttachment(AttachmentFile attachment) {
attachments.add(attachment);
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments());
Object oldValue = getTotalAttachmentLength();
- totalAttachmentLength += attachment.length();
+ totalAttachmentLength += attachment.getLength();
firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength());
recomputeValidity();
}
- public void removeAttachment(File attachment) {
+ public void removeAttachment(AttachmentFile attachment) {
attachments.remove(attachment);
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments());
Object oldValue = getTotalAttachmentLength();
- totalAttachmentLength -= attachment.length();
+ totalAttachmentLength -= attachment.getLength();
firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGHT, oldValue, getTotalAttachmentLength());
recomputeValidity();
}
- public Set<File> getAvailableAttachments() {
+ public Set<AttachmentFile> getAvailableAttachments() {
return availableAttachments;
}
- public void addAvailableAttachment(File attachment) {
+ public void addAvailableAttachment(AttachmentFile attachment) {
availableAttachments.add(attachment);
}
- public void removeAvailableAttachment(File attachment) {
+ public void removeAvailableAttachment(AttachmentFile attachment) {
availableAttachments.remove(attachment);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -22,7 +22,6 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Email;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.jaxx.application.listener.PropagatePropertyChangeListener;
import org.nuiton.util.CollectionUtil;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -23,12 +23,15 @@
*/
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.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel;
+
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXUtil;
+
import org.apache.commons.collections4.ComparatorUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -52,6 +55,7 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
+
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
@@ -175,7 +179,7 @@
return result;
}
- public static boolean isFileAPDF(File file) {
+ /*public static boolean isFileAPDF(File file) {
return FileUtil.extension(file).toUpperCase().equals("PDF");
}
@@ -185,8 +189,20 @@
public static boolean isFileATif(File file) {
return FileUtil.extension(file).toUpperCase().equals("TIF");
+ }*/
+
+ public static boolean isFileAPDF(AttachmentFile file) {
+ return FileUtil.extension(file.getFilename()).toUpperCase().equals("PDF");
}
+ public static boolean isFileATxt(AttachmentFile file) {
+ return FileUtil.extension(file.getFilename()).toUpperCase().equals("TXT");
+ }
+
+ public static boolean isFileATif(AttachmentFile file) {
+ return FileUtil.extension(file.getFilename()).toUpperCase().equals("TIF");
+ }
+
public static void setEmailContentInTextPane(JTextPane textPane, DemandeUIModel demandeUIModel) {
String content = demandeUIModel.getHtmlContent();
if (content != null) {
@@ -207,11 +223,12 @@
content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
for (Attachment attachment : demandeUIModel.getAttachment()) {
- File file = attachment.getOriginalFile();
- log.info("file " + file.getName());
- String key = file.getName();
+ AttachmentFile file = attachment.getOriginalFile();
+ log.info("file " + file.getFilename());
+ String key = file.getFilename();
// replace the inline attachments with the extracted attachment file url
- content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
+ //content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
+ throw new RuntimeException("Fix it");
}
} else {
@@ -238,9 +255,10 @@
return desktop;
}
- public static void print(File file) {
+ public static void print(AttachmentFile attachmentFile) {
Desktop desktop = getDesktopForPrint();
+ File file = attachmentFile.getFile();
try {
desktop.print(file);
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-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-20 14:25:32 UTC (rev 82)
@@ -19,6 +19,7 @@
faxtomail.attachmentCellRenderer.text=(%s)
faxtomail.attachmentEditor.action.add.tip=Ajouter une pièce jointe
faxtomail.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes
+faxtomail.attachmentEditor.action.edit.tip=Editer la pièce jointe
faxtomail.attachmentEditor.action.open.tip=Ouvrir la pièce jointe
faxtomail.attachmentEditor.action.remove.tip=Supprimer la pièce jointe
faxtomail.attachmentEditor.action.save.tip=Enregistrer la pièce jointe en local
@@ -61,6 +62,7 @@
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
+faxtomail.demandReplies.error=
faxtomail.demandReplies.text=Réponses (%s)
faxtomail.demandReplies.title=Réponses envoyées
faxtomail.demandRepliesCellRenderer.text=(%s)
@@ -231,6 +233,7 @@
faxtomail.reply.message=\nLe %1$s, %2$s a écrit \:\n> %3$s
faxtomail.reply.subject=Re \: %s
faxtomail.reply.title=Réponse à \: %s
+faxtomail.search.action.error=
faxtomail.search.action.gotoFolder=Aller au dossier
faxtomail.search.action.gotoFolder.tip=Aller au dossier
faxtomail.search.addGroupedElement.label=Ajouter les éléments groupés aux résultats
@@ -259,5 +262,6 @@
jaxx.application.error.cannot.print=
jaxx.application.error.desktop.not.supported=
jaxx.application.error.desktop.print.not.supported=
+swing.error.cannot.copy.file=
swing.error.cannot.open.file=
test=
Modified: trunk/faxtomail-ui-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-05-20 14:25:32 UTC (rev 82)
@@ -19,7 +19,7 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
-log4j.rootCategory=WARN, console
+log4j.rootCategory=DEBUG, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-05-16 16:05:30 UTC (rev 81)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-05-20 14:25:32 UTC (rev 82)
@@ -24,28 +24,19 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
-import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
-import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.services.DecoratorService;
-import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
-import com.franciaflex.faxtomail.services.service.CompanyService;
-import com.franciaflex.faxtomail.services.service.EmailService;
-import com.franciaflex.faxtomail.services.service.MailFolderService;
+import static org.nuiton.i18n.I18n.t;
-import org.apache.commons.io.Charsets;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.decorator.Decorator;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
@@ -60,26 +51,33 @@
import javax.mail.Store;
import javax.mail.URLName;
import javax.mail.internet.ContentType;
-import javax.mail.internet.MailDateFormat;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
+import org.apache.commons.io.Charsets;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.decorator.Decorator;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
-import static org.nuiton.i18n.I18n.t;
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailImpl;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.DecoratorService;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.CompanyService;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.services.service.MailFolderService;
/**
* @author Kevin Morin (Code Lutin)
@@ -172,10 +170,10 @@
log.debug(count + " messages, " + unread + " unread");
+ EmailService emailService = serviceContext.newService(EmailService.class);
+
for (int i = 0 ; i < count ; i++) {
Email email = new EmailImpl();
-
- EmailService emailService = serviceContext.newService(EmailService.class);
emailService.saveEmail(email, null);
int messageNumber = count - i;
@@ -249,7 +247,7 @@
email.setOriginalEmail(emailSource.toString());
if (message.isMimeType("multipart/*")) {
- decomposeMultipartEmail(message, email);
+ decomposeMultipartEmail(message, email, emailService);
// } else {
// String content = IOUtils.toString(message.getInputStream(), charset);
// email.setPlainContent(content);
@@ -273,9 +271,10 @@
*
* @param part the part to decompose
* @param email the email object to fill with the attachments or content
+ * @param emailService email service
* @throws Exception
*/
- protected void decomposeMultipartEmail(Part part, Email email) throws Exception {
+ protected void decomposeMultipartEmail(Part part, Email email, EmailService emailService) throws Exception {
DataSource dataSource = part.getDataHandler().getDataSource();
MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
int multiPartCount = mimeMultipart.getCount();
@@ -296,7 +295,7 @@
// if it is multipart part, decompose it
} else if (bp.isMimeType("multipart/*")) {
- decomposeMultipartEmail(bp, email);
+ decomposeMultipartEmail(bp, email, emailService);
// else, this is an attachment
} else {
@@ -333,7 +332,10 @@
Attachment attachment = new AttachmentImpl();
attachment.setAddedByUser(false);
- attachment.setOriginalFile(file);
+ AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream());
+ attachmentFile.setFilename(dh.getName());
+ attachment.setOriginalFile(attachmentFile);
+
email.addAttachment(attachment);
}
}
@@ -345,5 +347,4 @@
Charset charset = Charsets.toCharset(charsetName);
return charset;
}
-
}
1
0
Build failed in Jenkins: faxtomail-nightly » FaxToMail :: UI #27
by admin+ci-codelutin.com@codelutin.com 16 May '14
by admin+ci-codelutin.com@codelutin.com 16 May '14
16 May '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-nightly/com.franciaflex.faxto…>
Changes:
[kmorin] - add column to display the replies
- merge the search fields reference and command number
[echatellier] Update application to run with sql server
[echatellier] Fix search form
[kmorin] réponse par mail : propose les pièces-jointes des demandes du groupe
[kmorin] - fix referential files loading
- fix attachment deletion bug
- fix attachment not saved when opened before being saved
[kmorin] make the project build
[echatellier] Fix release
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: UI 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 46.7 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 48.3 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 55.9 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 7.8 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 64.2 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 64.2 KB/sec)
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 9.3 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 9.4 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 56.2 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 58.6 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/ezw…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/com/ezware/oxbow/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/ezware/oxb…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/ezware/oxbow/swing-bits/0.5.0/swing…
[WARNING] The POM for com.ezware.oxbow:swing-bits:jar:0.5.0 is missing, no dependency information available
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/nuiton…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/ezw…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/com/ezware/oxbow/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/ezware/oxb…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/ezware/oxbow/swing-bits/0.5.0/swing…
[JENKINS] Archiving disabled
1
4
r81 - in trunk: . faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor faxtomail-ui-swing/src/main/resources/i18n faxtomail-ui-swing/src/main/resources/icons
by kmorin@users.forge.codelutin.com 16 May '14
by kmorin@users.forge.codelutin.com 16 May '14
16 May '14
Author: kmorin
Date: 2014-05-16 18:05:30 +0200 (Fri, 16 May 2014)
New Revision: 81
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/81
Log:
add a line component in the pdf editor
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx
trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
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/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/pom.xml
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-16 16:05:30 UTC (rev 81)
@@ -25,6 +25,7 @@
*/
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIHandler;
@@ -182,6 +183,32 @@
cb.stroke();
cb.restoreState();
}
+
+ for (PDFEditorLineUI panel : model.getPages()[i].getLines()) {
+
+ Point location = panel.getLocation();
+ int width = (int) (panel.getWidth() / zoom);
+ int height = (int) (panel.getHeight() / zoom);
+ int x = (int) (location.x / zoom);
+ int y = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - height;
+
+ if (panel.isHorizontal()) {
+ y += height / 2;
+ } else {
+ x += width / 2;
+ }
+
+ cb.saveState();
+ cb.setColorStroke(BaseColor.BLUE);
+ cb.moveTo(x, y);
+ if (panel.isHorizontal()) {
+ cb.lineTo(x + width, y);
+ } else {
+ cb.lineTo(x, y + height);
+ }
+ cb.stroke();
+ cb.restoreState();
+ }
}
pdfStamper.close();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css 2014-05-16 16:05:30 UTC (rev 81)
@@ -26,7 +26,7 @@
border: { BorderFactory.createDashedBorder(null) };
opaque: false;
background: { null };
- size: { new Dimension(100, 100) };
+ size: { new Dimension(500, 200) };
}
#removeButton {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx 2014-05-16 16:05:30 UTC (rev 81)
@@ -37,12 +37,6 @@
<script><![CDATA[
- public static final String CROSS_IMAGE_FILE = "cross_blue.png";
-
- public PDFEditorCrossUI() {
- //setImage(SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage());
- }
-
protected void removeCross() {
JPanel container = getParentContainer(JPanel.class);
container.remove(this);
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css (from rev 79, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css 2014-05-16 16:05:30 UTC (rev 81)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * FaxToMail :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+#linePanel {
+ border: { BorderFactory.createDashedBorder(null) };
+ opaque: false;
+ background: { null };
+ size: { new Dimension(500, 100) };
+}
+
+#removeButton {
+ text: "X";
+ //borderPainted: { false };
+ //border: { null };
+ //opaque : { false };
+ //background: { null };
+}
\ No newline at end of file
Copied: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx (from rev 79, trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx)
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx 2014-05-16 16:05:30 UTC (rev 81)
@@ -0,0 +1,69 @@
+<!--
+ #%L
+ FaxToMail :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2014 Franciaflex, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<JPanel id='linePanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'>
+
+ <import>
+ java.awt.BasicStroke
+ java.awt.Color
+ java.awt.Dimension
+ java.awt.FlowLayout
+ java.awt.Font
+ java.awt.Graphics
+ java.awt.Graphics2D
+ javax.swing.BorderFactory
+ javax.swing.JPanel
+ </import>
+
+ <script><![CDATA[
+
+ protected void removeLine() {
+ JPanel container = getParentContainer(JPanel.class);
+ container.remove(this);
+ container.updateUI();
+ }
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+
+ Graphics2D g2 = (Graphics2D) g.create();
+ g2.setStroke(new BasicStroke(1));
+ g2.setColor(Color.BLUE);
+ if (Boolean.TRUE.equals(horizontal)) {
+ g2.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2);
+
+ } else {
+ g2.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight());
+ }
+ g2.dispose();
+ }
+
+ ]]></script>
+
+ <Boolean id="horizontal" javaBean="true"/>
+
+ <JButton id="removeButton"
+ onActionPerformed="removeLine()"/>
+
+</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-16 16:05:30 UTC (rev 81)
@@ -41,6 +41,11 @@
toolTipText: "faxtomail.pdfEditor.button.addCross.tip";
}
+#lineButton {
+ actionIcon: line;
+ toolTipText: "faxtomail.pdfEditor.button.addLine.tip";
+}
+
#prevPageButton {
actionIcon: left;
enabled: { getModel().getCurrentPageIndex() > 1 };
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-16 16:05:30 UTC (rev 81)
@@ -53,6 +53,8 @@
onActionPerformed="handler.addNote()"/>
<JButton id='crossButton'
onActionPerformed="handler.addCross()"/>
+ <JButton id='lineButton'
+ onActionPerformed="handler.addLine()"/>
<JSeparator constructorParams="SwingConstants.VERTICAL"/>
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-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-05-16 16:05:30 UTC (rev 81)
@@ -68,6 +68,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Date;
+import java.util.List;
import static org.nuiton.i18n.I18n.t;
@@ -103,6 +104,9 @@
} else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
currentPage.addCross((PDFEditorCrossUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) {
+ currentPage.addLine((PDFEditorLineUI) child);
}
}
@@ -115,6 +119,9 @@
} else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) {
currentPage.removeCross((PDFEditorCrossUI) child);
+
+ } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) {
+ currentPage.removeLine((PDFEditorLineUI) child);
}
}
});
@@ -228,6 +235,12 @@
cr.registerComponent(cross);
}
+ public void addLine() {
+ PDFEditorLineUI line = new PDFEditorLineUI();
+ addPanel(line);
+ cr.registerComponent(ComponentResizer.DIRECTION_HORIZONTAL, line);
+ }
+
protected void addPanel(JPanel panel) {
JPanel container = ui.getContainer();
container.add(panel, 0);
@@ -326,13 +339,15 @@
}
+ boolean orientation180 = Math.abs(rotationDiff) % 180 == 0;
+
for (PDFEditorCrossUI panel : p.getCrosses()) {
panel.setVisible(true);
Rectangle bounds = panel.getBounds();
- int newWidth = Math.abs(rotationDiff) % 180 == 0 ? bounds.width : bounds.height;
- int newHeight = Math.abs(rotationDiff) % 180 == 0 ? bounds.height : bounds.width;
+ int newWidth = orientation180 ? bounds.width : bounds.height;
+ int newHeight = orientation180 ? bounds.height : bounds.width;
int x, y;
@@ -355,6 +370,43 @@
}
+ List<PDFEditorLineUI> lines = p.getLines();
+ cr.deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()]));
+
+ for (PDFEditorLineUI panel : lines) {
+ panel.setVisible(true);
+
+ Rectangle bounds = panel.getBounds();
+
+ boolean horizontal = panel.isHorizontal();
+ panel.setHorizontal(orientation180 ? horizontal : ! horizontal);
+
+ int newWidth = orientation180 ? bounds.width : bounds.height;
+ int newHeight = orientation180 ? bounds.height : bounds.width;
+
+ int x, y;
+
+ if (rotationDiff == 0) {
+ x = bounds.x;
+ y = bounds.y;
+
+ } else if (rotationDiff == 90 || rotationDiff == -270) {
+ x = rect.width - newWidth - bounds.y;
+ y = bounds.x;
+
+ } else {
+ x = bounds.y;
+ y = rect.height - newHeight - bounds.x;
+ }
+
+ panel.setBounds((int) (zoomRatio * x) + insets.left,
+ (int) (zoomRatio * y) + insets.top,
+ (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight));
+
+ cr.registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL,
+ panel);
+ }
+
container.updateUI();
}
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-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-05-16 16:05:30 UTC (rev 81)
@@ -53,6 +53,7 @@
protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>();
protected List<PDFEditorCrossUI> crosses = new ArrayList<PDFEditorCrossUI>();
+ protected List<PDFEditorLineUI> lines = new ArrayList<PDFEditorLineUI>();
public List<PDFEditorNoteUI> getNotes() {
return notes;
@@ -74,9 +75,21 @@
crosses.add(cross);
}
- public void removeCross(JPanel cross) {
+ public void removeCross(PDFEditorCrossUI cross) {
crosses.remove(cross);
}
+
+ public List<PDFEditorLineUI> getLines() {
+ return lines;
+ }
+
+ public void addLine(PDFEditorLineUI line) {
+ lines.add(line);
+ }
+
+ public void removeLine(PDFEditorLineUI line) {
+ lines.remove(line);
+ }
}
protected Page[] pages;
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-05-16 14:48:31 UTC (rev 80)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-16 16:05:30 UTC (rev 81)
@@ -198,9 +198,12 @@
faxtomail.pdfEditor.action.validate=Enregistrer
faxtomail.pdfEditor.action.validate.tip=Enregistrer les changements et fermer
faxtomail.pdfEditor.button.addCross.tip=Ajouter une croix
+faxtomail.pdfEditor.button.addLine.tip=Ajouter une ligne
faxtomail.pdfEditor.button.addNote.tip=Ajouter une note
faxtomail.pdfEditor.button.nextPage=Page suivante
faxtomail.pdfEditor.button.previousPage=Page précédente
+faxtomail.pdfEditor.convertToPdf.error=
+faxtomail.pdfEditor.readPdf.error=
faxtomail.quantitiesByRange.button.text=OK
faxtomail.quantitiesByRange.title=Quantités par gamme
faxtomail.rangeRows.table.header.commandNumber=N° commande / devis
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-16 14:48:31 UTC (rev 80)
+++ trunk/pom.xml 2014-05-16 16:05:30 UTC (rev 81)
@@ -109,7 +109,7 @@
<hibernateVersion>4.3.5.Final</hibernateVersion>
<h2Version>1.3.176</h2Version>
- <jaxxVersion>2.8.5</jaxxVersion>
+ <jaxxVersion>2.8.6-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.5-1</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
1
0
r80 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply
by kmorin@users.forge.codelutin.com 16 May '14
by kmorin@users.forge.codelutin.com 16 May '14
16 May '14
Author: kmorin
Date: 2014-05-16 16:48:31 +0200 (Fri, 16 May 2014)
New Revision: 80
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/80
Log:
(la suite)
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/ReplyFormUIModel.java
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-05-16 14:46:47 UTC (rev 79)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-05-16 14:48:31 UTC (rev 80)
@@ -47,6 +47,12 @@
<ReplyFormUIModel id='model'
initializer='getContextValue(ReplyFormUIModel.class)'/>
+ <BeanValidator id='validator' bean='model'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='from' component='fromComboBox'/>
+ <field name='to' component='toField'/>
+ </BeanValidator>
+
<CardLayout2Ext id='fromPanelLayout'
constructorParams='this, "fromPanel"'/>
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-05-16 14:46:47 UTC (rev 79)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java 2014-05-16 14:48:31 UTC (rev 80)
@@ -190,9 +190,14 @@
return valid;
}
- public void recomputeValidity() {
+ public void setValid(boolean valid) {
Object oldValue = isValid();
- this.valid = totalAttachmentLength < maxAttachmentLength;
+ this.valid = valid;
firePropertyChange(PROPERTY_VALID, oldValue, valid);
}
+
+ public void recomputeValidity() {
+ setValid(totalAttachmentLength < maxAttachmentLength);
+
+ }
}
1
0
16 May '14
Author: kmorin
Date: 2014-05-16 16:46:47 +0200 (Fri, 16 May 2014)
New Revision: 79
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/79
Log:
- add error messages
- set some fields not editable according to the status
- validation of the reply form
- pdf rotation
- fix bug of the app which does not close of a popup is open
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.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/pdfeditor/PDFEditorCrossUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
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/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -45,6 +45,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.EmailConstants;
+import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.MultiPartEmail;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
@@ -72,6 +73,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import javax.mail.MessagingException;
+
import static org.nuiton.i18n.I18n.t;
/**
@@ -149,9 +152,9 @@
Set<String> fieldSet = Sets.newHashSet(modifiedFields);
if (email.getDemandStatus() == DemandStatus.UNTREATED
- && fieldSet.containsAll(Sets.newHashSet(Email.PROPERTY_CLIENT,
- Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_PROJECT_REFERENCE))) {
+ && email.getClient() != null
+ && email.getDemandType() != null
+ && email.getProjectReference() != null) {
email.setDemandStatus(DemandStatus.IN_PROGRESS);
transmitDemandToEdi(email);
}
@@ -409,75 +412,68 @@
public Email reply(String from, String to, String subject,
String content, Collection<File> attachments,
- String originalEmailId, FaxToMailUser user) {
+ String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException {
Email email = getEmailById(originalEmailId);
- try {
- Properties properties = new Properties();
+ Properties properties = new Properties();
- try {
- URL smtpPropertiesURL = ClassLoader.getSystemResource("smtp.properties");
- if (smtpPropertiesURL != null) {
- properties.load(smtpPropertiesURL.openStream());
- }
- } catch(Exception e) {
- log.error("error getting the smtp properties", e);
+ try {
+ URL smtpPropertiesURL = ClassLoader.getSystemResource("smtp.properties");
+ if (smtpPropertiesURL != null) {
+ properties.load(smtpPropertiesURL.openStream());
}
+ } catch(Exception e) {
+ log.error("error getting the smtp properties", e);
+ }
- final String smtpUser = properties.getProperty("mail.user");
- final String password = properties.getProperty("mail.password");
+ final String smtpUser = properties.getProperty("mail.user");
+ final String password = properties.getProperty("mail.password");
- MultiPartEmail message = new MultiPartEmail();
- message.setHostName(properties.getProperty("mail.smtp.host"));
- message.setSmtpPort(Integer.parseInt(properties.getProperty("mail.smtp.port")));
- message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
- message.setSSLOnConnect(true);
+ MultiPartEmail message = new MultiPartEmail();
+ message.setHostName(properties.getProperty("mail.smtp.host"));
+ message.setSmtpPort(Integer.parseInt(properties.getProperty("mail.smtp.port")));
+ message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
+ message.setSSLOnConnect(true);
- message.setCharset(EmailConstants.UTF_8);
- message.setFrom(from);
- message.addTo(to);
- message.setSubject(subject);
- message.setMsg(content);
+ message.setCharset(EmailConstants.UTF_8);
+ message.setFrom(from);
+ message.addTo(to);
+ message.setSubject(subject);
+ message.setMsg(content);
- for (File attachment : attachments) {
- // Create the attachment
- message.attach(attachment);
- }
+ for (File attachment : attachments) {
+ // Create the attachment
+ message.attach(attachment);
+ }
- String emailId = message.send();
+ String emailId = message.send();
- ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao();
- Date now = new Date();
+ ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao();
+ Date now = new Date();
- StringBuilder emailSource = new StringBuilder();
- Enumeration<String> headerLines = message.getMimeMessage().getAllHeaderLines();
- while (headerLines.hasMoreElements()) {
- String headerLine = headerLines.nextElement();
- emailSource.append(headerLine).append("\n");
- }
- emailSource.append("\n").append(IOUtils.toString(message.getMimeMessage().getInputStream()));
+ StringBuilder emailSource = new StringBuilder();
+ Enumeration<String> headerLines = message.getMimeMessage().getAllHeaderLines();
+ while (headerLines.hasMoreElements()) {
+ String headerLine = headerLines.nextElement();
+ emailSource.append(headerLine).append("\n");
+ }
+ emailSource.append("\n").append(IOUtils.toString(message.getMimeMessage().getInputStream()));
- Reply reply = replyTopiaDao.create(Reply.PROPERTY_EMAIL_SOURCE, emailSource.toString(),
- Reply.PROPERTY_SENT_DATE, now,
- Reply.PROPERTY_SUBJECT, subject);
+ Reply reply = replyTopiaDao.create(Reply.PROPERTY_EMAIL_SOURCE, emailSource.toString(),
+ Reply.PROPERTY_SENT_DATE, now,
+ Reply.PROPERTY_SUBJECT, subject);
- email.addReplies(reply);
+ email.addReplies(reply);
- HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
- History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.REPLY,
- History.PROPERTY_FAX_TO_MAIL_USER, user,
- History.PROPERTY_MODIFICATION_DATE, now);
- email.addHistory(history);
+ HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
+ History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.REPLY,
+ History.PROPERTY_FAX_TO_MAIL_USER, user,
+ History.PROPERTY_MODIFICATION_DATE, now);
+ email.addHistory(history);
- email = saveEmail(email, user);
+ email = saveEmail(email, user);
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- }
-
return email;
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -42,6 +42,9 @@
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfAction;
import com.itextpdf.text.pdf.PdfContentByte;
+import com.itextpdf.text.pdf.PdfDictionary;
+import com.itextpdf.text.pdf.PdfName;
+import com.itextpdf.text.pdf.PdfNumber;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;
@@ -54,6 +57,8 @@
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.css.Rect;
import javax.media.jai.PlanarImage;
@@ -74,6 +79,8 @@
*/
public class GenerateAnnotatedAttachmentAction extends AbstractFaxToMailAction<PDFEditorUIModel, PDFEditorUI, PDFEditorUIHandler> {
+ private static final Log log = LogFactory.getLog(GenerateAnnotatedAttachmentAction.class);
+
public GenerateAnnotatedAttachmentAction(PDFEditorUIHandler handler) {
super(handler, true);
}
@@ -81,8 +88,10 @@
@Override
public void doAction() throws Exception {
- File file = getModel().getNotNullFile();
+ PDFEditorUIModel model = getModel();
+ File file = model.getNotNullFile();
+
// InputStream inputStream;
// if (FaxToMailUIUtil.isFileAPDF(file)) {
// inputStream = new FileInputStream(file);
@@ -99,17 +108,21 @@
PdfReader pdfReader = new PdfReader(inputStream);
- File target = new File(FileUtils.getTempDirectory(), getModel().getOriginalFile().getName() + "-annoté.pdf");
+ File target = new File(FileUtils.getTempDirectory(), model.getOriginalFile().getName() + "-annoté.pdf");
FileOutputStream fos = new FileOutputStream(target);
PdfStamper pdfStamper = new PdfStamper(pdfReader, fos);
- int pageNb = getModel().getPages().length;
+ int pageNb = model.getPages().length;
+ float zoom = model.getZoom();
+ int rotation = model.getRotation();
for (int i = 0 ; i < pageNb ; i++) {
PdfContentByte cb = pdfStamper.getOverContent(i + 1);
- PDFEditorUIModel model = getModel();
- float zoom = model.getZoom();
+ PdfDictionary pageDict;
+ pageDict = pdfReader.getPageN(i + 1);
+ int pageRotation = pdfReader.getPageRotation(i + 1);
+ pageDict.put(PdfName.ROTATE, new PdfNumber((360 + pageRotation + rotation) % 360));
for (PDFEditorNoteUI note : model.getPages()[i].getNotes()) {
@@ -151,7 +164,7 @@
cb.restoreState();
}
- for (JImagePanel panel : model.getPages()[i].getCrosses()) {
+ for (PDFEditorCrossUI panel : model.getPages()[i].getCrosses()) {
Point location = panel.getLocation();
int width = (int) (panel.getWidth() / zoom);
@@ -160,10 +173,13 @@
int y = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - height;
cb.saveState();
- Image cross = Image.getInstance(JAXXUtil.class.getResource(SwingUtil.DEFAULT_ICON_PATH + PDFEditorCrossUI.CROSS_IMAGE_FILE));
- cross.scaleAbsolute(width, height);
- cross.setAbsolutePosition(x, y);
- cb.addImage(cross);
+ cb.setColorStroke(BaseColor.BLUE);
+ cb.moveTo(x, y);
+ cb.lineTo(x + width, y + height);
+ cb.stroke();
+ cb.moveTo(x + width, y);
+ cb.lineTo(x, y + height);
+ cb.stroke();
cb.restoreState();
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-05-16 14:46:47 UTC (rev 79)
@@ -39,6 +39,10 @@
font-style: "italic";
}
+.unmodifiableFields {
+ editable: { DemandStatus.UNTREATED.equals(model.getDemandStatus()) };
+}
+
#topToolBar {
floatable: false;
opaque: false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-05-16 14:46:47 UTC (rev 79)
@@ -112,6 +112,7 @@
</cell>
<cell weightx='1' columns="3">
<JTextField id='objectField'
+ styleClass="unmodifiableFields"
onKeyReleased='handler.setText(event, "object")'/>
</cell>
</row>
@@ -121,6 +122,7 @@
</cell>
<cell weightx='1'>
<JTextField id='clientField'
+ styleClass="unmodifiableFields"
onKeyReleased='handler.setText(event, "clientCode")'/>
</cell>
<cell>
@@ -138,6 +140,7 @@
</cell>
<cell weightx='1' columns="3">
<BeanFilterableComboBox id='docTypeComboBox'
+ styleClass="unmodifiableFields"
constructorParams='this'
genericType="DemandType"/>
</cell>
@@ -270,7 +273,7 @@
<JLabel id="savNbField"/>
</JPanel>
<JScrollPane constraints="BorderLayout.CENTER">
- <JXTable id='rangeTable'/>
+ <JXTable id='rangeTable' styleClass="unmodifiableFields"/>
</JScrollPane>
</JPanel>
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -322,7 +322,7 @@
Color color = new Color(255, 51, 51);
table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
- SwingValidator validator = this.ui.getValidator();
+ SwingValidator validator = getValidator();
listenValidatorValid(validator, model);
// if new fishingOperation can already cancel his creation
@@ -387,7 +387,6 @@
log.debug("closing: " + ui);
}
clearValidators();
- closeButtonPopups();
}
public void closeButtonPopups() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -817,6 +817,7 @@
}
} catch (Exception e) {
+ //TODO kmorin 20140516 do something when we use the real data
if (log.isErrorEnabled()) {
log.error("", e);
}
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -124,7 +124,7 @@
@Override
public void onCloseUI() {
- closeButtonPopups();
+// closeButtonPopups();
int tabCount = getTabPanel().getTabCount();
for (int i = 0 ; i < tabCount ; i++) {
DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i);
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -199,9 +199,7 @@
openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600));
} catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"));
}
// FaxToMailUIContext context = getContext();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css 2014-05-16 14:46:47 UTC (rev 79)
@@ -22,8 +22,11 @@
* #L%
*/
#crossPanel {
- scaleImageToFitPanel: { true };
+ //scaleImageToFitPanel: { true };
border: { BorderFactory.createDashedBorder(null) };
+ opaque: false;
+ background: { null };
+ size: { new Dimension(100, 100) };
}
#removeButton {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx 2014-05-16 14:46:47 UTC (rev 79)
@@ -21,14 +21,18 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<com.franciaflex.faxtomail.ui.swing.util.JImagePanel id='crossPanel'>
+<JPanel id='crossPanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'>
<import>
+ java.awt.BasicStroke
java.awt.Color
java.awt.Dimension
+ java.awt.FlowLayout
java.awt.Font
+ java.awt.Graphics
+ java.awt.Graphics2D
javax.swing.BorderFactory
- com.franciaflex.faxtomail.ui.swing.util.JImagePanel
+ javax.swing.JPanel
</import>
<script><![CDATA[
@@ -36,18 +40,30 @@
public static final String CROSS_IMAGE_FILE = "cross_blue.png";
public PDFEditorCrossUI() {
- setImage(SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage());
+ //setImage(SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage());
}
protected void removeCross() {
- JImagePanel container = getParentContainer(JImagePanel.class);
+ JPanel container = getParentContainer(JPanel.class);
container.remove(this);
container.updateUI();
}
+ @Override
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+
+ Graphics2D g2 = (Graphics2D) g.create();
+ g2.setStroke(new BasicStroke(1));
+ g2.setColor(Color.BLUE);
+ g2.drawLine(0, 0, getWidth(), getHeight());
+ g2.drawLine(getWidth(), 0, 0, getHeight());
+ g2.dispose();
+ }
+
]]></script>
<JButton id="removeButton"
onActionPerformed="removeCross()"/>
-</com.franciaflex.faxtomail.ui.swing.util.JImagePanel>
\ No newline at end of file
+</JPanel>
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx 2014-05-16 14:46:47 UTC (rev 79)
@@ -30,6 +30,7 @@
java.awt.Insets
java.awt.Point
javax.swing.BorderFactory
+ javax.swing.JPanel
com.itextpdf.text.pdf.BaseFont
com.franciaflex.faxtomail.ui.swing.util.JImagePanel
</import>
@@ -41,7 +42,7 @@
protected void textTyped() {
setText(getNoteText().getText());
- JImagePanel container = getParentContainer(JImagePanel.class);
+ JPanel container = getParentContainer(JPanel.class);
Point location = getLocation();
Insets insets = container.getInsets();
Dimension size = getPreferredSize();
@@ -50,7 +51,7 @@
}
protected void removeNote() {
- JImagePanel container = getParentContainer(JImagePanel.class);
+ JPanel container = getParentContainer(JPanel.class);
container.remove(this);
container.updateUI();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-16 14:46:47 UTC (rev 79)
@@ -21,6 +21,10 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+JSeparator {
+ border: { BorderFactory.createEmptyBorder(0, 5, 0, 5) };
+}
+
#toolbar {
floatable: false;
margin: {new java.awt.Insets(5, 0, 0, 5)};
@@ -29,18 +33,18 @@
#noteButton {
actionIcon: note;
- toolTipText: "faxtomail.pdfEitor.button.addNote.tip";
+ toolTipText: "faxtomail.pdfEditor.button.addNote.tip";
}
#crossButton {
actionIcon: cross;
- toolTipText: "faxtomail.pdfEitor.button.addCross.tip";
+ toolTipText: "faxtomail.pdfEditor.button.addCross.tip";
}
#prevPageButton {
actionIcon: left;
enabled: { getModel().getCurrentPageIndex() > 1 };
- toolTipText: "faxtomail.pdfEitor.button.previousPage";
+ toolTipText: "faxtomail.pdfEditor.button.previousPage";
}
#pageNumber {
@@ -62,7 +66,7 @@
#nextPageButton {
actionIcon: right;
enabled: { getModel().getCurrentPageIndex() < getModel().getPages().length };
- toolTipText: "faxtomail.pdfEitor.button.nextPage";
+ toolTipText: "faxtomail.pdfEditor.button.nextPage";
}
#zoomOutButton {
@@ -85,15 +89,19 @@
actionIcon: rotate-anticlockwise
}
+#printButton {
+ actionIcon: print;
+}
+
#cancelButton {
actionIcon: cancel;
- text: "faxtomail.pdfEitor.action.cancel";
- toolTipText: "faxtomail.pdfEitor.action.cancel.tip";
+ text: "faxtomail.pdfEditor.action.cancel";
+ toolTipText: "faxtomail.pdfEditor.action.cancel.tip";
}
#validateButton {
actionIcon: validate;
- text: "faxtomail.pdfEitor.action.validate";
- toolTipText: "faxtomail.pdfEitor.action.validate.tip";
+ text: "faxtomail.pdfEditor.action.validate";
+ toolTipText: "faxtomail.pdfEditor.action.validate.tip";
_applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction.class};
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-16 14:46:47 UTC (rev 79)
@@ -75,12 +75,19 @@
<JButton id="rotateAntiClockwiseButton"
onActionPerformed="handler.rotateAntiClockwise()"/>
+ <JSeparator constructorParams="SwingConstants.VERTICAL"/>
+
+ <JButton id="printButton"
+ onActionPerformed="handler.print()"/>
+
</JToolBar>
<JScrollPane constraints='BorderLayout.CENTER'>
<JPanel>
- <JImagePanel id="container">
- </JImagePanel>
+ <JPanel id="container" layout="{null}">
+ <JImagePanel id="documentPanel">
+ </JImagePanel>
+ </JPanel>
</JPanel>
</JScrollPane>
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -69,6 +69,8 @@
import java.nio.channels.FileChannel;
import java.util.Date;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -146,10 +148,13 @@
if (log.isErrorEnabled()) {
log.error("", e);
}
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.convertToPdf.error"));
+
} catch (DocumentException e) {
if (log.isErrorEnabled()) {
log.error("", e);
}
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.convertToPdf.error"));
}
}
if (FaxToMailUIUtil.isFileAPDF(file)) {
@@ -166,6 +171,7 @@
if (log.isErrorEnabled()) {
log.error("", e);
}
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.readPdf.error"));
}
}
getUI().setCursor(Cursor.getDefaultCursor());
@@ -178,14 +184,18 @@
model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ZOOM, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- displayPage(model.getCurrentPageIndex(), (Float) evt.getOldValue());
+ displayPage(model.getCurrentPageIndex(),
+ (Float) evt.getOldValue(),
+ model.getRotation());
}
});
model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ROTATION, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- displayPage(model.getCurrentPageIndex(), model.getZoom());
+ displayPage(model.getCurrentPageIndex(),
+ model.getZoom(),
+ (Integer) evt.getOldValue());
}
});
}
@@ -219,7 +229,7 @@
}
protected void addPanel(JPanel panel) {
- JImagePanel container = ui.getContainer();
+ JPanel container = ui.getContainer();
container.add(panel, 0);
Insets insets = container.getInsets();
@@ -246,12 +256,12 @@
}
}
- displayPage(pageNb, getModel().getZoom());
+ displayPage(pageNb, getModel().getZoom(), getModel().getRotation());
}
}
}
- protected void displayPage(int pageNb, float previousZoom) {
+ protected void displayPage(int pageNb, float previousZoom, int previousRotation) {
PDFPage page = pdf.getPage(pageNb);
// create the image
Rectangle2D bBox = page.getBBox();
@@ -270,36 +280,79 @@
true // block until drawing is done
);
- JImagePanel container = getUI().getContainer();
+ JPanel container = getUI().getContainer();
+ Dimension containerSize = new Dimension(rotation % 180 == 0 ? width : height,
+ rotation % 180 == 0 ? height : width);
+ container.setPreferredSize(containerSize);
+ container.setMinimumSize(containerSize);
+ container.setMaximumSize(containerSize);
+ container.setSize(containerSize);
- container.setImage(image, rotation);
+ JImagePanel documentPanel = ui.getDocumentPanel();
+ documentPanel.setRotation(rotation);
+ documentPanel.setImage(image);
Insets insets = container.getInsets();
- rect = container.getVisibleRect();
+ rect = container.getBounds();
+ float zoomRatio = zoom / previousZoom;
+ int rotationDiff = rotation - previousRotation;
+
PDFEditorUIModel.Page p = getModel().getPage(pageNb);
+
for (PDFEditorNoteUI panel : p.getNotes()) {
panel.setVisible(true);
panel.setZoom(zoom);
- Dimension size = panel.getPreferredSize();
- float ratio = zoom / previousZoom;
Rectangle bounds = panel.getBounds();
- panel.setBounds((int)(ratio * bounds.x) + rect.x + insets.left,
- (int)(ratio * bounds.y) + rect.y + insets.top,
- (int)(ratio * size.width), (int)(ratio * size.height));
+ int x, y;
+ if (rotationDiff == 0) {
+ x = bounds.x;
+ y = bounds.y;
+
+ } else if (rotationDiff == 90 || rotationDiff == -270) {
+ x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y;
+ y = bounds.x + bounds.width / 2 - bounds.height / 2;
+
+ } else {
+ x = bounds.y + bounds.height / 2 - bounds.width / 2;
+ y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x;
+ }
+
+ panel.setBounds((int)(zoomRatio * x) + insets.left,
+ (int)(zoomRatio * y) + insets.top,
+ (int)(zoomRatio * bounds.width), (int)(zoomRatio * bounds.height));
+
}
- for (JImagePanel panel : p.getCrosses()) {
+ for (PDFEditorCrossUI panel : p.getCrosses()) {
panel.setVisible(true);
- Dimension size = panel.getSize();
- float ratio = zoom / previousZoom;
Rectangle bounds = panel.getBounds();
- panel.setBounds((int)(ratio * bounds.x) + rect.x + insets.left,
- (int)(ratio * bounds.y) + rect.y + insets.top,
- (int)(ratio * size.width), (int)(ratio * size.height));
+
+ int newWidth = Math.abs(rotationDiff) % 180 == 0 ? bounds.width : bounds.height;
+ int newHeight = Math.abs(rotationDiff) % 180 == 0 ? bounds.height : bounds.width;
+
+ int x, y;
+
+ if (rotationDiff == 0) {
+ x = bounds.x;
+ y = bounds.y;
+
+ } else if (rotationDiff == 90 || rotationDiff == -270) {
+ x = rect.width - newWidth - bounds.y;
+ y = bounds.x;
+
+ } else {
+ x = bounds.y;
+ y = rect.height - newHeight - bounds.x;
+ }
+
+ panel.setBounds((int) (zoomRatio * x) + insets.left,
+ (int) (zoomRatio * y) + insets.top,
+ (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight));
+
}
container.updateUI();
@@ -381,4 +434,8 @@
int rotation = getModel().getRotation();
getModel().setRotation((360 + rotation - 90) % 360);
}
+
+ public void print() {
+ FaxToMailUIUtil.print(getModel().getEditedFile());
+ }
}
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -52,7 +52,7 @@
public class Page {
protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>();
- protected List<JImagePanel> crosses = new ArrayList<JImagePanel>();
+ protected List<PDFEditorCrossUI> crosses = new ArrayList<PDFEditorCrossUI>();
public List<PDFEditorNoteUI> getNotes() {
return notes;
@@ -66,11 +66,11 @@
notes.remove(note);
}
- public List<JImagePanel> getCrosses() {
+ public List<PDFEditorCrossUI> getCrosses() {
return crosses;
}
- public void addCross(JImagePanel cross) {
+ public void addCross(PDFEditorCrossUI cross) {
crosses.add(cross);
}
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -41,6 +41,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.validator.bean.simple.SimpleBeanValidator;
import javax.swing.*;
import javax.swing.plaf.basic.BasicComboBoxEditor;
@@ -156,6 +157,20 @@
JComboBox addAttachmentFile = ui.getAddAttachmentFile();
addAttachmentFile.setRenderer(new DecoratorListCellRenderer(getDecorator(File.class, null)));
addAttachmentFile.setEditor(new FileComboBoxEditor());
+
+ getValidator().addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ ReplyFormUIModel model = getModel();
+ if (log.isDebugEnabled()) {
+ log.debug("Model [" + model +
+ "] pass to valid state [" +
+ evt.getNewValue() + "]");
+ }
+ model.setValid((Boolean) evt.getNewValue());
+ }
+ });
}
@Override
@@ -169,7 +184,7 @@
@Override
public SwingValidator<ReplyFormUIModel> getValidator() {
- return null;
+ return getUI().getValidator();
}
@Override
@@ -237,9 +252,8 @@
}
public void openAttachment(File attachment) {
- Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
+ Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
-// desktop.browse(file.toURI());
desktop.open(attachment);
} catch (IOException e) {
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -188,6 +188,7 @@
if (log.isErrorEnabled()) {
log.error("error while searching", e);
}
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
}
}
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -188,6 +188,7 @@
if (log.isErrorEnabled()) {
log.error("error while searching", e);
}
+ getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -34,6 +34,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil;
import org.nuiton.util.FileUtil;
@@ -51,8 +52,10 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
+import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -61,6 +64,8 @@
import java.util.List;
import java.util.Map;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
@@ -215,4 +220,36 @@
textPane.setText(content);
}
+ public static Desktop getDesktopForPrint() {
+
+ if (!Desktop.isDesktopSupported()) {
+ throw new ApplicationTechnicalException(
+ t("jaxx.application.error.desktop.not.supported"));
+ }
+
+ Desktop desktop = Desktop.getDesktop();
+
+ if (!desktop.isSupported(Desktop.Action.PRINT)) {
+
+ throw new ApplicationTechnicalException(
+ t("jaxx.application.error.desktop.print.not.supported"));
+ }
+
+ return desktop;
+ }
+
+ public static void print(File file) {
+
+ Desktop desktop = getDesktopForPrint();
+
+ try {
+ desktop.print(file);
+
+ } catch (Exception e) {
+
+ throw new ApplicationTechnicalException(
+ t("jaxx.application.error.cannot.print"), e);
+ }
+ }
+
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java 2014-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java 2014-05-16 14:46:47 UTC (rev 79)
@@ -56,7 +56,7 @@
protected Image image;
protected Image scaledImage;
- protected int rotation;
+ protected int rotation = 0;
protected boolean scaleImageToFitPanel;
@@ -65,14 +65,18 @@
public void componentResized(ComponentEvent e) {
Component component = e.getComponent();
if (image != null) {
- scaledImage = image.getScaledInstance(component.getWidth(), component.getHeight(), Image.SCALE_SMOOTH);
+ int srcWidth = component.getWidth();
+ int srcHeight = component.getHeight();
+ int newWidth = rotation % 180 == 0 ? srcWidth : srcHeight;
+ int newHeight = rotation % 180 == 0 ? srcHeight : srcWidth;
+ scaledImage = image.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
}
repaint();
}
};
- public JImagePanel() {
- setLayout(null);
+ public void setRotation(int rotation) {
+ this.rotation = rotation;
}
public boolean isScaleImageToFitPanel() {
@@ -108,22 +112,16 @@
bufferedImage = null;
}
if (bufferedImage != null) {
- setImage(bufferedImage, 0);
+ setImage(bufferedImage);
}
}
public void setImage(Image img) {
- setImage(img, 0);
- }
-
- public void setImage(Image img, int rotation) {
this.image = img;
this.scaledImage = img;
- this.rotation = rotation;
int srcWidth = img.getWidth(null);
int srcHeight = img.getHeight(null);
-
int newWidth = rotation % 180 == 0 ? srcWidth : srcHeight;
int newHeight = rotation % 180 == 0 ? srcHeight : srcWidth;
@@ -135,7 +133,7 @@
}
public void setImage(String img) {
- setImage(new ImageIcon(img).getImage(), 0);
+ setImage(new ImageIcon(img).getImage());
}
@Override
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-05-15 16:05:08 UTC (rev 78)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-16 14:46:47 UTC (rev 79)
@@ -193,14 +193,14 @@
faxtomail.main.title.application=FaxToMail
faxtomail.main.title.applicationName=FaxToMail
faxtomail.main.title.nodb=
-faxtomail.pdfEitor.action.cancel=Annuler
-faxtomail.pdfEitor.action.cancel.tip=Ne pas enregistrer les changements et fermer
-faxtomail.pdfEitor.action.validate=Enregistrer
-faxtomail.pdfEitor.action.validate.tip=Enregistrer les changements et fermer
-faxtomail.pdfEitor.button.addCross.tip=Ajouter une croix
-faxtomail.pdfEitor.button.addNote.tip=Ajouter une note
-faxtomail.pdfEitor.button.nextPage=Page suivante
-faxtomail.pdfEitor.button.previousPage=Page précédente
+faxtomail.pdfEditor.action.cancel=Annuler
+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.button.addCross.tip=Ajouter une croix
+faxtomail.pdfEditor.button.addNote.tip=Ajouter une note
+faxtomail.pdfEditor.button.nextPage=Page suivante
+faxtomail.pdfEditor.button.previousPage=Page précédente
faxtomail.quantitiesByRange.button.text=OK
faxtomail.quantitiesByRange.title=Quantités par gamme
faxtomail.rangeRows.table.header.commandNumber=N° commande / devis
@@ -251,5 +251,10 @@
faxtomail.validator.error.email.clientCode.required=Code client requis
faxtomail.validator.error.email.demandType.required=Type de demande requis
faxtomail.validator.error.email.projectReference.required=Référence chantier requise
+faxtomail.validator.error.reply.from.required=
+faxtomail.validator.error.reply.to.required=
+jaxx.application.error.cannot.print=
+jaxx.application.error.desktop.not.supported=
+jaxx.application.error.desktop.print.not.supported=
swing.error.cannot.open.file=
test=
1
0
r78 - in trunk: . faxtomail-ui-web faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/WEB-INF/decorators faxtomail-ui-web/src/main/webapp/css faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 15 May '14
by echatellier@users.forge.codelutin.com 15 May '14
15 May '14
Author: echatellier
Date: 2014-05-15 18:05:08 +0200 (Thu, 15 May 2014)
New Revision: 78
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/78
Log:
Use js dependencies with webjars
Removed:
trunk/faxtomail-ui-web/src/main/webapp/css/jstree/
trunk/faxtomail-ui-web/src/main/webapp/css/select2/
trunk/faxtomail-ui-web/src/main/webapp/js/jquery.ui.touch.js
trunk/faxtomail-ui-web/src/main/webapp/js/jstree/
trunk/faxtomail-ui-web/src/main/webapp/js/require.js
trunk/faxtomail-ui-web/src/main/webapp/js/select2/
Modified:
trunk/faxtomail-ui-web/pom.xml
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
trunk/pom.xml
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/faxtomail-ui-web/pom.xml 2014-05-15 16:05:08 UTC (rev 78)
@@ -212,6 +212,31 @@
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angularjs</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jstree</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>bootstrap</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>select2</artifactId>
+ </dependency>
</dependencies>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-15 16:05:08 UTC (rev 78)
@@ -28,10 +28,14 @@
<html>
<head>
<title>Configuration</title>
- <script type="text/javascript" src="<s:url value='/js/select2/select2.min.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/select2/select2_locale_fr.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/jstree/jstree.js' />"></script>
+ <link rel="stylesheet" type="text/css" href="<s:url value='/webjars/select2/3.4.8/select2.css' />" />
+ <link rel="stylesheet" type="text/css" href="<s:url value='/webjars/jstree/3.0.0/themes/default/style.min.css' />" />
+ <link rel="stylesheet" type="text/css" href="<s:url value='/css/configuration.css' />" />
+ <script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2.min.js' />"></script>
+ <script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2_locale_fr.js' />"></script>
+ <script type="text/javascript" src="<s:url value='/webjars/jstree/3.0.0/jstree.min.js' />"></script>
+
<script>
var emailFields = {};
<s:iterator value="emailFields">
@@ -40,12 +44,8 @@
var folderData = JSON.parse('<s:property value="foldersTreeAsJson" escapeHtml="false"/>');
</script>
+
<script type="text/javascript" src="<s:url value='/js/configuration.js' />"></script>
-
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/select2/select2.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/jstree/themes/default/style.min.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/configuration.css' />" />
-
</head>
<body>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-05-15 16:05:08 UTC (rev 78)
@@ -33,11 +33,6 @@
<title>FaxToMail : <decorator:title default="FaxToMail"/></title>
<sj:head locale="fr" jqueryui="true" loadAtOnce='true' jquerytheme="start" />
<sb:head />
- <!--<script type="text/javascript" src="<s:url value='/js/select2/select2.min.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/select2/select2_locale_fr.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/extranet.js' />"></script>
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/select2/select2.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/extranet.css' />" />-->
<decorator:head/>
</head>
Deleted: trunk/faxtomail-ui-web/src/main/webapp/js/jquery.ui.touch.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/jquery.ui.touch.js 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/jquery.ui.touch.js 2014-05-15 16:05:08 UTC (rev 78)
@@ -1,192 +0,0 @@
-/** %%Ignore-License
-* jQuery.UI.iPad plugin
-* Copyright (c) 2010 Stephen von Takach
-* licensed under MIT.
-* Date: 27/8/2010
-*
-* Project Home:
-* http://code.google.com/p/jquery-ui-for-ipad-and-iphone/
-*
-* Modified: 19/01/2012
-* Organized as a proper plugin and added addTouch()
-*/
-(function ($) {
- var lastTap = null, // Holds last tapped element (so we can compare for double tap)
- tapValid = false, // Are we still in the .6 second window where a double tap can occur
- tapTimeout = null, // The timeout reference
- rightClickPending = false, // Is a right click still feasible
- rightClickEvent = null, // the original event
- holdTimeout = null, // timeout reference
- cancelMouseUp = false, // prevents a click from occurring as we want the context menu
- currentDOMElement = null; // the last DOM element that was seen during a drag.
-
- function cancelTap() {
- tapValid = false;
- }
-
- function cancelHold() {
- if (rightClickPending) {
- window.clearTimeout(holdTimeout);
- rightClickPending = false;
- rightClickEvent = null;
- }
- }
-
- function startHold(event) {
- if (rightClickPending) {
- return;
- }
- rightClickPending = true; // We could be performing a right click
- rightClickEvent = (event.changedTouches)[0];
- holdTimeout = window.setTimeout(doRightClick, 800);
- }
-
- function doRightClick() {
- rightClickPending = false;
- // We need to mouse up (as we were down)
- var first = rightClickEvent,
- simulatedEvent = document.createEvent("MouseEvent");
- simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null);
- first.target.dispatchEvent(simulatedEvent);
-
- // Emulate a right click
- simulatedEvent = document.createEvent("MouseEvent");
- simulatedEvent.initMouseEvent("mousedown", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 2, null);
- first.target.dispatchEvent(simulatedEvent);
-
- // Show a context menu
- simulatedEvent = document.createEvent("MouseEvent");
- simulatedEvent.initMouseEvent("contextmenu", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5, false, false, false, false, 2, null);
- first.target.dispatchEvent(simulatedEvent);
-
- simulatedEvent = document.createEvent("MouseEvent");
- simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5, false, false, false, false, 2, null);
- first.target.dispatchEvent(simulatedEvent);
-
- cancelMouseUp = true;
- rightClickEvent = null; // Release memory
- }
-
-
- // mouse over event then mouse down
- function iPadTouchStart(event) {
- var touches = event.changedTouches,
- first = touches[0],
- type = "mouseover",
- simulatedEvent = document.createEvent("MouseEvent");
-
- // Mouse over first - I have live events attached on mouse over
- simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null);
- first.target.dispatchEvent(simulatedEvent);
-
- type = "mousedown";
- simulatedEvent = document.createEvent("MouseEvent");
-
- simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null);
- first.target.dispatchEvent(simulatedEvent);
-
- if (!tapValid) {
- lastTap = first.target;
- tapValid = true;
- tapTimeout = window.setTimeout(cancelTap, 600);
- startHold(event);
- } else {
- window.clearTimeout(tapTimeout);
- // If a double tap is still a possibility and the elements are the same then perform a double click
- if (first.target == lastTap) {
- lastTap = null;
- tapValid = false;
-
- type = "click";
- simulatedEvent = document.createEvent("MouseEvent");
-
- simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null);
- first.target.dispatchEvent(simulatedEvent);
-
- type = "dblclick";
- simulatedEvent = document.createEvent("MouseEvent");
-
- simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0, null);
- first.target.dispatchEvent(simulatedEvent);
- } else {
- lastTap = first.target;
- tapValid = true;
- tapTimeout = window.setTimeout(cancelTap, 600);
- startHold(event);
- }
- }
- }
-
- function getDOMElementFromEvent(event) {
- if (event.targetTouches && event.targetTouches[0]) {
- return document.elementFromPoint(event.targetTouches[0].pageX - window.pageXOffset, event.targetTouches[0].pageY - window.pageYOffset);
- }
- return null;
- }
-
- function iPadTouchHandler(event) {
- var type = "",
- button = 0; /*left*/
- if (event.touches.length > 1) {
- return;
- }
- switch (event.type) {
- case "touchstart":
- if ($(event.changedTouches[0].target).is("select")) {
- return;
- }
- iPadTouchStart(event); /*We need to trigger two events here to support one touch drag and drop*/
- event.preventDefault();
- currentDOMElement = getDOMElementFromEvent(event);
- return false;
-
- case "touchmove":
- cancelHold();
- type = "mousemove";
- event.preventDefault();
-
- currentDOMElement = getDOMElementFromEvent(event);
- break;
-
- case "touchend":
- if (cancelMouseUp) {
- cancelMouseUp = false;
- event.preventDefault();
- return false;
- }
- cancelHold();
- type = "mouseup";
- break;
-
- default:
- return;
- }
- var touches = event.changedTouches,
- first = touches[0],
- simulatedEvent = document.createEvent("MouseEvent");
- simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,false, false, false, false, button, null);
- currentDOMElement.dispatchEvent(simulatedEvent);
- if (type == "mouseup" && tapValid && first.target == lastTap) { // This actually emulates the ipad's default behavior (which we prevented)
- simulatedEvent = document.createEvent("MouseEvent"); // This check avoids click being emulated on a double tap
- simulatedEvent.initMouseEvent("click", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,false, false, false, false, button, null);
- currentDOMElement.dispatchEvent(simulatedEvent);
- }
- }
-
- $.extend($.support, {
- touch: "ontouchend" in document
- });
-
- $.fn.addTouch = function () {
- if ($.support.touch) {
- this.each(function (i, el) {
- el.addEventListener("touchstart", iPadTouchHandler, false);
- el.addEventListener("touchmove", iPadTouchHandler, false);
- el.addEventListener("touchend", iPadTouchHandler, false);
- el.addEventListener("touchcancel", iPadTouchHandler, false);
- });
- }
- return this;
- };
-
-})(jQuery);
\ No newline at end of file
Deleted: trunk/faxtomail-ui-web/src/main/webapp/js/require.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/require.js 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/require.js 2014-05-15 16:05:08 UTC (rev 78)
@@ -1,36 +0,0 @@
-/* %%Ignore-License
- RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
- Available via the MIT or new BSD license.
- see: http://github.com/jrburke/requirejs for details
-*/
-var requirejs,require,define;
-(function(Z){function H(b){return"[object Function]"===L.call(b)}function I(b){return"[object Array]"===L.call(b)}function y(b,c){if(b){var e;for(e=0;e<b.length&&(!b[e]||!c(b[e],e,b));e+=1);}}function M(b,c){if(b){var e;for(e=b.length-1;-1<e&&(!b[e]||!c(b[e],e,b));e-=1);}}function t(b,c){return ga.call(b,c)}function l(b,c){return t(b,c)&&b[c]}function F(b,c){for(var e in b)if(t(b,e)&&c(b[e],e))break}function Q(b,c,e,h){c&&F(c,function(c,j){if(e||!t(b,j))h&&"string"!==typeof c?(b[j]||(b[j]={}),Q(b[j],
-c,e,h)):b[j]=c});return b}function u(b,c){return function(){return c.apply(b,arguments)}}function aa(b){throw b;}function ba(b){if(!b)return b;var c=Z;y(b.split("."),function(b){c=c[b]});return c}function A(b,c,e,h){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=h;e&&(c.originalError=e);return c}function ha(b){function c(a,f,b){var d,m,c,g,e,h,j,i=f&&f.split("/");d=i;var n=k.map,p=n&&n["*"];if(a&&"."===a.charAt(0))if(f){d=l(k.pkgs,f)?i=[f]:i.slice(0,i.length-
-1);f=a=d.concat(a.split("/"));for(d=0;f[d];d+=1)if(m=f[d],"."===m)f.splice(d,1),d-=1;else if(".."===m)if(1===d&&(".."===f[2]||".."===f[0]))break;else 0<d&&(f.splice(d-1,2),d-=2);d=l(k.pkgs,f=a[0]);a=a.join("/");d&&a===f+"/"+d.main&&(a=f)}else 0===a.indexOf("./")&&(a=a.substring(2));if(b&&n&&(i||p)){f=a.split("/");for(d=f.length;0<d;d-=1){c=f.slice(0,d).join("/");if(i)for(m=i.length;0<m;m-=1)if(b=l(n,i.slice(0,m).join("/")))if(b=l(b,c)){g=b;e=d;break}if(g)break;!h&&(p&&l(p,c))&&(h=l(p,c),j=d)}!g&&
-h&&(g=h,e=j);g&&(f.splice(0,e,g),a=f.join("/"))}return a}function e(a){z&&y(document.getElementsByTagName("script"),function(f){if(f.getAttribute("data-requiremodule")===a&&f.getAttribute("data-requirecontext")===i.contextName)return f.parentNode.removeChild(f),!0})}function h(a){var f=l(k.paths,a);if(f&&I(f)&&1<f.length)return f.shift(),i.require.undef(a),i.require([a]),!0}function $(a){var f,b=a?a.indexOf("!"):-1;-1<b&&(f=a.substring(0,b),a=a.substring(b+1,a.length));return[f,a]}function n(a,f,
-b,d){var m,B,g=null,e=f?f.name:null,h=a,j=!0,k="";a||(j=!1,a="_@r"+(L+=1));a=$(a);g=a[0];a=a[1];g&&(g=c(g,e,d),B=l(r,g));a&&(g?k=B&&B.normalize?B.normalize(a,function(a){return c(a,e,d)}):c(a,e,d):(k=c(a,e,d),a=$(k),g=a[0],k=a[1],b=!0,m=i.nameToUrl(k)));b=g&&!B&&!b?"_unnormalized"+(M+=1):"";return{prefix:g,name:k,parentMap:f,unnormalized:!!b,url:m,originalName:h,isDefine:j,id:(g?g+"!"+k:k)+b}}function q(a){var f=a.id,b=l(p,f);b||(b=p[f]=new i.Module(a));return b}function s(a,f,b){var d=a.id,m=l(p,
-d);if(t(r,d)&&(!m||m.defineEmitComplete))"defined"===f&&b(r[d]);else if(m=q(a),m.error&&"error"===f)b(m.error);else m.on(f,b)}function v(a,f){var b=a.requireModules,d=!1;if(f)f(a);else if(y(b,function(f){if(f=l(p,f))f.error=a,f.events.error&&(d=!0,f.emit("error",a))}),!d)j.onError(a)}function w(){R.length&&(ia.apply(G,[G.length-1,0].concat(R)),R=[])}function x(a){delete p[a];delete T[a]}function E(a,f,b){var d=a.map.id;a.error?a.emit("error",a.error):(f[d]=!0,y(a.depMaps,function(d,c){var g=d.id,
-e=l(p,g);e&&(!a.depMatched[c]&&!b[g])&&(l(f,g)?(a.defineDep(c,r[g]),a.check()):E(e,f,b))}),b[d]=!0)}function C(){var a,f,b,d,m=(b=1E3*k.waitSeconds)&&i.startTime+b<(new Date).getTime(),c=[],g=[],j=!1,l=!0;if(!U){U=!0;F(T,function(b){a=b.map;f=a.id;if(b.enabled&&(a.isDefine||g.push(b),!b.error))if(!b.inited&&m)h(f)?j=d=!0:(c.push(f),e(f));else if(!b.inited&&(b.fetched&&a.isDefine)&&(j=!0,!a.prefix))return l=!1});if(m&&c.length)return b=A("timeout","Load timeout for modules: "+c,null,c),b.contextName=
-i.contextName,v(b);l&&y(g,function(a){E(a,{},{})});if((!m||d)&&j)if((z||da)&&!V)V=setTimeout(function(){V=0;C()},50);U=!1}}function D(a){t(r,a[0])||q(n(a[0],null,!0)).init(a[1],a[2])}function J(a){var a=a.currentTarget||a.srcElement,b=i.onScriptLoad;a.detachEvent&&!W?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=i.onScriptError;(!a.detachEvent||W)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function K(){var a;for(w();G.length;){a=
-G.shift();if(null===a[0])return v(A("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));D(a)}}var U,X,i,N,V,k={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},p={},T={},Y={},G=[],r={},S={},L=1,M=1;N={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){var b=
-l(k.pkgs,a.map.id);return(b?l(k.config,a.map.id+"/"+b.main):l(k.config,a.map.id))||{}},exports:r[a.map.id]}}};X=function(a){this.events=l(Y,a.id)||{};this.map=a;this.shim=l(k.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};X.prototype={init:function(a,b,c,d){d=d||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=u(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;
-this.ignore=d.ignore;d.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
-this.map.url;S[a]||(S[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var d=this.exports,m=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(H(m)){if(this.events.error&&this.map.isDefine||j.onError!==aa)try{d=i.execCb(c,m,b,d)}catch(e){a=e}else d=i.execCb(c,m,b,d);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==
-this.exports?d=b.exports:void 0===d&&this.usingExports&&(d=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",v(this.error=a)}else d=m;this.exports=d;if(this.map.isDefine&&!this.ignore&&(r[c]=d,j.onResourceLoad))j.onResourceLoad(i,this.map,this.depMaps);x(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=
-!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,e=n(a.prefix);this.depMaps.push(e);s(e,"defined",u(this,function(d){var m,e;e=this.map.name;var g=this.map.parentMap?this.map.parentMap.name:null,h=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(d.normalize&&(e=d.normalize(e,function(a){return c(a,g,!0)})||""),d=n(a.prefix+"!"+e,this.map.parentMap),s(d,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),
-e=l(p,d.id)){this.depMaps.push(d);if(this.events.error)e.on("error",u(this,function(a){this.emit("error",a)}));e.enable()}}else m=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),m.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];F(p,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&x(a.map.id)});v(a)}),m.fromText=u(this,function(d,c){var e=a.name,g=n(e),B=O;c&&(d=c);B&&(O=!1);q(g);t(k.config,b)&&(k.config[e]=k.config[b]);try{j.exec(d)}catch(ca){return v(A("fromtexteval",
-"fromText eval for "+b+" failed: "+ca,ca,[b]))}B&&(O=!0);this.depMaps.push(g);i.completeLoad(e);h([e],m)}),d.load(a.name,h,m,k)}));i.enable(e,this);this.pluginMaps[e.id]=e},enable:function(){T[this.map.id]=this;this.enabling=this.enabled=!0;y(this.depMaps,u(this,function(a,b){var c,d;if("string"===typeof a){a=n(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=l(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",u(this,function(a){this.defineDep(b,
-a);this.check()}));this.errback&&s(a,"error",u(this,this.errback))}c=a.id;d=p[c];!t(N,c)&&(d&&!d.enabled)&&i.enable(a,this)}));F(this.pluginMaps,u(this,function(a){var b=l(p,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){y(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:k,contextName:b,registry:p,defined:r,urlFetched:S,defQueue:G,Module:X,makeModuleMap:n,
-nextTick:j.nextTick,onError:v,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=k.pkgs,c=k.shim,d={paths:!0,config:!0,map:!0};F(a,function(a,b){d[b]?"map"===b?(k.map||(k.map={}),Q(k[b],a,!0,!0)):Q(k[b],a,!0):k[b]=a});a.shim&&(F(a.shim,function(a,b){I(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);c[b]=a}),k.shim=c);a.packages&&(y(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,
-location:a.location||a.name,main:(a.main||"main").replace(ja,"").replace(ea,"")}}),k.pkgs=b);F(p,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=n(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(Z,arguments));return b||a.exports&&ba(a.exports)}},makeRequire:function(a,f){function h(d,c,e){var g,k;f.enableBuildCallback&&(c&&H(c))&&(c.__requireJsBuild=!0);if("string"===typeof d){if(H(c))return v(A("requireargs",
-"Invalid require call"),e);if(a&&t(N,d))return N[d](p[a.id]);if(j.get)return j.get(i,d,a,h);g=n(d,a,!1,!0);g=g.id;return!t(r,g)?v(A("notloaded",'Module name "'+g+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[g]}K();i.nextTick(function(){K();k=q(n(null,a));k.skipMap=f.skipMap;k.init(d,c,e,{enabled:!0});C()});return h}f=f||{};Q(h,{isBrowser:z,toUrl:function(b){var f,e=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==e&&(!("."===g||".."===g)||1<e))f=b.substring(e,b.length),b=
-b.substring(0,e);return i.nameToUrl(c(b,a&&a.id,!0),f,!0)},defined:function(b){return t(r,n(b,a,!1,!0).id)},specified:function(b){b=n(b,a,!1,!0).id;return t(r,b)||t(p,b)}});a||(h.undef=function(b){w();var c=n(b,a,!0),f=l(p,b);e(b);delete r[b];delete S[c.url];delete Y[b];f&&(f.events.defined&&(Y[b]=f.events),x(b))});return h},enable:function(a){l(p,a.id)&&q(a).enable()},completeLoad:function(a){var b,c,d=l(k.shim,a)||{},e=d.exports;for(w();G.length;){c=G.shift();if(null===c[0]){c[0]=a;if(b)break;b=
-!0}else c[0]===a&&(b=!0);D(c)}c=l(p,a);if(!b&&!t(r,a)&&c&&!c.inited){if(k.enforceDefine&&(!e||!ba(e)))return h(a)?void 0:v(A("nodefine","No define call for "+a,null,[a]));D([a,d.deps||[],d.exportsFn])}C()},nameToUrl:function(a,b,c){var d,e,h,g,i,n;if(j.jsExtRegExp.test(a))g=a+(b||"");else{d=k.paths;e=k.pkgs;g=a.split("/");for(i=g.length;0<i;i-=1)if(n=g.slice(0,i).join("/"),h=l(e,n),n=l(d,n)){I(n)&&(n=n[0]);g.splice(0,i,n);break}else if(h){a=a===h.name?h.location+"/"+h.main:h.location;g.splice(0,i,
-a);break}g=g.join("/");g+=b||(/^data\:|\?/.test(g)||c?"":".js");g=("/"===g.charAt(0)||g.match(/^[\w\+\.\-]+:/)?"":k.baseUrl)+g}return k.urlArgs?g+((-1===g.indexOf("?")?"?":"&")+k.urlArgs):g},load:function(a,b){j.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ka.test((a.currentTarget||a.srcElement).readyState))P=null,a=J(a),i.completeLoad(a.id)},onScriptError:function(a){var b=J(a);if(!h(b.id))return v(A("scripterror","Script error for: "+b.id,
-a,[b.id]))}};i.require=i.makeRequire();return i}var j,w,x,C,J,D,P,K,q,fa,la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ma=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ea=/\.js$/,ja=/^\.\//;w=Object.prototype;var L=w.toString,ga=w.hasOwnProperty,ia=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),da=!z&&"undefined"!==typeof importScripts,ka=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,W="undefined"!==typeof opera&&
-"[object Opera]"===opera.toString(),E={},s={},R=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(H(requirejs))return;s=requirejs;requirejs=void 0}"undefined"!==typeof require&&!H(require)&&(s=require,require=void 0);j=requirejs=function(b,c,e,h){var q,n="_";!I(b)&&"string"!==typeof b&&(q=b,I(c)?(b=c,c=e,e=h):b=[]);q&&q.context&&(n=q.context);(h=l(E,n))||(h=E[n]=j.s.newContext(n));q&&h.configure(q);return h.require(b,c,e)};j.config=function(b){return j(b)};j.nextTick="undefined"!==
-typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=j);j.version="2.1.9";j.jsExtRegExp=/^\/|:|\?|\.js$/;j.isBrowser=z;w=j.s={contexts:E,newContext:ha};j({});y(["toUrl","undef","defined","specified"],function(b){j[b]=function(){var c=E._;return c.require[b].apply(c,arguments)}});if(z&&(x=w.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0]))x=w.head=C.parentNode;j.onError=aa;j.createNode=function(b){var c=b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml",
-"html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};j.load=function(b,c,e){var h=b&&b.config||{};if(z)return h=j.createNode(h,c,e),h.setAttribute("data-requirecontext",b.contextName),h.setAttribute("data-requiremodule",c),h.attachEvent&&!(h.attachEvent.toString&&0>h.attachEvent.toString().indexOf("[native code"))&&!W?(O=!0,h.attachEvent("onreadystatechange",b.onScriptLoad)):(h.addEventListener("load",b.onScriptLoad,!1),h.addEventListener("error",
-b.onScriptError,!1)),h.src=e,K=h,C?x.insertBefore(h,C):x.appendChild(h),K=null,h;if(da)try{importScripts(e),b.completeLoad(c)}catch(l){b.onError(A("importscripts","importScripts failed for "+c+" at "+e,l,[c]))}};z&&!s.skipDataMain&&M(document.getElementsByTagName("script"),function(b){x||(x=b.parentNode);if(J=b.getAttribute("data-main"))return q=J,s.baseUrl||(D=q.split("/"),q=D.pop(),fa=D.length?D.join("/")+"/":"./",s.baseUrl=fa),q=q.replace(ea,""),j.jsExtRegExp.test(q)&&(q=J),s.deps=s.deps?s.deps.concat(q):
-[q],!0});define=function(b,c,e){var h,j;"string"!==typeof b&&(e=c,c=b,b=null);I(c)||(e=c,c=null);!c&&H(e)&&(c=[],e.length&&(e.toString().replace(la,"").replace(ma,function(b,e){c.push(e)}),c=(1===e.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(h=K))P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),h=P;h&&(b||(b=h.getAttribute("data-requiremodule")),j=E[h.getAttribute("data-requirecontext")])}(j?
-j.defQueue:R).push([b,c,e])};define.amd={jQuery:!0};j.exec=function(b){return eval(b)};j(s)}})(this);
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-15 13:13:09 UTC (rev 77)
+++ trunk/pom.xml 2014-05-15 16:05:08 UTC (rev 78)
@@ -512,6 +512,41 @@
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angularjs</artifactId>
+ <version>1.2.16-2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jstree</artifactId>
+ <version>3.0.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>bootstrap</artifactId>
+ <version>3.1.1-1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery</artifactId>
+ <version>1.11.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>select2</artifactId>
+ <version>3.4.8</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
1
0
r77 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web
by echatellier@users.forge.codelutin.com 15 May '14
by echatellier@users.forge.codelutin.com 15 May '14
15 May '14
Author: echatellier
Date: 2014-05-15 15:13:09 +0200 (Thu, 15 May 2014)
New Revision: 77
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/77
Log:
Update libs
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-15 13:12:52 UTC (rev 76)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-15 13:13:09 UTC (rev 77)
@@ -64,7 +64,7 @@
}
public String translateEnum(Class cl, String name) {
- return _(cl.getName() + "." + name);
+ return t(cl.getName() + "." + name);
}
public String translateEnum(Enum en) {
1
0
Author: echatellier
Date: 2014-05-15 15:12:52 +0200 (Thu, 15 May 2014)
New Revision: 76
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/76
Log:
Update libs
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-15 08:00:59 UTC (rev 75)
+++ trunk/pom.xml 2014-05-15 13:12:52 UTC (rev 76)
@@ -95,14 +95,14 @@
<!-- libraries version -->
- <nuitonI18nVersion>3.0</nuitonI18nVersion>
+ <nuitonI18nVersion>3.1</nuitonI18nVersion>
<nuitonConfigVersion>3.0-alpha-2</nuitonConfigVersion>
- <nuitonCsvVersion>3.0-alpha-3</nuitonCsvVersion>
+ <nuitonCsvVersion>3.0-rc-1</nuitonCsvVersion>
<nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion>
<nuitonUpdaterVersion>3.0-alpha-2</nuitonUpdaterVersion>
<nuitonUtilsVersion>3.0-SNAPSHOT</nuitonUtilsVersion>
- <nuitonValidatorVersion>3.0-alpha-3</nuitonValidatorVersion>
- <nuitonWebVersion>1.15-alpha-3</nuitonWebVersion>
+ <nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
+ <nuitonWebVersion>1.16</nuitonWebVersion>
<eugeneVersion>2.8</eugeneVersion>
<topiaVersion>3.0-beta-3</topiaVersion>
@@ -113,10 +113,10 @@
<swingXVersion>1.6.5-1</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
- <struts2Version>2.3.15.3</struts2Version>
- <jqueryPluginVersion>3.6.1</jqueryPluginVersion>
- <bootstrapPluginVersion>1.6.1</bootstrapPluginVersion>
- <shiroVersion>1.2.2</shiroVersion>
+ <struts2Version>2.3.16.3</struts2Version>
+ <jqueryPluginVersion>3.7.1</jqueryPluginVersion>
+ <bootstrapPluginVersion>1.7.0</bootstrapPluginVersion>
+ <shiroVersion>1.2.3</shiroVersion>
<slf4jVersion>1.7.7</slf4jVersion>
<mockitoVersion>1.9.5</mockitoVersion>
<postgresqlDriverVersion>9.3-1101-jdbc41</postgresqlDriverVersion>
@@ -213,7 +213,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-profiling</artifactId>
- <version>2.7</version>
+ <version>2.7.1</version>
</dependency>
<dependency>
1
0
Author: echatellier
Date: 2014-05-15 10:00:59 +0200 (Thu, 15 May 2014)
New Revision: 75
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/75
Log:
Use release
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-14 17:23:11 UTC (rev 74)
+++ trunk/pom.xml 2014-05-15 08:00:59 UTC (rev 75)
@@ -109,7 +109,7 @@
<hibernateVersion>4.3.5.Final</hibernateVersion>
<h2Version>1.3.176</h2Version>
- <jaxxVersion>2.8.5-SNAPSHOT</jaxxVersion>
+ <jaxxVersion>2.8.5</jaxxVersion>
<swingXVersion>1.6.5-1</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
1
0