private void viewNote() {
   if (notePanel.getSelectedObjectRef() != null) {
     Note note;
     try {
       note = landlord.getNote(notePanel.getSelectedObjectRef());
       if (note != null) {
         NoteDetails leaseDetails =
             new NoteDetails(client, note, "Landlord", landlord.getLandlordRef());
         leaseDetails.setVisible(true);
       }
     } catch (RemoteException ex) {
       Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
 private void updateNote() {
   Integer selection = notePanel.getSelectedObjectRef();
   if (selection != null) {
     try {
       Note note = landlord.getNote(selection);
       if (note != null) {
         UpdateNote noteDetails =
             new UpdateNote(client, note, "Landlord", landlord.getLandlordRef());
         noteDetails.setVisible(true);
       }
     } catch (RemoteException ex) {
       Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
 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 createNote() {
   try {
     CreateNote createNote = new CreateNote(client, "Landlord", landlord.getLandlordRef());
     createNote.setVisible(true);
     System.out.println("TEST - Create Note");
   } catch (RemoteException ex) {
     Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
 private void refresh() {
   try {
     if (landlord.getPerson().getDateOfBirth() != null) {
       dob.setText(formatter.format(landlord.getPerson().getDateOfBirth()));
     }
     if (landlord.getPerson().getName() != null) {
       name.setText(landlord.getPerson().getName());
     }
     leasePanel.setData(landlord.getLeases());
     notePanel.setData(landlord.getNotes());
     modPanel.setData(landlord.getModifiedBy());
     leasePanel.refresh();
     notePanel.refresh();
     modPanel.refresh();
     dob.setText(formatter.format(landlord.getPerson().getDateOfBirth()));
     name.setText(landlord.getPerson().getName());
   } catch (RemoteException ex) {
     Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
  private void setUpMainPanel() {
    /////// SET UP TABBED PANE

    mainPanel.setSize(1000, 250);

    int space = 15;
    Border spaceBorder = BorderFactory.createEmptyBorder(space, space, space, space);
    Border titleBorder = BorderFactory.createLineBorder(new Color(184, 207, 229));

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

    mainPanel.setLayout(new BorderLayout());

    centrePanel.setLayout(new BoxLayout(centrePanel, BoxLayout.PAGE_AXIS));

    buttonPanel = new ButtonPanel();

    buttonPanel.setButtonListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    tabbedPane = new JTabbedPane();

    leasePanel = new LeasePanel("Leases");

    try {
      leasePanel.setData(landlord.getLeases());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    leasePanel.setTableListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    notePanel = new NotePanel("Notes");

    try {
      notePanel.setData(landlord.getNotes());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    notePanel.setTableListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    modPanel = new ModPanel("Modifications");

    try {
      modPanel.setData(landlord.getModifiedBy());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    tabbedPane.setSize(800, 175);

    tabbedPane.add(leasePanel, "Leases");
    tabbedPane.add(notePanel, "Notes");
    tabbedPane.add(modPanel, "Modifications");

    centrePanel.add(tabbedPane);
    try {
      centrePanel.add(
          new DetailsPanel(
              landlord.getCreatedBy(),
              landlord.getCreatedDate(),
              landlord.getLastModifiedBy(),
              landlord.getLastModifiedDate()));
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    mainPanel.add(buttonPanel, BorderLayout.WEST);
    mainPanel.add(centrePanel, BorderLayout.CENTER);
  }
  private void setupDetails() throws RemoteException {
    /////// SET UP APPLICATION DETAILS PANEL

    detailsPanel.setSize(1000, 250);

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

    detailsPanel.setBorder(BorderFactory.createCompoundBorder(spaceBorder, titleBorder));

    detailsPanel.setLayout(new GridBagLayout());

    GridBagConstraints gc = new GridBagConstraints();

    ////////// FIRST ROW //////////
    gc.gridx = 0;
    gc.gridy = 0;

    gc.weightx = 1;
    gc.weighty = 1;
    gc.ipady = 30;

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

    appRef.setFont(plainFont);

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

    JLabel ref = new JLabel(String.valueOf(landlord.getLandlordRef()));
    ref.setFont(boldFont);

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

    JLabel corrName = new JLabel("Name    ");
    corrName.setFont(plainFont);

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

    name = new JLabel(landlord.getPerson().getName());
    name.setFont(boldFont);

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

    gc.gridx++;
    gc.gridwidth = 1;
    gc.anchor = GridBagConstraints.EAST;
    gc.insets = new Insets(0, 0, 0, 0);
    detailsPanel.add(new JLabel(""), gc);

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

    JLabel pDOB = new JLabel("Date of Birth    ");
    pDOB.setFont(plainFont);

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

    dob = new JLabel(formatter.format(landlord.getPerson().getDateOfBirth()));
    dob.setFont(boldFont);

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