Skip to content

Commit

Permalink
Add Mold Base Converter project files
Browse files Browse the repository at this point in the history
  • Loading branch information
epi-xel committed Dec 11, 2022
1 parent 42a14db commit 8ef92a6
Show file tree
Hide file tree
Showing 32 changed files with 1,191 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions .idea/artifacts/Mold_Base_Converter_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/runConfigurations/Main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Mold Base Converter.iml
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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions 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: converter.Launcher

88 changes: 88 additions & 0 deletions src/converter/HomeController.java
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();
}
}
}
8 changes: 8 additions & 0 deletions src/converter/Launcher.java
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);
}
}
70 changes: 70 additions & 0 deletions src/converter/Main.java
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);
}
}
Loading

0 comments on commit 8ef92a6

Please sign in to comment.