This is an automated email from the git hooks/post-receive script. New change to branch feature/9933_barre_progression_edition_PDF in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git at 8eeb0066 refs #9933 : déplacement de la génération des pages des PDF dans une action JAXX pour avoir la barre de progression si la génération est longue. This branch includes the following new commits: new 8eeb0066 refs #9933 : déplacement de la génération des pages des PDF dans une action JAXX pour avoir la barre de progression si la génération est longue. The 1 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 8eeb0066a9632ce95f878bbeaedd1b49ccde9696 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Jun 8 11:45:02 2018 +0200 refs #9933 : déplacement de la génération des pages des PDF dans une action JAXX pour avoir la barre de progression si la génération est longue. -- 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 feature/9933_barre_progression_edition_PDF in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 8eeb0066a9632ce95f878bbeaedd1b49ccde9696 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Jun 8 11:45:02 2018 +0200 refs #9933 : déplacement de la génération des pages des PDF dans une action JAXX pour avoir la barre de progression si la génération est longue. --- .../content/pdfeditor/PDFEditorUIHandler.java | 291 ++++----------------- .../pdfeditor/actions/DisplayPageAction.java | 271 +++++++++++++++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 1 + 3 files changed, 326 insertions(+), 237 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java index b2ced43a..093da452 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java @@ -30,13 +30,14 @@ import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.HistoryType; import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.actions.GenerateAnnotatedAttachmentAction; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel.EditionComponent; import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel.Page; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.actions.DisplayPageAction; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.actions.GenerateAnnotatedAttachmentAction; 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.DocumentException; import jaxx.runtime.swing.ComponentMover; import jaxx.runtime.swing.ComponentResizer; @@ -47,17 +48,24 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.xerces.impl.dv.util.Base64; import org.nuiton.jaxx.application.swing.util.Cancelable; import org.nuiton.jaxx.application.swing.util.CloseableUI; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.JToolBar; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Insets; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -65,7 +73,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.Collection; import java.util.Date; -import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -82,12 +89,25 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo protected PDDocument pdDocument; + protected PropertyChangeListener busyListener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + Boolean newvalue = (Boolean) evt.getNewValue(); + updateBusyState(newvalue != null && newvalue); + } + }; + @Override public void beforeInit(PDFEditorUI ui) { super.beforeInit(ui); final PDFEditorUIModel model = new PDFEditorUIModel(); model.setZoom(getConfig().getDefaultZoomValue()); ui.setContextValue(model); + + // ecoute des changements de l'état busy + getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_BUSY, busyListener); + } @Override @@ -296,6 +316,7 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo @Override public void onCloseUI() { IOUtils.closeQuietly(pdDocument); + getContext().removePropertyChangeListener(FaxToMailUIContext.PROPERTY_BUSY, busyListener); } public void addEditionComponent(MouseEvent event) { @@ -432,239 +453,11 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo if (pageNb < 1 || pageNb > pdDocument.getNumberOfPages()) { return; } - PDFRenderer renderer = new PDFRenderer(pdDocument); - - float zoom = getModel().getZoom(); - int rotation = getModel().getRotation(); - - try { - - BufferedImage image = renderer.renderImage(pageNb - 1, zoom); - - int width = image.getWidth(); - int height = image.getHeight(); - - JPanel container = getUI().getContainer(); - Dimension containerSize = new Dimension(rotation % 180 == 0 ? width : height, - rotation % 180 == 0 ? height : width); - container.setPreferredSize(containerSize); - container.setMinimumSize(containerSize); - container.setMaximumSize(containerSize); - container.setSize(containerSize); - JImagePanel documentPanel = ui.getDocumentPanel(); - documentPanel.setRotation(rotation); - documentPanel.setImage(image); - - Insets insets = container.getInsets(); - Rectangle rect = container.getBounds(); - - float zoomRatio = zoom / previousZoom; - int rotationDiff = rotation - previousRotation; - - Page p = getModel().getPage(pageNb); - - for (PDFEditorNoteUI panel : p.getNotes()) { - displayPageNote(zoom, insets, rect, zoomRatio, rotationDiff, panel); - } - - boolean orientation180 = Math.abs(rotationDiff) % 180 == 0; - - for (PDFEditorCrossUI panel : p.getCrosses()) { - displayPageCross(insets, rect, zoomRatio, rotationDiff, orientation180, panel); - } - - List<PDFEditorLineUI> lines = p.getLines(); - cr.deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()])); - - for (PDFEditorLineUI panel : lines) { - displayPageLine(insets, rect, zoomRatio, rotationDiff, orientation180, panel); - } - - for (PDFEditorHighlighterUI panel : p.getHighlighters()) { - displayPageHighlighter(insets, rect, zoomRatio, rotationDiff, orientation180, panel); - } + DisplayPageAction displayPageAction = new DisplayPageAction(this, pageNb, previousZoom, previousRotation); - for (PDFEditorStampTextUI panel : p.getTextStamps()) { - displayPageTextStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); - } - - for (PDFEditorStampImageUI panel : p.getImageStamps()) { - displayPageImageStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); - } - - container.updateUI(); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("error while displaying pdf", e); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.readPdf.error")); - } - } - - protected void displayPageNote(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorNoteUI panel) { - panel.setVisible(true); - - panel.setZoom(zoom); - Rectangle bounds = panel.getBounds(); - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; - y = bounds.x + bounds.width / 2 - bounds.height / 2; - - } else { - x = bounds.y + bounds.height / 2 - bounds.width / 2; - y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); - } - - protected void displayPageHighlighter(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorHighlighterUI panel) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } + getContext().getActionEngine().runAction(displayPageAction); - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - } - - protected void displayPageLine(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorLineUI panel) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - boolean horizontal = panel.isHorizontal(); - panel.setHorizontal(orientation180 ? horizontal : !horizontal); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - - cr.registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL, - panel); - } - - protected void displayPageCross(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorCrossUI panel) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - } - - protected void displayPageTextStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampTextUI panel) { - panel.setVisible(true); - - panel.setZoom(zoom); - Rectangle bounds = panel.getBounds(); - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; - y = bounds.x + bounds.width / 2 - bounds.height / 2; - - } else { - x = bounds.y + bounds.height / 2 - bounds.width / 2; - y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); - } - - protected void displayPageImageStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampImageUI panel) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; - y = bounds.x + bounds.width / 2 - bounds.height / 2; - - } else { - x = bounds.y + bounds.height / 2 - bounds.width / 2; - y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); } protected void updateStamps(Collection<Stamp> stamps) { @@ -743,4 +536,28 @@ public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIMo public void cancel() { closeFrame(); } + + public PDDocument getPdDocument() { + return pdDocument; + } + + public ComponentResizer getCr() { + return cr; + } + + protected void updateBusyState(boolean busy) { + if (busy) { + // ui bloquee + if (log.isDebugEnabled()) { + log.debug("block ui in busy mode"); + } + ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } else { + // ui debloquee + if (log.isDebugEnabled()) { + log.debug("unblock ui in none busy mode"); + } + ui.setCursor(Cursor.getDefaultCursor()); + } + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/actions/DisplayPageAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/actions/DisplayPageAction.java new file mode 100644 index 00000000..5a106ae3 --- /dev/null +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/actions/DisplayPageAction.java @@ -0,0 +1,271 @@ +package com.franciaflex.faxtomail.ui.swing.content.pdfeditor.actions; + +import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorHighlighterUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorStampImageUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorStampTextUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel; +import com.franciaflex.faxtomail.ui.swing.util.JImagePanel; +import jaxx.runtime.swing.ComponentResizer; +import org.apache.pdfbox.rendering.PDFRenderer; + +import javax.swing.JPanel; +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +public class DisplayPageAction extends AbstractFaxToMailAction<PDFEditorUIModel, PDFEditorUI, PDFEditorUIHandler> { + + protected final int pageNb; + protected final float previousZoom; + protected final int previousRotation; + + + public DisplayPageAction(PDFEditorUIHandler handler, int pageNb, float previousZoom, int previousRotation) { + super(handler, false); + setActionDescription(t("faxtomail.action.displayPage.tip", pageNb)); + this.pageNb = pageNb; + this.previousZoom = previousZoom; + this.previousRotation = previousRotation; + } + + @Override + public void doAction() throws Exception { + + int rotation = getModel().getRotation(); + float zoom = getModel().getZoom(); + + PDFRenderer renderer = new PDFRenderer(handler.getPdDocument()); + + BufferedImage image = renderer.renderImage(pageNb - 1, zoom); + + int width = image.getWidth(); + int height = image.getHeight(); + + JPanel container = getUI().getContainer(); + Dimension containerSize = new Dimension(rotation % 180 == 0 ? width : height, + rotation % 180 == 0 ? height : width); + container.setPreferredSize(containerSize); + container.setMinimumSize(containerSize); + container.setMaximumSize(containerSize); + container.setSize(containerSize); + + JImagePanel documentPanel = getUI().getDocumentPanel(); + documentPanel.setRotation(rotation); + documentPanel.setImage(image); + + Insets insets = container.getInsets(); + Rectangle rect = container.getBounds(); + + float zoomRatio = zoom / previousZoom; + int rotationDiff = rotation - previousRotation; + + PDFEditorUIModel.Page p = getModel().getPage(pageNb); + + for (PDFEditorNoteUI panel : p.getNotes()) { + displayPageNote(zoom, insets, rect, zoomRatio, rotationDiff, panel); + } + + boolean orientation180 = Math.abs(rotationDiff) % 180 == 0; + + for (PDFEditorCrossUI panel : p.getCrosses()) { + displayPageCross(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } + + List<PDFEditorLineUI> lines = p.getLines(); + getHandler().getCr().deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()])); + + for (PDFEditorLineUI panel : lines) { + displayPageLine(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } + + for (PDFEditorHighlighterUI panel : p.getHighlighters()) { + displayPageHighlighter(insets, rect, zoomRatio, rotationDiff, orientation180, panel); + } + + for (PDFEditorStampTextUI panel : p.getTextStamps()) { + displayPageTextStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); + } + + for (PDFEditorStampImageUI panel : p.getImageStamps()) { + displayPageImageStamp(zoom, insets, rect, zoomRatio, rotationDiff, panel); + } + + container.updateUI(); + + } + + protected void displayPageNote(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorNoteUI panel) { + panel.setVisible(true); + + panel.setZoom(zoom); + Rectangle bounds = panel.getBounds(); + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; + + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + } + + protected void displayPageCross(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorCrossUI panel) { + panel.setVisible(true); + + Rectangle bounds = panel.getBounds(); + + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; + + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; + + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + } + + protected void displayPageLine(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorLineUI panel) { + panel.setVisible(true); + + Rectangle bounds = panel.getBounds(); + + boolean horizontal = panel.isHorizontal(); + panel.setHorizontal(orientation180 ? horizontal : !horizontal); + + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; + + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; + + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + + getHandler().getCr().registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL, + panel); + } + + protected void displayPageHighlighter(Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, boolean orientation180, PDFEditorHighlighterUI panel) { + panel.setVisible(true); + + Rectangle bounds = panel.getBounds(); + + int newWidth = orientation180 ? bounds.width : bounds.height; + int newHeight = orientation180 ? bounds.height : bounds.width; + + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - newWidth - bounds.y; + y = bounds.x; + + } else { + x = bounds.y; + y = rect.height - newHeight - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); + } + + protected void displayPageTextStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampTextUI panel) { + panel.setVisible(true); + + panel.setZoom(zoom); + Rectangle bounds = panel.getBounds(); + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; + + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + } + + protected void displayPageImageStamp(float zoom, Insets insets, Rectangle rect, float zoomRatio, int rotationDiff, PDFEditorStampImageUI panel) { + panel.setVisible(true); + + Rectangle bounds = panel.getBounds(); + int x, y; + + if (rotationDiff == 0) { + x = bounds.x; + y = bounds.y; + + } else if (rotationDiff == 90 || rotationDiff == -270) { + x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; + y = bounds.x + bounds.width / 2 - bounds.height / 2; + + } else { + x = bounds.y + bounds.height / 2 - bounds.width / 2; + y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; + } + + panel.setBounds((int) (zoomRatio * x) + insets.left, + (int) (zoomRatio * y) + insets.top, + (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); + } + +} diff --git a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties index 138bfb71..178fff6b 100644 --- a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties +++ b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties @@ -12,6 +12,7 @@ faxtomail.action.attachment.add.fileDoesNotExist=Le fichier %s n'existe pas. Mer faxtomail.action.attachment.edit.tip=Edition du fichier %s faxtomail.action.attachment.open.tip=Ouverture du fichier %s faxtomail.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme +faxtomail.action.displayPage.tip=Affichage de la page %1$d faxtomail.action.exit.tip=Quitter l'application faxtomail.action.generateAnnotatedAttachment.tip=Générer le pdf annoté faxtomail.action.goto.demand.tip=Aller au détail de l'élément -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm