private void deleteNote() {
   Integer selection = notePanel.getSelectedObjectRef();
   if (selection != null) {
     try {
       int answer =
           JOptionPane.showConfirmDialog(
               null,
               "Are you sure you would like to DELETE note " + selection + "?",
               "Confirm",
               JOptionPane.YES_NO_OPTION,
               JOptionPane.QUESTION_MESSAGE);
       if (answer == JOptionPane.YES_OPTION) {
         System.out.println("Note Delete - Yes button clicked");
         int result = client.deleteLandlordNote(landlord.getLandlordRef(), selection);
         if (result > 0) {
           String message = "Note " + selection + " has been successfully deleted";
           String title = "Information";
           OKDialog.okDialog(LandlordDetails.this, message, title);
         } else {
           String message =
               "Note " + selection + " has dependent records and is not able to be deleted";
           String title = "Error";
           OKDialog.okDialog(LandlordDetails.this, message, title);
         }
       }
     } catch (RemoteException ex) {
       Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
 private void viewLease() {
   Integer selection = leasePanel.getSelectedObjectRef();
   if (selection != null) {
     try {
       LeaseInterface lease = client.getLease(selection);
       if (lease != null) {
         LeaseDetails leaseDetails = new LeaseDetails(client, lease);
         leaseDetails.setVisible(true);
         setVisible(false);
       }
     } catch (RemoteException ex) {
       Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
 private void updateLease() {
   Integer selection = leasePanel.getSelectedObjectRef();
   if (selection != null) {
     try {
       System.out.println("Lease Ref: " + selection);
       LeaseInterface lease = client.getLease(selection);
       if (lease != null) {
         System.out.println("Lease Name: " + lease.getAgreementName());
         UpdateLease leaseDetails = new UpdateLease(client, lease);
         leaseDetails.setVisible(true);
       }
     } catch (RemoteException ex) {
       Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
  private void layoutComponents() {

    setJMenuBar(createMenuBar());

    closeButton = new JButton("Close");
    noteField = new JTextArea(2, 50);
    noteField.setLineWrap(true);
    noteField.setEnabled(false);
    noteField.setDisabledTextColor(Color.BLACK);
    AccountInterface account = null;

    try {
      switch (transactionType) {
        case "Rent Account":
          account = client.getRentAccount(transaction.getAccountRef());
          break;

        case "Lease Account":
          account = client.getLeaseAccount(transaction.getAccountRef());
          break;

        case "Employee Account":
          account = client.getEmployeeAccount(transaction.getAccountRef());
          break;
      }

      PersonInterface toPerson = client.getPerson(transaction.getToRef());

      PersonInterface fromPerson = client.getPerson(transaction.getFromRef());

      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ev) {
              setVisible(false);
              dispose();
            }
          });

      try {
        noteField.setText(transaction.getNote().getNote());

        this.setMinimumSize(new Dimension(650, 450));
        this.setSize(650, 450);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(
            dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);

        ///////// DETAILS PANEL ////////////
        detailsPanel = new JPanel();
        // detailsPanel.setSize(450, 200);
        detailsPanel.setLayout(new GridBagLayout());

        GridBagConstraints gc = new GridBagConstraints();

        ////////// FIRST ROW //////////

        gc.gridx = 0;
        gc.gridy++;

        gc.weightx = 1;
        gc.weighty = 1;

        JLabel tranRefLabel = new JLabel("Transaction Ref  ");
        Font font = tranRefLabel.getFont();
        Font boldFont = new Font(font.getName(), Font.BOLD, 17);
        Font plainFont = new Font(font.getName(), Font.PLAIN, 17);

        tranRefLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(tranRefLabel, gc);

        tranRefField = new JLabel(String.valueOf(transaction.getTransactionRef()));
        tranRefField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(tranRefField, gc);

        ////////// NEXT ROW ///////////

        gc.gridx = 0;
        gc.gridy++;

        gc.weightx = 1;
        gc.weighty = 1;

        JLabel accRefLabel = new JLabel("Account Ref  ");

        accRefLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(accRefLabel, gc);

        accRefField = new JLabel(String.valueOf(transaction.getAccountRef()));
        accRefField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(accRefField, gc);

        if (account != null) {
          accNameField = new JLabel(account.getAccName());
        } else {
          accNameField = new JLabel("");
        }
        accNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(accNameField, gc);

        //////////// NEXT ROW //////////////

        JLabel toRefLabel = new JLabel("To Ref  ");
        toRefLabel.setFont(boldFont);

        gc.gridx = 0;
        gc.gridy++;

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(toRefLabel, gc);

        toField = new JLabel(String.valueOf(transaction.getToRef()));
        toField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(toField, gc);

        if (toPerson != null) {
          toNameField = new JLabel(toPerson.getName());
        } else {
          toNameField = new JLabel("");
        }
        toNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(toNameField, gc);

        ////////////// NEXT ROW ////////////////

        JLabel fromRefLabel = new JLabel("From Ref  ");
        fromRefLabel.setFont(boldFont);

        gc.gridx = 0;
        gc.gridy++;

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(fromRefLabel, gc);

        fromField = new JLabel(String.valueOf(transaction.getFromRef()));
        fromField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(fromField, gc);

        if (fromPerson != null) {
          fromNameField = new JLabel(fromPerson.getName());
        } else {
          fromNameField = new JLabel("");
        }
        fromNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(fromNameField, gc);

        ////////// NEXT ROW //////////

        gc.gridx = 0;
        gc.gridy++;

        JLabel amountLabel = new JLabel("Amount  ");
        amountLabel.setFont(boldFont);

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(amountLabel, gc);

        amountField = new JLabel(String.valueOf(transaction.getAmount()));
        amountField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(amountField, gc);

        JLabel isDebitLabel = new JLabel("Debit  ");
        isDebitLabel.setFont(boldFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(isDebitLabel, gc);

        isDebitField = new JCheckBox();
        isDebitField.setSelected(transaction.isDebit());
        isDebitField.setEnabled(false);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(isDebitField, gc);

        ////////// NEXT ROW //////////
        gc.gridx = 0;
        gc.gridy++;

        JLabel commentLabel = new JLabel("Comment  ");
        commentLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(commentLabel, gc);

        noteField = new JTextArea(3, 30);
        noteField.setText(transaction.getComment());
        noteField.setEnabled(false);

        gc.gridx++;
        gc.gridwidth = 3;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(noteField, gc);

        JPanel buttonsPanel = new JPanel();

        int space = 15;
        Border spaceBorder = BorderFactory.createEmptyBorder(space, space, space, space);
        Border titleBorder = BorderFactory.createTitledBorder("View Transaction");

        mainPanel = new JPanel();

        mainPanel.setBorder(BorderFactory.createCompoundBorder(spaceBorder, titleBorder));
        buttonsPanel.setBorder(BorderFactory.createEmptyBorder());

        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(detailsPanel, BorderLayout.CENTER);

        try {
          JPanel mods =
              new DetailsPanel(
                  transaction.getCreatedBy(), transaction.getCreatedDate(), null, null);
          mainPanel.add(mods, BorderLayout.SOUTH);
        } catch (RemoteException ex) {
          Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
        }

        ////////// BUTTONS PANEL //////////
        buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
        buttonsPanel.add(closeButton);

        // Add sub panels to dialog
        setLayout(new BorderLayout());
        add(mainPanel, BorderLayout.CENTER);
        add(buttonsPanel, BorderLayout.SOUTH);
      } catch (RemoteException ex) {
        Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
      }
    } catch (RemoteException ex) {
      Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
    }
  }