From 6bec76455fe56e4872fae01ef28382390f34df71 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Wed, 7 Feb 2024 19:30:12 +0100 Subject: [PATCH] ask before removing timesheet entry --- .../files/TimesheetPositionEntryPanel.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/TimesheetPositionEntryPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/TimesheetPositionEntryPanel.java index 59e3489ad..aee4f13f0 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/TimesheetPositionEntryPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/TimesheetPositionEntryPanel.java @@ -981,20 +981,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }// //GEN-END:initComponents private void cmdRemovePositionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdRemovePositionActionPerformed - ClientSettings settings = ClientSettings.getInstance(); - try { - JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties()); - locator.lookupArchiveFileServiceRemote().removeTimesheetPosition(this.timesheetId, this.position); - Container parentContainer=this.getParent(); - parentContainer.remove(this); + + int response = JOptionPane.showConfirmDialog(this, "Position '" + txtName.getText() + "' (" + txtStarted.getText() + ") löschen?", "erfasste Zeit löschen", JOptionPane.YES_NO_OPTION); + if (response == JOptionPane.YES_OPTION) { + + ClientSettings settings = ClientSettings.getInstance(); try { - parentContainer.doLayout(); + JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties()); + locator.lookupArchiveFileServiceRemote().removeTimesheetPosition(this.timesheetId, this.position); + Container parentContainer = this.getParent(); + parentContainer.remove(this); + try { + parentContainer.doLayout(); + } catch (Exception ex) { + log.warn("unable to layout time sheet positions container", ex); + } } catch (Exception ex) { - log.warn("unable to layout time sheet positions container", ex); + log.error("Error removing timsheet position", ex); + JOptionPane.showMessageDialog(this, "Fehler beim Löschen der Zeiterfassungsposition: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE); } - } catch (Exception ex) { - log.error("Error removing timsheet position", ex); - JOptionPane.showMessageDialog(this, "Fehler beim Löschen der Zeiterfassungsposition: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_cmdRemovePositionActionPerformed