From e6dc027a394409953a4f154cc44263cbfadba8d4 Mon Sep 17 00:00:00 2001 From: Maximilian Steinert <71747937+iradraconis@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:16:20 +0100 Subject: [PATCH 1/3] added keys for ExportPdfConversion -> Toc and pagenbrs --- .../jlawyer/server/services/settings/UserSettingsKeys.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java b/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java index 05b650ed1..9a6fa6db2 100644 --- a/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java +++ b/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java @@ -726,6 +726,8 @@ public class UserSettingsKeys { public static final String CONF_CASES_EXPORT_TOLOCAL="user.case.pdfexport.tolocal"; public static final String CONF_CASES_EXPORT_TOCASE="user.case.pdfexport.tocase"; + public static final String CONF_CASES_EXPORT_TOC="user.case.pdfexport.toc"; + public static final String CONF_CASES_EXPORT_PAGENUMBERS="user.case.pdfexport.pagenumbers"; // will be used with a suffix indicating the event type (see CalendarSetup class) public static final String CONF_CALENDAR_LASTSELECTED = "user.calendar.lastcalsetup."; From 8150146bb3964a55e41e2bcde2f7495bbfa7120d Mon Sep 17 00:00:00 2001 From: Maximilian Steinert <71747937+iradraconis@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:17:05 +0100 Subject: [PATCH 2/3] added options for adding Toc and Pagenumbers --- .../editors/files/ExportAsPdfMergeStep.java | 215 +++++++++++------- .../files/ExportAsPdfOrderingStep.form | 31 ++- .../files/ExportAsPdfOrderingStep.java | 53 ++++- 3 files changed, 203 insertions(+), 96 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfMergeStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfMergeStep.java index fa83a1fb7..159d11e73 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfMergeStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfMergeStep.java @@ -908,13 +908,12 @@ public String getStepName() { @Override public void display() { - List pdfFiles = (List) data.get("export.sortedpdffiles"); - ArchiveFileBean caseDto = (ArchiveFileBean) data.get("export.case"); this.lblProgress.setText("Dokumente werden zusammengeführt..."); this.pnlPreview.removeAll(); + this.pnlPreview.revalidate(); // Stellen sicher, dass das Panel wirklich leer ist if (this.wizard != null) { this.wizard.enableButtons(false, false, true, true); @@ -930,26 +929,33 @@ public void display() { File tf = new File(tempFile); byte[] tfBytes = FileUtils.readFile(tf); + // Aktualisiere die Bytes im data Container this.data.put("pdf.bytes", tfBytes); SwingUtilities.invokeLater(() -> { - PdfImagePanel pdfP = new PdfImagePanel(tf.getName(), tfBytes); + // Altes Panel entfernen this.pnlPreview.removeAll(); + + // Neues Panel erstellen und hinzufügen + PdfImagePanel pdfP = new PdfImagePanel(tf.getName(), tfBytes); this.pnlPreview.add(pdfP, BorderLayout.CENTER); - this.pnlPreview.revalidate(); - this.pnlPreview.doLayout(); - this.pnlPreview.updateUI(); + // Panel-Größe setzen int width = Math.max(290, this.pnlPreview.getWidth()); int height = Math.max(400, this.pnlPreview.getHeight()); - pdfP.setSize(new Dimension(width, height)); pdfP.setMaximumSize(new Dimension(width, height)); pdfP.setPreferredSize(new Dimension(width, height)); + + // Layout aktualisieren + this.pnlPreview.revalidate(); + this.pnlPreview.doLayout(); + this.pnlPreview.updateUI(); + + // PDF-Inhalt anzeigen pdfP.showContent(tfBytes); this.lblProgress.setText("Datei: " + tempFile); - }); } catch (Exception e) { @@ -969,7 +975,6 @@ public void display() { log.error(t); } }).start(); - } @Override @@ -978,108 +983,142 @@ public void setData(WizardDataContainer data) { } private void mergePDFsWithTOC(List pdfFiles, String outputFile, ArchiveFileBean caseDto) throws Exception { + // Status der Checkboxen aus data container lesen + Boolean createToc = (Boolean)data.get("export.createToc"); + Boolean createPageNumbers = (Boolean)data.get("export.createPageNumbers"); + + if(createToc == null) createToc = true; // Fallback wenn nicht gesetzt + if(createPageNumbers == null) createPageNumbers = true; // Fallback wenn nicht gesetzt + HashMap startPages = new HashMap<>(); PDFMergerUtility merger = new PDFMergerUtility(); PDDocument mergedDoc = new PDDocument(); - // Create TOC - PDDocument tocDoc = new PDDocument(); - - // first page with metadata - PDPage metaPage = new PDPage(PDRectangle.A4); - tocDoc.addPage(metaPage); - PDPageContentStream metaStream = new PDPageContentStream(tocDoc, metaPage); - metaStream.setFont(PDType1Font.HELVETICA_BOLD, 16); - metaStream.beginText(); - metaStream.setLeading(14.5f); - metaStream.newLineAtOffset(50, 750); - metaStream.showText(caseDto.getFileNumber() + " " + caseDto.getName() + " (" + new SimpleDateFormat("dd.MM.yyyy").format(new Date()) + ")"); - metaStream.newLine(); - metaStream.newLine(); - metaStream.endText(); - - // Set font for additional information - metaStream.setFont(PDType1Font.HELVETICA, 12); - metaStream.beginText(); - metaStream.setLeading(14.5f); - metaStream.newLineAtOffset(50, 710); - - // Add additional lines of text - metaStream.showText("wegen: " + caseDto.getReason()); - metaStream.newLine(); - metaStream.showText("Sachgebiet: " + caseDto.getSubjectField()); - metaStream.newLine(); - metaStream.showText("Anwalt / Anwältin: " + caseDto.getLawyer()); - metaStream.newLine(); - metaStream.showText("Sachbearbeiter(-in): " + caseDto.getAssistant()); - metaStream.newLine(); - metaStream.showText("erstellt: " + new SimpleDateFormat("dd.MM.yyyy").format(caseDto.getDateCreated())); - metaStream.newLine(); - metaStream.showText("geändert: " + new SimpleDateFormat("dd.MM.yyyy").format(caseDto.getDateChanged())); - metaStream.endText(); - - metaStream.close(); - - // add empty placeholder pages for the TOC - for (int i = 0; i < pdfFiles.size(); i += 45) { - PDPage tocPage = new PDPage(PDRectangle.A4); - tocDoc.addPage(tocPage); + PDDocument tocDoc = null; + File tocTempFile = null; + + // Nur TOC erstellen wenn Option gewählt + if (createToc) { + tocDoc = new PDDocument(); + // first page with metadata + PDPage metaPage = new PDPage(PDRectangle.A4); + tocDoc.addPage(metaPage); + + try (PDPageContentStream metaStream = new PDPageContentStream(tocDoc, metaPage)) { + metaStream.setFont(PDType1Font.HELVETICA_BOLD, 16); + metaStream.beginText(); + metaStream.setLeading(14.5f); + metaStream.newLineAtOffset(50, 750); + metaStream.showText(caseDto.getFileNumber() + " " + caseDto.getName() + " (" + new SimpleDateFormat("dd.MM.yyyy").format(new Date()) + ")"); + metaStream.newLine(); + metaStream.newLine(); + metaStream.endText(); + + // Set font for additional information + metaStream.setFont(PDType1Font.HELVETICA, 12); + metaStream.beginText(); + metaStream.setLeading(14.5f); + metaStream.newLineAtOffset(50, 710); + + // Add additional lines of text + metaStream.showText("wegen: " + caseDto.getReason()); + metaStream.newLine(); + metaStream.showText("Sachgebiet: " + caseDto.getSubjectField()); + metaStream.newLine(); + metaStream.showText("Anwalt / Anwältin: " + caseDto.getLawyer()); + metaStream.newLine(); + metaStream.showText("Sachbearbeiter(-in): " + caseDto.getAssistant()); + metaStream.newLine(); + metaStream.showText("erstellt: " + new SimpleDateFormat("dd.MM.yyyy").format(caseDto.getDateCreated())); + metaStream.newLine(); + metaStream.showText("geändert: " + new SimpleDateFormat("dd.MM.yyyy").format(caseDto.getDateChanged())); + metaStream.endText(); + } - } + // add empty placeholder pages for the TOC + for (int i = 0; i < pdfFiles.size(); i += 45) { + PDPage tocPage = new PDPage(PDRectangle.A4); + tocDoc.addPage(tocPage); + } - // Save TOC to temp file - File tocTempFile = createTempFileFromPDDocument(tocDoc); - tocDoc.close(); + // Save TOC to temp file and close + try { + tocTempFile = createTempFileFromPDDocument(tocDoc); + } finally { + if (tocDoc != null) { + tocDoc.close(); + } + } + + // TOC als erste Datei hinzufügen + pdfFiles.add(0, tocTempFile); + } int currentPageCount = 0; - pdfFiles.add(0, tocTempFile); for (File file : pdfFiles) { - PDDocument doc = PDDocument.load(file); - startPages.put(file.getName(), currentPageCount); - merger.appendDocument(mergedDoc, doc); - currentPageCount += doc.getNumberOfPages(); - doc.close(); + PDDocument doc = null; + try { + doc = PDDocument.load(file); + startPages.put(file.getName(), currentPageCount); + merger.appendDocument(mergedDoc, doc); + currentPageCount += doc.getNumberOfPages(); + } finally { + if (doc != null) { + doc.close(); + } + } } + + // Dokumentinformationen setzen PDDocumentInformation info = new PDDocumentInformation(); info.setTitle(caseDto.getFileNumber() + " " + caseDto.getName() + " (" + new SimpleDateFormat("dd.MM.yyyy").format(new Date()) + ")"); info.setAuthor(UserSettings.getInstance().getCurrentUser().getPrincipalId()); info.setCreationDate(GregorianCalendar.getInstance()); mergedDoc.setDocumentInformation(info); - PDDocumentOutline outline = new PDDocumentOutline(); - mergedDoc.getDocumentCatalog().setDocumentOutline(outline); - - int currentTocPage = 1; - // remove TOC document to avoid it from being added to the TOC itself - pdfFiles.remove(0); - for (int i = 0; i < pdfFiles.size(); i += 45) { - int end = Math.min(pdfFiles.size(), i + 45); - List batch = pdfFiles.subList(i, end); - processTocPage(currentTocPage, mergedDoc, batch, startPages, caseDto, outline); - currentTocPage = currentTocPage + 1; + // Nur TOC-Einträge erstellen wenn Option gewählt + if (createToc) { + PDDocumentOutline outline = new PDDocumentOutline(); + mergedDoc.getDocumentCatalog().setDocumentOutline(outline); + + int currentTocPage = 1; + // remove TOC document to avoid it from being added to the TOC itself + pdfFiles.remove(0); + for (int i = 0; i < pdfFiles.size(); i += 45) { + int end = Math.min(pdfFiles.size(), i + 45); + List batch = pdfFiles.subList(i, end); + processTocPage(currentTocPage, mergedDoc, batch, startPages, caseDto, outline); + currentTocPage = currentTocPage + 1; + } } - int pageCount = mergedDoc.getNumberOfPages(); - for (int i = 0; i < pageCount; i++) { - PDPage page = mergedDoc.getPage(i); - try (PDPageContentStream contentStream = new PDPageContentStream(mergedDoc, page, PDPageContentStream.AppendMode.APPEND, true, true)) { - contentStream.beginText(); - contentStream.setFont(PDType1Font.HELVETICA, 10); - - // Position the text at the bottom center of the page - float margin = 20; - float x = (page.getMediaBox().getWidth() - margin) / 2; - float y = margin; - - contentStream.newLineAtOffset(x, y); - contentStream.showText("" + (i + 1) + " / " + pageCount); - contentStream.endText(); + // Nur Seitenzahlen hinzufügen wenn Option gewählt + if (createPageNumbers) { + int pageCount = mergedDoc.getNumberOfPages(); + for (int i = 0; i < pageCount; i++) { + PDPage page = mergedDoc.getPage(i); + try (PDPageContentStream contentStream = new PDPageContentStream(mergedDoc, page, PDPageContentStream.AppendMode.APPEND, true, true)) { + contentStream.beginText(); + contentStream.setFont(PDType1Font.HELVETICA, 10); + + float margin = 20; + float x = (page.getMediaBox().getWidth() - margin) / 2; + float y = margin; + + contentStream.newLineAtOffset(x, y); + contentStream.showText("" + (i + 1) + " / " + pageCount); + contentStream.endText(); + } } } FileUtils.copyFile(createTempFileFromPDDocument(mergedDoc).getAbsolutePath(), outputFile, true); - mergedDoc.close(); + + // Cleanup + if (tocTempFile != null && tocTempFile.exists()) { + tocTempFile.delete(); + } } private void processTocPage(int currentTocPage, PDDocument mergedDoc, List pdfFiles, HashMap startPages, ArchiveFileBean caseDto, PDDocumentOutline outline) throws IOException { diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form index 898771062..2da6360e5 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form @@ -22,10 +22,14 @@ - + + + + + @@ -50,9 +54,11 @@ + + - - + + @@ -133,5 +139,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java index acdd6cc92..559b87563 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java @@ -663,6 +663,7 @@ */ package com.jdimension.jlawyer.client.editors.files; +import com.jdimension.jlawyer.client.settings.UserSettings; import com.jdimension.jlawyer.client.voip.*; import com.jdimension.jlawyer.client.utils.FileUtils; import com.jdimension.jlawyer.client.wizard.*; @@ -687,6 +688,11 @@ public class ExportAsPdfOrderingStep extends javax.swing.JPanel implements Wizar public ExportAsPdfOrderingStep() { initComponents(); this.jScrollPane1.getVerticalScrollBar().setUnitIncrement(16); + + // UserSettings laden + UserSettings uset = UserSettings.getInstance(); + this.addTocCb.setSelected(uset.getSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_TOC, true)); + this.addPageNbrsCb.setSelected(uset.getSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_PAGENUMBERS, true)); } @Override @@ -695,8 +701,16 @@ public void nextEvent() { for(Component c: this.pnlConversionList.getComponents()) { sortedPdfs.add(((EpostPdfPanel)c).getFile()); } - + this.data.put("export.sortedpdffiles", sortedPdfs); + this.data.put("export.createToc", this.addTocCb.isSelected()); + this.data.put("export.createPageNumbers", this.addPageNbrsCb.isSelected()); + + // UserSettings speichern + UserSettings uset = UserSettings.getInstance(); + uset.setSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_TOC, this.addTocCb.isSelected()); + uset.setSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_PAGENUMBERS, this.addPageNbrsCb.isSelected()); + } @Override @@ -731,6 +745,8 @@ private void initComponents() { lblFileSizeMax = new javax.swing.JLabel(); lblPages = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); + addTocCb = new javax.swing.JCheckBox(); + addPageNbrsCb = new javax.swing.JCheckBox(); setName("Dokumente sortieren"); // NOI18N @@ -757,6 +773,21 @@ private void initComponents() { jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | java.awt.Font.BOLD)); jLabel2.setText("Seiten:"); + addTocCb.setSelected(true); + addTocCb.setText("Inhaltsverzeichnis"); + addTocCb.setToolTipText("Inhaltsverzeichnis wird hinzugefügt"); + addTocCb.setActionCommand("addToc"); + + addPageNbrsCb.setSelected(true); + addPageNbrsCb.setText("Seitenzahlen"); + addPageNbrsCb.setToolTipText("Seitenzahlen werden hinzugefügt"); + addPageNbrsCb.setActionCommand("addPageNbrs"); + addPageNbrsCb.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addPageNbrsCbActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -764,10 +795,14 @@ private void initComponents() { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 876, Short.MAX_VALUE) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 863, Short.MAX_VALUE) .addComponent(jScrollPane1) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) + .addComponent(addPageNbrsCb) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(addTocCb) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblPages) @@ -787,14 +822,22 @@ private void initComponents() { .addComponent(lblFileSize) .addComponent(lblFileSizeMax) .addComponent(lblPages) - .addComponent(jLabel2)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE) + .addComponent(jLabel2) + .addComponent(addTocCb) + .addComponent(addPageNbrsCb)) + .addGap(47, 47, 47) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE) .addContainerGap()) ); }// //GEN-END:initComponents + private void addPageNbrsCbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPageNbrsCbActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_addPageNbrsCbActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox addPageNbrsCb; + private javax.swing.JCheckBox addTocCb; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane1; From 0599306d9fd171e900a6cacfaf769638ec848818 Mon Sep 17 00:00:00 2001 From: Maximilian Steinert <71747937+iradraconis@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:04:15 +0100 Subject: [PATCH 3/3] added remove single pdf from order before sending ePost or export pdfs --- .../files/ExportAsPdfOrderingStep.form | 4 +-- .../files/ExportAsPdfOrderingStep.java | 34 +++++++++++++++++-- .../jlawyer/client/voip/EpostPdfPanel.form | 14 ++++++++ .../jlawyer/client/voip/EpostPdfPanel.java | 33 ++++++++++++++++-- 4 files changed, 79 insertions(+), 6 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form index 2da6360e5..08040d74a 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.form @@ -144,7 +144,7 @@ - + @@ -152,7 +152,7 @@ - + diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java index 559b87563..363181c19 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ExportAsPdfOrderingStep.java @@ -693,6 +693,19 @@ public ExportAsPdfOrderingStep() { UserSettings uset = UserSettings.getInstance(); this.addTocCb.setSelected(uset.getSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_TOC, true)); this.addPageNbrsCb.setSelected(uset.getSettingAsBoolean(UserSettings.CONF_CASES_EXPORT_PAGENUMBERS, true)); + + // ComponentListener für pnlConversionList + this.pnlConversionList.addContainerListener(new java.awt.event.ContainerListener() { + @Override + public void componentRemoved(java.awt.event.ContainerEvent e) { + refreshDisplay(); + } + + @Override + public void componentAdded(java.awt.event.ContainerEvent e) { + refreshDisplay(); + } + }); } @Override @@ -776,12 +789,12 @@ private void initComponents() { addTocCb.setSelected(true); addTocCb.setText("Inhaltsverzeichnis"); addTocCb.setToolTipText("Inhaltsverzeichnis wird hinzugefügt"); - addTocCb.setActionCommand("addToc"); + addTocCb.setActionCommand(""); addPageNbrsCb.setSelected(true); addPageNbrsCb.setText("Seitenzahlen"); addPageNbrsCb.setToolTipText("Seitenzahlen werden hinzugefügt"); - addPageNbrsCb.setActionCommand("addPageNbrs"); + addPageNbrsCb.setActionCommand(""); addPageNbrsCb.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addPageNbrsCbActionPerformed(evt); @@ -887,4 +900,21 @@ public void setData(WizardDataContainer data) { public void setWizardPanel(WizardMainPanel wizard) { } + + private void refreshDisplay() { + long totalSize=0; + long totalPages=0; + + for (Component c: this.pnlConversionList.getComponents()) { + if(c instanceof EpostPdfPanel) { + EpostPdfPanel pdfPanel=(EpostPdfPanel)c; + totalSize+=pdfPanel.getFile().length(); + totalPages+=pdfPanel.getPageCount(); + } + } + + this.lblFileSize.setText("" + FileUtils.getFileSizeHumanReadable(totalSize)); + this.lblFileSizeMax.setText("Gesamtgröße:"); + this.lblPages.setText("" + totalPages); + } } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.form b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.form index 77b6c0205..e061058cf 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.form +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.form @@ -23,6 +23,7 @@ + @@ -72,6 +73,8 @@ + + @@ -151,5 +154,16 @@ + + + + + + + + + + + diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.java index 8c069c136..df22ff76f 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostPdfPanel.java @@ -663,6 +663,7 @@ You should also get your employer (if you work as a programmer) or school, */ package com.jdimension.jlawyer.client.voip; +import com.jdimension.jlawyer.client.editors.files.ExportAsPdfOrderingStep; import com.jdimension.jlawyer.client.utils.FileUtils; import java.awt.Image; import java.awt.image.BufferedImage; @@ -734,6 +735,7 @@ private void initComponents() { cmdDown = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); lblFileSize = new javax.swing.JLabel(); + cmdRemove = new javax.swing.JButton(); lblPdfPicture.setText("PDF"); @@ -765,6 +767,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { lblFileSize.setText("jLabel3"); + cmdRemove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons16/material/outline_backspace_black_48dp.png"))); // NOI18N + cmdRemove.setToolTipText("PDF Datei aus Sortierung entfernen"); + cmdRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmdRemoveActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -775,7 +785,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cmdDown) - .addComponent(cmdUp, javax.swing.GroupLayout.Alignment.TRAILING)) + .addComponent(cmdUp, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(cmdRemove)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblFileName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -813,7 +824,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addComponent(cmdUp) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cmdDown))) + .addComponent(cmdDown) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmdRemove))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); @@ -834,10 +847,26 @@ private void cmdDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST this.getParent().doLayout(); } }//GEN-LAST:event_cmdDownActionPerformed + + + + private void cmdRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdRemoveActionPerformed + int response = javax.swing.JOptionPane.showConfirmDialog(this, + "Diese PDF wirklich aus der Liste entfernen?", + "PDF entfernen", + javax.swing.JOptionPane.YES_NO_OPTION); + if(response == javax.swing.JOptionPane.YES_OPTION) { + javax.swing.JPanel parent = (javax.swing.JPanel)this.getParent(); + parent.remove(this); + parent.revalidate(); + parent.repaint(); + } + }//GEN-LAST:event_cmdRemoveActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cmdDown; + private javax.swing.JButton cmdRemove; private javax.swing.JButton cmdUp; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2;