-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
32 changed files
with
497 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,61 @@ | ||
package controllers; | ||
|
||
import countries.Countries; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.ChoiceBox; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.text.Text; | ||
import javafx.stage.Modality; | ||
import javafx.stage.Stage; | ||
import views.Main; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class AgregarController implements Initializable { | ||
private Countries countries; | ||
{ | ||
countries = Countries.getInstance(); | ||
} | ||
static ObservableList<String> continents = FXCollections.observableArrayList(); | ||
{ | ||
continents.addAll(countries.getAllContinents()); | ||
} | ||
@FXML | ||
public TextField contName; | ||
public TextField countName; | ||
public TextField countSize; | ||
public TextField countLang; | ||
|
||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
|
||
} | ||
public void addCountry() throws IOException { | ||
int size = 0; | ||
try{ | ||
size = Integer.valueOf(countSize.getText()); | ||
}catch (Exception e){ | ||
Stage stage = new Stage(); | ||
stage.setTitle("Error!"); | ||
stage.initModality(Modality.APPLICATION_MODAL); | ||
BorderPane b = new BorderPane(); | ||
b.setCenter(new Text("That's not a number!")); | ||
Scene scene = new Scene(b, 100,100); | ||
stage.setScene(scene); | ||
stage.show(); | ||
} | ||
Countries.addNewCountry(contName.getText(),countName.getText(),Integer.valueOf(countSize.getText()),countLang.getText()); | ||
} | ||
public void returnToMenu() throws IOException { | ||
Main.returnToMenuFromOtherPlaces(); | ||
} | ||
} |
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,43 @@ | ||
package controllers; | ||
|
||
import countries.Countries; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.control.ChoiceBox; | ||
import javafx.scene.control.ListView; | ||
import views.Main; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class ContinentController implements Initializable { | ||
private Countries countries; | ||
{ | ||
countries = Countries.getInstance(); | ||
} | ||
static ObservableList<String> continents = FXCollections.observableArrayList(); | ||
{ | ||
continents.addAll(countries.getAllContinents()); | ||
} | ||
@FXML | ||
public ChoiceBox<String> contChoice; | ||
public ListView<String> byContinentList; | ||
|
||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
|
||
} | ||
public void populateListByContinent(){ | ||
ObservableList<String> paises = FXCollections.observableArrayList(); | ||
paises.addAll(countries.getCountriesByContinent(contChoice.getValue())); | ||
byContinentList.getItems().clear(); | ||
byContinentList.getItems().addAll(paises); | ||
} | ||
public void returnToMenu() throws IOException { | ||
Main.returnToMenuFromOtherPlaces(); | ||
} | ||
} |
This file was deleted.
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,42 @@ | ||
package controllers; | ||
|
||
import countries.Countries; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.Parent; | ||
import javafx.scene.control.ChoiceBox; | ||
import javafx.scene.control.ComboBox; | ||
import javafx.scene.control.ListView; | ||
import views.Main; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class LangController implements Initializable { | ||
private Countries countries; | ||
{ | ||
countries = Countries.getInstance(); | ||
} | ||
@FXML | ||
public ListView<String> byLangList; | ||
public ChoiceBox<String> langChoice; | ||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
langChoice.getItems().clear(); | ||
langChoice.getItems().addAll(Countries.getAllLangs()); | ||
} | ||
public void populateListByLang(){ | ||
ObservableList<String> paises = FXCollections.observableArrayList(); | ||
paises.addAll(countries.getCountriesByLang(langChoice.getValue())); | ||
byLangList.getItems().clear(); | ||
byLangList.getItems().addAll(paises); | ||
} | ||
public void returnToMenu() throws IOException { | ||
Main.returnToMenuFromOtherPlaces(); | ||
} | ||
} |
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,66 @@ | ||
package controllers; | ||
|
||
import countries.Countries; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.layout.Border; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.text.Text; | ||
import javafx.stage.Modality; | ||
import javafx.stage.Stage; | ||
import views.Main; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.ResourceBundle; | ||
|
||
public class SizeController implements Initializable { | ||
private Countries countries; | ||
{ | ||
countries = Countries.getInstance(); | ||
} | ||
@FXML | ||
public ListView<String> bySizeList; | ||
public TextField sizeTextField; | ||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
|
||
} | ||
|
||
public void populateListBySize(){ | ||
ObservableList<String> paises = FXCollections.observableArrayList(); | ||
int sizeToLookFor = 0; | ||
try{ | ||
sizeToLookFor = Integer.valueOf(sizeTextField.getText()); | ||
}catch (Exception e){ | ||
Stage stage = new Stage(); | ||
stage.setTitle("Error!"); | ||
stage.initModality(Modality.APPLICATION_MODAL); | ||
BorderPane b = new BorderPane(); | ||
b.setCenter(new Text("That's not a number!")); | ||
Scene scene = new Scene(b, 100,100); | ||
stage.setScene(scene); | ||
stage.show(); | ||
} | ||
List<String> result = countries.getCountriesBySize(sizeToLookFor); | ||
if(result.size() != 0){ | ||
paises.addAll(result); | ||
}else{ | ||
ObservableList<String> temp = FXCollections.observableArrayList("No existen países con una extensión de" + sizeToLookFor + " o mayor."); | ||
} | ||
|
||
bySizeList.getItems().clear(); | ||
bySizeList.getItems().addAll(paises); | ||
} | ||
public void returnToMenu() throws IOException { | ||
Main.returnToMenuFromOtherPlaces(); | ||
} | ||
} |
Oops, something went wrong.