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
r65 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search
by echatellier@users.forge.codelutin.com 12 May '14
by echatellier@users.forge.codelutin.com 12 May '14
12 May '14
Author: echatellier
Date: 2014-05-12 17:21:31 +0200 (Mon, 12 May 2014)
New Revision: 65
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/65
Log:
Fix search form
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-05-12 10:37:26 UTC (rev 64)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-05-12 15:21:31 UTC (rev 65)
@@ -227,7 +227,7 @@
</cell>
<cell columns='3' weightx='1'>
<JTextField id='subjectField'
- onKeyReleased='handler.setText(event, "subject")'/>
+ onKeyReleased='handler.setText(event, "object")'/>
</cell>
<cell>
1
0
r64 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply
by kmorin@users.forge.codelutin.com 12 May '14
by kmorin@users.forge.codelutin.com 12 May '14
12 May '14
Author: kmorin
Date: 2014-05-12 12:37:26 +0200 (Mon, 12 May 2014)
New Revision: 64
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/64
Log:
r?\195?\169ponse par mail : propose les pi?\195?\168ces-jointes des demandes du groupe
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
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-12 10:27:56 UTC (rev 63)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-05-12 10:37:26 UTC (rev 64)
@@ -25,6 +25,7 @@
*/
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;
@@ -52,6 +53,7 @@
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;
@@ -76,11 +78,17 @@
DemandeUIModel currentEmail = getContext().getCurrentEmail();
model.setOriginalDemand(currentEmail);
- for (Attachment attachment : currentEmail.getAttachment()) {
- model.addAvailableAttachment(attachment.getOriginalFile());
- File file = attachment.getEditedFile();
- if (file != null) {
- model.addAvailableAttachment(file);
+ List<DemandeUIModel> models = new ArrayList<DemandeUIModel>();
+ models.add(currentEmail);
+ models.addAll(currentEmail.getGroupedDemandes());
+
+ for (DemandeUIModel demandeUIModel : models) {
+ for (Attachment attachment : demandeUIModel.getAttachment()) {
+ model.addAvailableAttachment(attachment.getOriginalFile());
+ File file = attachment.getEditedFile();
+ if (file != null) {
+ model.addAvailableAttachment(file);
+ }
}
}
1
0
r63 - in trunk: faxtomail-persistence faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande
by kmorin@users.forge.codelutin.com 12 May '14
by kmorin@users.forge.codelutin.com 12 May '14
12 May '14
Author: kmorin
Date: 2014-05-12 12:27:56 +0200 (Mon, 12 May 2014)
New Revision: 63
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/63
Log:
- fix referential files loading
- fix attachment deletion bug
- fix attachment not saved when opened before being saved
Modified:
trunk/faxtomail-persistence/pom.xml
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java
trunk/faxtomail-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/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
Modified: trunk/faxtomail-persistence/pom.xml
===================================================================
--- trunk/faxtomail-persistence/pom.xml 2014-05-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-persistence/pom.xml 2014-05-12 10:27:56 UTC (rev 63)
@@ -92,6 +92,11 @@
<dependency>
<groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
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-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-12 10:27:56 UTC (rev 63)
@@ -65,6 +65,7 @@
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import java.io.File;
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
@@ -302,11 +303,10 @@
// email accounts
try {
- URL emailAccountsPropertiesURL = ClassLoader.getSystemResource("email_accounts.csv");
- if (emailAccountsPropertiesURL != null) {
- File emailAccountFile = new File(emailAccountsPropertiesURL.toURI());
+ InputStream emailAccountsPropertiesStream = ClassLoader.getSystemResourceAsStream("email_accounts.csv");
+ if (emailAccountsPropertiesStream != null) {
- List<EmailAccount> emailAccounts = getReferentielService().importEmailAccounts(emailAccountFile);
+ List<EmailAccount> emailAccounts = getReferentielService().importEmailAccounts(emailAccountsPropertiesStream);
fx.addAllEmailAccount(emailAccounts);
companyTopiaDao.update(fx);
@@ -319,12 +319,10 @@
// email filters
try {
- URL emailFiltersPropertiesURL = ClassLoader.getSystemResource("email_filters.csv");
- if (emailFiltersPropertiesURL != null) {
- File emailFilterFile = new File(emailFiltersPropertiesURL.toURI());
+ InputStream emailFiltersPropertiesStream = ClassLoader.getSystemResourceAsStream("email_filters.csv");
+ if (emailFiltersPropertiesStream != null) {
+ List<MailFilter> mailFilters = getReferentielService().importEmailFilters(emailFiltersPropertiesStream, folders);
- List<MailFilter> mailFilters = getReferentielService().importEmailFilters(emailFilterFile, folders);
-
fx.addAllMailFilter(mailFilters);
companyTopiaDao.update(fx);
}
@@ -342,10 +340,9 @@
// clients and emails
try {
- URL fxClientsURL = ClassLoader.getSystemResource("fx_clients.csv");
- if (fxClientsURL != null) {
- File clientFile = new File(fxClientsURL.toURI());
- List<Client> clients = getReferentielService().importClients(clientFile);
+ InputStream fxClientsStream = ClassLoader.getSystemResourceAsStream("fx_clients.csv");
+ if (fxClientsStream != null) {
+ List<Client> clients = getReferentielService().importClients(fxClientsStream);
createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril);
createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire);
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-05-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-05-12 10:27:56 UTC (rev 63)
@@ -46,12 +46,15 @@
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.nuiton.csv.Import;
import org.nuiton.csv.ImportRuntimeException;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
@@ -65,6 +68,8 @@
*/
public class ReferentielService extends FaxToMailServiceSupport {
+ private static final Log log = LogFactory.getLog(ReferentielService.class);
+
public List<DemandType> getAllDemandType() {
DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao();
return new ArrayList<>(dao.findAll());
@@ -90,14 +95,13 @@
return new ArrayList<>(dao.findAll());
}
- public List<Client> importClients(File csvFile) throws IOException {
+ public List<Client> importClients(InputStream inputStream) {
List<Client> result = new ArrayList<>();
ClientTopiaDao dao = getPersistenceContext().getClientDao();
- Reader reader = Files.newReader(csvFile, Charsets.UTF_8);
ClientImportModel clientImportModel = new ClientImportModel(';');
try {
- Import<Client> importer = Import.newImport(clientImportModel, reader);
+ Import<Client> importer = Import.newImport(clientImportModel, inputStream);
try {
for (Client client : importer) {
result.add(dao.create(client));
@@ -107,11 +111,7 @@
} finally {
IOUtils.closeQuietly(importer);
}
- reader.close();
- } catch (IOException e) {
- throw new IOException(t("faxtomail.service.referential.import.clients.error", csvFile), e);
-
} catch (ImportRuntimeException e) {
String message;
if (e.getCause() != null) {
@@ -122,19 +122,18 @@
throw new ApplicationTechnicalException(message, e);
} finally {
- IOUtils.closeQuietly(reader);
+ IOUtils.closeQuietly(inputStream);
}
return result;
}
- public List<EmailAccount> importEmailAccounts(File csvFile) throws IOException {
+ public List<EmailAccount> importEmailAccounts(InputStream inputStream) {
List<EmailAccount> result = new ArrayList<>();
EmailAccountTopiaDao dao = getPersistenceContext().getEmailAccountDao();
- Reader reader = Files.newReader(csvFile, Charsets.UTF_8);
EmailAccountImportModel emailAccountImportModel = new EmailAccountImportModel(';');
try {
- Import<EmailAccount> importer = Import.newImport(emailAccountImportModel, reader);
+ Import<EmailAccount> importer = Import.newImport(emailAccountImportModel, inputStream);
try {
for (EmailAccount emailAccount : importer) {
result.add(dao.create(emailAccount));
@@ -144,11 +143,7 @@
} finally {
IOUtils.closeQuietly(importer);
}
- reader.close();
- } catch (IOException e) {
- throw new IOException(t("faxtomail.service.referential.import.emailAccount.error", csvFile), e);
-
} catch (ImportRuntimeException e) {
String message;
if (e.getCause() != null) {
@@ -159,19 +154,18 @@
throw new ApplicationTechnicalException(message, e);
} finally {
- IOUtils.closeQuietly(reader);
+ IOUtils.closeQuietly(inputStream);
}
return result;
}
- public List<MailFilter> importEmailFilters(File csvFile, Map<String, MailFolder> foldersByName) throws IOException {
+ public List<MailFilter> importEmailFilters(InputStream inputStream, Map<String, MailFolder> foldersByName) {
List<MailFilter> result = new ArrayList<>();
MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao();
- Reader reader = Files.newReader(csvFile, Charsets.UTF_8);
EmailFilterImportModel emailFilterImportModel = new EmailFilterImportModel(';', foldersByName);
try {
- Import<MailFilter> importer = Import.newImport(emailFilterImportModel, reader);
+ Import<MailFilter> importer = Import.newImport(emailFilterImportModel, inputStream);
try {
for (MailFilter emailFilter : importer) {
result.add(dao.create(emailFilter));
@@ -181,11 +175,7 @@
} finally {
IOUtils.closeQuietly(importer);
}
- reader.close();
- } catch (IOException e) {
- throw new IOException(t("faxtomail.service.referential.import.emailFilter.error", csvFile), e);
-
} catch (ImportRuntimeException e) {
String message;
if (e.getCause() != null) {
@@ -196,7 +186,7 @@
throw new ApplicationTechnicalException(message, e);
} finally {
- IOUtils.closeQuietly(reader);
+ IOUtils.closeQuietly(inputStream);
}
return result;
}
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-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-12 10:27:56 UTC (rev 63)
@@ -186,7 +186,7 @@
throw new ApplicationTechnicalException(t("faxtomail.attachmentEditor.fileNotFound", file.getAbsolutePath()));
}
- getModel().fireAttachmentOpened(attachment);
+ getModel().fireAttachmentEdited(attachment);
String extension = FileUtil.extension(file);
if (getModel().isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
@@ -229,6 +229,7 @@
if (answer == JOptionPane.YES_OPTION) {
+ ui.getAttachments().getCellEditor().stopCellEditing();
// getPersistenceService().deleteAttachment(attachment.getId());
getModel().removeAttachment(attachment);
@@ -236,6 +237,15 @@
}
}
+ public boolean isAttachmentEditable(Attachment attachment) {
+ String extension = FileUtil.extension(attachment.getOriginalFile());
+ return EDITABLE_EXTENSIONS.contains(extension.toUpperCase());
+ }
+
+ public boolean isAttachmentRemovable(Attachment attachment) {
+ return attachment != null && attachment.getTopiaId() == null;
+ }
+
protected class AttachmentItemRenderer extends AttachmentItem implements TableCellRenderer {
public AttachmentItemRenderer() {
@@ -291,13 +301,6 @@
return attachmentItem.getAttachment();
}
- public boolean stopCellEditing() {
- return super.stopCellEditing();
- }
-//FIXME still the error when we remove an attachment
-// protected void fireEditingStopped() {
-// super.fireEditingStopped();
-// }
}
}
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-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-12 10:27:56 UTC (rev 63)
@@ -42,11 +42,13 @@
#editAttachmentButton {
actionIcon: "edit";
toolTipText: "faxtomail.attachmentEditor.action.open.tip";
+ enabled: { handler != null && handler.isAttachmentEditable(getAttachment()) };
+ visible: { isEditable() };
}
#removeAttachmentButton {
actionIcon: "delete";
toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
- enabled: { getAttachment() != null && getAttachment().getTopiaId() == null };
+ enabled: { handler != null && handler.isAttachmentRemovable(getAttachment()) };
visible: { isEditable() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-12 09:05:34 UTC (rev 62)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-12 10:27:56 UTC (rev 63)
@@ -339,7 +339,7 @@
getContext().getCurrentUser(),
new Date(),
attachment.getOriginalFile().getName());
- getModel().fromEntity(email);
+ getModel().setHistory(email.getHistory());
}
}
@@ -352,7 +352,7 @@
getContext().getCurrentUser(),
new Date(),
attachment.getOriginalFile().getName());
- getModel().fromEntity(email);
+ getModel().setHistory(email.getHistory());
}
}
1
0
r62 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util
by kmorin@users.forge.codelutin.com 12 May '14
by kmorin@users.forge.codelutin.com 12 May '14
12 May '14
Author: kmorin
Date: 2014-05-12 11:05:34 +0200 (Mon, 12 May 2014)
New Revision: 62
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/62
Log:
make the project build
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-05-12 08:51:37 UTC (rev 61)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-05-12 09:05:34 UTC (rev 62)
@@ -25,25 +25,19 @@
*/
import javax.swing.*;
-import javax.swing.event.*;
import javax.swing.border.*;
import javax.swing.plaf.ComponentUI;
-import javax.swing.text.JTextComponent;
import java.awt.*;
-import java.awt.List;
import java.io.Serializable;
-import java.util.*;
-import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import sun.swing.DefaultLookup;
import static org.nuiton.i18n.I18n.t;
@@ -109,8 +103,8 @@
checkbox.setName("List.cellRenderer");
}
- private Border getNoFocusBorder(JComponent component, ComponentUI ui) {
- Border border = DefaultLookup.getBorder(component, ui, "List.cellNoFocusBorder");
+ private Border getNoFocusBorder() {
+ Border border = UIManager.getBorder("List.cellNoFocusBorder");
if (System.getSecurityManager() != null) {
if (border != null) return border;
return SAFE_NO_FOCUS_BORDER;
@@ -167,8 +161,8 @@
&& !dropLocation.isInsert()
&& dropLocation.getIndex() == index) {
- bg = DefaultLookup.getColor(component, ui, "List.dropCellBackground");
- fg = DefaultLookup.getColor(component, ui, "List.dropCellForeground");
+ bg = UIManager.getColor("List.dropCellBackground");
+ fg = UIManager.getColor("List.dropCellForeground");
isSelected = true;
}
@@ -190,13 +184,13 @@
Border border = null;
if (cellHasFocus) {
if (isSelected) {
- border = DefaultLookup.getBorder(component, ui, "List.focusSelectedCellHighlightBorder");
+ border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
}
if (border == null) {
- border = DefaultLookup.getBorder(component, ui, "List.focusCellHighlightBorder");
+ border = UIManager.getBorder("List.focusCellHighlightBorder");
}
} else {
- border = getNoFocusBorder(component, ui);
+ border = getNoFocusBorder();
}
component.setBorder(border);
1
0
r61 - in trunk: faxtomail-persistence faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util
by echatellier@users.forge.codelutin.com 12 May '14
by echatellier@users.forge.codelutin.com 12 May '14
12 May '14
Author: echatellier
Date: 2014-05-12 10:51:37 +0200 (Mon, 12 May 2014)
New Revision: 61
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/61
Log:
Fix release
Modified:
trunk/faxtomail-persistence/pom.xml
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/content/demande/DemandesUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
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/DemandesUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
Modified: trunk/faxtomail-persistence/pom.xml
===================================================================
--- trunk/faxtomail-persistence/pom.xml 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-persistence/pom.xml 2014-05-12 08:51:37 UTC (rev 61)
@@ -99,6 +99,11 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
<dependency>
<groupId>commons-logging</groupId>
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-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-12 08:51:37 UTC (rev 61)
@@ -30,20 +30,15 @@
import java.io.IOException;
import java.io.Writer;
import java.net.URL;
-import java.text.DateFormat;
import java.util.ArrayList;
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 java.util.Set;
-import javax.mail.internet.MailDateFormat;
-import javax.mail.internet.MimeMessage;
-
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.logging.Log;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,3 +1,26 @@
+/*
+ * #%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%
+ */
#topToolBar {
floatable: false;
opaque: false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,3 +1,26 @@
+<!--
+ #%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='demandsPanel' layout="{ new BorderLayout() }"
implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandesUIModel, DemandesUIHandler>'>
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-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.ui.swing.content.demande;
+/*
+ * #%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%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.ui.swing.actions.ArchiveAction;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.ui.swing.content.demande;
+/*
+ * #%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%
+ */
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractBean;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.ui.swing.util;
+/*
+ * #%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%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
import com.google.common.collect.Iterables;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-05-12 08:38:20 UTC (rev 60)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-05-12 08:51:37 UTC (rev 61)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.ui.swing.util;
+/*
+ * #%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%
+ */
+
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
1
0
Author: echatellier
Date: 2014-05-12 10:38:20 +0200 (Mon, 12 May 2014)
New Revision: 60
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/60
Log:
Add windows install doc
Added:
trunk/src/rst/
trunk/src/rst/install.rst
Added: trunk/src/rst/install.rst
===================================================================
--- trunk/src/rst/install.rst (rev 0)
+++ trunk/src/rst/install.rst 2014-05-12 08:38:20 UTC (rev 60)
@@ -0,0 +1,83 @@
+.. -
+.. * #%L
+.. * FaxToMail
+.. * $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%
+.. -
+
+Installation du serveur FaxToMail (Windows)
+===========================================
+
+Téléchargement
+--------------
+
+ * Installer Java JRE 7 (minimum) : http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880…
+ * Télécharger Tomcat 7 : http://apache.crihan.fr/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.…
+ * Télécharger Apache 2.4 : http://www.apachelounge.com/download/VC11/binaries/httpd-2.4.9-win64-VC11.z…
+
+ * Installer Java
+ * Installer tomcat. Tomcat s'installe automatiquement en tant que service windows.
+ * Décompresser httpd-2.4.9-win64-VC11.zip dans ''C:\Apache24''
+ * Installer apache en tant que service windows : ''httpd.exe -k install''
+ * Si un message à propos de msvcr110.dll s'affiche, c'est que "Microsoft Visual C++ Redistributable" n'est pas installé
+ * http://answers.microsoft.com/en-us/windows/forum/windows_8-winapps/the-prog…
+ * http://www.microsoft.com/en-us/download/details.aspx?id=30679
+ * Démarrer les services "Apache tomcat 7.0 Tomcat7" et "Apache2.4"
+
+À ce stade, les adresses http://localhost/ et http://localhost:8080 doivent répondre.
+
+Apache
+------
+
+ * Dans le fichier 'C:\Apache24\conf\httpd.conf', décommenter les lignes::
+
+ LoadModule proxy_module modules/mod_proxy.so
+ LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
+
+ * Ajouter à la fin du fichier::
+ Include conf/extra/httpd-faxtomail.conf
+
+ * Créer le fichier ''conf/extra/httpd-faxtomail.conf'' avec en contenu::
+ <VirtualHost *:80>
+ ServerAdmin webmaster(a)franciaflex.com
+ ServerName 192.168.100.247
+ #ServerAlias faxtomailsrv
+ ErrorLog "logs/faxtomail-error.log"
+ CustomLog "logs/faxtomail-access.log" common
+
+ # lien vers tomcat
+ ProxyRequests On
+ ProxyVia On
+ ProxyPass / ajp://localhost:8009/
+ ProxyPassReverse / ajp://localhost:8009/
+ </VirtualHost>
+
+À ce stade, l'adresse http://192.168.100.247/ devrait répondre par tomcat.
+
+Tomcat
+------
+
+ * Télécharger le war depuis l'adresse : http://forge.codelutin.com/projects/faxtomail/files
+ * Enregistrez le dans le dossier ''C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\'' avec le nom ''ROOT.war'' (supprimer le dossier ROOT)
+ * Créer le fichier ''C:\Windows\System32\faxToMail.properties'' avec en contenu::
+ faxtomail.storage=C:\\faxtomail\\data
+ * Relancer le service ''Apache Tomcat 7.0 Tomcat7''
+
+L'application doit maintenant être installée et répondre sur l'adresse : http://192.168.100.247/
Property changes on: trunk/src/rst/install.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r59 - in trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing: actions content content/attachment content/demande content/demande/demandgroup
by kmorin@users.forge.codelutin.com 08 May '14
by kmorin@users.forge.codelutin.com 08 May '14
08 May '14
Author: kmorin
Date: 2014-05-08 12:22:45 +0200 (Thu, 08 May 2014)
New Revision: 59
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/59
Log:
refs #4655 [ECRAN] D?\195?\169tail d'un mail / fax
- affichage des demandes d'un m?\195?\170me groupe dans des onglets
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.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/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/DemandesUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
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/demandgroup/DemandGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -37,9 +37,15 @@
}
@Override
+ public void doAction() throws Exception {
+ super.doAction();
+ }
+
+ @Override
public void postSuccessAction() {
super.postSuccessAction();
- getContext().setScreen(AbstractChangeScreenAction.PREVIOUS_SCREEN.getContextValue(handler.getUI()));
+ GoToPreviousScreenAction action = getContext().getActionFactory().createLogicAction(getContext().getMainUI().getHandler(), GoToPreviousScreenAction.class);
+ getActionEngine().runAction(action);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -445,4 +445,8 @@
public void setBodyTitle(String title) {
ui.getBody().setTitle(title);
}
+
+ public JComponent getCurrentBody() {
+ return currentBody;
+ }
}
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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -200,7 +200,7 @@
dialogContent.getModel().toEntity(attachment);
} else {
- Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
+ Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
// desktop.browse(file.toURI());
desktop.open(file);
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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-05-08 10:22:45 UTC (rev 59)
@@ -315,47 +315,4 @@
#toolbarContainer {
rightDecoration: { topToolBar };
-}
-
-#backButton {
- text: "faxtomail.demande.back.button.label";
- actionIcon: cancel;
- _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction.class };
-}
-
-#saveButton {
- text: "faxtomail.demande.save.button.label";
- actionIcon: save;
- enabled: { model.isEditable() };
- _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAndExitAction.class };
-}
-
-#transmitButton {
- text: "faxtomail.demande.transmit.button.label";
- actionIcon: transmit;
- enabled: { model.isValid() && model.isEditable() };
-}
-
-#printButton {
- text: "faxtomail.demande.print.button.label";
- actionIcon: print;
- enabled: { model.isValid() && model.isEditable() };
-}
-
-#archiveButton {
- text: "faxtomail.demande.archive.button.label";
- enabled: { model.isEditable() };
- _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ArchiveAction.class };
-}
-
-#replyButton {
- text: "faxtomail.demande.reply.button.label";
- actionIcon: reply;
- enabled: { model.isEditable() };
-}
-
-#groupButton {
- text: "faxtomail.demande.group.button.label";
- actionIcon: group;
- enabled: { model.isEditable() };
}
\ No newline at end of file
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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-05-08 10:22:45 UTC (rev 59)
@@ -55,8 +55,9 @@
<script><![CDATA[
- public DemandeUI(FaxToMailUI parentUI) {
+ public DemandeUI(FaxToMailUI parentUI, DemandeUIModel demand) {
FaxToMailUIUtil.setParentUI(this, parentUI);
+ setContextValue(demand);
}
]]></script>
@@ -325,15 +326,4 @@
</JSplitPane>
- <JPanel layout='{new GridLayout(1,0)}'
- constraints='BorderLayout.SOUTH'>
- <JButton id="backButton"/>
- <JButton id="saveButton"/>
- <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/>
- <JButton id="printButton" onActionPerformed="handler.print()"/>
- <JButton id="archiveButton"/>
- <JButton id="replyButton" onActionPerformed="handler.reply()"/>
- <JButton id="groupButton" onActionPerformed="handler.group()"/>
- </JPanel>
-
</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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -45,6 +45,7 @@
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;
@@ -54,6 +55,7 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.jdesktop.swingx.table.TableColumnModelExt;
+import org.nuiton.jaxx.application.swing.tab.TabHandler;
import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableCellAction;
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction;
@@ -71,6 +73,7 @@
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.Collection;
import java.util.Date;
@@ -87,7 +90,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandeUI> implements CloseableUI {
+public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandeUI> implements CloseableUI, TabHandler {
/** Logger. */
private static final Log log = LogFactory.getLog(DemandeUIHandler.class);
@@ -102,18 +105,15 @@
// private final PersistenceService persistenceService;
@Override
- public void beforeInit(DemandeUI ui) {
+ public void afterInit(DemandeUI ui) {
- super.beforeInit(ui);
+ initUI(ui);
- DemandeUIModel model = getContext().getCurrentEmail();
-// listModelIsModify(model);
+ DemandeUIModel model = getModel();
Set<String> propertiesToIgnore = getPropertiesToIgnore();
monitor = new BeanMonitor(true, propertiesToIgnore.toArray(new String[propertiesToIgnore.size()]));
monitor.setBean(model);
- this.ui.setContextValue(model);
-
model.addPropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, new PropertyChangeListener() {
private int dividerLocation = -1;
@@ -124,7 +124,7 @@
DemandType oldType = (DemandType) evt.getOldValue();
if (newType != null && (oldType == null
- || !Objects.equals(oldType.getRangeNeeded(), newType.getRangeNeeded()))) {
+ || !Objects.equals(oldType.getRangeNeeded(), newType.getRangeNeeded()))) {
JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel();
if (Boolean.TRUE.equals(newType.getRangeNeeded())) {
@@ -139,14 +139,7 @@
}
}
});
- }
- @Override
- public void afterInit(DemandeUI ui) {
-
- initUI(ui);
-
- DemandeUIModel model = getModel();
MailFolder folder = model.getMailFolder();
ReferentielService referentielService = getContext().getReferentielService();
@@ -367,6 +360,7 @@
}
);
+ listModelIsModify(getModel());
}
@Override
@@ -393,17 +387,18 @@
closeButtonPopups();
}
- protected void closeButtonPopups() {
+ public void closeButtonPopups() {
ui.getAttachmentsButton().setSelected(false);
ui.getHistoryButton().setSelected(false);
- ui.getGroupButton().setSelected(false);
+ ui.getDemandRepliesButton().setSelected(false);
}
@Override
public boolean quitUI() {
+ BeanMonitor monitor = getMonitor();
boolean result = quitScreen(
true,
- getMonitor().wasModified(),
+ monitor.wasModified(),
t("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave"),
t("faxtomail.demande.askSaveBeforeLeaving.save"),
getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class)
@@ -433,74 +428,18 @@
return rangeRow.getRange() != null;
}
- public void transmitDemande() {
+ @Override
+ public boolean onHideTab(int currentIndex, int newIndex) {
closeButtonPopups();
-
- MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui, getModel());
- SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
- true,
- dialogContent,
- t("faxtomail.chooseMailFolder.title"),
- new Dimension(350, 500));
-
- getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ return true;
}
- public void print() {
- closeButtonPopups();
-
-// for (Attachment attachment : getModel().getAttachment()) {
-//// try {
-// File editedFile = attachment.getEditedFile();
-// if (editedFile == null) {
-// editedFile = attachment.getOriginalFile();
-// }
-// log.info("print " + editedFile.getAbsolutePath());
-//// Desktop.getDesktop().print(editedFile);
-//
-//
-//// } catch (IOException e) {
-//// if (log.isErrorEnabled()) {
-//// log.error("", e);
-//// }
-//// }
-// }
- AttachmentToPrintChooserUI dialogContent = new AttachmentToPrintChooserUI(ui, getModel());
- SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
- true,
- dialogContent,
- t("faxtomail.chooseAttachmentToPrint.title"),
- new Dimension(350, 500));
-
- getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ @Override
+ public void onShowTab(int currentIndex, int newIndex) {
}
- public void reply() {
- closeButtonPopups();
-
- ReplyFormUI dialogContent = new ReplyFormUI(ui);
- ReplyFormUIModel model = dialogContent.getModel();
- model.setTo(getModel().getSender());
- SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
- false,
- dialogContent,
- t("faxtomail.reply.title", getModel().getObject()),
- new Dimension(800, 600));
-
- getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ @Override
+ public boolean onRemoveTab() {
+ return quitUI();
}
-
- public void group() {
- closeButtonPopups();
-
- SearchToGroupUI dialogContent = new SearchToGroupUI(ui);
- SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
- false,
- dialogContent,
- t("faxtomail.searchToGroup.title", getModel().getObject()),
- getContext().getMainUI().getSize());
-
- getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
- }
-
}
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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -126,7 +126,7 @@
protected List<String> ccRecipients;
-// protected List<String> sender;
+ protected boolean closeable;
protected static Binder<DemandeUIModel, Email> toBeanBinder =
BinderFactory.newBinder(DemandeUIModel.class,
@@ -643,7 +643,7 @@
public void setComment(String comment) {
Object oldValue = getComment();
editObject.setComment(comment);
- firePropertyChange(Email.PROPERTY_COMMENT, oldValue, editable);
+ firePropertyChange(Email.PROPERTY_COMMENT, oldValue, comment);
}
public String getComment() {
@@ -813,4 +813,13 @@
public String getIcon() {
return "email";
}
+
+ @Override
+ public boolean isCloseable() {
+ return closeable;
+ }
+
+ public void setCloseable(boolean closeable) {
+ this.closeable = closeable;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-05-08 10:22:45 UTC (rev 59)
@@ -2,4 +2,45 @@
floatable: false;
opaque: false;
borderPainted: false;
+}
+
+#backButton {
+ text: "faxtomail.demande.back.button.label";
+ actionIcon: cancel;
+ _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction.class };
+}
+
+#saveButton {
+ text: "faxtomail.demande.save.button.label";
+ actionIcon: save;
+ enabled: { model.getCurrentDemand().isEditable() };
+}
+
+#transmitButton {
+ text: "faxtomail.demande.transmit.button.label";
+ actionIcon: transmit;
+ enabled: { model.getCurrentDemand().isValid() && model.getCurrentDemand().isEditable() };
+}
+
+#printButton {
+ text: "faxtomail.demande.print.button.label";
+ actionIcon: print;
+ enabled: { model.getCurrentDemand().isValid() && model.getCurrentDemand().isEditable() };
+}
+
+#archiveButton {
+ text: "faxtomail.demande.archive.button.label";
+ enabled: { model.getCurrentDemand().isEditable() };
+}
+
+#replyButton {
+ text: "faxtomail.demande.reply.button.label";
+ actionIcon: reply;
+ enabled: { model.getCurrentDemand().isEditable() };
+}
+
+#groupButton {
+ text: "faxtomail.demande.group.button.label";
+ actionIcon: group;
+ enabled: { model.getCurrentDemand().isEditable() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx 2014-05-08 10:22:45 UTC (rev 59)
@@ -1,5 +1,5 @@
<JPanel id='demandsPanel' layout="{ new BorderLayout() }"
- implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, DemandesUIHandler>'>
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandesUIModel, DemandesUIHandler>'>
<import>
com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
@@ -16,19 +16,28 @@
]]></script>
+ <DemandesUIModel id='model'
+ initializer='getContextValue(DemandesUIModel.class)'/>
- <DemandeUIModel id='model'
- initializer='getContextValue(DemandeUIModel.class)'/>
-
-
<JToolBar id='topToolBar'>
<ButtonEmailGroup id="demandGroupButton"/>
</JToolBar>
<JTabbedPane id="demandsTabPane" constraints="BorderLayout.CENTER">
- <tab id="mainDemandTab">
- <DemandeUI id="mainDemand" constructorParams="this"/>
- </tab>
+ <!--<tab id="mainDemandTab">-->
+ <!--<DemandeUI id="mainDemand" constructorParams="this"/>-->
+ <!--</tab>-->
</JTabbedPane>
+ <JPanel layout='{new GridLayout(1,0)}'
+ constraints='BorderLayout.SOUTH'>
+ <JButton id="backButton"/>
+ <JButton id="saveButton" onActionPerformed="handler.save()"/>
+ <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/>
+ <JButton id="printButton" onActionPerformed="handler.print()"/>
+ <JButton id="archiveButton" onActionPerformed="handler.archive()"/>
+ <JButton id="replyButton" onActionPerformed="handler.reply()"/>
+ <JButton id="groupButton" onActionPerformed="handler.group()"/>
+ </JPanel>
+
</JPanel>
\ No newline at end of file
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-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -2,7 +2,17 @@
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.ui.swing.actions.ArchiveAction;
+import com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction;
+import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenDialogAction;
+import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAndExitAction;
+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 jaxx.runtime.validator.swing.SwingValidator;
import org.nuiton.jaxx.application.swing.tab.DelegateTabContainerHandler;
import org.nuiton.jaxx.application.swing.tab.TabContainerHandler;
@@ -11,16 +21,19 @@
import org.nuiton.util.beans.BeanMonitor;
import javax.swing.*;
+import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Objects;
import java.util.Set;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
*/
-public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandesUI> implements TabContainerHandler {
+public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIModel, DemandesUI> implements TabContainerHandler, CloseableUI {
protected DelegateTabContainerHandler delegateTabHandler;
@@ -29,7 +42,12 @@
super.beforeInit(ui);
- DemandeUIModel model = getContext().getCurrentEmail();
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ currentEmail.setCloseable(false);
+
+ DemandesUIModel model = new DemandesUIModel();
+// model.addDemand(currentEmail);
+
this.ui.setContextValue(model);
}
@@ -37,15 +55,58 @@
public void afterInit(DemandesUI demandesUI) {
initUI(ui);
- setCustomTab(0, getModel());
+ DemandesUIModel model = getModel();
+// setCustomTab(0, getModel().getDemands().get(0));
+ model.addDemandsListener(new DemandesUIModel.DemandsListener() {
+ @Override
+ public void onDemandAdded(DemandeUIModel demand, int index, boolean added) {
+
+ JTabbedPane tabPanel = getTabPanel();
+ if (added) {
+ DemandeUI demandeUI = new DemandeUI(getUI(), demand);
+ tabPanel.add(demandeUI);
+ setCustomTab(index, demand);
+ }
+
+ tabPanel.setSelectedIndex(index);
+ }
+
+ @Override
+ public void onDemandRemoved(DemandeUIModel demand, int index) {
+ }
+ });
+
+ DemandeUIModel currentEmail = getContext().getCurrentEmail();
+ model.addDemand(currentEmail);
}
@Override
+ public boolean quitUI() {
+ closeButtonPopups();
+ JTabbedPane tabPanel = getTabPanel();
+ int tabCount = tabPanel.getTabCount();
+ boolean quit = true;
+ int i = 0;
+ while (quit && i < tabCount) {
+ tabPanel.setSelectedIndex(i);
+ DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i++);
+ quit = tabHandler.quitUI();
+ }
+ return quit;
+ }
+
+ @Override
public void onCloseUI() {
+ closeButtonPopups();
+ int tabCount = getTabPanel().getTabCount();
+ for (int i = 0 ; i < tabCount ; i++) {
+ DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i);
+ tabHandler.onCloseUI();
+ }
}
@Override
- public SwingValidator<DemandeUIModel> getValidator() {
+ public SwingValidator<DemandesUIModel> getValidator() {
return null;
}
@@ -74,10 +135,20 @@
}
@Override
+ public boolean removeTab(int i) {
+ boolean remove = delegateTabHandler.removeTab(i);
+ if (remove) {
+ getModel().removeDemand(i);
+ }
+ return remove;
+ }
+
+ @Override
protected void initUI(DemandesUI ui) {
super.initUI(ui);
- delegateTabHandler = new DelegateTabContainerHandler(getTabPanel());
+ JTabbedPane tabPanel = getTabPanel();
+ delegateTabHandler = new DelegateTabContainerHandler(tabPanel, this);
delegateTabHandler.init();
}
@@ -93,7 +164,107 @@
@Override
public boolean onTabChanged(int currentIndex, int newIndex) {
- return delegateTabHandler.onTabChanged(currentIndex, newIndex);
+ boolean change = delegateTabHandler.onTabChanged(currentIndex, newIndex);
+ if (change) {
+ getModel().setCurrentIndex(newIndex);
+ }
+ return change;
}
+ protected void closeButtonPopups() {
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ demandeUI.getHandler().closeButtonPopups();
+ ui.getDemandGroupButton().setSelected(false);
+ }
+
+ public void save() {
+ closeButtonPopups();
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ SaveDemandeAndExitAction action = new SaveDemandeAndExitAction(demandeUI.getHandler());
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
+ public void transmitDemande() {
+ closeButtonPopups();
+
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ MailFolderChooserUI dialogContent = new MailFolderChooserUI(ui, demandeUI.getModel());
+ SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(demandeUI.getHandler(),
+ true,
+ dialogContent,
+ t("faxtomail.chooseMailFolder.title"),
+ new Dimension(350, 500));
+
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
+ public void print() {
+ closeButtonPopups();
+
+// for (Attachment attachment : getModel().getAttachment()) {
+//// try {
+// File editedFile = attachment.getEditedFile();
+// if (editedFile == null) {
+// editedFile = attachment.getOriginalFile();
+// }
+// log.info("print " + editedFile.getAbsolutePath());
+//// Desktop.getDesktop().print(editedFile);
+//
+//
+//// } catch (IOException e) {
+//// if (log.isErrorEnabled()) {
+//// log.error("", e);
+//// }
+//// }
+// }
+
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ AttachmentToPrintChooserUI dialogContent = new AttachmentToPrintChooserUI(ui, demandeUI.getModel());
+ SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(demandeUI.getHandler(),
+ true,
+ dialogContent,
+ t("faxtomail.chooseAttachmentToPrint.title"),
+ new Dimension(350, 500));
+
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
+ public void archive() {
+ closeButtonPopups();
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ ArchiveAction action = new ArchiveAction(demandeUI.getHandler());
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
+ public void reply() {
+ closeButtonPopups();
+
+ ReplyFormUI dialogContent = new ReplyFormUI(ui);
+ ReplyFormUIModel model = dialogContent.getModel();
+
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ model.setTo(demandeUI.getModel().getSender());
+ SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(demandeUI.getHandler(),
+ false,
+ dialogContent,
+ t("faxtomail.reply.title", demandeUI.getModel().getObject()),
+ new Dimension(800, 600));
+
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
+ public void group() {
+ closeButtonPopups();
+
+ SearchToGroupUI dialogContent = new SearchToGroupUI(ui);
+ DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
+ SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(demandeUI.getHandler(),
+ false,
+ dialogContent,
+ t("faxtomail.searchToGroup.title", demandeUI.getModel().getObject()),
+ getContext().getMainUI().getSize());
+
+ getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
+ }
+
}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -0,0 +1,94 @@
+package com.franciaflex.faxtomail.ui.swing.content.demande;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractBean;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class DemandesUIModel extends AbstractBean {
+
+ private static final Log log = LogFactory.getLog(DemandesUIModel.class);
+
+ public static final String PROPERTY_CURRENT_DEMAND = "currentDemand";
+
+ protected List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>();
+
+ protected List<DemandsListener> listeners = new ArrayList<DemandsListener>();
+
+ protected List<DemandeUIModel> getDemands() {
+ return demands;
+ }
+
+ protected int currentIndex = -1;
+
+ public void addDemand(DemandeUIModel demand) {
+ boolean added = !demands.contains(demand);
+ if (added) {
+ demands.add(demand);
+ }
+ int index = demands.indexOf(demand);
+ fireDemandAdded(demand, index, added);
+ }
+
+ public void removeDemand(int i) {
+ DemandeUIModel demand = demands.get(i);
+ demands.remove(i);
+ fireDemandRemoved(demand, i);
+ }
+
+ public void addDemandsListener(DemandsListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeDemandsListener(DemandsListener listener) {
+ listeners.remove(listener);
+ }
+
+ protected void fireDemandAdded(DemandeUIModel demand, int index, boolean added) {
+ for (DemandsListener listener : listeners) {
+ listener.onDemandAdded(demand, index, added);
+ }
+ }
+
+ protected void fireDemandRemoved(DemandeUIModel demand, int index) {
+ for (DemandsListener listener : listeners) {
+ listener.onDemandRemoved(demand, index);
+ }
+ }
+
+ public static interface DemandsListener {
+
+ void onDemandAdded(DemandeUIModel demand, int index, boolean added);
+
+ void onDemandRemoved(DemandeUIModel demand, int index);
+
+ }
+
+ public DemandeUIModel getCurrentDemand() {
+ int currentIndex = getCurrentIndex();
+ if (currentIndex < 0 || currentIndex >= demands.size()) {
+ return null;
+ }
+ return demands.get(currentIndex);
+ }
+
+ public int getCurrentIndex() {
+ return currentIndex;
+ }
+
+ public void setCurrentIndex(int currentIndex) {
+ Object oldValue = getCurrentDemand();
+ this.currentIndex = currentIndex;
+ Object newValue = getCurrentDemand();
+ firePropertyChange(PROPERTY_CURRENT_DEMAND, oldValue, newValue);
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css 2014-05-08 10:22:45 UTC (rev 59)
@@ -29,14 +29,6 @@
title: "faxtomail.demandGroup.title";
}
-#noGroupedDemandLabel {
- text: "faxtomail.demandGroup.empty";
- visible: { model.getGroupedDemandes().isEmpty() };
- border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) };
- font-style: italic;
-}
-
#demandGroup {
editable: true;
- visible: { !model.getGroupedDemandes().isEmpty() };
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx 2014-05-08 10:22:45 UTC (rev 59)
@@ -38,7 +38,6 @@
<JXTitledPanel id='body'>
<JScrollPane id='demandGroupBodyScrollPane'>
<JPanel id='mainPanel' layout="{new BorderLayout()}">
- <JLabel id='noGroupedDemandLabel' constraints="BorderLayout.NORTH"/>
<JXTable id='demandGroup' constraints="BorderLayout.CENTER"/>
</JPanel>
</JScrollPane>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-05-08 10:22:45 UTC (rev 59)
@@ -26,7 +26,10 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction;
+import com.franciaflex.faxtomail.ui.swing.content.MainUI;
+import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
import com.google.common.collect.Iterables;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -143,8 +146,12 @@
closeEditor();
FaxToMailUIContext context = getContext();
- context.setCurrentEmail(demande);
- context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
+ demande.setCloseable(true);
+// context.setCurrentEmail(demande);
+// context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler()));
+ MainUIHandler mainUIHandler = context.getMainUI().getHandler();
+ DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody();
+ parentContainer.getModel().addDemand(demande);
}
protected class DemandGroupItemRenderer extends DemandGroupItem
1
0
06 May '14
Author: kmorin
Date: 2014-05-06 18:55:34 +0200 (Tue, 06 May 2014)
New Revision: 58
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/58
Log:
refs #4655 [ECRAN] D?\195?\169tail d'un mail / fax
- affichage du sujet et de tous les destinataire
- d?\195?\169but de l'affichage des demandes d'un m?\195?\170me groupe dans des onglets
refs #4666 [ECRAN] Pi?\195?\168ces-jointes
- d?\195?\169but de la rotation
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png
Removed:
trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit-attachment.png
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.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/GroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.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/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/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/demandgroup/ButtonEmailGroup.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css
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/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.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
trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png
trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -41,7 +41,7 @@
public static final String PROPERTY_SENDER = "sender";
//public static final String PROPERTY_RECIPIENT = "recipient";
- public static final String PROPERTY_SUBJECT = "subject";
+ public static final String PROPERTY_OBJECT = "object";
public static final String PROPERTY_MESSAGE = "message";
public static final String PROPERTY_BODY = "body";
public static final String PROPERTY_ETAT_ATTENTE = "etatAttente";
@@ -74,7 +74,7 @@
//protected String recipient;
- protected String subject;
+ protected String object;
protected String message;
@@ -150,14 +150,14 @@
firePropertyChange(PROPERTY_RECIPIENT, oldValue, recipient);
}*/
- public String getSubject() {
- return subject;
+ public String getObject() {
+ return object;
}
- public void setSubject(String subject) {
- String oldValue = this.subject;
- this.subject = subject;
- firePropertyChange(PROPERTY_SUBJECT, oldValue, subject);
+ public void setObject(String object) {
+ String oldValue = this.object;
+ this.object = object;
+ firePropertyChange(PROPERTY_OBJECT, oldValue, object);
}
public List<EtatAttente> getEtatAttente() {
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -256,9 +256,9 @@
}
// email subject
- if (StringUtils.isNotBlank(emailFilter.getSubject())) {
- query.append(" AND lower(E." + Email.PROPERTY_SUBJECT + ") LIKE lower(:" + EmailFilter.PROPERTY_SUBJECT + ")");
- args.put(EmailFilter.PROPERTY_SUBJECT, "%" + emailFilter.getSubject() + "%");
+ if (StringUtils.isNotBlank(emailFilter.getObject())) {
+ query.append(" AND lower(E." + Email.PROPERTY_OBJECT + ") LIKE lower(:" + EmailFilter.PROPERTY_OBJECT + ")");
+ args.put(EmailFilter.PROPERTY_OBJECT, "%" + emailFilter.getObject() + "%");
}
// email demand type
@@ -352,11 +352,11 @@
query.append("))");
}
- // email comment
- if (StringUtils.isNotBlank(emailFilter.getBody())) {
- query.append(" AND lower(E." + Email.PROPERTY_HTML_CONTENT + ") LIKE lower(:" + EmailFilter.PROPERTY_BODY + ")");
- args.put(EmailFilter.PROPERTY_BODY, "%" + emailFilter.getBody() + "%");
- }
+// // email comment
+// if (StringUtils.isNotBlank(emailFilter.getBody())) {
+// query.append(" AND lower(E." + Email.PROPERTY_HTML_CONTENT + ") LIKE lower(:" + EmailFilter.PROPERTY_BODY + ")");
+// args.put(EmailFilter.PROPERTY_BODY, "%" + emailFilter.getBody() + "%");
+// }
// email commandNumber
if (StringUtils.isNotBlank(emailFilter.getCommandNumber())) {
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -34,12 +34,14 @@
import java.util.ArrayList;
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 java.util.Set;
import javax.mail.internet.MailDateFormat;
+import javax.mail.internet.MimeMessage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
@@ -395,13 +397,13 @@
email1.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
History.PROPERTY_FAX_TO_MAIL_USER, user,
- History.PROPERTY_FIELDS, Sets.newHashSet(email2.getSubject()),
+ History.PROPERTY_FIELDS, Sets.newHashSet(email2.getObject()),
History.PROPERTY_MODIFICATION_DATE, now));
Email result = emailDao.update(email1);
email2.addHistory(historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP,
History.PROPERTY_FAX_TO_MAIL_USER, user,
- History.PROPERTY_FIELDS, Sets.newHashSet(email1.getSubject()),
+ History.PROPERTY_FIELDS, Sets.newHashSet(email1.getObject()),
History.PROPERTY_MODIFICATION_DATE, now));
emailDao.update(email2);
@@ -452,12 +454,16 @@
ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao();
Date now = new Date();
- String emailSource = String.format("Date: %1$s\nFrom: %2$s\nTo: %3$s\nMessage-ID: %4$s\nSubject: %5$s\nContent-Type: %6$s\n",
- MailDateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US).format(now),
- from, to, emailId, subject, message.getMimeMessage().getContentType());
- emailSource += IOUtils.toString(message.getMimeMessage().getInputStream());
- Reply reply = replyTopiaDao.create(Reply.PROPERTY_EMAIL_SOURCE, emailSource,
+ 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);
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -28,6 +28,7 @@
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.Company;
import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
@@ -245,8 +246,21 @@
// companies
CompanyTopiaDao companyTopiaDao = getPersistenceContext().getCompanyDao();
ConfigurationTopiaDao configurationTopiaDao = getPersistenceContext().getConfigurationDao();
+ Configuration configuration = configurationTopiaDao.create(Configuration.PROPERTY_TABLE_COLUMNS,
+ Email.PROPERTY_PRIORITY + "," +
+ Email.PROPERTY_DEMAND_TYPE + "," +
+ Email.PROPERTY_OBJECT + "," +
+ "clientCode," +
+ Email.PROPERTY_SENDER + "," +
+ Email.PROPERTY_RECEPTION_DATE + "," +
+ Email.PROPERTY_DEMAND_STATUS + "," +
+ "pfNb,savNb," +
+ Email.PROPERTY_TAKEN_BY + "," +
+ "lastAttachmentOpeningUser," +
+ Email.PROPERTY_ATTACHMENT
+ );
Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex",
- Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create(),
+ Company.PROPERTY_CONFIGURATION, configuration,
Company.PROPERTY_MAIL_FOLDER, folders.values());
companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
@@ -370,13 +384,6 @@
FaxToMailUser user) throws InvalidClientException {
List<RangeRow> rangeRows = new ArrayList<>();
- for (int j = 0 ; j < random.nextInt(4) + 1 ; j++) {
- RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())),
- RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6),
- RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100),
- RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100));
- rangeRows.add(rangeRow);
- }
Client client = clients.get(random.nextInt(clients.size()));
String sender = client.getEmailAddress();
@@ -395,7 +402,7 @@
History.PROPERTY_FIELDS, Sets.newHashSet(Email.PROPERTY_SENDER,
Email.PROPERTY_CLIENT,
Email.PROPERTY_PROJECT_REFERENCE,
- Email.PROPERTY_SUBJECT,
+ Email.PROPERTY_OBJECT,
Email.PROPERTY_RECEPTION_DATE,
Email.PROPERTY_MAIL_FOLDER,
Email.PROPERTY_DEMAND_STATUS),
@@ -406,7 +413,7 @@
Email.PROPERTY_FAX, fax,
Email.PROPERTY_CLIENT, client,
Email.PROPERTY_PROJECT_REFERENCE, projectRef,
- Email.PROPERTY_SUBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now),
+ Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now),
Email.PROPERTY_RECEPTION_DATE, now,
Email.PROPERTY_MAIL_FOLDER, folder,
Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED,
@@ -414,8 +421,21 @@
if (opened) {
+
getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now);
- email.setDemandType(types.get(random.nextInt(types.size())));
+ DemandType demandType = types.get(random.nextInt(types.size()));
+ if (demandType.getRangeNeeded()) {
+ for (int j = 0; j < random.nextInt(4) + 1; j++) {
+ RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())),
+ RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6),
+ RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100),
+ RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100));
+ rangeRows.add(rangeRow);
+ }
+ email.setRangeRow(rangeRows);
+ }
+
+ email.setDemandType(demandType);
email.setPriority(priorities.get(random.nextInt(priorities.size())));
email.setRangeRow(rangeRows);
getEmailService().saveEmail(email, user,
@@ -429,7 +449,7 @@
History.PROPERTY_FIELDS, Sets.newHashSet(Email.PROPERTY_SENDER,
Email.PROPERTY_CLIENT,
Email.PROPERTY_PROJECT_REFERENCE,
- Email.PROPERTY_SUBJECT,
+ Email.PROPERTY_OBJECT,
Email.PROPERTY_RECEPTION_DATE,
Email.PROPERTY_MAIL_FOLDER,
Email.PROPERTY_DEMAND_STATUS),
@@ -440,7 +460,7 @@
Email.PROPERTY_FAX, fax,
Email.PROPERTY_CLIENT, client,
Email.PROPERTY_PROJECT_REFERENCE, projectRef,
- Email.PROPERTY_SUBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday),
+ Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday),
Email.PROPERTY_RECEPTION_DATE, yesterday,
Email.PROPERTY_MAIL_FOLDER, folder,
Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED,
@@ -449,7 +469,18 @@
if (opened) {
getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now);
- email.setDemandType(types.get(random.nextInt(types.size())));
+ DemandType demandType = types.get(random.nextInt(types.size()));
+ if (demandType.getRangeNeeded()) {
+ for (int j = 0; j < random.nextInt(4) + 1; j++) {
+ RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())),
+ RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6),
+ RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100),
+ RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100));
+ rangeRows.add(rangeRow);
+ }
+ email.setRangeRow(rangeRows);
+ }
+ email.setDemandType(demandType);
email.setPriority(priorities.get(random.nextInt(priorities.size())));
email.setRangeRow(rangeRows);
getEmailService().saveEmail(email, email.getClient().getCode(), user,
Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -76,7 +76,7 @@
Assert.assertEquals(18, emails.size());
// client code filter + subject filter
- filter.setSubject("ARENO");
+ filter.setObject("ARENO");
emails = service.search(filter);
Assert.assertEquals(2, emails.size());
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -35,6 +35,7 @@
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;
@@ -44,17 +45,28 @@
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
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 jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.io.FileUtils;
+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)
@@ -71,38 +83,22 @@
File file = getModel().getNotNullFile();
- FileInputStream fis;
- if (FaxToMailUIUtil.isFileAPDF(file)) {
- fis = new FileInputStream(file);
+// InputStream inputStream;
+// if (FaxToMailUIUtil.isFileAPDF(file)) {
+// inputStream = new FileInputStream(file);
- } else if (FaxToMailUIUtil.isFileATxt(file)) {
- File target = handler.convertTextToPdf(file);
- fis = new FileInputStream(target);
+// } else if (FaxToMailUIUtil.isFileATxt(file)) {
+// File target = handler.convertTextToPdf(file);
+// inputStream = new FileInputStream(target);
+//
+// } else {
+//
+//
+ InputStream inputStream = new FileInputStream(file);
+// }
- } else {
- File target = File.createTempFile(file.getName(), ".pdf");
+ PdfReader pdfReader = new PdfReader(inputStream);
- Document document = new Document();
- FileOutputStream fos = new FileOutputStream(target);
- PdfWriter writer = PdfWriter.getInstance(document, fos);
- writer.open();
-
- URL resource = file.toURI().toURL();
- Image image = Image.getInstance(resource);
- Rectangle pageSize = new Rectangle(image.getWidth(), image.getHeight());
- document.setPageSize(pageSize);
- document.setMargins(0, 0, 0, 0);
-
- document.open();
- document.add(image);
- document.close();
- writer.close();
-
- fis = new FileInputStream(target);
- }
-
- PdfReader pdfReader = new PdfReader(fis);
-
File target = new File(FileUtils.getTempDirectory(), getModel().getOriginalFile().getName() + "-annoté.pdf");
FileOutputStream fos = new FileOutputStream(target);
PdfStamper pdfStamper = new PdfStamper(pdfReader, fos);
@@ -112,13 +108,16 @@
for (int i = 0 ; i < pageNb ; i++) {
PdfContentByte cb = pdfStamper.getOverContent(i + 1);
- for (PDFEditorNoteUI note : getModel().getPages()[i].getNotes()) {
+ PDFEditorUIModel model = getModel();
+ float zoom = model.getZoom();
+ for (PDFEditorNoteUI note : model.getPages()[i].getNotes()) {
+
Point location = note.getLocation();
- int width = note.getWidth();
- int height = note.getHeight();
- int x = location.x;
- int y = getUI().getContainer().getHeight() - location.y - height;
+ int width = (int) (note.getWidth() / zoom);
+ int height = (int) (note.getHeight() / zoom);
+ int x = (int) (location.x / zoom);
+ int y = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - height;
Insets insets = note.getInsets();
cb.saveState();
@@ -129,7 +128,7 @@
cb.saveState();
JTextArea textArea = note.getNoteText();
- float fontSize = textArea.getFont().getSize2D();
+ float fontSize = textArea.getFont().getSize2D() / zoom;
cb.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED), fontSize * 1.3f);
ColumnText ct = new ColumnText(cb);
@@ -152,13 +151,13 @@
cb.restoreState();
}
- for (JImagePanel panel : getModel().getPages()[i].getCrosses()) {
+ for (JImagePanel panel : model.getPages()[i].getCrosses()) {
Point location = panel.getLocation();
- int width = panel.getWidth();
- int height = panel.getHeight();
- int x = location.x;
- int y = getUI().getContainer().getHeight() - location.y - height;
+ 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();
Image cross = Image.getInstance(JAXXUtil.class.getResource(SwingUtil.DEFAULT_ICON_PATH + PDFEditorCrossUI.CROSS_IMAGE_FILE));
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -67,7 +67,7 @@
int i = JOptionPane.showConfirmDialog(
null,
- t("faxtomail.alert.groupConfirmation.message", currentEmail.getSubject(), selectedEmail.getSubject()),
+ t("faxtomail.alert.groupConfirmation.message", currentEmail.getObject(), selectedEmail.getObject()),
t("faxtomail.alert.groupConfirmation.title"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
@@ -88,7 +88,7 @@
currentEmail.fromEntity(email1);
currentEmail.setGroupedDemandes(email1.getEmailGroup());
- handler.showInformationMessage(t("faxtomail.demande.group.successful", email2.getSubject()));
+ handler.showInformationMessage(t("faxtomail.demande.group.successful", email2.getObject()));
handler.closeFrame();
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -30,6 +30,7 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI;
import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
@@ -39,6 +40,8 @@
import jaxx.runtime.JAXXBinding;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.JAXXWidgetUtil;
+import jaxx.runtime.swing.TabInfo;
+import jaxx.runtime.swing.TabInfoPropertyChangeListener;
import jaxx.runtime.swing.session.SwingSession;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
@@ -46,10 +49,7 @@
import org.nuiton.i18n.I18n;
import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
-import javax.swing.Icon;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JToolBar;
+import javax.swing.*;
import java.awt.Cursor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -325,7 +325,6 @@
Icon icon;
switch (screen) {
case CONFIG:
-
screenUI = new FaxToMailConfigUI(ui);
screenTitle = t("faxtomail.config.title");
icon = ui.getMenuFileConfiguration().getIcon();
@@ -338,11 +337,10 @@
break;
case DEMANDE:
- screenUI = new DemandeUI(ui);
- DemandeUIModel currentEmail = getContext().getCurrentEmail();
- screenTitle = currentEmail.getSubject();
- icon = JAXXWidgetUtil.createActionIcon("email");
- rightDecoration = ((DemandeUI) screenUI).getTopToolBar();
+ screenUI = new DemandesUI(ui);
+ screenTitle = t("faxtomail.demand.title");
+ icon = JAXXWidgetUtil.createActionIcon("email-group");
+ rightDecoration = ((DemandesUI) screenUI).getTopToolBar();
break;
default:
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -63,7 +63,7 @@
protected AttachmentCellRenderer(Decorator<Attachment> decorator) {
setHorizontalAlignment(CENTER);
- setIcon(SwingUtil.createActionIcon("edit-attachment"));
+ setIcon(SwingUtil.createActionIcon("attachment"));
this.noneText = n("faxtomail.attachmentEditor.none.tip");
this.decorator = decorator;
}
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -26,6 +26,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+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;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
@@ -158,6 +159,24 @@
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);
+
+ 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();
@@ -172,9 +191,12 @@
String extension = FileUtil.extension(file);
if (getModel().isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
+ MainUI mainUI = getContext().getMainUI();
+ mainUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
PDFEditorUI dialogContent = new PDFEditorUI(ui);
dialogContent.getModel().fromEntity(attachment);
- openDialog(dialogContent, file.getName(), getContext().getMainUI().getSize());
+ mainUI.setCursor(Cursor.getDefaultCursor());
+ openDialog(dialogContent, file.getName(), mainUI.getSize());
dialogContent.getModel().toEntity(attachment);
} else {
@@ -272,10 +294,10 @@
public boolean stopCellEditing() {
return super.stopCellEditing();
}
-
- protected void fireEditingStopped() {
- super.fireEditingStopped();
- }
+//FIXME still the error when we remove an attachment
+// protected void fireEditingStopped() {
+// super.fireEditingStopped();
+// }
}
}
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -39,6 +39,11 @@
toolTipText: "faxtomail.attachmentEditor.action.open.tip";
}
+#editAttachmentButton {
+ actionIcon: "edit";
+ toolTipText: "faxtomail.attachmentEditor.action.open.tip";
+}
+
#removeAttachmentButton {
actionIcon: "delete";
toolTipText: "faxtomail.attachmentEditor.action.remove.tip";
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx 2014-05-06 16:55:34 UTC (rev 58)
@@ -40,6 +40,8 @@
<JToolBar id='toolbar' constraints='BorderLayout.EAST'>
<JButton id='openAttachmentButton'
onActionPerformed='handler.openAttachment(attachment)'/>
+ <JButton id='editAttachmentButton'
+ onActionPerformed='handler.editAttachment(attachment)'/>
<JButton id='removeAttachmentButton'
onActionPerformed='handler.removeAttachment(this)'/>
</JToolBar>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -412,7 +412,7 @@
ReplyFormUIModel model = dialogContent.getModel();
model.setTo(demand.getSender());
- openFrame(dialogContent, t("faxtomail.reply.title", demand.getSubject()), new Dimension(800, 600));
+ openFrame(dialogContent, t("faxtomail.reply.title", demand.getObject()), new Dimension(800, 600));
}
public void archive() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -45,12 +45,12 @@
borderPainted: false;
}
-#subjectLabel {
- text: "faxtomail.demande.subject.label";
+#objectLabel {
+ text: "faxtomail.demande.object.label";
}
-#subjectField {
- text: {model.getSubject()};
+#objectField {
+ text: {model.getObject()};
}
#receivedDateLabel {
@@ -151,6 +151,30 @@
text: { model.getComment() };
}
+#toRecipientsLabel {
+ text: "faxtomail.demande.toRecipients.label";
+}
+
+#toRecipientsField {
+ text: {model.getToRecipients()};
+}
+
+#ccRecipientsLabel {
+ text: "faxtomail.demande.ccRecipients.label";
+}
+
+#ccRecipientsField {
+ text: {model.getCcRecipients()};
+}
+
+#subjectLabel {
+ text: "faxtomail.demande.subject.label";
+}
+
+#subjectField {
+ text: {model.getSubject()};
+}
+
#mailBodyLabel {
text: "faxtomail.demande.mailBody.label";
verticalAlignment: { SwingConstants.TOP };
@@ -289,6 +313,10 @@
selectionMode: { ListSelectionModel.SINGLE_SELECTION };
}
+#toolbarContainer {
+ rightDecoration: { topToolBar };
+}
+
#backButton {
text: "faxtomail.demande.back.button.label";
actionIcon: cancel;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
@@ -19,7 +19,8 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-<JPanel id='demandePanel' layout='{new BorderLayout()}'
+<JPanel layout='{new BorderLayout()}'
+ id="demandPanel"
implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, DemandeUIHandler>'>
<import>
@@ -28,7 +29,6 @@
com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment
com.franciaflex.faxtomail.ui.swing.content.demande.history.ButtonHistory
- com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.ButtonEmailGroup
com.franciaflex.faxtomail.ui.swing.content.demande.replies.ButtonDemandReplies
com.franciaflex.faxtomail.persistence.entities.Email
@@ -67,13 +67,13 @@
<BeanValidator id='validator' bean='model'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='clientCode' component='clientField'/>
+ <field name='object' component='objectField'/>
<field name='demandType' component='docTypeComboBox'/>
<field name='projectReference' component='projectReferenceField'/>
</BeanValidator>
<JToolBar id='topToolBar'>
<ButtonDemandReplies id="demandRepliesButton"/>
- <ButtonEmailGroup id="demandGroupButton"/>
<ButtonHistory id="historyButton"/>
<ButtonAttachment id="attachmentsButton"
constructorParams="model"/>
@@ -106,11 +106,11 @@
</row>
<row>
<cell>
- <JLabel id='subjectLabel'/>
+ <JLabel id='objectLabel'/>
</cell>
<cell weightx='1' columns="3">
- <JTextField id='subjectField'
- onKeyReleased='handler.setText(event, "subject")'/>
+ <JTextField id='objectField'
+ onKeyReleased='handler.setText(event, "object")'/>
</cell>
</row>
<row>
@@ -268,27 +268,61 @@
</JSplitPane>
- <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
- id="rightVerticalSplitPanel">
- <JPanel layout="{new BorderLayout()}">
- <JLabel id='mailBodyLabel'
- constraints="BorderLayout.NORTH"/>
- <JScrollPane id='mailBodyPane'
- constraints="BorderLayout.CENTER">
- <JTextPane id='mailBodyField'/>
- </JScrollPane>
- </JPanel>
- <JPanel layout="{new BorderLayout()}">
- <JLabel id='commentLabel'
- constraints="BorderLayout.NORTH"/>
- <JScrollPane id='commentPane'
- constraints="BorderLayout.CENTER">
- <JEditorPane id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </JPanel>
- </JSplitPane>
+ <JXTitledPanel id="toolbarContainer">
+ <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}"
+ id="rightVerticalSplitPanel">
+ <Table fill="both">
+ <row>
+ <cell>
+ <JLabel id='toRecipientsLabel'/>
+ </cell>
+ <cell weightx="1">
+ <JLabel id='toRecipientsField'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='ccRecipientsLabel'/>
+ </cell>
+ <cell weightx="1">
+ <JLabel id='ccRecipientsField'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='subjectLabel'/>
+ </cell>
+ <cell weightx="1">
+ <JLabel id='subjectField'/>
+ </cell>
+ </row>
+ <!--<row>-->
+ <!--<cell columns="2">-->
+ <!--<JLabel id='mailBodyLabel'/>-->
+ <!--</cell>-->
+ <!--</row>-->
+ <row>
+ <cell weighty="1" columns="2">
+ <JScrollPane id='mailBodyPane'>
+ <JTextPane id='mailBodyField'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ <JPanel layout="{new BorderLayout()}">
+ <JLabel id='commentLabel'
+ constraints="BorderLayout.NORTH"/>
+ <JScrollPane id='commentPane'
+ constraints="BorderLayout.CENTER">
+ <JEditorPane id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+
+ </JXTitledPanel>
+
</JSplitPane>
<JPanel layout='{new GridLayout(1,0)}'
@@ -302,4 +336,4 @@
<JButton id="groupButton" onActionPerformed="handler.group()"/>
</JPanel>
-</JPanel>
\ No newline at end of file
+</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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -371,7 +371,7 @@
@Override
protected JComponent getComponentToFocus() {
- return getUI().getSubjectField();
+ return getUI().getObjectField();
}
@Override
@@ -484,7 +484,7 @@
SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
false,
dialogContent,
- t("faxtomail.reply.title", getModel().getSubject()),
+ t("faxtomail.reply.title", getModel().getObject()),
new Dimension(800, 600));
getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
@@ -497,7 +497,7 @@
SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(this,
false,
dialogContent,
- t("faxtomail.searchToGroup.title", getModel().getSubject()),
+ t("faxtomail.searchToGroup.title", getModel().getObject()),
getContext().getMainUI().getSize());
getContext().getActionFactory().createUIAction(null, action).actionPerformed(null);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -39,16 +39,37 @@
import com.franciaflex.faxtomail.persistence.entities.Reply;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
+import jaxx.runtime.swing.JAXXWidgetUtil;
+import org.apache.commons.io.Charsets;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.swing.tab.TabContentModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.Address;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Part;
+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;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.List;
import static org.nuiton.i18n.I18n.t;
@@ -56,13 +77,15 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
*/
-public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> implements AttachmentModelAware {
+public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> implements AttachmentModelAware, TabContentModel {
private static final Log log = LogFactory.getLog(DemandeUIModel.class);
public static final String PROPERTY_QUOTATION_NB = "quotationNb";
public static final String PROPERTY_PF_NB = "pfNb";
public static final String PROPERTY_SAV_NB = "savNb";
+ public static final String PROPERTY_PLAIN_CONTENT = "plainContent";
+ public static final String PROPERTY_HTML_CONTENT = "htmlContent";
public static final String PROPERTY_CLIENT_CODE = "clientCode";
public static final String PROPERTY_CLIENT_BRAND = "clientBrand";
public static final String PROPERTY_EDITABLE = "editable";
@@ -93,6 +116,18 @@
protected boolean editable = true;
+ protected String htmlContent;
+
+ protected String plainContent;
+
+ protected String subject;
+
+ protected List<String> toRecipients;
+
+ protected List<String> ccRecipients;
+
+// protected List<String> sender;
+
protected static Binder<DemandeUIModel, Email> toBeanBinder =
BinderFactory.newBinder(DemandeUIModel.class,
Email.class);
@@ -184,36 +219,59 @@
return editObject.getRecipient();
}
- public void setSubject(String object) {
- Object oldValue = getSubject();
- editObject.setSubject(object);
- firePropertyChanged(Email.PROPERTY_SUBJECT, oldValue, object);
+ public void setObject(String object) {
+ Object oldValue = getObject();
+ editObject.setObject(object);
+ firePropertyChanged(Email.PROPERTY_OBJECT, oldValue, object);
}
+ public String getObject() {
+ return editObject.getObject();
+ }
+
public String getSubject() {
- return editObject.getSubject();
+ if (subject == null) {
+ decomposeEmail();
+ }
+ return subject;
}
- public String getPlainContent() {
- return editObject.getPlainContent();
+ public String getToRecipients() {
+ if (toRecipients == null) {
+ decomposeEmail();
+ }
+ return StringUtils.join(toRecipients, ", ");
}
- public void setPlainContent(String content) {
- Object oldValue = getPlainContent();
- editObject.setPlainContent(content);
- firePropertyChanged(Email.PROPERTY_PLAIN_CONTENT, oldValue, content);
+ public String getCcRecipients() {
+ if (ccRecipients == null) {
+ decomposeEmail();
+ }
+ return StringUtils.join(ccRecipients, ", ");
}
+ public String getPlainContent() {
+ if (plainContent == null) {
+ decomposeEmail();
+ }
+ return plainContent;
+ }
+
public String getHtmlContent() {
- return editObject.getHtmlContent();
+ if (htmlContent == null) {
+ decomposeEmail();
+ }
+ return htmlContent;
}
- public void setHtmlContent(String content) {
- Object oldValue = getHtmlContent();
- editObject.setHtmlContent(content);
- firePropertyChanged(Email.PROPERTY_HTML_CONTENT, oldValue, content);
+ public void setOriginalEmail(String originalEmail) {
+ editObject.setOriginalEmail(originalEmail);
}
+ public String getOriginalEmail() {
+ return editObject.getOriginalEmail();
+ }
+
public void setClientCode(String clientCode) {
Object oldValue = getClientCode();
this.clientCode = clientCode;
@@ -664,4 +722,95 @@
DemandeUIModel other = (DemandeUIModel) obj;
return editObject.equals(other.editObject);
}
+
+ protected void decomposeEmail() {
+ try {
+ Message message = new MimeMessage(null, new ByteArrayInputStream(getOriginalEmail().getBytes()));
+ subject = message.getSubject();
+
+ toRecipients = new ArrayList<String>();
+ ccRecipients = new ArrayList<String>();
+ Address[] recipients = message.getRecipients(Message.RecipientType.TO);
+ if (recipients != null) {
+ for (Address address : recipients) {
+ toRecipients.add(address.toString());
+ }
+ }
+ recipients = message.getRecipients(Message.RecipientType.CC);
+ if (recipients != null) {
+ for (Address address : recipients) {
+ ccRecipients.add(address.toString());
+ }
+ }
+
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(message);
+
+ } else {
+ String content = IOUtils.toString(message.getInputStream());
+ plainContent = content;
+ }
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ }
+ }
+
+ /**
+ * Decompose a multipart part.
+ * - sets the email content if the part contains a text bodypart
+ * - adds attachments to the email
+ *
+ * @param part the part to decompose
+ * @throws Exception
+ */
+ protected void decomposeMultipartEmail(Part part) throws Exception {
+ DataSource dataSource = part.getDataHandler().getDataSource();
+ MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
+ int multiPartCount = mimeMultipart.getCount();
+
+ for (int j = 0; j < multiPartCount; j++) {
+ BodyPart bp = mimeMultipart.getBodyPart(j);
+
+ // if it is a text part, the,n this is the email content
+ String disposition = bp.getDisposition();
+ if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
+ Charset charset = getCharset(bp);
+ String content = IOUtils.toString(bp.getInputStream(), charset);
+ if (bp.isMimeType("text/plain")) {
+ plainContent = content;
+ } else {
+ htmlContent = content;
+ }
+
+ // if it is multipart part, decompose it
+ } else if (bp.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(bp);
+ }
+ }
+ }
+
+ protected Charset getCharset(Part part) throws MessagingException {
+ ContentType contentType = new ContentType(part.getContentType());
+ String charsetName = contentType.getParameter("charset");
+ Charset charset = Charsets.toCharset(charsetName);
+ return charset;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public String getTitle() {
+ return getObject();
+ }
+
+ @Override
+ public String getIcon() {
+ return "email";
+ }
}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -0,0 +1,5 @@
+#topToolBar {
+ floatable: false;
+ opaque: false;
+ borderPainted: false;
+}
\ No newline at end of file
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
@@ -0,0 +1,34 @@
+<JPanel id='demandsPanel' layout="{ new BorderLayout() }"
+ implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, DemandesUIHandler>'>
+
+ <import>
+ com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI
+ com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil
+ com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.ButtonEmailGroup
+ </import>
+
+ <script><![CDATA[
+
+ public DemandesUI(FaxToMailUI parentUI) {
+ FaxToMailUIUtil.setParentUI(this, parentUI);
+ }
+
+ ]]></script>
+
+
+ <DemandeUIModel id='model'
+ initializer='getContextValue(DemandeUIModel.class)'/>
+
+
+ <JToolBar id='topToolBar'>
+ <ButtonEmailGroup id="demandGroupButton"/>
+ </JToolBar>
+
+ <JTabbedPane id="demandsTabPane" constraints="BorderLayout.CENTER">
+ <tab id="mainDemandTab">
+ <DemandeUI id="mainDemand" constructorParams="this"/>
+ </tab>
+ </JTabbedPane>
+
+</JPanel>
\ No newline at end of file
Added: 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 (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -0,0 +1,99 @@
+package com.franciaflex.faxtomail.ui.swing.content.demande;
+
+import com.franciaflex.faxtomail.persistence.entities.DemandType;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import jaxx.runtime.validator.swing.SwingValidator;
+import org.nuiton.jaxx.application.swing.tab.DelegateTabContainerHandler;
+import org.nuiton.jaxx.application.swing.tab.TabContainerHandler;
+import org.nuiton.jaxx.application.swing.tab.TabContentModel;
+import org.nuiton.jaxx.application.swing.tab.TabHandler;
+import org.nuiton.util.beans.BeanMonitor;
+
+import javax.swing.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandesUI> implements TabContainerHandler {
+
+ protected DelegateTabContainerHandler delegateTabHandler;
+
+ @Override
+ public void beforeInit(DemandesUI ui) {
+
+ super.beforeInit(ui);
+
+ DemandeUIModel model = getContext().getCurrentEmail();
+ this.ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInit(DemandesUI demandesUI) {
+ initUI(ui);
+
+ setCustomTab(0, getModel());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ public SwingValidator<DemandeUIModel> getValidator() {
+ return null;
+ }
+
+ @Override
+ protected JComponent getComponentToFocus() {
+ return null;
+ }
+
+ /**
+ * Returns the tab handler of the tab i.
+ *
+ * @param index the index of the tab
+ * @return the tab handler of the index i if the handler implements
+ * the {@link org.nuiton.jaxx.application.swing.tab.TabHandler} interface,
+ * <code>null</code> otherwise
+ */
+ @Override
+ public TabHandler getTabHandler(int index) {
+ TabHandler tabHandler = delegateTabHandler.getTabHandler(index);
+ return tabHandler;
+ }
+
+ @Override
+ public void setCustomTab(int index, TabContentModel model) {
+ delegateTabHandler.setCustomTab(index, model);
+ }
+
+ @Override
+ protected void initUI(DemandesUI ui) {
+ super.initUI(ui);
+
+ delegateTabHandler = new DelegateTabContainerHandler(getTabPanel());
+ delegateTabHandler.init();
+ }
+
+ @Override
+ public JTabbedPane getTabPanel() {
+ return getUI().getDemandsTabPane();
+ }
+
+ @Override
+ public void init() {
+ delegateTabHandler.init();
+ }
+
+ @Override
+ public boolean onTabChanged(int currentIndex, int newIndex) {
+ return delegateTabHandler.onTabChanged(currentIndex, newIndex);
+ }
+
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -44,7 +44,7 @@
public ButtonEmailGroup() {
setToolTipText(t("faxtomail.demandGroup.action.tip"));
- int demandNb = popup.getModel().sizeGroupedDemandes();
+ int demandNb = popup.getModel().sizeGroupedDemandes() + 1;
setText(t("faxtomail.demandGroup.text", demandNb));
popup.getModel().addPropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, new PropertyChangeListener() {
@@ -53,7 +53,7 @@
Collection<DemandeUIModel> demands = (Collection<DemandeUIModel>) evt.getNewValue();
if (demands != null) {
int size = demands.size();
- setText(t("faxtomail.demandGroup.text", size));
+ setText(t("faxtomail.demandGroup.text", size + 1));
}
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -26,7 +26,7 @@
}
#demandeSubjectLabel {
- text: { getDemande().getSubject() };
+ text: { getDemande().getObject() };
}
#toolbar {
@@ -35,6 +35,6 @@
}
#openDemandeButton {
- actionIcon: "open-file";
+ actionIcon: "open";
toolTipText: "faxtomail.attachmentEditor.action.open.tip";
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -85,7 +85,7 @@
TableModel demandGroupTableModel = new AbstractTableModel() {
@Override
public int getRowCount() {
- return getModel().sizeGroupedDemandes();
+ return getModel().sizeGroupedDemandes() + 1;
}
@Override
@@ -95,7 +95,10 @@
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
- return Iterables.get(getModel().getGroupedDemandes(), rowIndex);
+ if (rowIndex == 0) {
+ return getModel();
+ }
+ return Iterables.get(getModel().getGroupedDemandes(), rowIndex - 1);
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -207,7 +207,7 @@
// if it is a text part, the,n this is the email content
String disposition = bp.getDisposition();
- if (bp.isMimeType("text/*") && Part.INLINE.equals(disposition)) {
+ if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
String content = IOUtils.toString(bp.getInputStream());
reply.setMessage(content);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -40,6 +40,6 @@
}
#openReplyButton {
- actionIcon: "open-file";
+ actionIcon: "open";
toolTipText: "faxtomail.demandReplies.action.open.tip";
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -32,6 +32,7 @@
#noteTitle {
font: { Font.decode(BaseFont.HELVETICA).deriveFont(Font.ITALIC) };
+ font-size: { (int)(DEFAULT_FONT_SIZE * getZoom()) };
text: { getTitle() };
}
@@ -48,6 +49,7 @@
opaque : { false };
background: { null };
font: { Font.decode(BaseFont.HELVETICA) };
+ font-size: { (int)(DEFAULT_FONT_SIZE * getZoom()) };
lineWrap: { false };
wrapStyleWord: { false };
}
\ 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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
@@ -36,6 +36,8 @@
<script><![CDATA[
+ public static final int DEFAULT_FONT_SIZE = 12;
+
protected void textTyped() {
setText(getNoteText().getText());
@@ -57,6 +59,7 @@
<String id="title" javaBean="null"/>
<String id="text" javaBean=""/>
+ <Float id="zoom" javaBean="1.0f"/>
<JPanel id="noteHeader"
layout='{ new BorderLayout() }'
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -65,6 +65,26 @@
toolTipText: "faxtomail.pdfEitor.button.nextPage";
}
+#zoomOutButton {
+ actionIcon: zoom-out;
+}
+
+#zoomLabel {
+ text: { String.format("%.0f", model.getZoom() * 100) + "%"};
+}
+
+#zoomInButton {
+ actionIcon: zoom-in;
+}
+
+#rotateClockwiseButton {
+ actionIcon: rotate-clockwise
+}
+
+#rotateAntiClockwiseButton {
+ actionIcon: rotate-anticlockwise
+}
+
#cancelButton {
actionIcon: cancel;
text: "faxtomail.pdfEitor.action.cancel";
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx 2014-05-06 16:55:34 UTC (rev 58)
@@ -63,6 +63,18 @@
<JLabel id="pageTotal"/>
<JButton id="nextPageButton"
onActionPerformed="getModel().incPageIndex()"/>
+
+ <JButton id="zoomOutButton"
+ onActionPerformed="handler.zoomOut()"/>
+ <JLabel id="zoomLabel"/>
+ <JButton id="zoomInButton"
+ onActionPerformed="handler.zoomIn()"/>
+
+ <JButton id="rotateClockwiseButton"
+ onActionPerformed="handler.rotateClockwise()"/>
+ <JButton id="rotateAntiClockwiseButton"
+ onActionPerformed="handler.rotateAntiClockwise()"/>
+
</JToolBar>
<JScrollPane constraints='BorderLayout.CENTER'>
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -28,10 +28,12 @@
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.Paragraph;
+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;
@@ -39,19 +41,30 @@
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.Image;
+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;
import java.beans.PropertyChangeListener;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.RandomAccessFile;
+import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Date;
@@ -77,11 +90,12 @@
cm.setEdgeInsets(new Insets(0, 0, 0, 0));
+ final PDFEditorUIModel model = getModel();
ui.getContainer().addContainerListener(new ContainerListener() {
@Override
public void componentAdded(ContainerEvent e) {
Component child = e.getChild();
- PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
+ PDFEditorUIModel.Page currentPage = model.getCurrentPage();
if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
currentPage.addNote((PDFEditorNoteUI) child);
@@ -93,7 +107,7 @@
@Override
public void componentRemoved(ContainerEvent e) {
Component child = e.getChild();
- PDFEditorUIModel.Page currentPage = getModel().getCurrentPage();
+ PDFEditorUIModel.Page currentPage = model.getCurrentPage();
if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) {
currentPage.removeNote((PDFEditorNoteUI) child);
@@ -103,17 +117,18 @@
}
});
- getModel().addPropertyChangeListener(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX,
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Integer pageNb = (Integer) evt.getNewValue();
- Integer prevPageNb = (Integer) evt.getOldValue();
- updatePageNumber(pageNb, prevPageNb);
- }
- });
+ model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX,
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Integer pageNb = (Integer) evt.getNewValue();
+ Integer prevPageNb = (Integer) evt.getOldValue();
+ updatePageNumber(pageNb, prevPageNb);
+ }
+ }
+ );
- getModel().addPropertyChangeListener(new PropertyChangeListener() {
+ model.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (Attachment.PROPERTY_ORIGINAL_FILE.equals(evt.getPropertyName())
@@ -123,9 +138,9 @@
File file = model.getNotNullFile();
if (file != null) {
- if (FaxToMailUIUtil.isFileATxt(file)) {
+ if (!FaxToMailUIUtil.isFileAPDF(file)) {
try {
- file = convertTextToPdf(file);
+ file = convertFileToPdf(file);
} catch (IOException e) {
if (log.isErrorEnabled()) {
@@ -138,7 +153,6 @@
}
}
if (FaxToMailUIUtil.isFileAPDF(file)) {
- getUI().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel channel = raf.getChannel();
@@ -153,60 +167,27 @@
log.error("", e);
}
}
- getUI().setCursor(Cursor.getDefaultCursor());
-
- } else {
- model.setPageNumber(1);
- model.setCurrentPageIndex(1);
-
- JImagePanel container = getUI().getContainer();
- if (FaxToMailUIUtil.isFileATxt(file)) {
- JTextPane textPane = new JTextPane();
- textPane.setEditable(false);
- try {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String text = new String();
- while (br.readLine() != null) {
- text += br.readLine() + "\n";
- }
- textPane.setText(text);
-
- log.debug(textPane.getText());
-
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- }
- container.add(textPane);
-
- Insets insets = container.getInsets();
- Dimension size = textPane.getPreferredSize();
-
- container.setPreferredSize(size);
- container.setMinimumSize(size);
- container.setMaximumSize(size);
- container.setSize(size);
-
- textPane.setBounds(insets.left, insets.top, size.width, size.height);
-
- container.updateUI();
-
- } else {
- if (FaxToMailUIUtil.isFileATif(file)) {
- container.setTifImage(file);
-
- } else {
- container.setImage(file);
- }
- }
}
+ getUI().setCursor(Cursor.getDefaultCursor());
model.firePropertyChanged(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX, null, 1);
}
}
}
});
+
+ model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ZOOM, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ displayPage(model.getCurrentPageIndex(), (Float) evt.getOldValue());
+ }
+ });
+
+ model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ROTATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ displayPage(model.getCurrentPageIndex(), model.getZoom());
+ }
+ });
}
@Override
@@ -232,10 +213,6 @@
}
public void addCross() {
-// java.awt.Image cross = SwingUtil.createImageIcon(CROSS_IMAGE_FILE).getImage();
-// JImagePanel panel = new JImagePanel(cross);
-// panel.setScaleImageToFitPanel(true);
-// panel.setBorder(BorderFactory.createDashedBorder(null));
PDFEditorCrossUI cross = new PDFEditorCrossUI();
addPanel(cross);
cr.registerComponent(cross);
@@ -269,53 +246,139 @@
}
}
- PDFPage page = pdf.getPage(pageNb);
- // create the image
- Rectangle rect = new Rectangle(0, 0, (int) page.getBBox().getWidth(),
- (int) page.getBBox().getHeight());
+ displayPage(pageNb, getModel().getZoom());
+ }
+ }
+ }
- Image image = page.getImage(rect.width, rect.height, // width & height
- rect, // clip rect
- null, // null for the ImageObserver
- true, // fill background with white
- true // block until drawing is done
- );
- JImagePanel container = getUI().getContainer();
- container.setImage(image);
+ protected void displayPage(int pageNb, float previousZoom) {
+ PDFPage page = pdf.getPage(pageNb);
+ // create the image
+ Rectangle2D bBox = page.getBBox();
+ Rectangle rect = new Rectangle(0, 0, (int) bBox.getWidth(),
+ (int) bBox.getHeight());
- PDFEditorUIModel.Page p = getModel().getPage(pageNb);
- for (JPanel panel : p.getNotes()) {
- panel.setVisible(true);
- }
- for (JPanel panel : p.getCrosses()) {
- panel.setVisible(true);
- }
+ float zoom = getModel().getZoom();
+ int rotation = getModel().getRotation();
- container.updateUI();
- }
+ int width = (int) (zoom * rect.width);
+ int height = (int) (zoom * rect.height);
+ Image image = page.getImage(width, height, // width & height
+ rect, // clip rect
+ null, // null for the ImageObserver
+ true, // fill background with white
+ true // block until drawing is done
+ );
+
+ JImagePanel container = getUI().getContainer();
+
+ container.setImage(image, rotation);
+
+ Insets insets = container.getInsets();
+ rect = container.getVisibleRect();
+
+ 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));
+
}
- }
- public File convertTextToPdf(File file) throws IOException, DocumentException {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String text = new String();
- while (br.readLine() != null) {
- text += br.readLine() + "\n";
+ for (JImagePanel 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));
}
- file = File.createTempFile(file.getName(), ".pdf");
+ container.updateUI();
+ }
+ public File convertFileToPdf(File file) throws IOException, DocumentException {
+ File target = File.createTempFile(file.getName(), ".pdf");
+
Document document = new Document();
- FileOutputStream fos = new FileOutputStream(file);
+ FileOutputStream fos = new FileOutputStream(target);
PdfWriter writer = PdfWriter.getInstance(document, fos);
writer.open();
+ document.setPageSize(PageSize.A4);
document.open();
- document.add(new Paragraph(text));
+
+ if (FaxToMailUIUtil.isFileATxt(file)) {
+ FileReader fr = new FileReader(file);
+ BufferedReader br = new BufferedReader(fr);
+ StringBuilder text = new StringBuilder();
+ while (br.readLine() != null) {
+ text.append(br.readLine()).append("\n");
+ }
+ document.add(new Paragraph(text.toString()));
+
+ } else if (FaxToMailUIUtil.isFileATif(file)) {
+ FileInputStream fis = new FileInputStream(file);
+ FileChannel channel = fis.getChannel();
+ ByteBuffer buffer = ByteBuffer.allocate((int) channel.size());
+ channel.read(buffer);
+ SeekableStream stream = new ByteArraySeekableStream(buffer.array());
+ String[] names = ImageCodec.getDecoderNames(stream);
+ ImageDecoder tifImageDecoder = ImageCodec.createImageDecoder(names[0], stream, null);
+
+ for (int i = 0 ; i < tifImageDecoder.getNumPages() ; i++) {
+ RenderedImage renderedImage = tifImageDecoder.decodeAsRenderedImage(i);
+ java.awt.Image awtImage = PlanarImage.wrapRenderedImage(renderedImage).getAsBufferedImage();
+ document.newPage();
+ com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(writer, awtImage, 1.0f);
+ image.scaleToFit(PageSize.A4.getWidth() - document.leftMargin() - document.rightMargin(),
+ PageSize.A4.getHeight() - document.topMargin() - document.bottomMargin());
+ document.add(image);
+ }
+
+ } else {
+ URL resource = file.toURI().toURL();
+ com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(resource);
+ float scaler = ((document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin()) / image.getWidth()) * 100;
+ image.scalePercent(scaler);
+ document.add(image);
+ }
+
document.close();
writer.close();
- return file;
+
+ getModel().setEditedFile(target);
+
+ return target;
}
+ public void zoomOut() {
+ PDFEditorUIModel model = getModel();
+ float zoom = model.getZoom();
+ model.setZoom(zoom - 0.25f);
+ }
+
+ public void zoomIn() {
+ PDFEditorUIModel model = getModel();
+ float zoom = model.getZoom();
+ model.setZoom(zoom + 0.25f);
+ }
+
+ public void rotateClockwise() {
+ int rotation = getModel().getRotation();
+ getModel().setRotation((360 + rotation + 90) % 360);
+ }
+
+ public void rotateAntiClockwise() {
+ int rotation = getModel().getRotation();
+ getModel().setRotation((360 + rotation - 90) % 360);
+ }
}
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -44,6 +44,8 @@
public static final String PROPERTY_PAGES = "pages";
public static final String PROPERTY_CURRENT_PAGE_INDEX = "currentPageIndex";
+ public static final String PROPERTY_ZOOM = "zoom";
+ public static final String PROPERTY_ROTATION = "rotation";
protected final Attachment editObject = new AttachmentImpl();
@@ -82,6 +84,10 @@
// first page is 1 not 0
protected int currentPageIndex = -1;
+ protected float zoom = 1.0f;
+
+ protected int rotation = 0;
+
protected static Binder<PDFEditorUIModel, Attachment> toBeanBinder =
BinderFactory.newBinder(PDFEditorUIModel.class,
Attachment.class);
@@ -179,6 +185,28 @@
setCurrentPageIndex(currentPageIndex + 1);
}
+ public float getZoom() {
+ return zoom;
+ }
+
+ public void setZoom(float zoom) {
+ if (zoom > 0) {
+ Object oldValue = getZoom();
+ this.zoom = zoom;
+ firePropertyChanged(PROPERTY_ZOOM, oldValue, zoom);
+ }
+ }
+
+ public int getRotation() {
+ return rotation;
+ }
+
+ public void setRotation(int rotation) {
+ Object oldValue = getRotation();
+ this.rotation = rotation;
+ firePropertyChanged(PROPERTY_ROTATION, oldValue, rotation);
+ }
+
@Override
protected Attachment newEntity() {
return new AttachmentImpl();
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -31,7 +31,6 @@
border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) };
}
-
#toolbar {
borderPainted: false;
floatable: false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -114,7 +114,7 @@
}
#validateButton {
- actionIcon: validate;
+ actionIcon: reply;
text: "faxtomail.reply.action.validate";
toolTipText: "faxtomail.reply.action.validate.tip";
_applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class };
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -77,11 +77,11 @@
model.setOriginalDemand(currentEmail);
for (Attachment attachment : currentEmail.getAttachment()) {
+ model.addAvailableAttachment(attachment.getOriginalFile());
File file = attachment.getEditedFile();
- if (file == null) {
- file = attachment.getOriginalFile();
+ if (file != null) {
+ model.addAvailableAttachment(file);
}
- model.addAvailableAttachment(file);
}
model.setFrom(currentEmail.getRecipient());
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -149,7 +149,7 @@
}
#subjectField {
- text: {model.getSubject()};
+ text: {model.getObject()};
}
#senderLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-05-06 16:55:34 UTC (rev 58)
@@ -154,7 +154,7 @@
}
#subjectField {
- text: {model.getSubject()};
+ text: {model.getObject()};
}
#senderLabel {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -91,14 +91,14 @@
return editObject.getRecipient();
}*/
- public void setSubject(String subject) {
- Object oldValue = getSubject();
- editObject.setSubject(subject);
- firePropertyChanged(EmailFilter.PROPERTY_SUBJECT, oldValue, subject);
+ public void setObject(String object) {
+ Object oldValue = getObject();
+ editObject.setObject(object);
+ firePropertyChanged(EmailFilter.PROPERTY_OBJECT, oldValue, object);
}
- public String getSubject() {
- return editObject.getSubject();
+ public String getObject() {
+ return editObject.getObject();
}
public void setClientCode(String clientCode) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -82,7 +82,9 @@
if (node.getClass().isAssignableFrom(FolderTreeNode.class)) {
FolderTreeNode folderTreeNode = (FolderTreeNode) node;
folderTreeNode.setCanSelect(!currentFolder.equals(folder) &&
- (foldersWithEtatAttente.isEmpty()
+ //TODO condition moche
+ (foldersWithEtatAttente == null ||
+ foldersWithEtatAttente.isEmpty()
|| foldersWithEtatAttente.contains(folder)));
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -88,7 +88,7 @@
columns = StringUtils.join(new String[]{
Email.PROPERTY_PRIORITY,
Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_SUBJECT,
+ Email.PROPERTY_OBJECT,
DemandeUIModel.PROPERTY_CLIENT_CODE,
DemandeUIModel.PROPERTY_CLIENT_BRAND,
Email.PROPERTY_SENDER,
@@ -194,8 +194,7 @@
if (highlight) {
Font font = renderer.getFont();
renderer.setFont(font.deriveFont(Font.ITALIC));
- //TODO kmorin 20140326 find color between gray and black
- renderer.setForeground(Color.BLUE);
+ renderer.setForeground(new Color(96, 96, 96));
}
return renderer;
}
@@ -227,6 +226,19 @@
Color color = new Color(255, 51, 51);
table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
+ HighlightPredicate testPredicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ int viewRow = adapter.row;
+ int modelRow = adapter.convertRowIndexToModel(viewRow);
+ DemandeUIModel row = tableModel.getEntry(modelRow);
+ return row.getLastAttachmentOpeningUser() != null
+ && !row.getLastAttachmentOpeningUser().equals(row.getTakenBy());
+ }
+ };
+ color = Color.ORANGE;
+ table.addHighlighter(new ColorHighlighter(testPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
+
table.addMouseListener(getDataTableMouseListener());
return tableModel;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -131,7 +131,7 @@
return input != null ? input.getLabel() : noneLabel;
}
});
- decorate = StringUtils.join(e, ", ");
+ decorate = StringUtils.join(e, " ou ");
label.setText(decorate);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -53,11 +53,11 @@
n("faxtomail.demandeList.table.header.sender"),
n("faxtomail.demandeList.table.header.sender.tip")));
- put(Email.PROPERTY_SUBJECT,
+ put(Email.PROPERTY_OBJECT,
ColumnIdentifier.<Email>newReadOnlyId(
- Email.PROPERTY_SUBJECT,
- n("faxtomail.demandeList.table.header.subject"),
- n("faxtomail.demandeList.table.header.subject.tip")));
+ Email.PROPERTY_OBJECT,
+ n("faxtomail.demandeList.table.header.object"),
+ n("faxtomail.demandeList.table.header.object.tip")));
put(Email.PROPERTY_RECEPTION_DATE,
ColumnIdentifier.<Email>newReadOnlyId(
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -30,11 +30,18 @@
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;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil;
import org.nuiton.util.FileUtil;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.BodyPart;
+import javax.mail.Part;
+import javax.mail.internet.MimeMultipart;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
@@ -45,6 +52,7 @@
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.io.File;
+import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -206,4 +214,5 @@
}
textPane.setText(content);
}
+
}
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -34,6 +34,7 @@
import javax.imageio.ImageIO;
import javax.media.jai.PlanarImage;
import javax.swing.*;
+import javax.swing.border.BevelBorder;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
@@ -55,6 +56,7 @@
protected Image image;
protected Image scaledImage;
+ protected int rotation;
protected boolean scaleImageToFitPanel;
@@ -106,34 +108,26 @@
bufferedImage = null;
}
if (bufferedImage != null) {
- setImage(bufferedImage);
+ setImage(bufferedImage, 0);
}
}
- public void setTifImage(File file) {
- try {
- FileInputStream fis = new FileInputStream(file);
- FileChannel channel = fis.getChannel();
- ByteBuffer buffer = ByteBuffer.allocate((int) channel.size());
- channel.read(buffer);
- SeekableStream stream = new ByteArraySeekableStream(buffer.array());
- String[] names = ImageCodec.getDecoderNames(stream);
- ImageDecoder dec = ImageCodec.createImageDecoder(names[0], stream, null);
- RenderedImage im = dec.decodeAsRenderedImage();
- Image image = PlanarImage.wrapRenderedImage(im).getAsBufferedImage();
-
- setImage(image);
-
- } catch (IOException e) {
- log.error("error while reading image " + file.getAbsolutePath(), e);
- }
+ public void setImage(Image img) {
+ setImage(img, 0);
}
- public void setImage(Image img) {
+ public void setImage(Image img, int rotation) {
this.image = img;
this.scaledImage = img;
+ this.rotation = rotation;
- Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
+ int srcWidth = img.getWidth(null);
+ int srcHeight = img.getHeight(null);
+
+ int newWidth = rotation % 180 == 0 ? srcWidth : srcHeight;
+ int newHeight = rotation % 180 == 0 ? srcHeight : srcWidth;
+
+ Dimension size = new Dimension(newWidth, newHeight);
setPreferredSize(size);
setMinimumSize(size);
setMaximumSize(size);
@@ -141,14 +135,49 @@
}
public void setImage(String img) {
- setImage(new ImageIcon(img).getImage());
+ setImage(new ImageIcon(img).getImage(), 0);
}
@Override
public void paintComponent(Graphics g) {
if (scaledImage != null) {
+ Graphics2D g2d = (Graphics2D) g;
+
+ double width = getSize().getWidth();
+ double height = getSize().getHeight();
+
+ double translateX;
+ double translateY;
+
+ switch (rotation) {
+ case 90:
+ translateX = width;
+ translateY = 0;
+ break;
+
+ case 180:
+ translateX = width;
+ translateY = height;
+ break;
+
+ case 270:
+ translateX = 0;
+ translateY = height;
+ break;
+
+ default:
+ translateX = 0;
+ translateY = 0;
+ }
+ g2d.translate(translateX, translateY);
+ g2d.rotate(Math.toRadians(rotation), 0, 0);
+
Insets insets = getInsets();
- g.drawImage(scaledImage, insets.left, insets.top, this);
+ int leftInset = rotation % 180 == 0 ? insets.left : insets.top;
+ int topInset = rotation % 180 == 0 ? insets.top : insets.left;
+ g2d.drawImage(scaledImage, leftInset, topInset, this);
+
}
+
}
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-06 16:55:34 UTC (rev 58)
@@ -1,4 +1,7 @@
\ |\ =
+%=
++=
+-=
\:=
X=
application.action.create.error=
@@ -50,6 +53,7 @@
faxtomail.common.on.label=le
faxtomail.config.application=
faxtomail.config.title=
+faxtomail.demand.title=Détail
faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant
faxtomail.demandGroup.empty=Aucune demande groupée
faxtomail.demandGroup.text=Groupe (%s)
@@ -66,6 +70,7 @@
faxtomail.demande.attachment.label=Pièces-jointes
faxtomail.demande.back.button.label=Quitter
faxtomail.demande.body.label=Corps du mail
+faxtomail.demande.ccRecipients.label=Copie à \:
faxtomail.demande.client.label=Code client
faxtomail.demande.clientBrand.label=Marque
faxtomail.demande.clientCode.label=Client
@@ -87,6 +92,7 @@
faxtomail.demande.localReference.label=Notre référence
faxtomail.demande.mailBody.label=Corps du mail
faxtomail.demande.mailFolder.label=Dossier
+faxtomail.demande.object.label=Objet
faxtomail.demande.print.button.label=Imprimer
faxtomail.demande.printedBy.label=Imprimé par
faxtomail.demande.priority.label=Priorité
@@ -100,8 +106,9 @@
faxtomail.demande.sender.label=Émetteur
faxtomail.demande.sender.manualCreation=Création manuelle
faxtomail.demande.status.label=Statut
-faxtomail.demande.subject.label=Objet
+faxtomail.demande.subject.label=Sujet \:
faxtomail.demande.takenBy.label=Pris par
+faxtomail.demande.toRecipients.label=À \:
faxtomail.demande.transferBy.label=Transmit par
faxtomail.demande.transmit.button.label=Transmettre
faxtomail.demandeList.action.archive=Archiver
@@ -132,6 +139,8 @@
faxtomail.demandeList.table.header.ediCodeNumber.tip=Code EDI
faxtomail.demandeList.table.header.lastAttachmentOpeningUser=Dernier à ouvrir une PJ
faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip=Dernier utilisateur à avoir ouvert une pièce-jointe
+faxtomail.demandeList.table.header.object=Objet
+faxtomail.demandeList.table.header.object.tip=Objet
faxtomail.demandeList.table.header.pfNb=Qté produits
faxtomail.demandeList.table.header.pfNb.tip=Quantité de produits
faxtomail.demandeList.table.header.priority=P
@@ -148,15 +157,13 @@
faxtomail.demandeList.table.header.sender.tip=Addresse email ou numéro de fax de l'émetteur
faxtomail.demandeList.table.header.status=Statut
faxtomail.demandeList.table.header.status.tip=Statut
-faxtomail.demandeList.table.header.subject=Objet
-faxtomail.demandeList.table.header.subject.tip=Objet
faxtomail.demandeList.table.header.type=Type
faxtomail.demandeList.table.header.type.tip=Type
faxtomail.demandeList.table.header.user=Pris par
faxtomail.demandeList.table.header.user.tip=Pris par
faxtomail.demandeList.table.header.waitingState=État attente
faxtomail.demandeList.table.header.waitingState.tip=État attente
-faxtomail.demandeList.title=Gestion des fax
+faxtomail.demandeList.title=Liste des éléments
faxtomail.historyList.action.tip=Historique
faxtomail.historyList.text=Historique (%s)
faxtomail.historyList.title=Historique
@@ -180,7 +187,7 @@
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=Valider
+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
@@ -202,8 +209,8 @@
faxtomail.reply.action.cancel.tip=Annuler et fermer la popup
faxtomail.reply.action.close=Fermer
faxtomail.reply.action.close.tip=Fermer
-faxtomail.reply.action.validate=Valider
-faxtomail.reply.action.validate.tip=Valider et répondre au mail
+faxtomail.reply.action.validate=Envoyer
+faxtomail.reply.action.validate.tip=Envoyer la réponse au mail
faxtomail.reply.attachment.label=%1$s (%2$s ko)
faxtomail.reply.attachments.add.label=Ajouter des pièces jointes
faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés)
Deleted: trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit-attachment.png
===================================================================
(Binary files differ)
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png
===================================================================
(Binary files differ)
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
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-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -60,6 +60,8 @@
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;
@@ -67,11 +69,14 @@
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 static org.nuiton.i18n.I18n.t;
@@ -180,9 +185,9 @@
List<String> modifiedProperties = new ArrayList<>();
- log.debug("Object: " + message.getSubject());
- email.setSubject(message.getSubject());
- modifiedProperties.add(Email.PROPERTY_SUBJECT);
+// log.debug("Object: " + message.getSubject());
+// email.s(message.getSubject());
+// modifiedProperties.add(Email.PROPERTY_OBJECT);
Address[] addresses = message.getFrom();
if (addresses != null && addresses.length > 0) {
@@ -233,14 +238,21 @@
email.setDemandStatus(DemandStatus.UNTREATED);
modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
+ StringBuilder emailSource = new StringBuilder();
+ Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines();
+ while (headerLines.hasMoreElements()) {
+ String headerLine = headerLines.nextElement();
+ emailSource.append(headerLine).append("\n");
+ }
String originalContent = IOUtils.toString(message.getInputStream(), charset);
- email.setOriginalEmail(originalContent);
+ emailSource.append("\n").append(originalContent);
+ email.setOriginalEmail(emailSource.toString());
if (message.isMimeType("multipart/*")) {
decomposeMultipartEmail(message, email);
- } else {
- String content = IOUtils.toString(message.getInputStream(), charset);
- email.setPlainContent(content);
+// } else {
+// String content = IOUtils.toString(message.getInputStream(), charset);
+// email.setPlainContent(content);
}
emailService.saveEmail(email, null, modifiedProperties.toArray(new String[modifiedProperties.size()]));
@@ -275,12 +287,12 @@
// if it is a text part, the,n this is the email content
String disposition = bp.getDisposition();
if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
- String content = IOUtils.toString(bp.getInputStream(), charset);
- if (bp.isMimeType("text/plain")) {
- email.setPlainContent(content);
- } else {
- email.setHtmlContent(content);
- }
+// String content = IOUtils.toString(bp.getInputStream(), charset);
+// if (bp.isMimeType("text/plain")) {
+// email.setPlainContent(content);
+// } else {
+// email.setHtmlContent(content);
+// }
// if it is multipart part, decompose it
} else if (bp.isMimeType("multipart/*")) {
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-04-29 13:24:22 UTC (rev 57)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-05-06 16:55:34 UTC (rev 58)
@@ -169,7 +169,7 @@
result.put(Email.PROPERTY_SENDER, "Adresse email");
result.put(Email.PROPERTY_RECEPTION_DATE, "Date de réception");
result.put(Email.PROPERTY_EDI_CODE_NUMBER, "Code EDI");
- result.put(Email.PROPERTY_SUBJECT, "Objet");
+ result.put(Email.PROPERTY_OBJECT, "Objet");
result.put(Email.PROPERTY_PROJECT_REFERENCE, "Référence travaux");
result.put(Email.PROPERTY_PRIORITY, "Priorité");
result.put(Email.PROPERTY_RANGE_ROW, "Gamme");
1
0