-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JIMMY
committed
May 4, 2017
0 parents
commit 32ee2cd
Showing
33 changed files
with
2,515 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/> | ||
<classpathentry kind="lib" path="lib/jgrapht-core-0.9.0.jar"/> | ||
<classpathentry kind="lib" path="lib/jgrapht-core-0.9.2-javadoc.jar"/> | ||
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.29-bin.jar"/> | ||
<classpathentry kind="lib" path="lib/simplelatlng-1.3.0.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Lab09_MetroDeParis</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/MetroDeParis.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.layout.BorderPane?> | ||
|
||
<BorderPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="it.polito.tdp.metrodeparis.MetroDeParisController"> | ||
<!-- TODO Add Nodes --> | ||
</BorderPane> |
Binary file added
BIN
+345 Bytes
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/MetroDeParisController.class
Binary file not shown.
1 change: 1 addition & 0 deletions
1
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/application.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ |
Binary file added
BIN
+1.14 KB
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/dao/DBConnect.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+961 Bytes
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/dao/TestDAO.class
Binary file not shown.
Binary file added
BIN
+1.78 KB
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/model/Fermata.class
Binary file not shown.
Binary file added
BIN
+306 Bytes
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/model/Model.class
Binary file not shown.
Binary file added
BIN
+745 Bytes
Lab09_MetroDeParis/bin/it/polito/tdp/metrodeparis/model/TestModel.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="ASCII"?> | ||
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build"> | ||
<deploy> | ||
<application name="Lab8_MetroDeParis"/> | ||
<info/> | ||
</deploy> | ||
<signjar/> | ||
</anttasks:AntTask> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package it.polito.tdp.metrodeparis; | ||
|
||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Scene; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.stage.Stage; | ||
|
||
public class Main extends Application { | ||
@Override | ||
public void start(Stage primaryStage) { | ||
try { | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("MetroDeParis.fxml")); | ||
BorderPane root = (BorderPane) loader.load(); | ||
MetroDeParisController controller = loader.getController(); | ||
|
||
// TODO: Set the model | ||
|
||
Scene scene = new Scene(root); | ||
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); | ||
primaryStage.setScene(scene); | ||
primaryStage.show(); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
launch(args); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/MetroDeParis.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.layout.BorderPane?> | ||
|
||
<BorderPane xmlns:fx="http://javafx.com/fxml/1" fx:controller="it.polito.tdp.metrodeparis.MetroDeParisController"> | ||
<!-- TODO Add Nodes --> | ||
</BorderPane> |
5 changes: 5 additions & 0 deletions
5
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/MetroDeParisController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package it.polito.tdp.metrodeparis; | ||
|
||
public class MetroDeParisController { | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/application.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ |
35 changes: 35 additions & 0 deletions
35
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/dao/DBConnect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package it.polito.tdp.metrodeparis.dao; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
|
||
public class DBConnect { | ||
|
||
static private final String jdbcUrl = "jdbc:mysql://localhost/metroparis?user=root"; | ||
static private DBConnect instance = null; | ||
|
||
private DBConnect() { | ||
instance = this; | ||
} | ||
|
||
public static DBConnect getInstance() { | ||
if (instance == null) | ||
return new DBConnect(); | ||
else { | ||
return instance; | ||
} | ||
} | ||
|
||
public Connection getConnection() { | ||
try { | ||
|
||
Connection conn = DriverManager.getConnection(jdbcUrl); | ||
return conn; | ||
|
||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
throw new RuntimeException("Errore di connessione al database"); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/dao/MetroDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package it.polito.tdp.metrodeparis.dao; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.javadocmd.simplelatlng.LatLng; | ||
|
||
import it.polito.tdp.metrodeparis.model.Fermata; | ||
|
||
public class MetroDAO { | ||
|
||
public List<Fermata> getAllFermate() { | ||
|
||
final String sql = "SELECT id_fermata, nome, coordx, coordy FROM fermata ORDER BY nome ASC"; | ||
List<Fermata> fermate = new ArrayList<Fermata>(); | ||
|
||
try { | ||
Connection conn = DBConnect.getInstance().getConnection(); | ||
PreparedStatement st = conn.prepareStatement(sql); | ||
ResultSet rs = st.executeQuery(); | ||
|
||
while (rs.next()) { | ||
Fermata f = new Fermata(rs.getInt("id_Fermata"), rs.getString("nome"), new LatLng(rs.getDouble("coordx"), rs.getDouble("coordy"))); | ||
fermate.add(f); | ||
} | ||
|
||
st.close(); | ||
conn.close(); | ||
|
||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
throw new RuntimeException("Errore di connessione al Database."); | ||
} | ||
|
||
return fermate; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/dao/TestDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package it.polito.tdp.metrodeparis.dao; | ||
|
||
import java.util.List; | ||
|
||
import it.polito.tdp.metrodeparis.model.Fermata; | ||
|
||
public class TestDAO { | ||
|
||
public static void main(String[] args) { | ||
|
||
MetroDAO metroDAO = new MetroDAO(); | ||
|
||
System.out.println("Lista fermate"); | ||
List<Fermata> fermate = metroDAO.getAllFermate(); | ||
System.out.println(fermate); | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/model/Fermata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package it.polito.tdp.metrodeparis.model; | ||
|
||
import com.javadocmd.simplelatlng.LatLng; | ||
|
||
public class Fermata { | ||
|
||
private int idFermata; | ||
private String nome; | ||
private LatLng coords; | ||
|
||
public Fermata(int idFermata, String nome, LatLng coords) { | ||
this.idFermata = idFermata; | ||
this.nome = nome; | ||
this.coords = coords; | ||
} | ||
|
||
public Fermata(int idFermata) { | ||
this.idFermata = idFermata; | ||
} | ||
|
||
public int getIdFermata() { | ||
return idFermata; | ||
} | ||
|
||
public void setIdFermata(int idFermata) { | ||
this.idFermata = idFermata; | ||
} | ||
|
||
public String getNome() { | ||
return nome; | ||
} | ||
|
||
public void setNome(String nome) { | ||
this.nome = nome; | ||
} | ||
|
||
public LatLng getCoords() { | ||
return coords; | ||
} | ||
|
||
public void setCoords(LatLng coords) { | ||
this.coords = coords; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return ((Integer) idFermata).hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
Fermata other = (Fermata) obj; | ||
if (idFermata != other.idFermata) | ||
return false; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return nome; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/model/Model.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package it.polito.tdp.metrodeparis.model; | ||
|
||
public class Model { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
Lab09_MetroDeParis/src/it/polito/tdp/metrodeparis/model/TestModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package it.polito.tdp.metrodeparis.model; | ||
|
||
public class TestModel { | ||
|
||
public static void main(String[] args) { | ||
|
||
Model model = new Model(); | ||
System.out.println("TODO: write a Model class and test it!"); | ||
} | ||
|
||
} |
Binary file not shown.