private void deleteLease() { Integer selection = leasePanel.getSelectedObjectRef(); if (selection != null) { try { int answer = JOptionPane.showConfirmDialog( null, "Are you sure you would like to DELETE lease " + selection + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (answer == JOptionPane.YES_OPTION) { System.out.println("Lease Delete - Yes button clicked"); int result = client.deleteLease(selection); if (result > 0) { String message = "Lease " + selection + " has been successfully deleted"; String title = "Information"; OKDialog.okDialog(LandlordDetails.this, message, title); } else { String message = "Lease " + 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 endLease() { Integer selection = leasePanel.getSelectedObjectRef(); if (selection != null) { System.out.println("Lease Ref: " + selection); EndObject endLease = new EndObject(client, "Lease", selection); endLease.setVisible(true); } }
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 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 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); }