branch develop updated (e8c577d4 -> 5b784e44)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from e8c577d4 Typo new e327555e fixes #10565 : Revert cloneable deletion. It was indeed used new 5b784e44 fixes #10578 : Utilisation du navigateur JavaFX The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 5b784e4419866f2434d1b8e2d5de29053ef54872 Author: jcouteau <couteau@codelutin.com> Date: Tue Nov 12 17:06:30 2019 +0100 fixes #10578 : Utilisation du navigateur JavaFX commit e327555efb721dd6748ee597ba696de183cf9ad1 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 4 16:17:20 2019 +0100 fixes #10565 : Revert cloneable deletion. It was indeed used Summary of changes: .../faxtomail/services/DecoratorServiceImpl.java | 7 ++- .../faxtomail/services/FaxToMailDecorator.java | 16 ++++- faxtomail-ui-swing/pom.xml | 8 +++ .../ui/swing/content/demande/DemandeUIHandler.java | 63 +------------------ .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 73 ++++------------------ .../faxtomail/ui/swing/util/HTMLPane.java | 47 ++++++++++++++ pom.xml | 4 +- 7 files changed, 91 insertions(+), 127 deletions(-) create mode 100644 faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/HTMLPane.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit e327555efb721dd6748ee597ba696de183cf9ad1 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 4 16:17:20 2019 +0100 fixes #10565 : Revert cloneable deletion. It was indeed used --- .../faxtomail/services/DecoratorServiceImpl.java | 7 ++++++- .../faxtomail/services/FaxToMailDecorator.java | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java index f85ae821..0d385584 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java @@ -147,12 +147,17 @@ public class DecoratorServiceImpl extends FaxToMailServiceSupport implements Dec }; } - public static class StringMultiJXPathDecorator extends MultiJXPathDecorator<String> { + public static class StringMultiJXPathDecorator extends MultiJXPathDecorator<String> implements Cloneable { public StringMultiJXPathDecorator() throws IllegalArgumentException, NullPointerException { super(String.class, "", "#", null); } + @Override + public Object clone() { + return new StringMultiJXPathDecorator(); + } + @Override public String toString(Object bean) { return String.valueOf(bean); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java index dff6e107..7f065062 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java @@ -50,7 +50,7 @@ import java.util.concurrent.ExecutionException; * * @author kmorin - morin@codelutin.com */ -public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> { +public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> implements Cloneable { private static final long serialVersionUID = 1L; @@ -231,7 +231,12 @@ public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> { return null; } - public static class FaxToMailDecoratorComparator<O> extends JXPathComparator<O> implements Serializable { + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public static class FaxToMailDecoratorComparator<O> extends JXPathComparator<O> implements Serializable, Cloneable { private static final long serialVersionUID = 1L; @@ -266,6 +271,13 @@ public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> { } } + @Override + public FaxToMailDecoratorComparator<O> clone() { + FaxToMailDecoratorComparator<O> result = + new FaxToMailDecoratorComparator<O>(expression); + return result; + } + public String getExpression() { return expression; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 5b784e4419866f2434d1b8e2d5de29053ef54872 Author: jcouteau <couteau@codelutin.com> Date: Tue Nov 12 17:06:30 2019 +0100 fixes #10578 : Utilisation du navigateur JavaFX --- faxtomail-ui-swing/pom.xml | 8 +++ .../ui/swing/content/demande/DemandeUIHandler.java | 63 +------------------ .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 73 ++++------------------ .../faxtomail/ui/swing/util/HTMLPane.java | 47 ++++++++++++++ pom.xml | 4 +- 5 files changed, 71 insertions(+), 124 deletions(-) diff --git a/faxtomail-ui-swing/pom.xml b/faxtomail-ui-swing/pom.xml index c0f88925..094f7ee2 100644 --- a/faxtomail-ui-swing/pom.xml +++ b/faxtomail-ui-swing/pom.xml @@ -436,6 +436,14 @@ </archive> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>8</source> + <target>8</target> + </configuration> + </plugin> </plugins> </build> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index c371dd90..02a2c695 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -259,63 +259,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, final JPanel mailBodyPanel = ui.getMailBodyPanel(); FaxToMailUIUtil.setEmailContentInTextPane(this, model, mailBodyPanel, getConfig()); - final JScrollPane mailBodyScrollPane = getUI().getMailBodyScrollPane(); - FaxToMailUIUtil.initScrollPaneBars(mailBodyScrollPane); - mailBodyPanel.addComponentListener(new java.awt.event.ComponentAdapter() { - @Override - public void componentResized(ComponentEvent componentEvent) { - super.componentResized(componentEvent); - resize(); - } - - @Override - public void componentMoved(ComponentEvent componentEvent) { - super.componentMoved(componentEvent); - resize(); - } - - @Override - public void componentShown(ComponentEvent componentEvent) { - super.componentShown(componentEvent); - resize(); - } - - @Override - public void componentHidden(ComponentEvent componentEvent) { - super.componentHidden(componentEvent); - //resize(); - } - - public void resize(){ - if (mailBodyPanel.getComponents().length > 0 && mailBodyPanel.getComponent(0) instanceof JScrollPane) { - JScrollPane holder = (JScrollPane) mailBodyPanel.getComponent(0); - JTextPane pane = (JTextPane) ((JViewport) holder.getComponent(0)).getComponent(0); - - //compute box height so that it can be taken into account later on - int boxHeight = 0; - for (Component component : mailBodyPanel.getComponents()) { - if (!(component instanceof JScrollPane)) { - boxHeight += component.getHeight(); - } - } - - holder.setPreferredSize(new Dimension(mailBodyPanel.getWidth(), pane.getHeight())); - holder.setMinimumSize(new Dimension(mailBodyPanel.getWidth(), pane.getHeight())); - - //Resize mailBodyPanel so that it takes pane height + box height - if (boxHeight < 0) { - mailBodyPanel.setPreferredSize(new Dimension(mailBodyScrollPane.getWidth() - 30, pane.getHeight() - boxHeight)); - mailBodyPanel.setMaximumSize(new Dimension(mailBodyScrollPane.getWidth() - 30, Integer.MAX_VALUE)); - } else { - mailBodyPanel.setPreferredSize(new Dimension(mailBodyScrollPane.getWidth() - 30, pane.getHeight() + boxHeight)); - mailBodyPanel.setMaximumSize(new Dimension(mailBodyScrollPane.getWidth() - 30, Integer.MAX_VALUE)); - } - - mailBodyPanel.repaint(); - } - } - }); // init table final JXTable table = ui.getRangeTable(); @@ -328,12 +272,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, } else { ranges.addAll(folderRanges); } - Collections.sort(ranges, new Comparator<Range>() { - @Override - public int compare(Range o1, Range o2) { - return ObjectUtils.compare(o1.getLabel(), o2.getLabel()); - } - }); + ranges.sort((o1, o2) -> ObjectUtils.compare(o1.getLabel(), o2.getLabel())); TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); addComboDataColumnToModel(columnModel, diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java index 5031e78a..0cbde7ab 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java @@ -54,6 +54,10 @@ 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 javafx.application.Platform; +import javafx.scene.Scene; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXUtil; import org.apache.commons.collections4.CollectionUtils; @@ -71,6 +75,7 @@ import org.nuiton.jaxx.application.ApplicationTechnicalException; import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil; import org.nuiton.util.FileUtil; import org.nuiton.util.StringUtil; +import javafx.embed.swing.JFXPanel; import javax.imageio.ImageIO; import javax.media.jai.PlanarImage; @@ -347,11 +352,8 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { List<String> contents = demandeUIModel.getHtmlContent(); if (CollectionUtils.isNotEmpty(contents)) { - for (String content : contents) { - if (content != null) { - addHtmlTextPane(handler, demandeUIModel, textPanePanel, content); - } - } + String result = String.join("<br>", contents); + addHtmlTextPane(handler, demandeUIModel, textPanePanel, result); } // if there is no html content or if no html content can be correctly displayed (ie throws an exception) @@ -411,6 +413,8 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { } } } + + //si un seul fils -> resize et jscrollpane never } /** @@ -944,12 +948,7 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null); Desktop desktop = getDesktopForMail(); desktop.mail(mailtoURI); - - // version for xfce - // DesktopUtil.mail(mailtoURI); - } catch (Exception e) { - throw new ApplicationTechnicalException( t("jaxx.application.error.cannot.mail"), e); } @@ -966,8 +965,6 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { Preconditions.checkNotNull(content); - JTextPane textPane = createHtmlTextPane(); - // the meta tag makes the content is not displayed content = content.replaceAll("<meta (.*?)>(</meta>)?", ""); @@ -998,16 +995,6 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { } } - StringBuilder builder = new StringBuilder(content); - replaceAll(builder, "(.+) width=([\"])(.+)([\"])", "$1"); - replaceAll(builder, "(.+) width=(['])(.+)(['])", "$1"); - replaceAll(builder, "(.+) height=([\"])(.+)([\"])", "$1"); - replaceAll(builder, "(.+) height=(['])(.+)(['])", "$1"); - replaceAll(builder, "(.+) style=([\"])(.+)([\"])", "$1"); - replaceAll(builder, "(.+) style=(['])(.+)(['])", "$1"); - replaceAll(builder, " ",""); - content = builder.toString(); - if (log.isTraceEnabled()) { log.trace("Content after mail = " + content); } @@ -1017,15 +1004,12 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { // cf #7741 content = FaxToMailServiceUtils.encodeImageSourcesInEmail(content, handler.getConfig().getDefaultImageIfMalformedUrl()); - textPane.setText(content); - textPane.setAlignmentX(Component.LEFT_ALIGNMENT); + HTMLPane panel= new HTMLPane(); - JScrollPane holder = new JScrollPane(textPane); - holder.setAlignmentX(Component.LEFT_ALIGNMENT); - holder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - holder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + panel.init(textPanePanel.getParent().getHeight()); + panel.loadContent(content); - textPanePanel.add(holder); + textPanePanel.add(panel); textPanePanel.add(Box.createVerticalStrut(3)); @@ -1036,37 +1020,6 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { } } - /* Faster method to replace String.replaceAll (More thant 30 time faster on some emails)*/ - public static void replaceAll(StringBuilder builder, String from, String to) { - int index = builder.indexOf(from); - while (index != -1) { - builder.replace(index, index + from.length(), to); - index += to.length(); // Move to the end of the replacement - index = builder.indexOf(from, index); - } - } - - protected static JTextPane createHtmlTextPane() { - JTextPane textPane = new JTextPane(); - textPane.setEditable(false); - - textPane.setContentType("text/html"); - - textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); - Font font = new Font(Font.MONOSPACED, Font.PLAIN, 16); - textPane.setFont(font); - - textPane.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - ApplicationUIUtil.openLink(e.getURL()); - } - } - }); - return textPane; - } - protected static void addAttachmentPane(final DemandeUIHandler handler, JPanel textPanePanel, final Attachment attachment, diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/HTMLPane.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/HTMLPane.java new file mode 100644 index 00000000..284d6166 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/HTMLPane.java @@ -0,0 +1,47 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import javafx.application.Platform; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.concurrent.Worker; +import javafx.embed.swing.JFXPanel; +import javafx.scene.Scene; +import javafx.scene.input.TouchPoint; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; + +public class HTMLPane extends JFXPanel { + + private static WebEngine engine; + + public void init(int height) { + //This is needed for refreshes (if not present, JavaFX closes itself and nothing is displayed anymore) + Platform.setImplicitExit(false); + + Platform.runLater(() -> { + WebView browser = new WebView(); + browser.setMinHeight(200); + browser.setPrefHeight(height); + engine = browser.getEngine(); + /*engine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() + { + + public void changed(ObservableValue<? extends Worker.State> o, Worker.State old, final Worker.State state) + { + if (state == Worker.State.RUNNING || state == Worker.State.SUCCEEDED) + { + engine.executeScript("document.body.style.overflow = 'hidden';"); + } + } + + });*/ + Scene scene = new Scene(browser); + this.setScene(scene); + }); + } + + public void loadContent(final String content) { + Platform.runLater(() -> engine.loadContent(content)); + } + +} diff --git a/pom.xml b/pom.xml index afb5778e..6edf5c59 100644 --- a/pom.xml +++ b/pom.xml @@ -139,8 +139,8 @@ <license.licenseName>gpl_v3</license.licenseName> <!-- Java version --> - <javaVersion>1.7</javaVersion> - <signatureArtifactId>java17</signatureArtifactId> + <javaVersion>1.8</javaVersion> + <signatureArtifactId>java18</signatureArtifactId> <signatureVersion>1.0</signatureVersion> <!-- issues status to include in changelog --> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm