-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="lib" level="project" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: converter.Launcher | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package converter; | ||
|
||
import converter.controllers.ConversionController; | ||
import converter.operations.ExcelFile; | ||
import converter.operations.ExceptionHandler; | ||
import converter.operations.FileManager; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.layout.Pane; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
|
||
public class HomeController { | ||
|
||
@FXML | ||
private Button bChoose; | ||
@FXML | ||
private Button info; | ||
@FXML | ||
private Pane infoPane; | ||
@FXML | ||
private Button close; | ||
|
||
private ExcelFile excelFile; | ||
|
||
@FXML | ||
public void initialize() { | ||
|
||
infoPane.setVisible(false); | ||
bChoose.setDefaultButton(true); | ||
bChoose.setOnAction(e -> { | ||
try { | ||
this.chooseFile(); | ||
} catch (IOException ioException) { | ||
StringWriter sw = new StringWriter(); | ||
ioException.printStackTrace(new PrintWriter(sw)); | ||
Main.ioStackTrace = sw.toString(); | ||
Main.exception = ioException; | ||
ExceptionHandler exceptionHandler = new ExceptionHandler(); | ||
} catch (IndexOutOfBoundsException indexOutOfBoundsException) { | ||
StringWriter sw = new StringWriter(); | ||
indexOutOfBoundsException.printStackTrace(new PrintWriter(sw)); | ||
Main.ioStackTrace = sw.toString(); | ||
Main.exception = indexOutOfBoundsException; | ||
ExceptionHandler exceptionHandler = new ExceptionHandler(); | ||
} catch (NumberFormatException numberFormatException) { | ||
StringWriter sw = new StringWriter(); | ||
numberFormatException.printStackTrace(new PrintWriter(sw)); | ||
Main.ioStackTrace = sw.toString(); | ||
Main.exception = numberFormatException; | ||
ExceptionHandler exceptionHandler = new ExceptionHandler(); | ||
} | ||
}); | ||
info.setOnAction(e -> infoPane.setVisible(true)); | ||
close.setOnAction(e -> infoPane.setVisible(false)); | ||
|
||
} | ||
|
||
public void chooseFile() throws IOException, NumberFormatException, IndexOutOfBoundsException { | ||
|
||
FileManager fm = new FileManager(); | ||
File f = fm.chooseFile(); | ||
if (f == null) { | ||
bChoose.setDisable(false); | ||
} else { | ||
Main.homeStage.hide(); | ||
|
||
FXMLLoader loader = new FXMLLoader(getClass().getResource("fxmlFiles/SaveOptions.fxml")); | ||
Parent root = loader.load(); | ||
|
||
excelFile = new ExcelFile(f); | ||
SaveController controller = loader.getController(); | ||
controller.setEf(excelFile); | ||
|
||
Main.secondStage.setTitle("Saving Options"); | ||
Main.secondStage.setScene(new Scene(root, 400, 251)); | ||
Main.secondStage.setResizable(false); | ||
Main.secondStage.setOnCloseRequest(e -> ConversionController.returnHome()); | ||
Main.secondStage.show(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package converter; | ||
|
||
public class Launcher { | ||
|
||
public static void main(String[] args) { | ||
Main.main(args); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package converter; | ||
|
||
import converter.operations.ExceptionHandler; | ||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.image.Image; | ||
import javafx.stage.Modality; | ||
import javafx.stage.Stage; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
|
||
public class Main extends Application { | ||
|
||
public static Stage homeStage; | ||
public static Stage secondStage; | ||
|
||
public static String ioStackTrace; | ||
public static Exception exception; | ||
|
||
@Override | ||
public void start(Stage primaryStage) throws IOException { | ||
|
||
homeStage = new Stage(); | ||
secondStage = new Stage(); | ||
|
||
FXMLLoader loader = new FXMLLoader(getClass().getResource("fxmlFiles/Home.fxml")); | ||
Parent root = (Parent) loader.load(); | ||
|
||
homeStage.getIcons().add(new Image("file:resources/iconfinder_General_Office_48_3592847.png")); | ||
homeStage.setScene(new Scene(root, 600, 400)); | ||
homeStage.setTitle("Mold Base Converter"); | ||
homeStage.setResizable(false); | ||
|
||
homeStage.setOnCloseRequest(e -> { | ||
try { | ||
e.consume(); | ||
closeRequest(); | ||
} catch (IOException ioException) { | ||
StringWriter sw = new StringWriter(); | ||
ioException.printStackTrace(new PrintWriter(sw)); | ||
Main.ioStackTrace = sw.toString(); | ||
Main.exception = ioException; | ||
ExceptionHandler exceptionHandler = new ExceptionHandler(); | ||
} | ||
}); | ||
|
||
homeStage.show(); | ||
} | ||
|
||
public void closeRequest() throws IOException { | ||
|
||
Stage close = new Stage(); | ||
Parent root = FXMLLoader.load(getClass().getResource("fxmlFiles/CloseRequest.fxml")); | ||
close.setScene(new Scene(root, 350, 150)); | ||
close.setResizable(false); | ||
close.getIcons().add(new Image("file:resources/iconfinder_General_Office_48_3592847.png")); | ||
|
||
close.initModality(Modality.WINDOW_MODAL); | ||
close.initOwner(Main.homeStage); | ||
close.showAndWait(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
launch(args); | ||
} | ||
} |