added progress bar

This commit is contained in:
nedlir 2022-03-31 15:59:18 +02:00
parent 07f1ce9427
commit ac8f461594
5 changed files with 30 additions and 9 deletions

View File

@ -41,25 +41,39 @@ public class Controller {
private Image wordImage;
private Image excelImage;
private Image powerpointImage;
private Image progressOnGoing;
private Image progressFinished;
@FXML
private Text fileText;
@FXML
private Text invalidFileText;
@FXML
private ImageView progressBarBrowse;
@FXML
private ImageView progressBarRemove;
@FXML
public void initialize() {
anchorPane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
invalidFileText.setVisible(false); // hides the invalid file text
invalidFileText.setVisible(false);
progressBarBrowse.setVisible(false);
progressBarRemove.setVisible(false);
try {
wordImage = new Image(getClass().getResourceAsStream("img/word.png"));
powerpointImage = new Image(getClass().getResourceAsStream("img/powerpoint.png"));
excelImage = new Image(getClass().getResourceAsStream("img/excel.png"));
progressOnGoing = new Image(getClass().getResourceAsStream("img/prog-bar-ongoing.gif"));
progressFinished = new Image(getClass().getResourceAsStream("img/prog-bar-complete.png"));
} catch (Exception e) {
e.printStackTrace();
@ -70,7 +84,8 @@ public class Controller {
void browsePressed(ActionEvent event) {
invalidFileText.setVisible(false);
progressBarBrowse.setVisible(true);
progressBarBrowse.setImage(progressOnGoing);
try {
fileChooser = new FileChooser();
fileChooser.setTitle("Please Select a File");
@ -100,6 +115,9 @@ public class Controller {
}
try {
progressBarRemove.setVisible(true);
progressBarRemove.setImage(progressOnGoing);
FileManipulator manipulator = new FileManipulator(filePath, "./"); // create new object to manipulate the file
manipulator.extractFile(); // extract XML from file
@ -115,8 +133,10 @@ public class Controller {
manipulator.insertFile(); // write back to file
manipulator.removeXMLFile(); // cleans the xml extracted from origin file
fileText.setText(fileFinishedMessage());
progressBarRemove.setImage(progressFinished);
}
} catch (Exception e) {
@ -153,6 +173,7 @@ public class Controller {
private void setScreenByFileType() {
titleImageView.setVisible(false);
progressBarBrowse.setVisible(false);
switch (fileType) {
case EXCEL:

View File

@ -35,12 +35,14 @@
</Text>
<Text layoutX="280.0" layoutY="537.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Art by " />
<Hyperlink layoutX="312.0" layoutY="521.0" onAction="#openCioccolatodorimaURL" text="Cioccolatodorima" />
<Text fx:id="invalidFileText" fill="RED" layoutX="221.0" layoutY="512.0" strokeType="OUTSIDE" strokeWidth="0.0" text="File not supported. Please use &quot;.pptx&quot;, &quot;.docx&quot; or &quot;.xlsx&quot;">
<Text fx:id="invalidFileText" fill="RED" layoutX="234.0" layoutY="514.0" strokeType="OUTSIDE" strokeWidth="0.0" text="File not supported. Please use &quot;.pptx&quot;, &quot;.docx&quot; or &quot;.xlsx&quot;">
<font>
<Font size="14.0" />
</font>
</Text>
<Text layoutX="305.0" layoutY="554.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Code by " />
<Hyperlink layoutX="348.0" layoutY="538.0" onAction="#openNedlirURL" text="nedlir" />
<Hyperlink layoutX="351.0" layoutY="537.0" onAction="#openNedlirURL" text="nedlir" />
<ImageView fx:id="progressBarRemove" fitHeight="30.0" fitWidth="347.0" layoutX="230.0" layoutY="494.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fx:id="progressBarBrowse" fitHeight="30.0" fitWidth="398.0" layoutX="171.0" layoutY="451.0" pickOnBounds="true" preserveRatio="true" />
</children>
</AnchorPane>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="25225"/><workbookPr defaultThemeVersion="166925"/><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="x15"><x15ac:absPath url="C:\Users\Liran Neduva\Desktop\" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="13_ncr:1_{DF33D4B3-B0EF-4B3F-B0D0-67161B1CF47A}" xr6:coauthVersionLast="47" xr6:coauthVersionMax="47" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="-120" yWindow="-120" windowWidth="20730" windowHeight="11160" xr2:uid="{52F2438F-A815-44A8-B6F5-B307D753DD34}"/></bookViews><sheets><sheet name=יליון1" sheetId="1" r:id="rId1"/></sheets><calcPr calcId="191029"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:workbookPr chartTrackingRefBase="1"/></ext><ext uri="{B58B0392-4F1F-4190-BB64-5DF3571DCE5F}" xmlns:xcalcf="http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures"><xcalcf:calcFeatures><xcalcf:feature name="microsoft.com:RD"/><xcalcf:feature name="microsoft.com:Single"/><xcalcf:feature name="microsoft.com:FV"/><xcalcf:feature name="microsoft.com:CNMTM"/></xcalcf:calcFeatures></ext></extLst></workbook>