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 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 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); }