Merge branch 'gui-fix-itinerary' into 'dev'
[feat] Fix GUI See merge request gla-groupe-3/projet!17
This commit is contained in:
commit
db471f41d1
2 changed files with 181 additions and 327 deletions
|
@ -1,270 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="fr.u_paris.gla.project.gui.View">
|
|
||||||
<grid id="27dc6" binding="MainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<xy x="20" y="20" width="853" height="600"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<background color="-12828863"/>
|
|
||||||
<focusCycleRoot value="true"/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="15a59" binding="Cardpanel" layout-manager="CardLayout" hgap="0" vgap="0" show="24ba7">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<background color="-720907"/>
|
|
||||||
<doubleBuffered value="true"/>
|
|
||||||
<enabled value="true"/>
|
|
||||||
<foreground color="-12495218"/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="24ba7" binding="HomePanel" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<card name="Card1"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<background color="-8683389"/>
|
|
||||||
<enabled value="false"/>
|
|
||||||
<foreground color="-10699971"/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="3cb9b" class="javax.swing.JTextField" binding="textField1" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="a2307" class="javax.swing.JButton" binding="searchButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<label value="Search"/>
|
|
||||||
<text value="Search"/>
|
|
||||||
<verifyInputWhenFocusTarget value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="177f" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Search stop"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<vspacer id="8b80">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<vspacer id="b3e57">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<hspacer id="5107e">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
<hspacer id="f414">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="184ef" binding="NetworkPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<card name="Card2"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<background color="-2708071"/>
|
|
||||||
<doubleBuffered value="true"/>
|
|
||||||
<enabled value="true"/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="89720" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<labelFor value="44153"/>
|
|
||||||
<text value="Network"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<grid id="7f3c9" binding="stationsPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="35d9e" class="javax.swing.JLabel" binding="departText">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Departure:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<vspacer id="f3812">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<component id="33aa0" class="javax.swing.JLabel" binding="arrText">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Arrival:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<scrollpane id="44153" binding="mypane">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="2046e" class="javax.swing.JTable" binding="table">
|
|
||||||
<constraints/>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</scrollpane>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="dfb19" binding="FavoritesPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<card name="Card3"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<background color="-5520023"/>
|
|
||||||
<doubleBuffered value="true"/>
|
|
||||||
<enabled value="true"/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="131d5" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Favorites"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="30e2e" binding="ItineraryPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<card name="Card4"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children/>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="67039" class="javax.swing.JMenuBar" layout-manager="GridLayoutManager" row-count="9" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="10ffa" class="javax.swing.JMenuItem" binding="Home">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="20"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<hideActionText value="false"/>
|
|
||||||
<text value="Home"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="43d5e" class="javax.swing.JMenuItem" binding="Network">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="20"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Network"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="9da5d" class="javax.swing.JMenuItem" binding="Favorites">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="20"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Favorites"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<vspacer id="402a8">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="14"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<vspacer id="15816">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="14"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<vspacer id="dae0c">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="14"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<component id="664f9" class="javax.swing.JMenuItem" binding="Itinerary">
|
|
||||||
<constraints>
|
|
||||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="102" height="20"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Itinerary"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<vspacer id="936ed">
|
|
||||||
<constraints>
|
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<vspacer id="c45a6">
|
|
||||||
<constraints>
|
|
||||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</form>
|
|
|
@ -8,29 +8,41 @@ import javax.swing.table.TableModel;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class View extends JFrame {
|
public class View extends JFrame {
|
||||||
private JPanel Cardpanel;
|
private JPanel CardPanel;
|
||||||
private JMenuItem Home;
|
private JMenuItem Home;
|
||||||
private JMenuItem Network;
|
private JMenuItem Network;
|
||||||
private JMenuItem Favorites;
|
private JMenuItem Favorites;
|
||||||
private JPanel NetworkPanel;
|
private JPanel NetworkPanel;
|
||||||
private JPanel FavoritesPanel;
|
|
||||||
private JTextField textField1;
|
private JTextField TextLocation;
|
||||||
private JButton searchButton;
|
private JButton ButtonLocation;
|
||||||
private JPanel HomePanel;
|
private JPanel HomePanel;
|
||||||
private JPanel MainPanel;
|
private JPanel MainPanel;
|
||||||
private DefaultTableModel model;
|
private DefaultTableModel modelStops;
|
||||||
|
|
||||||
private JTable table;
|
private JTable tableStops;
|
||||||
|
|
||||||
private JScrollPane mypane;
|
private JTable tableItinerary;
|
||||||
|
|
||||||
|
private DefaultTableModel modelItinerary;
|
||||||
|
|
||||||
|
private JScrollPane paneStops;
|
||||||
|
|
||||||
|
private JScrollPane paneItinerary;
|
||||||
private JPanel ItineraryPanel;
|
private JPanel ItineraryPanel;
|
||||||
private JMenuItem Itinerary;
|
private JMenuItem Itinerary;
|
||||||
private JPanel stationsPanel;
|
private JPanel stationsPanel;
|
||||||
private JLabel departText;
|
private JLabel departText;
|
||||||
private JLabel arrText;
|
private JLabel arrText;
|
||||||
|
private JTextField TextCoord;
|
||||||
|
private JButton ButtonCoord;
|
||||||
|
private JPanel SearchCoordPanel;
|
||||||
|
private JPanel SearchLocationPanel;
|
||||||
|
private JLabel NetworkLabel;
|
||||||
|
private JLabel FavLabel;
|
||||||
|
private JMenuBar ButtonBar;
|
||||||
|
|
||||||
private ArrayList<Stop> StopList;
|
private ArrayList<Stop> StopList;
|
||||||
|
|
||||||
|
@ -38,7 +50,9 @@ public class View extends JFrame {
|
||||||
|
|
||||||
private String arrivalCur;
|
private String arrivalCur;
|
||||||
|
|
||||||
private String searchCur;
|
private String searchLocation;
|
||||||
|
|
||||||
|
private String searchCoord;
|
||||||
|
|
||||||
private ArrayList<Stop> searchRes;
|
private ArrayList<Stop> searchRes;
|
||||||
|
|
||||||
|
@ -46,9 +60,87 @@ public class View extends JFrame {
|
||||||
|
|
||||||
|
|
||||||
public View(ArrayList<Stop> s) throws HeadlessException {
|
public View(ArrayList<Stop> s) throws HeadlessException {
|
||||||
model = (DefaultTableModel) table.getModel();
|
MainPanel = new JPanel();
|
||||||
model.setColumnCount(2);
|
GridLayout MainLayout = new GridLayout(1, 2, 50, 0);
|
||||||
model.setColumnIdentifiers(new Object[]{"Line", "Stop"});
|
MainPanel.setLayout(MainLayout);
|
||||||
|
CardLayout CardLay = new CardLayout();
|
||||||
|
CardPanel = new JPanel(CardLay);
|
||||||
|
|
||||||
|
HomePanel = new JPanel();
|
||||||
|
CardPanel.add(HomePanel);
|
||||||
|
SearchCoordPanel = new JPanel();
|
||||||
|
SearchLocationPanel = new JPanel();
|
||||||
|
GridLayout SearchLayout = new GridLayout(1, 2);
|
||||||
|
HomePanel.setLayout(SearchLayout);
|
||||||
|
HomePanel.add(SearchCoordPanel);
|
||||||
|
HomePanel.add(SearchLocationPanel);
|
||||||
|
GridLayout SearchCoordLayout = new GridLayout(2, 1);
|
||||||
|
GridLayout SearchLocationLayout = new GridLayout(2, 1);
|
||||||
|
SearchCoordPanel.setLayout(SearchCoordLayout);
|
||||||
|
SearchLocationPanel.setLayout(SearchLocationLayout);
|
||||||
|
TextCoord = new JTextField();
|
||||||
|
ButtonCoord = new JButton("Look for coords");
|
||||||
|
SearchCoordPanel.add(TextCoord);
|
||||||
|
SearchCoordPanel.add(ButtonCoord);
|
||||||
|
TextLocation = new JTextField();
|
||||||
|
ButtonLocation = new JButton("Look for string");
|
||||||
|
SearchLocationPanel.add(TextLocation);
|
||||||
|
SearchLocationPanel.add(ButtonLocation);
|
||||||
|
|
||||||
|
NetworkPanel = new JPanel();
|
||||||
|
CardPanel.add(NetworkPanel);
|
||||||
|
GridLayout NetworkLayout = new GridLayout(3, 1);
|
||||||
|
NetworkPanel.setLayout(NetworkLayout);
|
||||||
|
NetworkLabel = new JLabel("Network");
|
||||||
|
NetworkPanel.add(NetworkLabel);
|
||||||
|
stationsPanel = new JPanel();
|
||||||
|
NetworkPanel.add(stationsPanel);
|
||||||
|
GridLayout StationsLayout = new GridLayout(2, 1);
|
||||||
|
departText = new JLabel("Départ: ");
|
||||||
|
arrText = new JLabel("Arivée: ");
|
||||||
|
stationsPanel.setLayout(StationsLayout);
|
||||||
|
stationsPanel.add(departText);
|
||||||
|
stationsPanel.add(arrText);
|
||||||
|
paneStops = new JScrollPane();
|
||||||
|
tableStops = new JTable();
|
||||||
|
paneStops.add(tableStops);
|
||||||
|
NetworkPanel.add(paneStops);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ItineraryPanel = new JPanel();
|
||||||
|
CardPanel.add(ItineraryPanel);
|
||||||
|
GridLayout ItineraryLayout = new GridLayout(2, 1);
|
||||||
|
ItineraryPanel.setLayout(ItineraryLayout);
|
||||||
|
paneItinerary = new JScrollPane();
|
||||||
|
tableItinerary = new JTable();
|
||||||
|
paneItinerary.add(tableItinerary);
|
||||||
|
ItineraryPanel.add(paneItinerary);
|
||||||
|
|
||||||
|
|
||||||
|
ButtonBar = new JMenuBar();
|
||||||
|
GridLayout ButtonLayout = new GridLayout(3, 1);
|
||||||
|
ButtonBar.setLayout(ButtonLayout);
|
||||||
|
Home = new JMenuItem("Home");
|
||||||
|
ButtonBar.add(Home);
|
||||||
|
Network = new JMenuItem("Network");
|
||||||
|
ButtonBar.add(Network);
|
||||||
|
|
||||||
|
Itinerary = new JMenuItem("Itinerary");
|
||||||
|
ButtonBar.add(Itinerary);
|
||||||
|
ButtonBar.setPreferredSize(new Dimension(50, 500));
|
||||||
|
|
||||||
|
MainPanel.add(ButtonBar);
|
||||||
|
MainPanel.add(CardPanel);
|
||||||
|
|
||||||
|
|
||||||
|
modelStops = (DefaultTableModel) tableStops.getModel();
|
||||||
|
modelStops.setColumnCount(2);
|
||||||
|
modelStops.setColumnIdentifiers(new Object[]{"Line", "Stop"});
|
||||||
|
|
||||||
|
modelItinerary = (DefaultTableModel) tableItinerary.getModel();
|
||||||
|
modelItinerary.setColumnCount(3);
|
||||||
|
modelItinerary.setColumnIdentifiers(new Object[]{"Line", "Stop", "Time"});
|
||||||
this.StopList = s;
|
this.StopList = s;
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,79 +155,98 @@ public class View extends JFrame {
|
||||||
Home.addActionListener(new ActionListener() {
|
Home.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Cardpanel.removeAll();
|
CardPanel.removeAll();
|
||||||
Cardpanel.add(HomePanel);
|
CardPanel.add(HomePanel);
|
||||||
Cardpanel.repaint();
|
CardPanel.repaint();
|
||||||
Cardpanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Network.addActionListener(new ActionListener() {
|
Network.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
showSearch(s);
|
LoadSearchResult(s, modelStops);
|
||||||
Cardpanel.removeAll();
|
CardPanel.removeAll();
|
||||||
Cardpanel.add(NetworkPanel);
|
CardPanel.add(NetworkPanel);
|
||||||
|
|
||||||
Cardpanel.repaint();
|
CardPanel.repaint();
|
||||||
Cardpanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Favorites.addActionListener(new ActionListener() {
|
Itinerary.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Cardpanel.removeAll();
|
LoadSearchResult(s, modelItinerary);
|
||||||
Cardpanel.add(FavoritesPanel);
|
CardPanel.removeAll();
|
||||||
Cardpanel.repaint();
|
CardPanel.add(ItineraryPanel);
|
||||||
Cardpanel.revalidate();
|
|
||||||
|
CardPanel.repaint();
|
||||||
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
textField1.addKeyListener(new KeyAdapter() {
|
|
||||||
|
|
||||||
|
TextLocation.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
super.keyReleased(e);
|
super.keyReleased(e);
|
||||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
|
|
||||||
searchCur = textField1.getText();
|
searchLocation = TextLocation.getText();
|
||||||
showSearch(s);
|
LoadSearchResult(s, modelStops);
|
||||||
System.out.println("Enter key released with text " + searchCur);
|
System.out.println("Enter key released with text " + searchLocation);
|
||||||
Cardpanel.removeAll();
|
CardPanel.removeAll();
|
||||||
Cardpanel.add(NetworkPanel);
|
CardPanel.add(NetworkPanel);
|
||||||
|
|
||||||
Cardpanel.repaint();
|
CardPanel.repaint();
|
||||||
Cardpanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
searchButton.addActionListener(new ActionListener() {
|
ButtonLocation.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Cardpanel.removeAll();
|
CardPanel.removeAll();
|
||||||
searchCur = textField1.getText();
|
searchLocation = TextLocation.getText();
|
||||||
showSearch(s);
|
LoadSearchResult(s, modelStops);
|
||||||
System.out.println("search button clicked with text " + searchCur);
|
System.out.println("search location clicked with text " + searchLocation);
|
||||||
Cardpanel.add(NetworkPanel);
|
CardPanel.add(NetworkPanel);
|
||||||
|
|
||||||
Cardpanel.repaint();
|
CardPanel.repaint();
|
||||||
Cardpanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.addMouseListener(new MouseAdapter() {
|
|
||||||
|
ButtonCoord.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
CardPanel.removeAll();
|
||||||
|
searchCoord = TextCoord.getText();
|
||||||
|
LoadSearchResult(s, modelStops);
|
||||||
|
System.out.println("search coord clicked with text " + searchCoord);
|
||||||
|
CardPanel.add(NetworkPanel);
|
||||||
|
|
||||||
|
CardPanel.repaint();
|
||||||
|
CardPanel.revalidate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tableStops.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
super.mouseClicked(e);
|
super.mouseClicked(e);
|
||||||
System.out.println("MouseClick: " + e.getX() + ";" + e.getY());
|
System.out.println("MouseClick: " + e.getX() + ";" + e.getY());
|
||||||
showOptionsDialog(table, e.getX(), e.getY());
|
showOptionsDialog(tableStops, e.getX(), e.getY());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
mypane.addMouseListener(new MouseAdapter() {
|
|
||||||
|
paneStops.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
super.mouseClicked(e);
|
super.mouseClicked(e);
|
||||||
|
@ -182,11 +293,11 @@ public class View extends JFrame {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void showSearch(ArrayList<Stop> stops) {
|
public void LoadSearchResult(ArrayList<Stop> stops, DefaultTableModel model) {
|
||||||
// Clear existing rows from the table
|
// Clear existing rows from the table
|
||||||
|
int cols = model.getColumnCount();
|
||||||
model.setRowCount(0);
|
model.setRowCount(0);
|
||||||
model.setColumnCount(2);
|
model.setColumnCount(cols);
|
||||||
|
|
||||||
|
|
||||||
// Add new rows based on the search results
|
// Add new rows based on the search results
|
||||||
|
@ -208,26 +319,39 @@ public class View extends JFrame {
|
||||||
|
|
||||||
System.out.println(count);
|
System.out.println(count);
|
||||||
|
|
||||||
table.revalidate();
|
tableStops.revalidate();
|
||||||
table.repaint();
|
tableStops.repaint();
|
||||||
|
|
||||||
|
tableItinerary.revalidate();
|
||||||
|
tableItinerary.repaint();
|
||||||
|
|
||||||
|
paneStops.setViewportView(tableStops);
|
||||||
|
paneStops.revalidate();
|
||||||
|
paneStops.repaint();
|
||||||
|
|
||||||
|
|
||||||
|
paneItinerary.setViewportView(tableItinerary);
|
||||||
|
paneItinerary.revalidate();
|
||||||
|
paneItinerary.repaint();
|
||||||
|
|
||||||
mypane.setViewportView(table);
|
|
||||||
mypane.revalidate();
|
|
||||||
mypane.repaint();
|
|
||||||
|
|
||||||
NetworkPanel.revalidate();
|
NetworkPanel.revalidate();
|
||||||
NetworkPanel.repaint();
|
NetworkPanel.repaint();
|
||||||
|
|
||||||
|
ItineraryPanel.revalidate();
|
||||||
|
ItineraryPanel.repaint();
|
||||||
|
|
||||||
this.displayTableValues();
|
|
||||||
|
this.displayTableValues(model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayTableValues() {
|
public void displayTableValues(TableModel mod) {
|
||||||
TableModel mod = table.getModel();
|
|
||||||
for (int row = 0; row < mod.getRowCount(); row++) {
|
for (int row = 0; row < mod.getRowCount(); row++) {
|
||||||
for (int column = 0; column < mod.getColumnCount(); column++) {
|
for (int column = 0; column < mod.getColumnCount(); column++) {
|
||||||
System.out.print(mod.getValueAt(row, column).toString() + " ");
|
|
||||||
|
if (mod.getValueAt(row, column) != null) System.out.print(mod.getValueAt(row, column).toString() + " ");
|
||||||
}
|
}
|
||||||
System.out.print(";");
|
System.out.print(";");
|
||||||
|
|
||||||
|
|
Reference in a new issue