Skip to content

Commit

Permalink
Merge pull request #28 from mhijazi1/Iwasaki
Browse files Browse the repository at this point in the history
Iwasaki
  • Loading branch information
Mo committed Oct 25, 2015
2 parents a749859 + 57e2faf commit 5e77e9b
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,35 @@
*
* @author Iwasaki
*/
public class AddVehicleController implements Initializable {

public class AddVehicleController implements Initializable, GlobalValidator {
final JFileChooser chooser = new JFileChooser();
tagg validator = new tagg(System.getProperty("user.dir") + "/src/main/resources/python");

@FXML
private TextField fronttext;

@FXML
private TextField backtext;

@FXML
private TextField passtext;

@FXML
private TextField drivertext;


@FXML
private Button importbtn;

@FXML
private Button frontbtn;

@FXML
private Button uploadbtn;

@FXML
private Button backbtn;

@FXML
private Button driverbtn;

@FXML
private Button passengerbtn;

@FXML
private Button submitbtn;


@FXML
private void OpenUpload(ActionEvent event) throws IOException {
Stage stage;
if(event.getSource()== frontbtn){
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
fronttext.setText(chooser.getSelectedFile().getPath());
fronttext.setText(chooser.getSelectedFile().getAbsolutePath());
} else {
System.out.println("No Selection ");
}
Expand All @@ -84,7 +65,7 @@ else if(event.getSource()== backbtn){
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
fronttext.setText(chooser.getSelectedFile().getPath());
backtext.setText(chooser.getSelectedFile().getAbsolutePath());
} else {
System.out.println("No Selection ");
}
Expand All @@ -94,7 +75,7 @@ else if(event.getSource()== driverbtn){
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
fronttext.setText(chooser.getSelectedFile().getPath());
drivertext.setText(chooser.getSelectedFile().getAbsolutePath());
} else {
System.out.println("No Selection ");
}
Expand All @@ -104,14 +85,39 @@ else if(event.getSource()== passengerbtn){
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
fronttext.setText(chooser.getSelectedFile().getPath());
passtext.setText(chooser.getSelectedFile().getAbsolutePath());
} else {
System.out.println("No Selection ");
}
}

}

}
@FXML
private void ToDispute(ActionEvent event) throws IOException {
Stage stage;
Parent root;
PredictionVariables.frontURL = fronttext.getText();
PredictionVariables.backURL = backtext.getText();
PredictionVariables.driverURL = drivertext.getText();
PredictionVariables.passURL = passtext.getText();

PredictionVariables.frontstatus = validator.predict(PredictionVariables.frontURL);
PredictionVariables.backstatus= validator.predict( PredictionVariables.backURL);
PredictionVariables.driverstatus = validator.predict( PredictionVariables.driverURL);
PredictionVariables.passstatus = validator.predict( PredictionVariables.passURL);


stage=(Stage) submitbtn.getScene().getWindow();
root = FXMLLoader.load(getClass().getResource("/fxml/Dispute.fxml"));




Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,189 @@
*/
package gsu.ugahacksproject;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

/**
* FXML Controller class
*
* @author Iwasaki
*/
public class DisputeController implements Initializable {
public class DisputeController implements Initializable, GlobalValidator {
String expected;
String dent = "dent";
String perfect = "perfect";
String fstate = "";
String bstate = "";
String dstate = "";
String pstate = "";

String fstatefinal;
String bstatefinal;
String dstatefinal;
String pstatefinal;

@FXML
private CheckBox frontdent;
@FXML
private CheckBox frontgood;
@FXML
private CheckBox backdent;
@FXML
private CheckBox backgood;
@FXML
private CheckBox driverdent;
@FXML
private CheckBox drivergood;
@FXML
private CheckBox passdent;
@FXML
private CheckBox passgood;
@FXML
private Button confirmbtn;



@FXML
private void ToHome(ActionEvent event) throws IOException {
Stage stage;
Parent root;

if(PredictionVariables.frontstatus.equals(dent))
{
fstatefinal+= "dent";
}
else
{
fstatefinal += "perfect";
}
if(PredictionVariables.backstatus.equals(dent))
{
bstatefinal += "dent";
}
else
{
bstatefinal += "perfect";
}
if(PredictionVariables.driverstatus.equals(dent))
{
dstatefinal += "dent";
}
else
{
dstatefinal += "perfect";
}
if(PredictionVariables.passstatus.equals(dent))
{
pstatefinal += "dent";
}
else
{
pstatefinal += "perfect";
}





if(fstate.equals(fstatefinal))
{
validator.trainNew(PredictionVariables.frontURL, PredictionVariables.frontstatus);
}
else
{
validator.dispute(PredictionVariables.frontURL, PredictionVariables.frontstatus, fstate);
}
if(bstate.equals(bstatefinal))
{
validator.trainNew(PredictionVariables.backURL, PredictionVariables.backstatus);
}
else
{
validator.dispute(PredictionVariables.backURL, PredictionVariables.backstatus, bstate);
}
if(dstate.equals(dstatefinal))
{
validator.trainNew(PredictionVariables.driverURL, PredictionVariables.driverstatus);
}
else
{
validator.dispute(PredictionVariables.driverURL, PredictionVariables.driverstatus, dstate);
}
if(pstate.equals(pstatefinal))
{
validator.trainNew(PredictionVariables.passURL, PredictionVariables.passstatus);
}
else
{
validator.dispute(PredictionVariables.passURL, PredictionVariables.passstatus, pstate);
}





stage=(Stage) confirmbtn.getScene().getWindow();
root = FXMLLoader.load(getClass().getResource("/fxml/Home.fxml"));

/**
* Initializes the controller class.
*/
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
if(PredictionVariables.frontstatus.equals("dent"))
{
frontdent.setSelected(true);
fstate += "dent";
}
else
{
frontgood.setSelected(true);
fstate += "perfect";
}
if(PredictionVariables.backstatus.equals("dent"))
{
backdent.setSelected(true);
bstate += "dent";
}
else
{
backgood.setSelected(true);
bstate += "perfect";
}
if(PredictionVariables.driverstatus.equals("dent"))
{
driverdent.setSelected(true);
dstate += "dent";
}
else
{
drivergood.setSelected(true);
dstate += "perfect";
}
if(PredictionVariables.passstatus.equals("dent"))
{
passdent.setSelected(true);
pstate += "dent";
}
else
{
passgood.setSelected(true);
pstate += "perfect";
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gsu.ugahacksproject;

/**
*
* @author Iwasaki
*/
public interface GlobalValidator {
tagg validator = new tagg(System.getProperty("user.dir") + "/src/main/resources/python");
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public void start(Stage stage) throws Exception {
Scene scene = new Scene(root);
//scene.getStylesheets().add("/styles/Styles.css");

stage.setTitle("JavaFX and Maven");
stage.setScene(scene);
stage.show();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gsu.ugahacksproject;

public class PredictionVariables {
public static String frontstatus;
public static String backstatus;
public static String driverstatus;
public static String passstatus;

public static String frontURL;
public static String backURL;
public static String driverURL;
public static String passURL;
}
4 changes: 2 additions & 2 deletions UGAHacksProject/src/main/resources/fxml/AddVehicle.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</Label>
<TextField fx:id="fronttext" layoutX="126.0" layoutY="353.0" prefHeight="25.0" prefWidth="216.0" promptText="Front View" />
<Button fx:id="frontbtn" layoutX="358.0" layoutY="353.0" mnemonicParsing="false" onAction="#OpenUpload" text="Browse" />
<TextField fx:id="reartext" layoutX="126.0" layoutY="403.0" prefHeight="25.0" prefWidth="216.0" promptText="Rear View" />
<TextField fx:id="backtext" layoutX="126.0" layoutY="403.0" prefHeight="25.0" prefWidth="216.0" promptText="Rear View" />
<TextField fx:id="drivertext" layoutX="126.0" layoutY="451.0" prefHeight="25.0" prefWidth="216.0" promptText="Driver Side" />
<TextField fx:id="passtext" layoutX="127.0" layoutY="499.0" prefHeight="25.0" prefWidth="216.0" promptText="Passenger Side" />
<Button fx:id="driverbtn" layoutX="358.0" layoutY="451.0" mnemonicParsing="false" onAction="#OpenUpload" text="Browse" />
Expand All @@ -26,7 +26,7 @@
<Hyperlink layoutX="289.0" layoutY="428.0" text="Example" />
<Hyperlink layoutX="289.0" layoutY="476.0" text="Example" />
<Hyperlink layoutX="289.0" layoutY="526.0" text="Example" />
<Button fx:id="submitbtn" layoutX="170.0" layoutY="571.0" mnemonicParsing="false" prefHeight="23.0" prefWidth="203.0" style="-fx-background-color: rgba(48,132,217);" text="Submit Vehicle" textFill="WHITE">
<Button fx:id="submitbtn" layoutX="170.0" layoutY="571.0" mnemonicParsing="false" onAction="#ToDispute" prefHeight="23.0" prefWidth="203.0" style="-fx-background-color: rgba(48,132,217);" text="Submit Vehicle" textFill="WHITE">
<font>
<Font size="18.0" />
</font>
Expand Down
18 changes: 9 additions & 9 deletions UGAHacksProject/src/main/resources/fxml/Dispute.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
<Font size="28.0" />
</font>
</Label>
<CheckBox layoutX="248.0" layoutY="171.0" mnemonicParsing="false" text="Dented" />
<CheckBox layoutX="248.0" layoutY="195.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox layoutX="254.0" layoutY="730.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox layoutX="254.0" layoutY="699.0" mnemonicParsing="false" text="Dented" />
<CheckBox layoutX="254.0" layoutY="557.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox layoutX="254.0" layoutY="530.0" mnemonicParsing="false" text="Dented" />
<CheckBox layoutX="254.0" layoutY="369.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox layoutX="254.0" layoutY="343.0" mnemonicParsing="false" text="Dented" />
<Button layoutX="549.0" layoutY="780.0" mnemonicParsing="false" text="Submit" />
<CheckBox fx:id="frontdent" layoutX="248.0" layoutY="171.0" mnemonicParsing="false" text="Dented" />
<CheckBox fx:id="frontgood" layoutX="248.0" layoutY="195.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox fx:id="passgood" layoutX="254.0" layoutY="730.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox fx:id="passdent" layoutX="254.0" layoutY="699.0" mnemonicParsing="false" text="Dented" />
<CheckBox fx:id="drivergood" layoutX="254.0" layoutY="557.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox fx:id="driverdent" layoutX="254.0" layoutY="530.0" mnemonicParsing="false" text="Dented" />
<CheckBox fx:id="backgood" layoutX="254.0" layoutY="369.0" mnemonicParsing="false" text="Good Condition" />
<CheckBox fx:id="backdent" layoutX="254.0" layoutY="343.0" mnemonicParsing="false" text="Dented" />
<Button fx:id="confirmbtn" layoutX="549.0" layoutY="780.0" mnemonicParsing="false" onAction="#ToHome" text="Confirm" />
</children>
</AnchorPane>
</center>
Expand Down

0 comments on commit 5e77e9b

Please sign in to comment.