try {
Owner jon = new Owner("Jon");
Owner alfredo = new Owner("Alfredo");
- jon.addRuralHouse("Ezkio", "Ezkioko etxea", "Ezkio", 3, 3, 3, 3, 3);
- jon.addRuralHouse("Eskia", "Eskiatzeko etxea", "Jaca", 4, 4, 4, 4, 4);
+ jon.addRuralHouse("Ezkioko", "Ezkioko etxea", "Ezkio", 3, 3, 3, 3, 3);
+ jon.addRuralHouse("Eskiatze", "Eskiatzeko etxea", "Jaca", 4, 4, 4, 4, 4);
jon.setBankAccount("1349 5677 21 2133567777");
alfredo.addRuralHouse("Aitonako", "Casa del abuelo", "Pitillas", 5, 5, 5, 5,
5);
import java.awt.*;
import java.awt.event.*;
+import businessLogic.HouseManager;
import businessLogic.OfferManager;
import com.toedter.calendar.JCalendar;
private final JLabel lblNewLabel = new JLabel("");
private final JRadioButton ruralHouseName = new JRadioButton(
"Use RuralHouse name");
+ private final JRadioButton district = new JRadioButton("Use district name");
private final ButtonGroup buttonGroup = new ButtonGroup();
private final JMenuBar menuBar = new JMenuBar();
private final JMenu mnMoreOptions = new JMenu("Search Options");
private final JTextField nBaths = new JTextField();
private final JLabel lblParkings = new JLabel("Parking slots:");
private final JTextField nParkings = new JTextField();
+ private HouseManager houseMan = new HouseManager();
- public QueryAvailabilityGUI2(Vector<RuralHouse> v) {
+ public QueryAvailabilityGUI2() {
nParkings.setText("");
nParkings.setColumns(10);
nBaths.setColumns(10);
try {
- jbInit(v);
+ jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
- private void jbInit(Vector<RuralHouse> v) throws Exception {
+ private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
this.setSize(new Dimension(550, 500));
this.setTitle("Set availability");
- jComboBox1 = new JComboBox(v);
+ //TODO here we should add the districts of villatripas this is just for testing purposes
+ jComboBox1 = new JComboBox(this.houseMan.getAllRuralHouses());
jComboBox1.setBounds(new Rectangle(115, 30, 115, 20));
jLabel2.setText("First day :");
jLabel2.setBounds(new Rectangle(20, 134, 85, 25));
getContentPane().add(lblNewLabel);
- JRadioButton district = new JRadioButton("Use district name");
- district.setSelected(true);
- buttonGroup.add(district);
+ district.setSelected(true);;
district.setBounds(20, 69, 128, 20);
getContentPane().add(district);
buttonGroup.add(ruralHouseName);
+ buttonGroup.add(district);
ruralHouseName.setBounds(276, 60, 177, 38);
district.addItemListener(new ItemListener() {
@Override
}
private void jButton1_actionPerformed(ActionEvent e) {
-
+ if(this.district.isSelected()){
+ //show list of houses GUI
+ }
+ else if(this.ruralHouseName.isSelected()){
+ //show features of specific house
+ }
}
private void jButton2_actionPerformed(ActionEvent e) {
public void actionPerformed(java.awt.event.ActionEvent e) {
// C?digo cedido por la universidad
//JFrame a = new QueryAvailabilityWindow();
- JFrame a = new QueryAvailabilityGUI();
+ JFrame a = new QueryAvailabilityGUI2();
a.setVisible(true);
}
--- /dev/null
+package gui;
+
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JLabel;
+
+import java.awt.Font;
+
+import javax.swing.JTextField;
+import javax.swing.JScrollPane;
+
+import java.awt.Rectangle;
+
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableModel;
+
+import java.awt.Component;
+
+import javax.swing.Box;
+
+public class listOfHousesGUI extends JFrame {
+
+ private JPanel contentPane;
+ private JTextField textField;
+ private JTable table;
+
+ /**
+ * Create the frame.
+ */
+ public listOfHousesGUI() {
+ try {
+ init();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void init() throws Exception
+ {
+ setBounds(100, 100, 600, 450);
+ contentPane = new JPanel();
+ contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ setContentPane(contentPane);
+ contentPane.setLayout(null);
+
+ JLabel lblNewLabel = new JLabel("List of available houses in:");
+ lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
+ lblNewLabel.setBounds(23, 41, 325, 33);
+ contentPane.add(lblNewLabel);
+
+ textField = new JTextField();
+ textField.setEnabled(false);
+ textField.setEditable(false);
+ textField.setFont(new Font("Tahoma", Font.PLAIN, 27));
+ textField.setBounds(373, 41, 152, 33);
+ contentPane.add(textField);
+ textField.setColumns(10);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
+ scrollPane.setBounds(23, 113, 536, 271);
+ contentPane.add(scrollPane);
+
+ table = new JTable();
+ scrollPane.setViewportView(table);
+ table.setModel(new DefaultTableModel(
+ new Object[][] {
+ },
+ new String[] {
+ "House Name", "Bedrooms", "Kitchens", "Baths", "Parkings", "Livings"
+ }
+ ));
+ }
+}