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] 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;