diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index a9e1831..515168c 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,32 +1,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 3cee6c5..92257e7 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,6 +1,7 @@
+
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..780641d
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,1113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_14_0_1.xml b/.idea/libraries/Maven__com_google_guava_guava_14_0_1.xml
new file mode 100644
index 0000000..b71e220
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_guava_guava_14_0_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_10.xml b/.idea/libraries/Maven__junit_junit_4_10.xml
new file mode 100644
index 0000000..ed8bf5f
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_all_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_all_1_3.xml
new file mode 100644
index 0000000..5619316
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_all_1_3.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_0_0_M4.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_0_0_M4.xml
new file mode 100644
index 0000000..9d5417b
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_0_0_M4.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_0_0_M4.xml
new file mode 100644
index 0000000..ef0909d
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_0_0_M4.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_0_0_M4.xml
new file mode 100644
index 0000000..1f0a149
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_0_0_M4.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_0_0_M4.xml
new file mode 100644
index 0000000..9908811
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_launcher_1_0_0_M4.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_launcher_1_0_0_M4.xml
new file mode 100644
index 0000000..c68fd66
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_launcher_1_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_runner_1_0_0_M4.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_runner_1_0_0_M4.xml
new file mode 100644
index 0000000..2b3c315
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_runner_1_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_suite_api_1_0_0_M4.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_suite_api_1_0_0_M4.xml
new file mode 100644
index 0000000..4e2c02e
--- /dev/null
+++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_suite_api_1_0_0_M4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_loadui_testFx_3_0_0.xml b/.idea/libraries/Maven__org_loadui_testFx_3_0_0.xml
new file mode 100644
index 0000000..ca10a5b
--- /dev/null
+++ b/.idea/libraries/Maven__org_loadui_testFx_3_0_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_opentest4j_opentest4j_1_0_0_M2.xml b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_0_0_M2.xml
new file mode 100644
index 0000000..c237915
--- /dev/null
+++ b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_0_0_M2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/commons_io_commons_io_2_4.xml b/.idea/libraries/commons_io_commons_io_2_4.xml
deleted file mode 100644
index 9ca89f9..0000000
--- a/.idea/libraries/commons_io_commons_io_2_4.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8d8fd52..0e3abdc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -38,8 +38,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/pom.xml b/pom.xml
index ca1dadc..bd2c450 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,11 +3,12 @@
4.0.0
de.selfomat
selfomat-single-user
- 0.4.1.2-SNAPSHOT
+ 0.4.2.0-SNAPSHOT
scm:git:http://192.168.100.78/git/selfomat-software.git
+
@@ -30,12 +31,62 @@
3.2.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.loadui
+ testFx
+ 3.0.0
+
+
+
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.jupiter.version}
+
+
+ org.junit.platform
+ junit-platform-runner
+ ${junit.platform.version}
+ test
+
selfomat single user
Photobooth Software
+
+ UTF-8
+ 1.8
+ 5.0.0-M4
+ 1.0.0-M4
+
+
@@ -61,7 +112,16 @@
+
+ maven-compiler-plugin
+ 3.1
+
+ ${java.version}
+ ${java.version}
+
+
+
src/main/resources
diff --git a/selfomat-single-user.iml b/selfomat-single-user.iml
index ef9182f..ebeeeb4 100644
--- a/selfomat-single-user.iml
+++ b/selfomat-single-user.iml
@@ -1,6 +1,6 @@
-
+
@@ -19,5 +19,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/GUI/CaptureCtl.java b/src/main/java/GUI/CaptureCtl.java
index a578aed..0ed3926 100644
--- a/src/main/java/GUI/CaptureCtl.java
+++ b/src/main/java/GUI/CaptureCtl.java
@@ -14,7 +14,6 @@ import model.SOMEvent;
import model.SOMImage;
import model.SOMLayout;
import workers.FilesWorker;
-import workers.ScaleWorker;
import java.util.Timer;
import java.util.TimerTask;
@@ -53,10 +52,10 @@ public class CaptureCtl {
private void setPictureLoadIndicator() {
pictureLoadIndicator.setVisible(false);
- pictureLoadIndicator.setPrefHeight(SOMLayout.screenHeight / 4);
- pictureLoadIndicator.setPrefWidth(SOMLayout.screenHeight / 4);
+ pictureLoadIndicator.setPrefHeight(SOMLayout.SCREEN_HEIGHT / 4);
+ pictureLoadIndicator.setPrefWidth(SOMLayout.SCREEN_HEIGHT / 4);
- pictureLoadIndicator.setMaxSize(SOMLayout.screenHeight / 2, SOMLayout.screenHeight / 2);
+ pictureLoadIndicator.setMaxSize(SOMLayout.SCREEN_HEIGHT / 2, SOMLayout.SCREEN_HEIGHT / 2);
pictureLoadIndicator.setStyle("-fx-progress-color: white;");
}
@@ -66,11 +65,11 @@ public class CaptureCtl {
capturePane.setAlignment(Pos.CENTER);
countdownText.setAlignment(Pos.CENTER);
- countdownText.setPrefSize(SOMLayout.screenHeight / 2, SOMLayout.screenHeight / 2);
- countdownText.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ countdownText.setPrefSize(SOMLayout.SCREEN_HEIGHT / 2, SOMLayout.SCREEN_HEIGHT / 2);
+ countdownText.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
countdownText.setText(null);
- countdownText.setFont(new Font("Century Gothic Bold", SOMLayout.screenHeight / 4));
+ countdownText.setFont(new Font("Century Gothic Bold", SOMLayout.SCREEN_HEIGHT / 4));
countdownText.setTextFill(SOMLayout.WHITE);
}
@@ -86,12 +85,12 @@ public class CaptureCtl {
image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen
-// image.setFitWidth(SOMLayout.screenHeight / 2);
+// image.setFitWidth(SOMLayout.SCREEN_HEIGHT / 2);
// Calculate the offset to center it horizontally if the image is wider than the screen (or narrower)
double aspect = image.getImage().getWidth() / image.getImage().getHeight();
- double scaledWidth = aspect * SOMLayout.screenHeight;
- double offset = (scaledWidth - SOMLayout.screenWidth) / 2;
+ double scaledWidth = aspect * SOMLayout.SCREEN_HEIGHT;
+ double offset = (scaledWidth - SOMLayout.SCREEN_WIDTH) / 2;
image.setX(-offset);
}
@@ -226,15 +225,10 @@ public class CaptureCtl {
// Capture the image
SOMImage newImage = FilesWorker.waitForImageAndCapture();
- //Scale the image to preview
- ScaleWorker.scale(newImage, ScaleWorker.PREVIEW);
// set te image to UI
image.setImage(new Image(newImage.getPrv().toURI().toString()));
SOMGUI.pictureCtl.image.setImage(new Image(newImage.getPrv().toURI().toString()));
- // trigger the thumb calculation
- ScaleWorker.scale(newImage, ScaleWorker.THUMBNAIL);
-
}
//
diff --git a/src/main/java/GUI/GalleryCtl.java b/src/main/java/GUI/GalleryCtl.java
index 1a807a1..fe514ff 100644
--- a/src/main/java/GUI/GalleryCtl.java
+++ b/src/main/java/GUI/GalleryCtl.java
@@ -129,7 +129,6 @@ public class GalleryCtl {
SOMEvent.getInstance().createAndSetImage(somPageImagesArray[finalI]);
}
});
-
i++;
}
}
@@ -140,8 +139,8 @@ public class GalleryCtl {
imageView.setPreserveRatio(true);
// make it fit the height of the Screen
- imageView.setFitHeight(SOMLayout.screenHeight / 3);
- imageView.setFitWidth(SOMLayout.screenWidth / 4);
+ imageView.setFitHeight(SOMLayout.SCREEN_HEIGHT / 3);
+ imageView.setFitWidth(SOMLayout.SCREEN_WIDTH / 4);
// position the images in Center
GridPane.setValignment(imageView, VPos.CENTER);
@@ -150,22 +149,22 @@ public class GalleryCtl {
}
public void setPane() {
- pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
- pane.setMinSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
+ pane.setMinSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG);
}
public void setGrid() {
- grid.setPrefHeight(SOMLayout.screenHeight);
- grid.setPrefWidth(SOMLayout.screenWidth);
- grid.setMinSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ grid.setPrefHeight(SOMLayout.SCREEN_HEIGHT);
+ grid.setPrefWidth(SOMLayout.SCREEN_WIDTH);
+ grid.setMinSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
}
public void setForthButton() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment
GridPane.setHalignment(forthButton, HPos.CENTER);
GridPane.setValignment(forthButton, VPos.CENTER);
@@ -188,7 +187,7 @@ public class GalleryCtl {
forthButton.setOnMousePressed(new EventHandler() {
public void handle(MouseEvent event) {
// Feedback
- forthButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ forthButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
});
@@ -197,7 +196,7 @@ public class GalleryCtl {
public void handle(MouseEvent event) {
// Feedback
- forthButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ forthButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
@@ -213,7 +212,7 @@ public class GalleryCtl {
public void setBackButton() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment
GridPane.setHalignment(backButton, HPos.CENTER);
GridPane.setValignment(backButton, VPos.CENTER);
@@ -236,7 +235,7 @@ public class GalleryCtl {
backButton.setOnMousePressed(new EventHandler() {
public void handle(MouseEvent event) {
// Feedback
- backButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ backButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
});
@@ -245,7 +244,7 @@ public class GalleryCtl {
public void handle(MouseEvent event) {
// Feedback
- backButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ backButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
@@ -261,7 +260,7 @@ public class GalleryCtl {
public void setPictureButton() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment
GridPane.setHalignment(pictureButton, HPos.CENTER);
GridPane.setValignment(pictureButton, VPos.CENTER);
@@ -284,7 +283,7 @@ public class GalleryCtl {
pictureButton.setOnMousePressed(new EventHandler() {
public void handle(MouseEvent event) {
// Feedback
- pictureButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ pictureButton.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
});
@@ -293,7 +292,7 @@ public class GalleryCtl {
public void handle(MouseEvent event) {
// Feedback
- pictureButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ pictureButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
diff --git a/src/main/java/GUI/PictureCtl.java b/src/main/java/GUI/PictureCtl.java
index e023a04..8565ae5 100644
--- a/src/main/java/GUI/PictureCtl.java
+++ b/src/main/java/GUI/PictureCtl.java
@@ -64,12 +64,12 @@ public class PictureCtl {
}
private void setPane() {
- pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG);
}
private void setGrid() {
- grid.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ grid.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
grid.setAlignment(Pos.CENTER);
@@ -80,7 +80,7 @@ public class PictureCtl {
private void setSingleBtn() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width
singleBtn.setPrefSize(height, height);
@@ -100,7 +100,7 @@ public class PictureCtl {
// Set the Action to run after Button is Pressed
EventHandler singleCapturePressedEventHandler = new EventHandler() {
public void handle(MouseEvent event) {
- singleBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ singleBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
};
@@ -109,7 +109,7 @@ public class PictureCtl {
public void handle(MouseEvent event) {
// Feedback (button gets less transparent)
- singleBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ singleBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
@@ -137,7 +137,7 @@ public class PictureCtl {
private void setSeriesBtn() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width
seriesBtn.setPrefSize(height, height);
@@ -159,7 +159,7 @@ public class PictureCtl {
EventHandler seriesCapturePressedEventHandler = new EventHandler() {
public void handle(MouseEvent event) {
// Feedback (Button gets lesstransparent)
- seriesBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ seriesBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
};
//Set Action after series Button is released
@@ -167,7 +167,7 @@ public class PictureCtl {
public void handle(MouseEvent event) {
// Feedback (Button gets less transparent)
- seriesBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ seriesBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Shoot series (true means series Mode)
SOMGUI.captureCtl.shoot(true);
@@ -177,7 +177,7 @@ public class PictureCtl {
EventHandler seriesCapturePressedTouchEventHandler = new EventHandler() {
public void handle(TouchEvent event) {
// Feedback (Button gets lesstransparent)
- seriesBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ seriesBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
};
//Set Action after series Button is released
@@ -185,7 +185,7 @@ public class PictureCtl {
public void handle(TouchEvent event) {
// Feedback (Button gets less transparent)
- seriesBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ seriesBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Shoot series (true means series Mode)
SOMGUI.captureCtl.shoot(true);
@@ -206,7 +206,7 @@ public class PictureCtl {
private void setGalleryBtn() {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width
galleryBtn.setPrefSize(height, height);
@@ -227,7 +227,7 @@ public class PictureCtl {
galleryBtn.setOnMousePressed(new EventHandler() {
public void handle(MouseEvent event) {
// Feedback
- galleryBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ galleryBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
});
@@ -236,7 +236,7 @@ public class PictureCtl {
public void handle(MouseEvent event) {
// Feedback
- galleryBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ galleryBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
@@ -253,7 +253,7 @@ public class PictureCtl {
if (SOMConfig.PRINTER == true) {
// get the button height & width
- int height = (SOMLayout.screenHeight / 4);
+ int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width
printBtn.setPrefSize(height, height);
@@ -274,7 +274,7 @@ public class PictureCtl {
printBtn.setOnMousePressed(new EventHandler() {
public void handle(MouseEvent event) {
// Feedback
- printBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4));
+ printBtn.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
}
});
@@ -290,7 +290,7 @@ public class PictureCtl {
public void handle(MouseEvent event) {
// Feedback
- printBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4));
+ printBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action
action();
@@ -315,7 +315,7 @@ public class PictureCtl {
// image.setImage(splash);
//
// // make it fit the height of the Screen
-// image.setFitWidth(SOMLayout.screenHeight/2);
+// image.setFitWidth(SOMLayout.SCREEN_HEIGHT/2);
// Set the image aspect ratio to be preserved
image.setPreserveRatio(true);
@@ -324,12 +324,12 @@ public class PictureCtl {
image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen
-// image.setFitWidth(SOMLayout.screenHeight);
+// image.setFitWidth(SOMLayout.SCREEN_HEIGHT);
// Calculate the offset to center it horizontally if the image is wider than the screen (or narrower)
double aspect = image.getImage().getWidth() / image.getImage().getHeight();
- double scaledWidth = aspect * SOMLayout.screenHeight;
- double offset = (scaledWidth - SOMLayout.screenWidth) / 2;
+ double scaledWidth = aspect * SOMLayout.SCREEN_HEIGHT;
+ double offset = (scaledWidth - SOMLayout.SCREEN_WIDTH) / 2;
image.setX(-offset);
@@ -341,10 +341,6 @@ public class PictureCtl {
// Set the last Image of the session
SOMImage somImage = somImageList.get(numberOfImages - 1);
- // update the Image State
-// TODO Probably not necessary -- commented out to test it
-// somImage.updateImageState();
-
// Scale the Image if needed
ScaleWorker.scale(somImage, ScaleWorker.PREVIEW);
diff --git a/src/main/java/GUI/SOMGUI.java b/src/main/java/GUI/SOMGUI.java
index 2d67cc6..11b54db 100644
--- a/src/main/java/GUI/SOMGUI.java
+++ b/src/main/java/GUI/SOMGUI.java
@@ -67,11 +67,11 @@ public class SOMGUI extends Application {
warnCtl = warnLoader.getController();
// Initialize the Scenes
- pictureScene = new Scene(picture, SOMLayout.screenWidth, SOMLayout.screenHeight);
- galleryScene = new Scene(gallery, SOMLayout.screenWidth, SOMLayout.screenHeight);
- uploadScene = new Scene(upload, SOMLayout.screenWidth, SOMLayout.screenHeight);
- captureScene = new Scene(capture, SOMLayout.screenWidth, SOMLayout.screenHeight);
- warnScene = new Scene(warn, SOMLayout.screenWidth, SOMLayout.screenHeight);
+ pictureScene = new Scene(picture, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
+ galleryScene = new Scene(gallery, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
+ uploadScene = new Scene(upload, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
+ captureScene = new Scene(capture, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
+ warnScene = new Scene(warn, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
}
public static SOMGUI getInstance() throws Exception {
diff --git a/src/main/java/GUI/UploadCtl.java b/src/main/java/GUI/UploadCtl.java
index 20555f6..00f3aac 100644
--- a/src/main/java/GUI/UploadCtl.java
+++ b/src/main/java/GUI/UploadCtl.java
@@ -77,12 +77,12 @@ public class UploadCtl {
}
private void setPane() {
- pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG);
}
private void setGrid() {
- grid.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
+ grid.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
GridPane.setHalignment(folderImageView, HPos.CENTER);
GridPane.setHalignment(folderLabel, HPos.CENTER);
GridPane.setHalignment(folderProgressBar, HPos.CENTER);
@@ -99,15 +99,15 @@ public class UploadCtl {
}
private void setFolderProg() {
- folderProgressBar.setPrefSize(SOMLayout.screenWidth, 3);
+ folderProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
}
private void setPicProg() {
- pictureProgressBar.setPrefSize(SOMLayout.screenWidth, 3);
+ pictureProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
}
private void setCleanProg() {
- cleanProgressBar.setPrefSize(SOMLayout.screenWidth, 3);
+ cleanProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
}
private void setFolderIV() {
@@ -139,10 +139,10 @@ public class UploadCtl {
}
// set the progress
-// public void setFolderProgress(double value) {
-// folderProgressBar.setProgress(value);
-// System.out.println("Folder Progress set to: "+ value);
-// }
+ public void setFolderProgress(double value) {
+ folderProgressBar.setProgress(value);
+ System.out.println("Folder Progress set to: "+ value);
+ }
public void setPicProgress(double value) {
pictureProgressBar.setProgress(value);
diff --git a/src/main/java/model/SOMConfig.java b/src/main/java/model/SOMConfig.java
index 794819a..a75490b 100644
--- a/src/main/java/model/SOMConfig.java
+++ b/src/main/java/model/SOMConfig.java
@@ -2,7 +2,7 @@ package model;
import workers.MachineWorker;
-import java.io.*;
+import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -49,8 +49,7 @@ public class SOMConfig {
// Constructor
private SOMConfig() {
// get the default Displays' dimensions
-
- System.out.println("Creating Configuration. Sreen Size: " + SOMLayout.screenWidth + "x" + SOMLayout.screenHeight);
+// System.out.println("Creating Configuration. Sreen Size: " + SOMLayout.SCREEN_WIDTH + "x" + SOMLayout.SCREEN_HEIGHT);
// important Paths
PICTURES_PATH = new File("images");
diff --git a/src/main/java/model/SOMConfigFileHandler.java b/src/main/java/model/SOMConfigFileHandler.java
index 47c6977..83be03e 100644
--- a/src/main/java/model/SOMConfigFileHandler.java
+++ b/src/main/java/model/SOMConfigFileHandler.java
@@ -1,7 +1,5 @@
package model;
-import workers.MachineWorker;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -10,9 +8,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;
import java.nio.file.Files;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
@XmlRootElement(name = "Config")
public class SOMConfigFileHandler {
diff --git a/src/main/java/model/SOMEvent.java b/src/main/java/model/SOMEvent.java
index 2e17a94..f0864bf 100644
--- a/src/main/java/model/SOMEvent.java
+++ b/src/main/java/model/SOMEvent.java
@@ -48,7 +48,6 @@ public class SOMEvent {
// Singleton to prevent Instantiation
if (event == null) {
event = new SOMEvent();
- // event.currentimage = SOMImage.getFallbackImage();
}
return event;
@@ -61,22 +60,16 @@ public class SOMEvent {
*/
public void getEventImages() {
// Behandelt
-// if (!imagesread) {
-
File[] files = FilesWorker.getSourcePath().listFiles();
assert files != null;
Arrays.sort(files);
for (File file : files) {
- SOMImage img = new SOMImage(file.getName());
+ SOMImage img = new SOMImage();
img.updateImageState();
this.addImage(img);
}
-
-// imagesread = true;
-// }
-// return;
}
/**
@@ -89,15 +82,6 @@ public class SOMEvent {
images.add(now);
}
- /**
- * Returns the Events' Date
- *
- * @return the date
- */
- public Date getDate() {
- return date;
- }
-
/**
* Returns a List of all of the Events' images
*
@@ -105,9 +89,9 @@ public class SOMEvent {
*/
public List getImages() {
// If there are no Event Images Collected
- if (images.size() == 0)
- // get all the events' images
- getEventImages();
+// if (0 == images.size())
+// // get all the events' images
+// this.getEventImages();
//...and return them
return images;
}
diff --git a/src/main/java/model/SOMImage.java b/src/main/java/model/SOMImage.java
index 51fea69..19f753c 100644
--- a/src/main/java/model/SOMImage.java
+++ b/src/main/java/model/SOMImage.java
@@ -3,11 +3,11 @@ package model;
import workers.FilesWorker;
import java.io.File;
-import java.nio.file.Files;
+import java.util.List;
public class SOMImage {
- private static String name; // the filename
+ private final String imageName; // the filename
private final SOMConfig config = SOMConfig.getInstance();
@@ -22,68 +22,62 @@ public class SOMImage {
private boolean srcthere; // source status
private boolean fnlthere; // final status
- SOMImage(String name) {
-
- File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
-
- File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name);
-
- File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
-
- File fnl = new File(FilesWorker.getFinalPath().toString() + "/" + name);
-
- File tmp = new File(FilesWorker.getTempPath().toString() + "/" + name);
-
- this.tmb = tmb;
- this.prv = prv;
- this.src = src;
- this.fnl = fnl;
- this.tmp = tmp;
-
- this.updateImageState();
- }
-
+ /**
+ * Automatically generates an SOMImage Object
+ * with an incremented Number and all th Paths
+ */
public SOMImage() {
- super();
+// super();
+
+ SOMEvent somEvent = SOMEvent.getInstance();
+ int nrOfEventPics;
+ List somEventImages = somEvent.getImages();
+
+ nrOfEventPics = somEventImages.size();
- int numberOfEventPictures = SOMEvent.getInstance().getImages().size();
String fill = "00000";
- int nmb = (numberOfEventPictures + 1);
+ int nmb = (nrOfEventPics + 1);
String number = String.valueOf(nmb);
- String filledNumber = fill.substring(number.length()) + number;
- name = filledNumber + ".jpg";
- File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
- File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name);
- File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
- File fnl = new File(FilesWorker.getFinalPath().toString() + "/" + name);
- File tmp = new File(FilesWorker.getTempPath().toString() + "/" + name);
+ int numberLength = number.length();
+ String filledNumber = fill.substring(numberLength) + number;
- this.tmb = tmb;
- this.prv = prv;
- this.src = src;
- this.fnl = fnl;
- this.tmp = tmp;
+ this.imageName = filledNumber + ".jpg";
+
+ File sourcePath = FilesWorker.getSourcePath();
+ this.src = new File(sourcePath + "/" + this.imageName);
+
+ File previewPath = FilesWorker.getPreviewPath();
+ this.prv = new File(previewPath + "/" + this.imageName);
+
+ File thumbPath = FilesWorker.getThumbPath();
+ this.tmb = new File(thumbPath + "/" + this.imageName);
+
+ File finalPath = FilesWorker.getFinalPath();
+ this.fnl = new File(finalPath + "/" + this.imageName);
+
+ File tempPath = FilesWorker.getTempPath();
+ this.tmp = new File(tempPath + "/" + this.imageName);
this.updateImageState();
}
- public void updateImageState() {
+ public final void updateImageState() {
// tmb
- tmbthere = Files.exists(tmb.toPath());
+ this.tmbthere = this.tmb.isFile();
// prv
- prvthere = Files.exists(prv.toPath());
+ this.prvthere = this.prv.isFile();
// src
- srcthere = Files.exists(src.toPath());
+ this.srcthere = this.src.isFile();
// fnl
- fnlthere = Files.exists(fnl.toPath());
+ this.fnlthere = this.fnl.isFile();
}
/**
- * @return the name
+ * @return the imageName
*/
public String getName() {
- return name;
+ return this.imageName;
}
/**
@@ -97,79 +91,55 @@ public class SOMImage {
* @return the prv
*/
public File getPrv() {
- return prv;
+ return this.prv;
}
/**
* @return the src
*/
public File getSrc() {
- return src;
+ return this.src;
}
/**
* @return the fnl
*/
public File getFnl() {
- return fnl;
+ return this.fnl;
}
/**
* @return the tmp
*/
public File getTmp() {
- return tmp;
+ return this.tmp;
}
/**
* @return the tmbthere
*/
public boolean isTmbthere() {
- return tmbthere;
+ return this.tmbthere;
}
/**
* @return the prvthere
*/
public boolean isPrvthere() {
- return prvthere;
+ return this.prvthere;
}
/**
* @return the srcthere
*/
public boolean isSrcthere() {
- return srcthere;
+ return this.srcthere;
}
/**
* @return the fnlthere
*/
public boolean isFnlthere() {
- return fnlthere;
+ return this.fnlthere;
}
-
- /**
- * @param type 0 = thumb, 1 = preview, 2 = full Size
- * @return
- */
-// public ImageIcon toImageIcon(int type) {
-// File imagepath;
-// switch (type) {
-// case 0:
-// imagepath = getTmb();
-// break;
-// case 1:
-// imagepath = getPrv();
-// break;
-// case 2:
-// imagepath = getSrc();
-// break;
-// default:
-// imagepath = null;
-// break;
-// }
-//
-// return new ImageIcon(imagepath.getPath());
-// }
}
diff --git a/src/main/java/model/SOMLayout.java b/src/main/java/model/SOMLayout.java
index 09b57da..3e2d85b 100644
--- a/src/main/java/model/SOMLayout.java
+++ b/src/main/java/model/SOMLayout.java
@@ -3,16 +3,20 @@ package model;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
+import javafx.scene.text.Font;
import javafx.stage.Screen;
-import java.awt.*;
public class SOMLayout {
// Fonts
- public static final Font H_0 = new Font(Font.SANS_SERIF, 1, 150);
- public static final Font H_1 = new Font(Font.SANS_SERIF, 1, 100);
- public static final Font H_2 = new Font(Font.SANS_SERIF, 1, 75);
- public static final Font P = new Font(Font.SANS_SERIF, 1, 50);
+ public static final Font H_0 = Font.loadFont("fonts/CenturyGothicStd.otf", 150);
+ // public static final Font H_0 = new Font(Font.SANS_SERIF, 1, 150);
+ public static final Font H_1 = Font.loadFont("fonts/CenturyGothicStd.otf", 100);
+ // public static final Font H_1 = new Font(Font.SANS_SERIF, 1, 100);
+ public static final Font H_2 = Font.loadFont("fonts/CenturyGothicStd.otf", 75);
+ // public static final Font H_2 = new Font(Font.SANS_SERIF, 1, 75);
+ public static final Font P = Font.loadFont("fonts/CenturyGothicStd.otf", 50);
+ // public static final Font P = new Font(Font.SANS_SERIF, 1, 50);
// Icons & Images
//UI
public static final javafx.scene.image.Image GALLERY_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Gallery.png").toString());
@@ -27,15 +31,29 @@ public class SOMLayout {
public static final javafx.scene.image.Image LOGO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMLogo.png").toString());
// public static final javafx.scene.image.Image SPLASH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMSplash.jpg").toString());
public static final javafx.scene.paint.Color WHITE = new javafx.scene.paint.Color(1, 1, 1, 1);
- public static final Background WHITE_BG = new Background(new BackgroundFill(WHITE, null, null));
+ public static final Background WHITE_BG = new Background(new BackgroundFill(SOMLayout.WHITE, null, null));
// Screen
// private static final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
private static final javafx.geometry.Rectangle2D gd = Screen.getPrimary().getBounds();
- public static final int screenWidth = (int) gd.getWidth();
- public static final int screenHeight = (int) gd.getHeight();
+ public static final int SCREEN_WIDTH = SOMLayout.getScreenWidth();
+
+ private static int getScreenWidth() {
+ if (null != SOMLayout.gd) {
+ return (int) SOMLayout.gd.getWidth();
+ } else {
+ return 1024;
+ }
+ }
+
+ public static final int SCREEN_HEIGHT = getHeight();
+
+ private static int getHeight() {
+ return (int) SOMLayout.gd.getHeight();
+ }
+
// Layout
- private static final int row = screenHeight / 3;
- private static final int column = screenWidth / 4;
+ private static final int row = SOMLayout.SCREEN_HEIGHT / 3;
+ private static final int column = SOMLayout.SCREEN_WIDTH / 4;
// Colors
private static final javafx.scene.paint.Color BLACK = new javafx.scene.paint.Color(0, 0, 0, 1);
//Backgrounds
diff --git a/src/main/java/workers/FilesWorker.java b/src/main/java/workers/FilesWorker.java
index df9705c..1332e59 100644
--- a/src/main/java/workers/FilesWorker.java
+++ b/src/main/java/workers/FilesWorker.java
@@ -18,27 +18,29 @@ import java.nio.file.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.logging.Logger;
-import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
import static java.nio.file.StandardWatchEventKinds.*;
-public class FilesWorker {
+/**
+ *
+ */
+public final class FilesWorker {
private static final SOMEvent event = SOMEvent.getInstance();
+ private static Logger log = Logger.getLogger(FilesWorker.class.getName());
- public FilesWorker() {
-
+ private FilesWorker() {
}
/**
* Returns true if a File is an image and returns false if not.
*
- * @param path
+ * @param file
* @return
*/
- public static boolean isImage(Path path) {
- File f = path.toFile();
- String mimeType = new MimetypesFileTypeMap().getContentType(f);
+ public static boolean isImage(File file) {
+ String mimeType = new MimetypesFileTypeMap().getContentType(file);
String type = mimeType.split("/")[0];
return type.equals("image");
}
@@ -50,7 +52,7 @@ public class FilesWorker {
* @return
*/
public static File getSourcePath() {
- File src = new File(SOMConfig.PICTURES_PATH.toString() + "/src");
+ File src = new File(SOMConfig.PICTURES_PATH + "/src");
src.mkdirs();
return src;
@@ -63,7 +65,7 @@ public class FilesWorker {
* @return
*/
public static File getPreviewPath() {
- File prv = new File(SOMConfig.PICTURES_PATH.toString() + "/prv");
+ File prv = new File(SOMConfig.PICTURES_PATH + "/prv");
prv.mkdirs();
return prv;
@@ -76,7 +78,7 @@ public class FilesWorker {
* @return
*/
public static File getThumbPath() {
- File tmb = new File(SOMConfig.PICTURES_PATH.toString() + "/tmb");
+ File tmb = new File(SOMConfig.PICTURES_PATH + "/tmb");
tmb.mkdirs();
return tmb;
@@ -89,7 +91,7 @@ public class FilesWorker {
* @return
*/
public static File getFinalPath() {
- File fnl = new File(SOMConfig.PICTURES_PATH.toString() + "/fnl");
+ File fnl = new File(SOMConfig.PICTURES_PATH + "/fnl");
fnl.mkdirs();
return fnl;
@@ -102,23 +104,27 @@ public class FilesWorker {
* @return
*/
public static File getTempPath() {
- File tmp = new File(SOMConfig.PICTURES_PATH.toString() + "/tmp");
+ File tmp = new File(SOMConfig.PICTURES_PATH + "/tmp");
tmp.mkdirs();
return tmp;
}
+
+ /**
+ * Prints out the current image via cups
+ */
public static void print() {
try {
- System.out.println(
+ log.info(
SOMEvent.getInstance().getCurrentimage().getSrc().toString()
);
// get a process taking the image
ProcessBuilder builder = new ProcessBuilder(
"lp",
SOMEvent.getInstance().getCurrentimage().getSrc().toString()
- );
+ );
builder.redirectErrorStream(true);
@@ -131,17 +137,22 @@ public class FilesWorker {
}
}
+ /**
+ * Checks whether the Software has an Internet Connection or not
+ *
+ * @return boolean true if it has an internet connection, false if not
+ */
private static boolean internet() {
Socket sock = new Socket();
- InetSocketAddress socketAddress = new InetSocketAddress("google.com", 80);
+ InetSocketAddress socketAddress = new InetSocketAddress("selfomat.de", 80);
try {
sock.connect(socketAddress, 3000);
- System.out.println("Internet available");
+ log.info("Internet available");
return true;
} catch (IOException e) {
- System.out.println("Internet NOT available");
+ log.warning("Internet NOT available");
return false;
} finally {
try {
@@ -152,6 +163,9 @@ public class FilesWorker {
}
}
+ /**
+ * Collects the Images and folders and Uploads the images from src-folder to SELFOMAT Cloud
+ */
public static void upload() {
try {
@@ -177,7 +191,7 @@ public class FilesWorker {
currentdir = currentdir + "/" + split;
dirs.add(new File(currentdir));
- System.out.println("DIR added:" + currentdir);
+ log.info("DIR added:" + currentdir);
}
// FILES
@@ -186,7 +200,7 @@ public class FilesWorker {
// get the current file
File file = images.get(i);
- System.out.println(file);
+ log.info(file.toString());
// get pics
if (file.isFile()
@@ -198,8 +212,8 @@ public class FilesWorker {
}
// REPORT TO CONSOLE
- System.out.println(dirs.size() + " Directories");
- System.out.println(pics.size() + " Pics");
+ log.info(dirs.size() + " Directories");
+ log.info(pics.size() + " Pics");
int queueddirs = 0;
int queuedfiles = 0;
@@ -211,16 +225,16 @@ public class FilesWorker {
queueddirs++;
- System.out.println("Queueing Directories " + dir.toString());
+ log.info("Queueing Directories " + dir.toString());
limitdirs.add(dir);
if (limitdirs.size() >= SOMConfig.PARALLEL_UPLOADS
// Upload even if limit is not reached
|| (dirs.size() - queueddirs) < SOMConfig.PARALLEL_UPLOADS) {
- System.out.println("Launch Dir upload");
+ log.info("Launch Dir upload");
uploadDir(limitdirs);
- System.out.println("Clear Queue");
+ log.info("Clear Queue");
limitdirs.clear();
}
}
@@ -232,18 +246,18 @@ public class FilesWorker {
// Counter for all queued files over the whole upload process
queuedfiles++;
- System.out.println("Queueing File " + pic.toString());
+ log.info("Queueing File " + pic.toString());
limitpics.add(pic);
if ( // Check if the parallel Upload Limit is reached
limitpics.size() >= SOMConfig.PARALLEL_UPLOADS
- // Upload even if limit is not reached if the pics are the last ones
- || (pics.size() - queuedfiles) < SOMConfig.PARALLEL_UPLOADS) {
+ // Upload even if limit is not reached if the pics are the last ones
+ || (pics.size() - queuedfiles) < SOMConfig.PARALLEL_UPLOADS) {
- System.out.println("Launch File upload");
+ log.info("Launch File upload");
uploadFile(limitpics);
- System.out.println("Clear File Queue");
+ log.info("Clear File Queue");
limitpics.clear();
} else {
}
@@ -261,7 +275,7 @@ public class FilesWorker {
// reboot
- new File("reboot").mkdirs();
+// new File("reboot").mkdirs();
// new ProcessBuilder("sudo reboot").start();
}
@@ -282,14 +296,15 @@ public class FilesWorker {
}
}
+ /**
+ *
+ */
private static void archiveBackup() {
Task task = new Task() {
@Override
protected Boolean call() throws Exception {
// build the archive process
- // TODO remove -k option (this option skips certificate verification)
- // TODO Make Software run in SELFOMAT Directory
ProcessBuilder builder = new ProcessBuilder(
"bash",
"SELFOMAT/sh/move-backup.sh"
@@ -303,34 +318,42 @@ public class FilesWorker {
// wait for the process to end
if (process.waitFor() == 0) {
// process ended successful
- System.out.println("archiving Backup");
+ log.info("archiving Backup");
return true;
} else {
// process ended failing
- // TODO Catch failed uploads
+ // TODO Catch failed archives
- System.out.println("Backup archiving failed!");
+ log.severe("Backup archiving failed!");
return false;
}
}
};
}
+ /**
+ * The Actual Upload of the File List.
+ * Loops through the Files List and uploads the images in batches of the
+ * given threads-counter in config
+ *
+ * @param files - The Files List
+ * @throws Exception
+ */
private static void uploadFile(final List files) throws Exception {
- final Thread[] threads = new Thread[files.size()];
+ final Thread[] threads = new Thread[files.size()];
for (int i = 0; i < threads.length; i++) {
- System.out.println("LAUNCH Upload Process: " + i);
+ log.info("LAUNCH Upload Process: " + i);
final File file = files.get(i);
final String target = SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir() + "/" + file.getName();
- System.out.println("");
- System.out.println(file.toString() + "----------->" + target);
- System.out.println("");
+ log.info("");
+ log.info(file.toString() + "----------->" + target);
+ log.info("");
final int pictureCounter = i + 1;
Task task = new Task() {
@@ -339,7 +362,6 @@ public class FilesWorker {
protected Boolean call() throws Exception {
// build the upload process
// TODO remove -k option (this option skips certificate verification)
- // TODO Make Software run in SELFOMAT Directory
ProcessBuilder builder = new ProcessBuilder(
"bash",
"SELFOMAT/sh/upload.sh",
@@ -356,32 +378,26 @@ public class FilesWorker {
// wait for the process to end
if (process.waitFor() == 0) {
// process ended successful
- System.out.println("file uploaded: " + file);
-
- // TODO get the length of all threads
- // TODO bind to UI
- updateProgress(pictureCounter, threads.length);
+ log.info("file uploaded: " + file);
return true;
} else {
// process ended failing
// TODO Catch failed uploads
-
- System.out.println("process ended failing " + file);
- Thread.sleep(1000);
-
+ log.severe("process ended failing " + file);
return false;
}
}
};
- SOMGUI.uploadCtl.pictureProgressBar.progressProperty().bind(task.progressProperty());
+// SOMGUI.uploadCtl.pictureProgressBar.progressProperty().bind(task.progressProperty());
threads[i] = new Thread(task);
threads[i].setDaemon(true);
threads[i].start();
+// threads[i].
}
int i = 0;
while (i < threads.length) {
@@ -390,12 +406,22 @@ public class FilesWorker {
}
}
+ /**
+ * The Actual Upload of the Directory List.
+ * Loops through the directories List and uploads the directories in batches of the
+ * given threads-counter in config
+ *
+ * @param dirs
+ * @throws Exception
+ */
+
private static void uploadDir(final List dirs) throws Exception {
final Thread[] threads = new Thread[dirs.size()];
+
for (int i = 0; i < threads.length; i++) {
- System.out.println("launch mkdir Process: " + i);
+ log.info("launch mkdir Process: " + i);
final File dir = dirs.get(i);
final int directoryCounter = i + 1;
@@ -404,14 +430,12 @@ public class FilesWorker {
@Override
protected Boolean call() throws Exception {
// build the Upload process with curl
- // TODO remove -k option (this option skips certificate verification)
ProcessBuilder builder = new ProcessBuilder("curl",
"-u",
SOMConfig.CLOUD_CREDENTIALS,
"-X",
"MKCOL",
- SOMConfig.CLOUD_ADDRESS + dir.toString().replace("/src", ""),
- "-k");
+ SOMConfig.CLOUD_ADDRESS + dir.toString().replace("/src", ""));
// make the process traceable
builder.redirectErrorStream(true);
@@ -422,23 +446,23 @@ public class FilesWorker {
// wait for the process to end
if (process.waitFor() == 0) {
// Process ended successful
- System.out.println("directory made: " + dir);
+ log.info("directory made: " + dir);
//Set upload Progress
- // TODO get the length of all threads
// TODO bind to UI
- updateProgress(directoryCounter, threads.length);
+ SOMGUI.uploadCtl.setFolderProgress(directoryCounter / dirs.size());
+// updateProgress(directoryCounter, threads.length);
return true;
} else {
// Process ended failing
- System.out.println("process ended failing " + dir);
+ log.info("process ended failing " + dir);
return false;
}
}
};
- SOMGUI.uploadCtl.folderProgressBar.progressProperty().bind(task.progressProperty());
+// SOMGUI.uploadCtl.folderProgressBar.progressProperty().bind(task.progressProperty());
// Start the Task
threads[i] = new Thread(task);
@@ -452,10 +476,14 @@ public class FilesWorker {
threads[i].join();
i++;
}
-
//TODO Catch upload fails
}
+ /**
+ * Reads out all files and dirs in the Images Folder
+ *
+ * @return a File ArrayList containing all files and dirs
+ */
private static List allFilesForUpload() {
File dir = SOMConfig.PICTURES_PATH;
@@ -465,8 +493,15 @@ public class FilesWorker {
return new ArrayList(filesAndDirs);
}
+ /**
+ * Wraps the actual capturing function.
+ * Waits for an image that is served by the capture function,
+ * adds it into the Event and sets it to UI.
+ *
+ * @return SOMImage Object - the new Image. Null if function fails.
+ */
+
public static SOMImage waitForImageAndCapture() {
- //Behandelt
try {
// Set the Source Path to be watched
@@ -476,11 +511,11 @@ public class FilesWorker {
WatchService watcher = FileSystems.getDefault().newWatchService();
dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
- System.out.println("Watch Service registered for dir: "
+ log.info("Watch Service registered for dir: "
+ dir.getFileName());
// TRIGGER THE CAPTURE
- System.out.println("START CAPTURE THREAD");
+ log.info("START CAPTURE THREAD");
SOMImage newImage = CaptureWorker.now();
while (true) {
@@ -500,7 +535,7 @@ public class FilesWorker {
WatchEvent ev = (WatchEvent) event;
Path fileName = ev.context();
- System.out.println(kind.name() + ": " + fileName);
+ log.info(kind.name() + ": " + fileName);
// check for a file being created
if (
// Make sure there is an Image created
@@ -512,14 +547,26 @@ public class FilesWorker {
//Set the Progress Indicator to 0.5
SOMGUI.captureCtl.pictureLoadIndicator.setProgress(0.5);
+ //Scale the image to preview
+ ScaleWorker.scale(newImage, ScaleWorker.PREVIEW);
+
+ //Set the Progress Indicator to 0.5
+ SOMGUI.captureCtl.pictureLoadIndicator.setProgress(0.75);
+
+ // trigger the thumb calculation
+ ScaleWorker.scale(newImage, ScaleWorker.THUMBNAIL);
+
+ //Set the Progress Indicator to 0.5
+ SOMGUI.captureCtl.pictureLoadIndicator.setProgress(1);
+
// START THE "PICTURE HAS ARRIVED" ACTION
- System.out.println("The image is there!!!");
+ // System.out.println("The image is there!!!");
// ADD THE IMAGE TO THE EVENT
FilesWorker.event.addImage(newImage);
// Set last Image
- System.out.println("Set the taken Picture to UI");
+ // System.out.println("Set the taken Picture to UI");
FilesWorker.event.createAndSetImage(FilesWorker.event.getLastImage());
// Hide the Progress Indicator
@@ -535,14 +582,14 @@ public class FilesWorker {
// Check that filename is the same as expected image
&& !fileName.toString().equals(
newImage.getSrc().getName())) {
- // TODO Catch wrong pictures, only for testing, make only available for Developer (Hostname??)
- // Hide the Progress Indicator
- SOMGUI.captureCtl.pictureLoadIndicator.setVisible(false);
- // Set back the Progress Indicator
- SOMGUI.captureCtl.pictureLoadIndicator.setProgress(-1);
- //Close Watcher
- watcher.close();
+// // Hide the Progress Indicator
+// SOMGUI.captureCtl.pictureLoadIndicator.setVisible(false);
+// // Set back the Progress Indicator
+// SOMGUI.captureCtl.pictureLoadIndicator.setProgress(-1);
+//
+// //Close Watcher
+// watcher.close();
}
}
diff --git a/src/main/java/workers/MachineWorker.java b/src/main/java/workers/MachineWorker.java
index 066590c..4a18362 100644
--- a/src/main/java/workers/MachineWorker.java
+++ b/src/main/java/workers/MachineWorker.java
@@ -2,29 +2,33 @@ package workers;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.logging.Logger;
/**
* This Class works through all kinds of Machine-Related Values such as Screen size, Machine Name, OS etc.
* Created by Simon on 12.12.2016.
*/
-public class MachineWorker {
- static int OperatingSystem;
- static String HostName;
- static int[] Screen;
+public final class MachineWorker {
+ // for multiple OS'
+// static int OperatingSystem;
+ private static String HostName = null;
+ private static final Logger log = Logger.getLogger(MachineWorker.class.getName());
+
+ private MachineWorker() {
+ super();
+ }
+ // for multiple screens
+// static int[] Screen;
public static String getHostName() {
try {
- InetAddress addr;
- addr = InetAddress.getLocalHost();
- HostName = addr.getHostName();
+ InetAddress addr = InetAddress.getLocalHost();
+ String hostName = addr.getHostName();
+ HostName = hostName;
+ log.info("Hostname: " + HostName);
} catch (UnknownHostException ex) {
- System.out.println("Hostname can not be resolved");
+ log.info("Hostname can not be resolved");
}
return HostName;
}
-
- public static int[] getScreen() {
- return Screen;
- }
-
}
diff --git a/src/main/java/workers/ScaleWorker.java b/src/main/java/workers/ScaleWorker.java
index 13b395c..d6410ae 100644
--- a/src/main/java/workers/ScaleWorker.java
+++ b/src/main/java/workers/ScaleWorker.java
@@ -15,6 +15,7 @@ import java.awt.image.FilteredImageSource;
import java.io.File;
import java.io.IOException;
import java.util.List;
+import java.util.logging.Logger;
//import java.awt.*;
@@ -23,19 +24,14 @@ public class ScaleWorker extends Thread {
public static final int SOURCE = 0;
public static final int PREVIEW = 1;
public static final int THUMBNAIL = 2;
+ private static Logger log = Logger.getLogger(ScaleWorker.class.getName());
SOMConfig config = SOMConfig.getInstance();
public static SOMImage scale(SOMImage somImage1, final int type) {
final SOMImage somImage = somImage1;
- Task task = new Task() {
- @Override
- protected SOMImage call() throws Exception {
- // Do the scale work
- return prepareandStart(somImage, type);
- }
- };
+ Task task = new scaleTask(somImage, type);
// open Thread
Thread thread = new Thread(task);
@@ -61,7 +57,7 @@ public class ScaleWorker extends Thread {
return somImages;
}
- private static SOMImage prepareandStart(SOMImage somImage, int type) {
+ static SOMImage prepareAndStart(SOMImage somImage, int type) {
// the image before scaling
@@ -152,13 +148,13 @@ public class ScaleWorker extends Thread {
// for the preview
case PREVIEW:
- targetWidth = SOMLayout.screenWidth;
- targetHeight = SOMLayout.screenHeight;
+ targetWidth = SOMLayout.SCREEN_WIDTH;
+ targetHeight = SOMLayout.SCREEN_HEIGHT;
targetFile = somImage.getPrv();
-
- // for the Thumbnail
break;
+
+ // for the Thumbnail
case THUMBNAIL:
targetWidth = SOMLayout.getColumn(1);
targetHeight = SOMLayout.getRow(1);
@@ -207,10 +203,10 @@ public class ScaleWorker extends Thread {
}
// Probably way faster than ImageIcon
- System.out.println("Scale with Graphics2D:");
+ log.info("Scale with Graphics2D:");
// Print the File Path
- System.out.println(sourceFile.toString());
+ log.info(sourceFile.toString());
// SCALE -----------------------------------------------------------
// THE -------------------------------------------------------------
@@ -306,7 +302,7 @@ public class ScaleWorker extends Thread {
somImage.updateImageState();
- System.out.println("Image State Updated: Scaled");
+ log.info("Image State Updated: Scaled");
// Clean up
croppedGraphics.dispose();
@@ -330,7 +326,7 @@ public class ScaleWorker extends Thread {
somImage.updateImageState();
- System.out.println("Image State Updated: Scaled");
+ log.info("Image State Updated: Scaled");
somImage.updateImageState();
break;
@@ -348,4 +344,20 @@ public class ScaleWorker extends Thread {
e.printStackTrace();
}
}
+
+ private static class scaleTask extends Task {
+ private final SOMImage somImage;
+ private final int type;
+
+ public scaleTask(SOMImage somImage, int type) {
+ this.somImage = somImage;
+ this.type = type;
+ }
+
+ @Override
+ protected SOMImage call() throws Exception {
+ // Do the scale work
+ return prepareAndStart(somImage, type);
+ }
+ }
}
diff --git a/src/main/resources/fonts/CenturyGothicStd-Bold.otf b/src/main/resources/fonts/CenturyGothicStd-Bold.otf
new file mode 100644
index 0000000..c5bb056
Binary files /dev/null and b/src/main/resources/fonts/CenturyGothicStd-Bold.otf differ
diff --git a/src/main/resources/fonts/CenturyGothicStd.otf b/src/main/resources/fonts/CenturyGothicStd.otf
new file mode 100644
index 0000000..079493b
Binary files /dev/null and b/src/main/resources/fonts/CenturyGothicStd.otf differ
diff --git a/src/main/resources/fxml/gallery.fxml b/src/main/resources/fxml/gallery.fxml
index a18b736..34e35c0 100644
--- a/src/main/resources/fxml/gallery.fxml
+++ b/src/main/resources/fxml/gallery.fxml
@@ -27,6 +27,7 @@
+
+