move to git.simongehrig.de

This commit is contained in:
2020-09-28 18:07:49 +02:00
parent ea054db0fe
commit b5f378072e
46 changed files with 1985 additions and 322 deletions
+2 -18
View File
@@ -1,32 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Maven default annotation processors profile" enabled="true">
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="selfomat-single-user" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8">
<module name="selfomat-single-user" target="1.5" />
<module name="selfomat-single-user" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources/sh/upload.sh" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.guava:guava:14.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/14.0.1/guava-14.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/14.0.1/guava-14.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/14.0.1/guava-14.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.10">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-sources.jar!/" />
</SOURCES>
</library>
</component>
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-all:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.jupiter:junit-jupiter-api:5.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.0.0-M4/junit-jupiter-api-5.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.0.0-M4/junit-jupiter-api-5.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.0.0-M4/junit-jupiter-api-5.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.jupiter:junit-jupiter-engine:5.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.0.0-M4/junit-jupiter-engine-5.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.0.0-M4/junit-jupiter-engine-5.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.0.0-M4/junit-jupiter-engine-5.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-commons:1.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.0.0-M4/junit-platform-commons-1.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.0.0-M4/junit-platform-commons-1.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.0.0-M4/junit-platform-commons-1.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-engine:1.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.0.0-M4/junit-platform-engine-1.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.0.0-M4/junit-platform-engine-1.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.0.0-M4/junit-platform-engine-1.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-launcher:1.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.0.0-M4/junit-platform-launcher-1.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.0.0-M4/junit-platform-launcher-1.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.0.0-M4/junit-platform-launcher-1.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-runner:1.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-runner/1.0.0-M4/junit-platform-runner-1.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-runner/1.0.0-M4/junit-platform-runner-1.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-runner/1.0.0-M4/junit-platform-runner-1.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-suite-api:1.0.0-M4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.0.0-M4/junit-platform-suite-api-1.0.0-M4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.0.0-M4/junit-platform-suite-api-1.0.0-M4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.0.0-M4/junit-platform-suite-api-1.0.0-M4-sources.jar!/" />
</SOURCES>
</library>
</component>
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.loadui:testFx:3.0.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/loadui/testFx/3.0.0/testFx-3.0.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/loadui/testFx/3.0.0/testFx-3.0.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/loadui/testFx/3.0.0/testFx-3.0.0-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.opentest4j:opentest4j:1.0.0-M2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.0.0-M2/opentest4j-1.0.0-M2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.0.0-M2/opentest4j-1.0.0-M2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.0.0-M2/opentest4j-1.0.0-M2-sources.jar!/" />
</SOURCES>
</library>
</component>
-10
View File
@@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="commons-io:commons-io:2.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-io-2.4.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/commons-io-2.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
+18 -3
View File
@@ -38,8 +38,23 @@
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$USER_HOME$/Desktop/SOMDoc" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" />
<option name="HEAP_SIZE" />
<option name="LOCALE" value="DE" />
<option name="OPEN_IN_BROWSER" value="true" />
<option name="OPTION_INCLUDE_LIBS" value="false" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
@@ -48,7 +63,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
<component name="SvnBranchConfigurationManager">
+61 -1
View File
@@ -3,11 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.selfomat</groupId>
<artifactId>selfomat-single-user</artifactId>
<version>0.4.1.2-SNAPSHOT</version>
<version>0.4.2.0-SNAPSHOT</version>
<scm>
<url>scm:git:http://192.168.100.78/git/selfomat-software.git</url>
</scm>
<distributionManagement>
<!-- Publish the versioned releases here -->
<repository>
@@ -30,12 +31,62 @@
<version>3.2.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.junit.jupiter</groupId>-->
<!--<artifactId>junit-jupiter-api</artifactId>-->
<!--<version>5.0.0-M4</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.junit.jupiter</groupId>-->
<!--<artifactId>junit-jupiter-engine</artifactId>-->
<!--<version>5.0.0-M4</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.junit.platform</groupId>-->
<!--<artifactId>junit-platform-runner</artifactId>-->
<!--<version>1.1.0-M2</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.loadui</groupId>
<artifactId>testFx</artifactId>
<version>3.0.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>junit</groupId>-->
<!--<artifactId>junit</artifactId>-->
<!--<version>RELEASE</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<name>selfomat single user</name>
<description>Photobooth Software</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<junit.jupiter.version>5.0.0-M4</junit.jupiter.version>
<junit.platform.version>1.0.0-M4</junit.platform.version>
</properties>
<build>
<plugins>
<plugin>
@@ -61,7 +112,16 @@
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
+13 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
@@ -19,5 +19,17 @@
<orderEntry type="library" name="Maven: com.twelvemonkeys.common:common-lang:3.2.1" level="project" />
<orderEntry type="library" name="Maven: com.twelvemonkeys.common:common-io:3.2.1" level="project" />
<orderEntry type="library" name="Maven: com.twelvemonkeys.common:common-image:3.2.1" level="project" />
<orderEntry type="library" name="Maven: org.loadui:testFx:3.0.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:14.0.1" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.0.0-M4" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-engine:1.0.0-M4" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.0.0-M4" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.0.0-M2" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.0.0-M4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-runner:1.0.0-M4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-launcher:1.0.0-M4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-suite-api:1.0.0-M4" level="project" />
</component>
</module>
+9 -15
View File
@@ -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);
}
//
+16 -17
View File
@@ -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<MouseEvent>() {
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<MouseEvent>() {
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<MouseEvent>() {
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();
+20 -24
View File
@@ -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<MouseEvent>() {
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<MouseEvent> seriesCapturePressedEventHandler = new EventHandler<MouseEvent>() {
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<TouchEvent> seriesCapturePressedTouchEventHandler = new EventHandler<TouchEvent>() {
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<MouseEvent>() {
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<MouseEvent>() {
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);
+5 -5
View File
@@ -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 {
+9 -9
View File
@@ -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);
+2 -3
View File
@@ -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");
@@ -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 {
+4 -20
View File
@@ -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<SOMImage> 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;
}
+47 -77
View File
@@ -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<SOMImage> 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());
// }
}
+28 -10
View File
@@ -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
+122 -75
View File
@@ -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<Boolean> task = new Task<Boolean>() {
@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<File> 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<Boolean> task = new Task<Boolean>() {
@@ -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<File> 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<File> allFilesForUpload() {
File dir = SOMConfig.PICTURES_PATH;
@@ -465,8 +493,15 @@ public class FilesWorker {
return new ArrayList<File>(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<Path> ev = (WatchEvent<Path>) 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();
}
}
+17 -13
View File
@@ -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;
}
}
+28 -16
View File
@@ -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);
}
}
}
Binary file not shown.
Binary file not shown.
+2
View File
@@ -27,6 +27,7 @@
<Button fx:id="backButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
<!--ROW 1-->
<Button fx:id="galleryButton1" mnemonicParsing="false" text="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic>
@@ -45,6 +46,7 @@
<ImageView fx:id="galleryImageView3" preserveRatio="true"/>
</graphic>
</Button>
<!--ROW 2-->
<Button fx:id="galleryButton4" mnemonicParsing="false" text="4" GridPane.rowIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
+18
View File
@@ -0,0 +1,18 @@
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
/**
* Created by selfomat on 31.01.2018.
*/
public class TestRunner {
public static void main(String[] args) {
Result result = JUnitCore.runClasses(TestSuite.class);
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
}
+16
View File
@@ -0,0 +1,16 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
workers.MachineWorkerTest.class,
workers.ScaleWorkerTest.class,
workers.FilesWorkerTest.class
})
/**
* Created by selfomat on 31.01.2018.
*/
public class TestSuite {
}
View File
@@ -0,0 +1,75 @@
package workers;
//import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Test;
import java.io.File;
import static junit.framework.TestCase.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Created by selfomat on 31.01.2018.
*/
public class FilesWorkerTest {
@Test
void isImageTest() {
File image = new File("src/test/resources/img/00001.jpg");
File noimage = new File("src/test/resources/misc/NoImage.html");
boolean isImage = FilesWorker.isImage(image);
assertTrue(isImage);
boolean isNoImage = FilesWorker.isImage(noimage);
assertFalse(isNoImage);
}
@Test
void getSourcePath() {
assertTrue(FilesWorker.getSourcePath().isDirectory());
}
@Test
void getPreviewPath() {
assertTrue(FilesWorker.getPreviewPath().isDirectory());
}
@Test
void getThumbPath() {
assertTrue(FilesWorker.getThumbPath().isDirectory());
}
@Test
void getFinalPath() {
assertTrue(FilesWorker.getFinalPath().isDirectory());
}
@Test
void getTempPath() {
assertTrue(FilesWorker.getTempPath().isDirectory());
}
@Test
void print() {
// TODO Check Printqueue
}
@Test
void upload() {
// TODO upload file an check if uploaded
}
@Test
void waitForImageAndCapture() {
// TODO TEST ImageCapture
// Check OS
// if not on Linux, skip
// Check gphoto2 installation
// Check if camera is present
// shoot image and check for File
}
}
@@ -0,0 +1,20 @@
package workers;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Created by selfomat on 31.01.2018.
*/
public class MachineWorkerTest {
@Test
final void getHostNameTest() {
final String hostName = MachineWorker.getHostName();
assertTrue((null != hostName) && (!"".equals(hostName)), "Empty hostname.");
}
}
+173
View File
@@ -0,0 +1,173 @@
package workers;
import GUI.*;
import javafx.application.Application;
import javafx.embed.swing.JFXPanel;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import model.SOMConfig;
import model.SOMEvent;
import model.SOMImage;
import model.SOMLayout;
import org.apache.commons.io.FileUtils;
import org.junit.BeforeClass;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.loadui.testfx.GuiTest;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
/**
* Created by selfomat on 26.01.2018.
*/
public class ScaleWorkerTest extends GuiTest {
@BeforeEach
void setUp() {
System.out.println("--------------------------------");
System.out.println("SETUP");
System.out.println("--------------------------------");
// Clean up image dir
System.out.println("DELETE:" + SOMConfig.PICTURES_PATH.getAbsolutePath());
recursiveDeleteDir(SOMConfig.PICTURES_PATH.getAbsoluteFile());
// Make sure there are images to scale
// Get Resources dir
File imgTestResources = new File("src/test/resources/img");
System.out.println(imgTestResources.getAbsolutePath().toString());
// Get images inside
File[] testResourceImages = imgTestResources.listFiles();
// Recurse through images
for (File testResourceImg : testResourceImages) {
// Open new SOMImage and therefore get the Destination Path
SOMImage somimage = new SOMImage();
// Initaialize the Event
SOMEvent.getInstance().addImage(somimage);
// Output the dirs
System.out.println(testResourceImg);
System.out.println(somimage.getSrc());
// Copy the Files
try {
FileUtils.copyFile(testResourceImg, somimage.getSrc());
} catch (IOException e) {
e.printStackTrace();
// Fail if images can't be moved
fail("unable to move resource images");
}
somimage.updateImageState();
}
}
@AfterEach
void tearDown() {
// Clean up image dir
recursiveDeleteDir(SOMConfig.PICTURES_PATH.getAbsoluteFile());
}
@Test
void scaleTest() {
// Initialize Graphics
getRootNode();
System.out.println("--------------------------------");
System.out.println("ScaleTest");
System.out.println("--------------------------------");
System.out.println("Start Scale all images");
List<SOMImage> eventimages
= SOMEvent.getInstance().getImages();
for (SOMImage img :
eventimages) {
System.out.println("--------------------------------");
System.out.println("Scale " + img.getName());
System.out.println("Source: " + img.getSrc());
// ------------------------------------------------------------------
// Test if Files get generated
System.out.println("Preview: " + img.getPrv());
assertEquals(true, Boolean.valueOf(ScaleWorker.scale(img, ScaleWorker.PREVIEW).getPrv().isFile()), "No Preview generated");
System.out.println("Thumbnail: " + img.getTmb());
assertEquals(true, Boolean.valueOf(ScaleWorker.scale(img, ScaleWorker.THUMBNAIL).getTmb().isFile()), "No Thumbnail genetated");
// ------------------------------------------------------------------
// Test if Previews are the right size
ImageIcon previewImageIcon = new ImageIcon(img.getPrv().getPath());
// the sources original width and height
int previewWidth = previewImageIcon.getIconWidth();
int previewHeight = previewImageIcon.getIconHeight();
assertEquals(SOMLayout.SCREEN_WIDTH, previewWidth, "Width does not Equal");
assertEquals(SOMLayout.SCREEN_HEIGHT, previewHeight, "Height does not Equal");
// ---------
// Test if Thumbnails are the right size
ImageIcon thumbnailImageIcon = new ImageIcon(img.getTmb().getPath());
// the sources original width and height
int thumbnailWidth = thumbnailImageIcon.getIconWidth();
int thumbnailHeight = thumbnailImageIcon.getIconHeight();
assertEquals(SOMLayout.getColumn(1), thumbnailWidth, "Width does not Equal");
assertEquals(SOMLayout.getRow(1), thumbnailHeight, "Height does not Equal");
// -------------------------------------------------------------------
System.out.println("Done.");
System.out.println("");
}
}
private static void recursiveDeleteDir(File ImageDir) {
System.out.println("recursion: " + ImageDir);
for (File fileInImageDir :
ImageDir.listFiles()) {
// IF IS FILE
if (fileInImageDir.isFile()) {
if (!fileInImageDir.delete()) {
fail("Unable to delete File: " + fileInImageDir.getAbsoluteFile().toString());
}
}
// IF IS DIR
if (fileInImageDir.isDirectory()) {
recursiveDeleteDir(fileInImageDir);
fileInImageDir.delete();
}
}
}
protected Parent getRootNode() {
JFXPanel jfxPanel = new JFXPanel();
final Button btn = new Button();
btn.setId("btn");
btn.setText("Hello World");
return btn;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 KiB

+10
View File
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>No Image Here</title>
</head>
<body>
</body>
</html>