Minor error correction and some bugs, alongside with modify offers quality of life...
authorEneko Pinzolas Murua <kelossus@localhost.localdomain>
Fri, 10 Apr 2015 10:37:22 +0000 (12:37 +0200)
committerEneko Pinzolas Murua <kelossus@localhost.localdomain>
Fri, 10 Apr 2015 10:37:22 +0000 (12:37 +0200)
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/gui/HouseFeaturesGUI.java
ruralHouses/src/gui/ModifyOfferGUI.java
ruralHouses/src/gui/listOfHousesGUI.java

index 7275ba2..8078e78 100644 (file)
@@ -155,8 +155,9 @@ public class DB4oManager {
                        db.close();
                }
        }
+       
+       
 
-       @SuppressWarnings("finally")
        public Offer createOffer(RuralHouse ruralHouse, Date firstDay,
                        Date lastDay, float price) throws RemoteException, Exception {
                Offer o = null;
index 414ff07..ecc44ab 100644 (file)
@@ -60,7 +60,7 @@ public class HouseFeaturesGUI extends JFrame {
         * Create the frame.
         */
 
-       public HouseFeaturesGUI(RuralHouse RH, Date FirstDay, Date LastDay) {
+       public HouseFeaturesGUI(RuralHouse RH, final Date FirstDay, final Date LastDay) {
                this.rh = RH;
                this.getContentPane().setLayout(null);
                setBounds(100, 100, 500, 583);
@@ -159,7 +159,7 @@ public class HouseFeaturesGUI extends JFrame {
                scrollPane.setBounds(40, 311, 376, 183);
                contentPane.add(scrollPane);
 
-               JTable table = new JTable() {
+               table = new JTable() {
                        private static final long serialVersionUID = 1L;
 
                        public boolean isCellEditable(int row, int column) {
@@ -226,13 +226,11 @@ public class HouseFeaturesGUI extends JFrame {
                                Date firstDay = (Date) table.getModel().getValueAt(row, 1);
                                Date lastDay = (Date) table.getModel().getValueAt(row, 2);
                                if (FirstDay != null && LastDay != null) {
-                                       if (FirstDay.before(firstDay) || FirstDay.equals(firstDay)
-                                                       && LastDay.after(lastDay)
-                                                       || LastDay.equals(lastDay)) {
-                                               setBackground(Color.GREEN);
+                                       if (LastDay.before(lastDay)  ||  FirstDay.after(firstDay)) {
+                                               setBackground(Color.RED);
                                                setForeground(Color.BLACK);
                                        } else {
-                                               setBackground(Color.RED);
+                                               setBackground(Color.GREEN);
                                                setForeground(Color.BLACK);
                                        }
                                }
index 651d85c..853ce07 100644 (file)
@@ -56,7 +56,10 @@ public class ModifyOfferGUI extends JFrame  {
 
                jComboBox1 = new JComboBox<RuralHouse>(v);
                
-               comboBox_o = new JComboBox<Offer>();
+               comboBox_o = new JComboBox<Offer>(((RuralHouse)jComboBox1.getSelectedItem()).getAllOffers());
+               DateFormat dateformat1 = DateFormat.getDateInstance(1, jCalendar1.getLocale());
+               jTextField1.setText(dateformat1.format(((Offer) comboBox_o.getSelectedItem()).getFirstDay()));
+               jTextField2.setText(dateformat1.format(((Offer) comboBox_o.getSelectedItem()).getLastDay()));
                
                jComboBox1.setBounds(new Rectangle(115, 12, 115, 20));
                jLabel1.setText("List of houses:");
index e75b125..b8db0df 100644 (file)
@@ -68,7 +68,7 @@ public class listOfHousesGUI extends JFrame {
                scrollPane.setBounds(23, 113, 536, 271);
                contentPane.add(scrollPane);
 
-               JTable table = new JTable() {
+               table = new JTable() {
                private static final long serialVersionUID = 1L;
 
                public boolean isCellEditable(int row, int column) {