RRRRHHHH_Code
d30bcc8a3c13bbf5144b03a644c1345865aed708
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
package gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.rmi.Naming; import java.rmi.RemoteException; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.border.EmptyBorder; import common.AdminInterface; import configuration.___IntNames; import domain.Owner; import domain.RuralHouse; public class RequestDeleteHouseGUI extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private Owner owner; private JComboBox<RuralHouse> comboBox; private JButton btnDelete; private AdminInterface am = null; JLabel feedback = new JLabel(""); /** * Create the frame. */ public RequestDeleteHouseGUI(Owner o) { try { am = (AdminInterface) Naming .lookup(___IntNames.AdminManager); } catch (Exception e1) { System.out.println("Error accessing remote authentication: " + e1.toString()); } this.owner = o; setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses()); comboBox.setBounds(75, 55, 332, 20); JRadioButton rdbtnIAmSure = new JRadioButton("I am sure"); rdbtnIAmSure.setBounds(90, 154, 90, 23); btnDelete = new JButton("REQUEST"); btnDelete.setBounds(90, 213, 90, 23); btnDelete.setEnabled(false); rdbtnIAmSure.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { int state = e.getStateChange(); if (state == ItemEvent.SELECTED){ btnDelete.setEnabled(true); } else if (state == ItemEvent.DESELECTED){ btnDelete.setEnabled(false); } } }); contentPane.setLayout(null); contentPane.add(comboBox); contentPane.add(rdbtnIAmSure); contentPane.add(btnDelete); feedback.setBounds(90, 184, 274, 18); contentPane.add(feedback); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { actionListenerButton(arg0); } }); } private void actionListenerButton(ActionEvent e){ RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem(); try { if(am.addDeletionRequest(toDel)){ am.saveInstance(); feedback.setText("Delete request sended"); }else{ feedback.setText("Request cannot be sended(Already sended)"); } } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } |
Commits for RRRRHHHH_CoderuralHouses/src/gui/RequestDeleteHouseGUI.java
Revision | Author | Commited | Message |
---|---|---|---|
d30bcc ... Diff | pinene | Wed 20 May, 2015 16:32:33 +0000 | cleaning |
4f8bcc ... Diff | epinzolas001 | Mon 18 May, 2015 09:49:54 +0000 | Merge conflicts solutioned |
520867 ... Diff | pinene | Sun 19 Apr, 2015 14:09:12 +0000 | tmp |
46d6c3 ... Diff | camjan | Wed 15 Apr, 2015 17:08:42 +0000 | Debbugin continues... |
e2ae30 ... Diff | Eneko Pinzolas Murua | Tue 14 Apr, 2015 15:07:35 +0000 | imports leaned |
66f0c8 ... | Eneko Pinzolas Murua | Sun 12 Apr, 2015 18:11:42 +0000 | Model modified so that owners now request for a new house insetion or a house removal. Furthermore, all Administrator GUI and bussines logic create. However, Login GUI and BussinesLogic are to be modified so that they integrate Admin identification. |