Skip to content

Commit

Permalink
Added download window
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Bueide committed Oct 3, 2016
1 parent 6ca59ae commit 6ad882c
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 0 deletions.
Binary file added libs/commons-csv-1.4.jar
Binary file not shown.
Binary file added libs/commons-io-2.5.jar
Binary file not shown.
3 changes: 3 additions & 0 deletions nsaa-seed-predictor/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: main.Main

42 changes: 42 additions & 0 deletions nsaa-seed-predictor/src/controller/DownloadController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package controller;

import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

/**
* Created by Andrew Bueide on 10/3/16.
*/
public class DownloadController implements Initializable {

public DownloadController(){}


@Override
public void initialize(URL url, ResourceBundle resourceBundle) {

}

public void display() {
FXMLLoader loader = new FXMLLoader(
getClass().getClassLoader().getResource("view/download.fxml"));
loader.setController(this);
Parent root;
try {
root = loader.load();
Stage stage = new Stage();
stage.setTitle("Download file");
stage.setScene(new Scene(root));
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}

}
44 changes: 44 additions & 0 deletions nsaa-seed-predictor/src/controller/MainController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

/**
* Created by Andrew Bueide on 10/2/16.
*/
public class MainController implements Initializable{
@FXML
MenuItem download;
public MainController(){};

public MainController(String file){}

public void launch(Stage primaryStage) {
FXMLLoader loader = new FXMLLoader(
getClass().getClassLoader().getResource("view/main.fxml"));
loader.setController(this);
Parent root;
try {
root = loader.load();
primaryStage.setTitle("NSAA Seed Predictor by Andrew Bueide");
primaryStage.setScene(new Scene(root));
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
download.setOnAction(e -> new DownloadController().display());
}
}
18 changes: 18 additions & 0 deletions nsaa-seed-predictor/src/main/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main;

import controller.MainController;
import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception{
new MainController().launch(primaryStage);
}


public static void main(String[] args) {
launch(args);
}
}
50 changes: 50 additions & 0 deletions nsaa-seed-predictor/src/view/download.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>

<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="187.0" prefWidth="610.0" spacing="10.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox alignment="CENTER_LEFT" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<ComboBox prefWidth="230.0" promptText="Class" />
<Button mnemonicParsing="false" prefWidth="60.0" text="Open" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Opens a new file with latest game results" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<ComboBox prefWidth="230.0" promptText="Example.csv" />
<Button mnemonicParsing="false" prefWidth="60.0" text="Insert" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Inserts latest game results" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" VBox.vgrow="ALWAYS">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="OR enter your own link" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<TextField prefHeight="26.0" prefWidth="230.0" promptText="www.example.com/example.csv" />
<Button mnemonicParsing="false" prefWidth="60.0" text="Open" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Opens linked csv as new file" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<ComboBox prefWidth="230.0" promptText="Example.csv" />
<Button mnemonicParsing="false" prefWidth="60.0" text="Insert" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Inserts game results from link" />
</children>
</HBox>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
66 changes: 66 additions & 0 deletions nsaa-seed-predictor/src/view/main.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>


<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1">
<children>
<MenuBar>
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Open..." />
<MenuItem fx:id="download" mnemonicParsing="false" text="Download..." />
<MenuItem mnemonicParsing="false" text="Save" />
<MenuItem mnemonicParsing="false" text="Save as..." />
<MenuItem mnemonicParsing="false" text="Exit" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<TabPane prefHeight="349.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" VBox.vgrow="ALWAYS">
<tabs>
<Tab text="Example.csv">
<content>
<AnchorPane>
<children>
<VBox prefHeight="338.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<TableView VBox.vgrow="ALWAYS">
<columns>
<TableColumn prefWidth="116.0" text="Game" />
<TableColumn prefWidth="125.0" text="Date" />
<TableColumn prefWidth="82.0" text="Outcome" />
</columns>
</TableView>
<TableView>
<columns>
<TableColumn prefWidth="75.0" text="Seed" />
<TableColumn prefWidth="64.0" text="Team" />
<TableColumn prefWidth="86.0" text="Record" />
<TableColumn prefWidth="75.0" text="Points" />
</columns>
</TableView>
</children>
</VBox>
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</VBox>

0 comments on commit 6ad882c

Please sign in to comment.