package gui;
-import java.awt.BorderLayout;
-import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
-import java.util.Vector;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
import javax.swing.JFrame;
+import javax.swing.JLabel;
import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-import javax.swing.GroupLayout;
-import javax.swing.GroupLayout.Alignment;
-import javax.swing.JComboBox;
import javax.swing.JRadioButton;
-import javax.swing.JButton;
+import javax.swing.border.EmptyBorder;
import businessLogic.AdminManager;
-import businessLogic.HouseManager;
-import businessLogic.HouseManagerInterface;
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 comboBox;
+ private JComboBox<RuralHouse> comboBox;
private JButton btnDelete;
private AdminManager am;
+ JLabel feedback = new JLabel("");
/**
* Create the frame.
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
- comboBox = new JComboBox(this.owner.getRuralHouses());
+ 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() {
}
}
});
-
- GroupLayout gl_contentPane = new GroupLayout(contentPane);
- gl_contentPane.setHorizontalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(70)
- .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(85)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
- .addComponent(btnDelete)
- .addComponent(rdbtnIAmSure))))
- .addContainerGap(954, Short.MAX_VALUE))
- );
- gl_contentPane.setVerticalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(50)
- .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGap(68)
- .addComponent(rdbtnIAmSure)
- .addGap(47)
- .addComponent(btnDelete)
- .addContainerGap(493, Short.MAX_VALUE))
- );
- contentPane.setLayout(gl_contentPane);
+ 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) {
private void actionListenerButton(ActionEvent e){
RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
- am.addDeletionRequest(toDel);
+ if(am.addDeletionRequest(toDel)){
+ feedback.setText("Delete request sended");
+
+ }else{
+ feedback.setText("Request cannot be sended(Already sended)");
+ }
}
}