From: pinene Date: Thu, 5 Mar 2015 12:22:00 +0000 (+0100) Subject: Owner related new GUI created, some of them are disabled until corresponding logic... X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/commitdiff_plain/7b7027e13369849d213c9b4e118395e4bfd23dc2 Owner related new GUI created, some of them are disabled until corresponding logic is created. --- diff --git a/ruralHouses/db/DBjcampos004.yap b/ruralHouses/db/DBjcampos004.yap index 23ef7bc..41236b6 100644 Binary files a/ruralHouses/db/DBjcampos004.yap and b/ruralHouses/db/DBjcampos004.yap differ diff --git a/ruralHouses/src/gui/HousesRelatedOwnerGUI.java b/ruralHouses/src/gui/HousesRelatedOwnerGUI.java new file mode 100644 index 0000000..4a7bfba --- /dev/null +++ b/ruralHouses/src/gui/HousesRelatedOwnerGUI.java @@ -0,0 +1,97 @@ +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.JButton; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; + +import domain.Owner; +import domain.RuralHouse; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.util.Vector; +import javax.swing.JLabel; +import java.awt.Color; +import java.awt.Font; + +public class HousesRelatedOwnerGUI extends JFrame { + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private Owner owner; + /** + * Create the frame. + */ + public HousesRelatedOwnerGUI(Owner o) { + this.getContentPane().setLayout(null); + owner = o; + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 562); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JButton btnCreateHouses = new JButton("Create Houses"); + btnCreateHouses.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + //TODO this button must direct to the House create GUI + } + }); + + JButton btnModifyHouses = new JButton("Modify Houses"); + btnModifyHouses.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //TODO this button must direct to the House modify GUI + } + }); + + JButton btnDeleteHouses = new JButton("Delete Houses"); + btnDeleteHouses.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //TODO this button must direct to the House delete GUI + } + }); + + JLabel lblDisabledYet = new JLabel("Disabled yet"); + lblDisabledYet.setFont(new Font("Courier New", Font.PLAIN, 19)); + lblDisabledYet.setForeground(Color.RED); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(110) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addComponent(btnDeleteHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) + .addComponent(btnModifyHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) + .addComponent(btnCreateHouses, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) + .addGap(121)) + .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() + .addGap(127) + .addComponent(lblDisabledYet) + .addContainerGap(165, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(37) + .addComponent(lblDisabledYet) + .addGap(28) + .addComponent(btnCreateHouses, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) + .addGap(40) + .addComponent(btnModifyHouses, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE) + .addGap(39) + .addComponent(btnDeleteHouses, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE) + .addContainerGap(186, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/ruralHouses/src/gui/IntroduceOfferGUI.java b/ruralHouses/src/gui/IntroduceOfferGUI.java index 40083ec..876a1b9 100644 --- a/ruralHouses/src/gui/IntroduceOfferGUI.java +++ b/ruralHouses/src/gui/IntroduceOfferGUI.java @@ -71,7 +71,7 @@ public class IntroduceOfferGUI extends JFrame { e.printStackTrace(); } if(!ownerHouseList.isEmpty()){ - Frame a = new IntroduceOffer2GUI(ownerHouseList); + Frame a = new OwnerMenuGUI(owner); a.setVisible(true); } else if(ownerHouseList.isEmpty()) diff --git a/ruralHouses/src/gui/NewHouseGUI.java b/ruralHouses/src/gui/NewHouseGUI.java new file mode 100644 index 0000000..4139091 --- /dev/null +++ b/ruralHouses/src/gui/NewHouseGUI.java @@ -0,0 +1,209 @@ +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.GroupLayout; +import javax.swing.GroupLayout.Alignment; + +import domain.Owner; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.SwingConstants; +import javax.swing.JButton; + +public class NewHouseGUI extends JFrame { + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private Owner owner; + private JTextField Code_f; + private JLabel lblTown; + private JTextField Town_f; + private JLabel lblDescription; + private JTextField description_f; + private JLabel lblKitchen; + private JTextField kitchens_f; + private JLabel lblRooms; + private JTextField rooms_f; + private JLabel lblLivings; + private JTextField lRooms_f; + private JLabel lblParkings; + private JTextField parkings_f; + private JLabel lblBaths; + private JTextField baths_f; + private JButton btnRegister; + + + /** + * Create the frame. + */ + public NewHouseGUI(Owner o) { + this.getContentPane().setLayout(null); + owner = o; + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 583); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JLabel lblCode = new JLabel("House Code:"); + lblCode.setHorizontalAlignment(SwingConstants.RIGHT); + + Code_f = new JTextField(); + Code_f.setColumns(10); + + lblTown = new JLabel("Town:"); + lblTown.setHorizontalAlignment(SwingConstants.RIGHT); + + Town_f = new JTextField(); + Town_f.setColumns(10); + + lblDescription = new JLabel("Description:"); + lblDescription.setHorizontalAlignment(SwingConstants.RIGHT); + + description_f = new JTextField(); + description_f.setColumns(10); + + lblKitchen = new JLabel("Kitchens:"); + lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT); + + kitchens_f = new JTextField(); + kitchens_f.setColumns(10); + + lblRooms = new JLabel("Rooms:"); + lblRooms.setHorizontalAlignment(SwingConstants.RIGHT); + + rooms_f = new JTextField(); + rooms_f.setColumns(10); + + lblLivings = new JLabel("Living rooms:"); + lblLivings.setHorizontalAlignment(SwingConstants.RIGHT); + + lRooms_f = new JTextField(); + lRooms_f.setColumns(10); + + lblParkings = new JLabel("Parkings:"); + lblParkings.setHorizontalAlignment(SwingConstants.RIGHT); + + parkings_f = new JTextField(); + parkings_f.setColumns(10); + + lblBaths = new JLabel("Baths:"); + lblBaths.setHorizontalAlignment(SwingConstants.RIGHT); + + baths_f = new JTextField(); + baths_f.setColumns(10); + + btnRegister = new JButton("Register House"); + 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() + .addContainerGap() + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblCode) + .addGap(18) + .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblTown, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(lblDescription, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(10) + .addComponent(description_f, GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(17) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblLivings) + .addGap(18) + .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_contentPane.createSequentialGroup() + .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) + .addGap(18) + .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(140) + .addComponent(btnRegister))) + .addContainerGap()) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(20) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(60) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(lblCode) + .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblTown))) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(63) + .addComponent(lblDescription) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE))) + .addGap(71) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(3) + .addComponent(lblRooms)) + .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(3) + .addComponent(lblKitchen)) + .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(3) + .addComponent(lblBaths)) + .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) + .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblLivings))) + .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(30) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(3) + .addComponent(lblParkings)) + .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(41) + .addComponent(btnRegister) + .addGap(54)) + ); + contentPane.setLayout(gl_contentPane); + } +} diff --git a/ruralHouses/src/gui/OwnerMenuGUI.java b/ruralHouses/src/gui/OwnerMenuGUI.java new file mode 100644 index 0000000..4cc4f43 --- /dev/null +++ b/ruralHouses/src/gui/OwnerMenuGUI.java @@ -0,0 +1,80 @@ +package gui; + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.Frame; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JButton; + +import domain.Owner; +import domain.RuralHouse; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.util.Vector; + +public class OwnerMenuGUI extends JFrame { + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private Owner owner; + + + /** + * Create the frame. + */ + public OwnerMenuGUI(Owner o) { + this.getContentPane().setLayout(null); + owner = o; + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 473); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JButton btnHouses = new JButton("Houses"); + btnHouses.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Frame a = new HousesRelatedOwnerGUI(owner); + a.setVisible(true); + } + }); + + JButton btnOffers = new JButton("Offers"); + btnOffers.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Frame a = new IntroduceOffer2GUI(owner.getRuralHouses()); + a.setVisible(true); + } + }); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(115) + .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE) + .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(145, Short.MAX_VALUE)) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addGap(62) + .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) + .addGap(58) + .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) + .addContainerGap(142, Short.MAX_VALUE)) + ); + contentPane.setLayout(gl_contentPane); + } + +}