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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <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> <annotationProcessing>
<profile default="true" name="Default" enabled="false"> <profile name="Maven default annotation processors profile" enabled="true">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="selfomat-single-user" /> <module name="selfomat-single-user" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="1.8"> <bytecodeTargetLevel target="1.8">
<module name="selfomat-single-user" target="1.5" /> <module name="selfomat-single-user" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>
</project> </project>
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding"> <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="file://$PROJECT_DIR$/src/main/resources/sh/upload.sh" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" /> <file url="PROJECT" charset="UTF-8" />
</component> </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" /> <property name="caretWidth" class="java.lang.Integer" />
</properties> </properties>
</component> </component>
<component name="EntryPointsManager"> <component name="JavadocGenerationManager">
<entry_points version="2.0" /> <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>
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">
@@ -48,7 +63,7 @@
</list> </list>
</option> </option>
</component> </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" /> <output url="file://$PROJECT_DIR$/classes" />
</component> </component>
<component name="SvnBranchConfigurationManager"> <component name="SvnBranchConfigurationManager">
+61 -1
View File
@@ -3,11 +3,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.selfomat</groupId> <groupId>de.selfomat</groupId>
<artifactId>selfomat-single-user</artifactId> <artifactId>selfomat-single-user</artifactId>
<version>0.4.1.2-SNAPSHOT</version> <version>0.4.2.0-SNAPSHOT</version>
<scm> <scm>
<url>scm:git:http://192.168.100.78/git/selfomat-software.git</url> <url>scm:git:http://192.168.100.78/git/selfomat-software.git</url>
</scm> </scm>
<distributionManagement> <distributionManagement>
<!-- Publish the versioned releases here --> <!-- Publish the versioned releases here -->
<repository> <repository>
@@ -30,12 +31,62 @@
<version>3.2.1</version> <version>3.2.1</version>
</dependency> </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> </dependencies>
<name>selfomat single user</name> <name>selfomat single user</name>
<description>Photobooth Software</description> <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> <build>
<plugins> <plugins>
<plugin> <plugin>
@@ -61,7 +112,16 @@
</descriptorRefs> </descriptorRefs>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
+13 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <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 url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <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-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-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: 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> </component>
</module> </module>
+9 -15
View File
@@ -14,7 +14,6 @@ import model.SOMEvent;
import model.SOMImage; import model.SOMImage;
import model.SOMLayout; import model.SOMLayout;
import workers.FilesWorker; import workers.FilesWorker;
import workers.ScaleWorker;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@@ -53,10 +52,10 @@ public class CaptureCtl {
private void setPictureLoadIndicator() { private void setPictureLoadIndicator() {
pictureLoadIndicator.setVisible(false); pictureLoadIndicator.setVisible(false);
pictureLoadIndicator.setPrefHeight(SOMLayout.screenHeight / 4); pictureLoadIndicator.setPrefHeight(SOMLayout.SCREEN_HEIGHT / 4);
pictureLoadIndicator.setPrefWidth(SOMLayout.screenHeight / 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;"); pictureLoadIndicator.setStyle("-fx-progress-color: white;");
} }
@@ -66,11 +65,11 @@ public class CaptureCtl {
capturePane.setAlignment(Pos.CENTER); capturePane.setAlignment(Pos.CENTER);
countdownText.setAlignment(Pos.CENTER); countdownText.setAlignment(Pos.CENTER);
countdownText.setPrefSize(SOMLayout.screenHeight / 2, SOMLayout.screenHeight / 2); countdownText.setPrefSize(SOMLayout.SCREEN_HEIGHT / 2, SOMLayout.SCREEN_HEIGHT / 2);
countdownText.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.screenHeight / 4)); countdownText.setBackground(SOMLayout.getTransparentBG20rounded(SOMLayout.SCREEN_HEIGHT / 4));
countdownText.setText(null); 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); countdownText.setTextFill(SOMLayout.WHITE);
} }
@@ -86,12 +85,12 @@ public class CaptureCtl {
image.setImage(SOMLayout.LOGO_IMAGE); image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen // 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) // 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 aspect = image.getImage().getWidth() / image.getImage().getHeight();
double scaledWidth = aspect * SOMLayout.screenHeight; double scaledWidth = aspect * SOMLayout.SCREEN_HEIGHT;
double offset = (scaledWidth - SOMLayout.screenWidth) / 2; double offset = (scaledWidth - SOMLayout.SCREEN_WIDTH) / 2;
image.setX(-offset); image.setX(-offset);
} }
@@ -226,15 +225,10 @@ public class CaptureCtl {
// Capture the image // Capture the image
SOMImage newImage = FilesWorker.waitForImageAndCapture(); SOMImage newImage = FilesWorker.waitForImageAndCapture();
//Scale the image to preview
ScaleWorker.scale(newImage, ScaleWorker.PREVIEW);
// set te image to UI // set te image to UI
image.setImage(new Image(newImage.getPrv().toURI().toString())); image.setImage(new Image(newImage.getPrv().toURI().toString()));
SOMGUI.pictureCtl.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]); SOMEvent.getInstance().createAndSetImage(somPageImagesArray[finalI]);
} }
}); });
i++; i++;
} }
} }
@@ -140,8 +139,8 @@ public class GalleryCtl {
imageView.setPreserveRatio(true); imageView.setPreserveRatio(true);
// make it fit the height of the Screen // make it fit the height of the Screen
imageView.setFitHeight(SOMLayout.screenHeight / 3); imageView.setFitHeight(SOMLayout.SCREEN_HEIGHT / 3);
imageView.setFitWidth(SOMLayout.screenWidth / 4); imageView.setFitWidth(SOMLayout.SCREEN_WIDTH / 4);
// position the images in Center // position the images in Center
GridPane.setValignment(imageView, VPos.CENTER); GridPane.setValignment(imageView, VPos.CENTER);
@@ -150,22 +149,22 @@ public class GalleryCtl {
} }
public void setPane() { public void setPane() {
pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight); pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setMinSize(SOMLayout.screenWidth, SOMLayout.screenHeight); pane.setMinSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG); pane.setBackground(SOMLayout.BLACK_BG);
} }
public void setGrid() { public void setGrid() {
grid.setPrefHeight(SOMLayout.screenHeight); grid.setPrefHeight(SOMLayout.SCREEN_HEIGHT);
grid.setPrefWidth(SOMLayout.screenWidth); grid.setPrefWidth(SOMLayout.SCREEN_WIDTH);
grid.setMinSize(SOMLayout.screenWidth, SOMLayout.screenHeight); grid.setMinSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
} }
public void setForthButton() { public void setForthButton() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment // set alignment
GridPane.setHalignment(forthButton, HPos.CENTER); GridPane.setHalignment(forthButton, HPos.CENTER);
GridPane.setValignment(forthButton, VPos.CENTER); GridPane.setValignment(forthButton, VPos.CENTER);
@@ -188,7 +187,7 @@ public class GalleryCtl {
forthButton.setOnMousePressed(new EventHandler<MouseEvent>() { forthButton.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback // 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) { public void handle(MouseEvent event) {
// Feedback // Feedback
forthButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); forthButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
@@ -213,7 +212,7 @@ public class GalleryCtl {
public void setBackButton() { public void setBackButton() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment // set alignment
GridPane.setHalignment(backButton, HPos.CENTER); GridPane.setHalignment(backButton, HPos.CENTER);
GridPane.setValignment(backButton, VPos.CENTER); GridPane.setValignment(backButton, VPos.CENTER);
@@ -236,7 +235,7 @@ public class GalleryCtl {
backButton.setOnMousePressed(new EventHandler<MouseEvent>() { backButton.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback // 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) { public void handle(MouseEvent event) {
// Feedback // Feedback
backButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); backButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
@@ -261,7 +260,7 @@ public class GalleryCtl {
public void setPictureButton() { public void setPictureButton() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set alignment // set alignment
GridPane.setHalignment(pictureButton, HPos.CENTER); GridPane.setHalignment(pictureButton, HPos.CENTER);
GridPane.setValignment(pictureButton, VPos.CENTER); GridPane.setValignment(pictureButton, VPos.CENTER);
@@ -284,7 +283,7 @@ public class GalleryCtl {
pictureButton.setOnMousePressed(new EventHandler<MouseEvent>() { pictureButton.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback // 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) { public void handle(MouseEvent event) {
// Feedback // Feedback
pictureButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); pictureButton.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
+20 -24
View File
@@ -64,12 +64,12 @@ public class PictureCtl {
} }
private void setPane() { private void setPane() {
pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight); pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG); pane.setBackground(SOMLayout.BLACK_BG);
} }
private void setGrid() { private void setGrid() {
grid.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight); grid.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
grid.setAlignment(Pos.CENTER); grid.setAlignment(Pos.CENTER);
@@ -80,7 +80,7 @@ public class PictureCtl {
private void setSingleBtn() { private void setSingleBtn() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width // set the Button height & width
singleBtn.setPrefSize(height, height); singleBtn.setPrefSize(height, height);
@@ -100,7 +100,7 @@ public class PictureCtl {
// Set the Action to run after Button is Pressed // Set the Action to run after Button is Pressed
EventHandler singleCapturePressedEventHandler = new EventHandler<MouseEvent>() { EventHandler singleCapturePressedEventHandler = new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { 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) { public void handle(MouseEvent event) {
// Feedback (button gets less transparent) // Feedback (button gets less transparent)
singleBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); singleBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
@@ -137,7 +137,7 @@ public class PictureCtl {
private void setSeriesBtn() { private void setSeriesBtn() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width // set the Button height & width
seriesBtn.setPrefSize(height, height); seriesBtn.setPrefSize(height, height);
@@ -159,7 +159,7 @@ public class PictureCtl {
EventHandler<MouseEvent> seriesCapturePressedEventHandler = new EventHandler<MouseEvent>() { EventHandler<MouseEvent> seriesCapturePressedEventHandler = new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback (Button gets lesstransparent) // 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 //Set Action after series Button is released
@@ -167,7 +167,7 @@ public class PictureCtl {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback (Button gets less transparent) // 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) // Shoot series (true means series Mode)
SOMGUI.captureCtl.shoot(true); SOMGUI.captureCtl.shoot(true);
@@ -177,7 +177,7 @@ public class PictureCtl {
EventHandler<TouchEvent> seriesCapturePressedTouchEventHandler = new EventHandler<TouchEvent>() { EventHandler<TouchEvent> seriesCapturePressedTouchEventHandler = new EventHandler<TouchEvent>() {
public void handle(TouchEvent event) { public void handle(TouchEvent event) {
// Feedback (Button gets lesstransparent) // 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 //Set Action after series Button is released
@@ -185,7 +185,7 @@ public class PictureCtl {
public void handle(TouchEvent event) { public void handle(TouchEvent event) {
// Feedback (Button gets less transparent) // 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) // Shoot series (true means series Mode)
SOMGUI.captureCtl.shoot(true); SOMGUI.captureCtl.shoot(true);
@@ -206,7 +206,7 @@ public class PictureCtl {
private void setGalleryBtn() { private void setGalleryBtn() {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width // set the Button height & width
galleryBtn.setPrefSize(height, height); galleryBtn.setPrefSize(height, height);
@@ -227,7 +227,7 @@ public class PictureCtl {
galleryBtn.setOnMousePressed(new EventHandler<MouseEvent>() { galleryBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback // 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) { public void handle(MouseEvent event) {
// Feedback // Feedback
galleryBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); galleryBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
@@ -253,7 +253,7 @@ public class PictureCtl {
if (SOMConfig.PRINTER == true) { if (SOMConfig.PRINTER == true) {
// get the button height & width // get the button height & width
int height = (SOMLayout.screenHeight / 4); int height = (SOMLayout.SCREEN_HEIGHT / 4);
// set the Button height & width // set the Button height & width
printBtn.setPrefSize(height, height); printBtn.setPrefSize(height, height);
@@ -274,7 +274,7 @@ public class PictureCtl {
printBtn.setOnMousePressed(new EventHandler<MouseEvent>() { printBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// Feedback // 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) { public void handle(MouseEvent event) {
// Feedback // Feedback
printBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.screenHeight / 4)); printBtn.setBackground(SOMLayout.getTransparentBG10rounded(SOMLayout.SCREEN_HEIGHT / 4));
// Action // Action
action(); action();
@@ -315,7 +315,7 @@ public class PictureCtl {
// image.setImage(splash); // image.setImage(splash);
// //
// // make it fit the height of the Screen // // 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 // Set the image aspect ratio to be preserved
image.setPreserveRatio(true); image.setPreserveRatio(true);
@@ -324,12 +324,12 @@ public class PictureCtl {
image.setImage(SOMLayout.LOGO_IMAGE); image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen // 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) // 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 aspect = image.getImage().getWidth() / image.getImage().getHeight();
double scaledWidth = aspect * SOMLayout.screenHeight; double scaledWidth = aspect * SOMLayout.SCREEN_HEIGHT;
double offset = (scaledWidth - SOMLayout.screenWidth) / 2; double offset = (scaledWidth - SOMLayout.SCREEN_WIDTH) / 2;
image.setX(-offset); image.setX(-offset);
@@ -341,10 +341,6 @@ public class PictureCtl {
// Set the last Image of the session // Set the last Image of the session
SOMImage somImage = somImageList.get(numberOfImages - 1); 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 // Scale the Image if needed
ScaleWorker.scale(somImage, ScaleWorker.PREVIEW); ScaleWorker.scale(somImage, ScaleWorker.PREVIEW);
+5 -5
View File
@@ -67,11 +67,11 @@ public class SOMGUI extends Application {
warnCtl = warnLoader.getController(); warnCtl = warnLoader.getController();
// Initialize the Scenes // Initialize the Scenes
pictureScene = new Scene(picture, SOMLayout.screenWidth, SOMLayout.screenHeight); pictureScene = new Scene(picture, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
galleryScene = new Scene(gallery, SOMLayout.screenWidth, SOMLayout.screenHeight); galleryScene = new Scene(gallery, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
uploadScene = new Scene(upload, SOMLayout.screenWidth, SOMLayout.screenHeight); uploadScene = new Scene(upload, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
captureScene = new Scene(capture, SOMLayout.screenWidth, SOMLayout.screenHeight); captureScene = new Scene(capture, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
warnScene = new Scene(warn, SOMLayout.screenWidth, SOMLayout.screenHeight); warnScene = new Scene(warn, SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
} }
public static SOMGUI getInstance() throws Exception { public static SOMGUI getInstance() throws Exception {
+9 -9
View File
@@ -77,12 +77,12 @@ public class UploadCtl {
} }
private void setPane() { private void setPane() {
pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight); pane.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
pane.setBackground(SOMLayout.BLACK_BG); pane.setBackground(SOMLayout.BLACK_BG);
} }
private void setGrid() { private void setGrid() {
grid.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight); grid.setPrefSize(SOMLayout.SCREEN_WIDTH, SOMLayout.SCREEN_HEIGHT);
GridPane.setHalignment(folderImageView, HPos.CENTER); GridPane.setHalignment(folderImageView, HPos.CENTER);
GridPane.setHalignment(folderLabel, HPos.CENTER); GridPane.setHalignment(folderLabel, HPos.CENTER);
GridPane.setHalignment(folderProgressBar, HPos.CENTER); GridPane.setHalignment(folderProgressBar, HPos.CENTER);
@@ -99,15 +99,15 @@ public class UploadCtl {
} }
private void setFolderProg() { private void setFolderProg() {
folderProgressBar.setPrefSize(SOMLayout.screenWidth, 3); folderProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
} }
private void setPicProg() { private void setPicProg() {
pictureProgressBar.setPrefSize(SOMLayout.screenWidth, 3); pictureProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
} }
private void setCleanProg() { private void setCleanProg() {
cleanProgressBar.setPrefSize(SOMLayout.screenWidth, 3); cleanProgressBar.setPrefSize(SOMLayout.SCREEN_WIDTH, 3);
} }
private void setFolderIV() { private void setFolderIV() {
@@ -139,10 +139,10 @@ public class UploadCtl {
} }
// set the progress // set the progress
// public void setFolderProgress(double value) { public void setFolderProgress(double value) {
// folderProgressBar.setProgress(value); folderProgressBar.setProgress(value);
// System.out.println("Folder Progress set to: "+ value); System.out.println("Folder Progress set to: "+ value);
// } }
public void setPicProgress(double value) { public void setPicProgress(double value) {
pictureProgressBar.setProgress(value); pictureProgressBar.setProgress(value);
+2 -3
View File
@@ -2,7 +2,7 @@ package model;
import workers.MachineWorker; import workers.MachineWorker;
import java.io.*; import java.io.File;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
@@ -49,8 +49,7 @@ public class SOMConfig {
// Constructor // Constructor
private SOMConfig() { private SOMConfig() {
// get the default Displays' dimensions // get the default Displays' dimensions
// System.out.println("Creating Configuration. Sreen Size: " + SOMLayout.SCREEN_WIDTH + "x" + SOMLayout.SCREEN_HEIGHT);
System.out.println("Creating Configuration. Sreen Size: " + SOMLayout.screenWidth + "x" + SOMLayout.screenHeight);
// important Paths // important Paths
PICTURES_PATH = new File("images"); PICTURES_PATH = new File("images");
@@ -1,7 +1,5 @@
package model; package model;
import workers.MachineWorker;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
@@ -10,9 +8,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.io.File; import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@XmlRootElement(name = "Config") @XmlRootElement(name = "Config")
public class SOMConfigFileHandler { public class SOMConfigFileHandler {
+4 -20
View File
@@ -48,7 +48,6 @@ public class SOMEvent {
// Singleton to prevent Instantiation // Singleton to prevent Instantiation
if (event == null) { if (event == null) {
event = new SOMEvent(); event = new SOMEvent();
// event.currentimage = SOMImage.getFallbackImage();
} }
return event; return event;
@@ -61,22 +60,16 @@ public class SOMEvent {
*/ */
public void getEventImages() { public void getEventImages() {
// Behandelt // Behandelt
// if (!imagesread) {
File[] files = FilesWorker.getSourcePath().listFiles(); File[] files = FilesWorker.getSourcePath().listFiles();
assert files != null; assert files != null;
Arrays.sort(files); Arrays.sort(files);
for (File file : files) { for (File file : files) {
SOMImage img = new SOMImage(file.getName()); SOMImage img = new SOMImage();
img.updateImageState(); img.updateImageState();
this.addImage(img); this.addImage(img);
} }
// imagesread = true;
// }
// return;
} }
/** /**
@@ -89,15 +82,6 @@ public class SOMEvent {
images.add(now); images.add(now);
} }
/**
* Returns the Events' Date
*
* @return the date
*/
public Date getDate() {
return date;
}
/** /**
* Returns a List of all of the Events' images * Returns a List of all of the Events' images
* *
@@ -105,9 +89,9 @@ public class SOMEvent {
*/ */
public List<SOMImage> getImages() { public List<SOMImage> getImages() {
// If there are no Event Images Collected // If there are no Event Images Collected
if (images.size() == 0) // if (0 == images.size())
// get all the events' images // // get all the events' images
getEventImages(); // this.getEventImages();
//...and return them //...and return them
return images; return images;
} }
+47 -77
View File
@@ -3,11 +3,11 @@ package model;
import workers.FilesWorker; import workers.FilesWorker;
import java.io.File; import java.io.File;
import java.nio.file.Files; import java.util.List;
public class SOMImage { public class SOMImage {
private static String name; // the filename private final String imageName; // the filename
private final SOMConfig config = SOMConfig.getInstance(); private final SOMConfig config = SOMConfig.getInstance();
@@ -22,68 +22,62 @@ public class SOMImage {
private boolean srcthere; // source status private boolean srcthere; // source status
private boolean fnlthere; // final status private boolean fnlthere; // final status
SOMImage(String name) { /**
* Automatically generates an SOMImage Object
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name); * with an incremented Number and all th Paths
*/
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();
}
public SOMImage() { 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"; String fill = "00000";
int nmb = (numberOfEventPictures + 1); int nmb = (nrOfEventPics + 1);
String number = String.valueOf(nmb); String number = String.valueOf(nmb);
String filledNumber = fill.substring(number.length()) + number;
name = filledNumber + ".jpg";
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name); int numberLength = number.length();
File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name); String filledNumber = fill.substring(numberLength) + number;
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.imageName = filledNumber + ".jpg";
this.prv = prv;
this.src = src; File sourcePath = FilesWorker.getSourcePath();
this.fnl = fnl; this.src = new File(sourcePath + "/" + this.imageName);
this.tmp = tmp;
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(); this.updateImageState();
} }
public void updateImageState() { public final void updateImageState() {
// tmb // tmb
tmbthere = Files.exists(tmb.toPath()); this.tmbthere = this.tmb.isFile();
// prv // prv
prvthere = Files.exists(prv.toPath()); this.prvthere = this.prv.isFile();
// src // src
srcthere = Files.exists(src.toPath()); this.srcthere = this.src.isFile();
// fnl // fnl
fnlthere = Files.exists(fnl.toPath()); this.fnlthere = this.fnl.isFile();
} }
/** /**
* @return the name * @return the imageName
*/ */
public String getName() { public String getName() {
return name; return this.imageName;
} }
/** /**
@@ -97,79 +91,55 @@ public class SOMImage {
* @return the prv * @return the prv
*/ */
public File getPrv() { public File getPrv() {
return prv; return this.prv;
} }
/** /**
* @return the src * @return the src
*/ */
public File getSrc() { public File getSrc() {
return src; return this.src;
} }
/** /**
* @return the fnl * @return the fnl
*/ */
public File getFnl() { public File getFnl() {
return fnl; return this.fnl;
} }
/** /**
* @return the tmp * @return the tmp
*/ */
public File getTmp() { public File getTmp() {
return tmp; return this.tmp;
} }
/** /**
* @return the tmbthere * @return the tmbthere
*/ */
public boolean isTmbthere() { public boolean isTmbthere() {
return tmbthere; return this.tmbthere;
} }
/** /**
* @return the prvthere * @return the prvthere
*/ */
public boolean isPrvthere() { public boolean isPrvthere() {
return prvthere; return this.prvthere;
} }
/** /**
* @return the srcthere * @return the srcthere
*/ */
public boolean isSrcthere() { public boolean isSrcthere() {
return srcthere; return this.srcthere;
} }
/** /**
* @return the fnlthere * @return the fnlthere
*/ */
public boolean isFnlthere() { 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.Background;
import javafx.scene.layout.BackgroundFill; import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii; import javafx.scene.layout.CornerRadii;
import javafx.scene.text.Font;
import javafx.stage.Screen; import javafx.stage.Screen;
import java.awt.*;
public class SOMLayout { public class SOMLayout {
// Fonts // Fonts
public static final Font H_0 = new Font(Font.SANS_SERIF, 1, 150); public static final Font H_0 = Font.loadFont("fonts/CenturyGothicStd.otf", 150);
public static final Font H_1 = new Font(Font.SANS_SERIF, 1, 100); // public static final Font H_0 = new Font(Font.SANS_SERIF, 1, 150);
public static final Font H_2 = new Font(Font.SANS_SERIF, 1, 75); public static final Font H_1 = Font.loadFont("fonts/CenturyGothicStd.otf", 100);
public static final Font P = new Font(Font.SANS_SERIF, 1, 50); // 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 // Icons & Images
//UI //UI
public static final javafx.scene.image.Image GALLERY_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Gallery.png").toString()); 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 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.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 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 // Screen
// private static final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); // private static final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
private static final javafx.geometry.Rectangle2D gd = Screen.getPrimary().getBounds(); private static final javafx.geometry.Rectangle2D gd = Screen.getPrimary().getBounds();
public static final int screenWidth = (int) gd.getWidth(); public static final int SCREEN_WIDTH = SOMLayout.getScreenWidth();
public static final int screenHeight = (int) gd.getHeight();
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 // Layout
private static final int row = screenHeight / 3; private static final int row = SOMLayout.SCREEN_HEIGHT / 3;
private static final int column = screenWidth / 4; private static final int column = SOMLayout.SCREEN_WIDTH / 4;
// Colors // Colors
private static final javafx.scene.paint.Color BLACK = new javafx.scene.paint.Color(0, 0, 0, 1); private static final javafx.scene.paint.Color BLACK = new javafx.scene.paint.Color(0, 0, 0, 1);
//Backgrounds //Backgrounds
+122 -75
View File
@@ -18,27 +18,29 @@ import java.nio.file.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
import static java.nio.file.StandardWatchEventKinds.*; import static java.nio.file.StandardWatchEventKinds.*;
public class FilesWorker { /**
*
*/
public final class FilesWorker {
private static final SOMEvent event = SOMEvent.getInstance(); 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. * Returns true if a File is an image and returns false if not.
* *
* @param path * @param file
* @return * @return
*/ */
public static boolean isImage(Path path) { public static boolean isImage(File file) {
File f = path.toFile(); String mimeType = new MimetypesFileTypeMap().getContentType(file);
String mimeType = new MimetypesFileTypeMap().getContentType(f);
String type = mimeType.split("/")[0]; String type = mimeType.split("/")[0];
return type.equals("image"); return type.equals("image");
} }
@@ -50,7 +52,7 @@ public class FilesWorker {
* @return * @return
*/ */
public static File getSourcePath() { public static File getSourcePath() {
File src = new File(SOMConfig.PICTURES_PATH.toString() + "/src"); File src = new File(SOMConfig.PICTURES_PATH + "/src");
src.mkdirs(); src.mkdirs();
return src; return src;
@@ -63,7 +65,7 @@ public class FilesWorker {
* @return * @return
*/ */
public static File getPreviewPath() { public static File getPreviewPath() {
File prv = new File(SOMConfig.PICTURES_PATH.toString() + "/prv"); File prv = new File(SOMConfig.PICTURES_PATH + "/prv");
prv.mkdirs(); prv.mkdirs();
return prv; return prv;
@@ -76,7 +78,7 @@ public class FilesWorker {
* @return * @return
*/ */
public static File getThumbPath() { public static File getThumbPath() {
File tmb = new File(SOMConfig.PICTURES_PATH.toString() + "/tmb"); File tmb = new File(SOMConfig.PICTURES_PATH + "/tmb");
tmb.mkdirs(); tmb.mkdirs();
return tmb; return tmb;
@@ -89,7 +91,7 @@ public class FilesWorker {
* @return * @return
*/ */
public static File getFinalPath() { public static File getFinalPath() {
File fnl = new File(SOMConfig.PICTURES_PATH.toString() + "/fnl"); File fnl = new File(SOMConfig.PICTURES_PATH + "/fnl");
fnl.mkdirs(); fnl.mkdirs();
return fnl; return fnl;
@@ -102,23 +104,27 @@ public class FilesWorker {
* @return * @return
*/ */
public static File getTempPath() { public static File getTempPath() {
File tmp = new File(SOMConfig.PICTURES_PATH.toString() + "/tmp"); File tmp = new File(SOMConfig.PICTURES_PATH + "/tmp");
tmp.mkdirs(); tmp.mkdirs();
return tmp; return tmp;
} }
/**
* Prints out the current image via cups
*/
public static void print() { public static void print() {
try { try {
System.out.println( log.info(
SOMEvent.getInstance().getCurrentimage().getSrc().toString() SOMEvent.getInstance().getCurrentimage().getSrc().toString()
); );
// get a process taking the image // get a process taking the image
ProcessBuilder builder = new ProcessBuilder( ProcessBuilder builder = new ProcessBuilder(
"lp", "lp",
SOMEvent.getInstance().getCurrentimage().getSrc().toString() SOMEvent.getInstance().getCurrentimage().getSrc().toString()
); );
builder.redirectErrorStream(true); 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() { private static boolean internet() {
Socket sock = new Socket(); Socket sock = new Socket();
InetSocketAddress socketAddress = new InetSocketAddress("google.com", 80); InetSocketAddress socketAddress = new InetSocketAddress("selfomat.de", 80);
try { try {
sock.connect(socketAddress, 3000); sock.connect(socketAddress, 3000);
System.out.println("Internet available"); log.info("Internet available");
return true; return true;
} catch (IOException e) { } catch (IOException e) {
System.out.println("Internet NOT available"); log.warning("Internet NOT available");
return false; return false;
} finally { } finally {
try { 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() { public static void upload() {
try { try {
@@ -177,7 +191,7 @@ public class FilesWorker {
currentdir = currentdir + "/" + split; currentdir = currentdir + "/" + split;
dirs.add(new File(currentdir)); dirs.add(new File(currentdir));
System.out.println("DIR added:" + currentdir); log.info("DIR added:" + currentdir);
} }
// FILES // FILES
@@ -186,7 +200,7 @@ public class FilesWorker {
// get the current file // get the current file
File file = images.get(i); File file = images.get(i);
System.out.println(file); log.info(file.toString());
// get pics // get pics
if (file.isFile() if (file.isFile()
@@ -198,8 +212,8 @@ public class FilesWorker {
} }
// REPORT TO CONSOLE // REPORT TO CONSOLE
System.out.println(dirs.size() + " Directories"); log.info(dirs.size() + " Directories");
System.out.println(pics.size() + " Pics"); log.info(pics.size() + " Pics");
int queueddirs = 0; int queueddirs = 0;
int queuedfiles = 0; int queuedfiles = 0;
@@ -211,16 +225,16 @@ public class FilesWorker {
queueddirs++; queueddirs++;
System.out.println("Queueing Directories " + dir.toString()); log.info("Queueing Directories " + dir.toString());
limitdirs.add(dir); limitdirs.add(dir);
if (limitdirs.size() >= SOMConfig.PARALLEL_UPLOADS if (limitdirs.size() >= SOMConfig.PARALLEL_UPLOADS
// Upload even if limit is not reached // Upload even if limit is not reached
|| (dirs.size() - queueddirs) < SOMConfig.PARALLEL_UPLOADS) { || (dirs.size() - queueddirs) < SOMConfig.PARALLEL_UPLOADS) {
System.out.println("Launch Dir upload"); log.info("Launch Dir upload");
uploadDir(limitdirs); uploadDir(limitdirs);
System.out.println("Clear Queue"); log.info("Clear Queue");
limitdirs.clear(); limitdirs.clear();
} }
} }
@@ -232,18 +246,18 @@ public class FilesWorker {
// Counter for all queued files over the whole upload process // Counter for all queued files over the whole upload process
queuedfiles++; queuedfiles++;
System.out.println("Queueing File " + pic.toString()); log.info("Queueing File " + pic.toString());
limitpics.add(pic); limitpics.add(pic);
if ( // Check if the parallel Upload Limit is reached if ( // Check if the parallel Upload Limit is reached
limitpics.size() >= SOMConfig.PARALLEL_UPLOADS limitpics.size() >= SOMConfig.PARALLEL_UPLOADS
// Upload even if limit is not reached if the pics are the last ones // Upload even if limit is not reached if the pics are the last ones
|| (pics.size() - queuedfiles) < SOMConfig.PARALLEL_UPLOADS) { || (pics.size() - queuedfiles) < SOMConfig.PARALLEL_UPLOADS) {
System.out.println("Launch File upload"); log.info("Launch File upload");
uploadFile(limitpics); uploadFile(limitpics);
System.out.println("Clear File Queue"); log.info("Clear File Queue");
limitpics.clear(); limitpics.clear();
} else { } else {
} }
@@ -261,7 +275,7 @@ public class FilesWorker {
// reboot // reboot
new File("reboot").mkdirs(); // new File("reboot").mkdirs();
// new ProcessBuilder("sudo reboot").start(); // new ProcessBuilder("sudo reboot").start();
} }
@@ -282,14 +296,15 @@ public class FilesWorker {
} }
} }
/**
*
*/
private static void archiveBackup() { private static void archiveBackup() {
Task<Boolean> task = new Task<Boolean>() { Task<Boolean> task = new Task<Boolean>() {
@Override @Override
protected Boolean call() throws Exception { protected Boolean call() throws Exception {
// build the archive process // build the archive process
// TODO remove -k option (this option skips certificate verification)
// TODO Make Software run in SELFOMAT Directory
ProcessBuilder builder = new ProcessBuilder( ProcessBuilder builder = new ProcessBuilder(
"bash", "bash",
"SELFOMAT/sh/move-backup.sh" "SELFOMAT/sh/move-backup.sh"
@@ -303,34 +318,42 @@ public class FilesWorker {
// wait for the process to end // wait for the process to end
if (process.waitFor() == 0) { if (process.waitFor() == 0) {
// process ended successful // process ended successful
System.out.println("archiving Backup"); log.info("archiving Backup");
return true; return true;
} else { } else {
// process ended failing // process ended failing
// TODO Catch failed uploads // TODO Catch failed archives
System.out.println("Backup archiving failed!"); log.severe("Backup archiving failed!");
return false; 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 { 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++) { 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 File file = files.get(i);
final String target = SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir() + "/" + file.getName(); final String target = SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir() + "/" + file.getName();
System.out.println(""); log.info("");
System.out.println(file.toString() + "----------->" + target); log.info(file.toString() + "----------->" + target);
System.out.println(""); log.info("");
final int pictureCounter = i + 1; final int pictureCounter = i + 1;
Task<Boolean> task = new Task<Boolean>() { Task<Boolean> task = new Task<Boolean>() {
@@ -339,7 +362,6 @@ public class FilesWorker {
protected Boolean call() throws Exception { protected Boolean call() throws Exception {
// build the upload process // build the upload process
// TODO remove -k option (this option skips certificate verification) // TODO remove -k option (this option skips certificate verification)
// TODO Make Software run in SELFOMAT Directory
ProcessBuilder builder = new ProcessBuilder( ProcessBuilder builder = new ProcessBuilder(
"bash", "bash",
"SELFOMAT/sh/upload.sh", "SELFOMAT/sh/upload.sh",
@@ -356,32 +378,26 @@ public class FilesWorker {
// wait for the process to end // wait for the process to end
if (process.waitFor() == 0) { if (process.waitFor() == 0) {
// process ended successful // process ended successful
System.out.println("file uploaded: " + file); log.info("file uploaded: " + file);
// TODO get the length of all threads
// TODO bind to UI
updateProgress(pictureCounter, threads.length);
return true; return true;
} else { } else {
// process ended failing // process ended failing
// TODO Catch failed uploads // TODO Catch failed uploads
log.severe("process ended failing " + file);
System.out.println("process ended failing " + file);
Thread.sleep(1000);
return false; return false;
} }
} }
}; };
SOMGUI.uploadCtl.pictureProgressBar.progressProperty().bind(task.progressProperty()); // SOMGUI.uploadCtl.pictureProgressBar.progressProperty().bind(task.progressProperty());
threads[i] = new Thread(task); threads[i] = new Thread(task);
threads[i].setDaemon(true); threads[i].setDaemon(true);
threads[i].start(); threads[i].start();
// threads[i].
} }
int i = 0; int i = 0;
while (i < threads.length) { 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 { private static void uploadDir(final List<File> dirs) throws Exception {
final Thread[] threads = new Thread[dirs.size()]; final Thread[] threads = new Thread[dirs.size()];
for (int i = 0; i < threads.length; i++) { 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 File dir = dirs.get(i);
final int directoryCounter = i + 1; final int directoryCounter = i + 1;
@@ -404,14 +430,12 @@ public class FilesWorker {
@Override @Override
protected Boolean call() throws Exception { protected Boolean call() throws Exception {
// build the Upload process with curl // build the Upload process with curl
// TODO remove -k option (this option skips certificate verification)
ProcessBuilder builder = new ProcessBuilder("curl", ProcessBuilder builder = new ProcessBuilder("curl",
"-u", "-u",
SOMConfig.CLOUD_CREDENTIALS, SOMConfig.CLOUD_CREDENTIALS,
"-X", "-X",
"MKCOL", "MKCOL",
SOMConfig.CLOUD_ADDRESS + dir.toString().replace("/src", ""), SOMConfig.CLOUD_ADDRESS + dir.toString().replace("/src", ""));
"-k");
// make the process traceable // make the process traceable
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
@@ -422,23 +446,23 @@ public class FilesWorker {
// wait for the process to end // wait for the process to end
if (process.waitFor() == 0) { if (process.waitFor() == 0) {
// Process ended successful // Process ended successful
System.out.println("directory made: " + dir); log.info("directory made: " + dir);
//Set upload Progress //Set upload Progress
// TODO get the length of all threads
// TODO bind to UI // TODO bind to UI
updateProgress(directoryCounter, threads.length); SOMGUI.uploadCtl.setFolderProgress(directoryCounter / dirs.size());
// updateProgress(directoryCounter, threads.length);
return true; return true;
} else { } else {
// Process ended failing // Process ended failing
System.out.println("process ended failing " + dir); log.info("process ended failing " + dir);
return false; return false;
} }
} }
}; };
SOMGUI.uploadCtl.folderProgressBar.progressProperty().bind(task.progressProperty()); // SOMGUI.uploadCtl.folderProgressBar.progressProperty().bind(task.progressProperty());
// Start the Task // Start the Task
threads[i] = new Thread(task); threads[i] = new Thread(task);
@@ -452,10 +476,14 @@ public class FilesWorker {
threads[i].join(); threads[i].join();
i++; i++;
} }
//TODO Catch upload fails //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() { private static List<File> allFilesForUpload() {
File dir = SOMConfig.PICTURES_PATH; File dir = SOMConfig.PICTURES_PATH;
@@ -465,8 +493,15 @@ public class FilesWorker {
return new ArrayList<File>(filesAndDirs); 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() { public static SOMImage waitForImageAndCapture() {
//Behandelt
try { try {
// Set the Source Path to be watched // Set the Source Path to be watched
@@ -476,11 +511,11 @@ public class FilesWorker {
WatchService watcher = FileSystems.getDefault().newWatchService(); WatchService watcher = FileSystems.getDefault().newWatchService();
dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); 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()); + dir.getFileName());
// TRIGGER THE CAPTURE // TRIGGER THE CAPTURE
System.out.println("START CAPTURE THREAD"); log.info("START CAPTURE THREAD");
SOMImage newImage = CaptureWorker.now(); SOMImage newImage = CaptureWorker.now();
while (true) { while (true) {
@@ -500,7 +535,7 @@ public class FilesWorker {
WatchEvent<Path> ev = (WatchEvent<Path>) event; WatchEvent<Path> ev = (WatchEvent<Path>) event;
Path fileName = ev.context(); Path fileName = ev.context();
System.out.println(kind.name() + ": " + fileName); log.info(kind.name() + ": " + fileName);
// check for a file being created // check for a file being created
if ( if (
// Make sure there is an Image created // Make sure there is an Image created
@@ -512,14 +547,26 @@ public class FilesWorker {
//Set the Progress Indicator to 0.5 //Set the Progress Indicator to 0.5
SOMGUI.captureCtl.pictureLoadIndicator.setProgress(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 // 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 // ADD THE IMAGE TO THE EVENT
FilesWorker.event.addImage(newImage); FilesWorker.event.addImage(newImage);
// Set last Image // 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()); FilesWorker.event.createAndSetImage(FilesWorker.event.getLastImage());
// Hide the Progress Indicator // Hide the Progress Indicator
@@ -535,14 +582,14 @@ public class FilesWorker {
// Check that filename is the same as expected image // Check that filename is the same as expected image
&& !fileName.toString().equals( && !fileName.toString().equals(
newImage.getSrc().getName())) { 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 // // Hide the Progress Indicator
watcher.close(); // 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.InetAddress;
import java.net.UnknownHostException; 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. * 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. * Created by Simon on 12.12.2016.
*/ */
public class MachineWorker { public final class MachineWorker {
static int OperatingSystem; // for multiple OS'
static String HostName; // static int OperatingSystem;
static int[] Screen; 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() { public static String getHostName() {
try { try {
InetAddress addr; InetAddress addr = InetAddress.getLocalHost();
addr = InetAddress.getLocalHost(); String hostName = addr.getHostName();
HostName = addr.getHostName(); HostName = hostName;
log.info("Hostname: " + HostName);
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
System.out.println("Hostname can not be resolved"); log.info("Hostname can not be resolved");
} }
return HostName; 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.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
//import java.awt.*; //import java.awt.*;
@@ -23,19 +24,14 @@ public class ScaleWorker extends Thread {
public static final int SOURCE = 0; public static final int SOURCE = 0;
public static final int PREVIEW = 1; public static final int PREVIEW = 1;
public static final int THUMBNAIL = 2; public static final int THUMBNAIL = 2;
private static Logger log = Logger.getLogger(ScaleWorker.class.getName());
SOMConfig config = SOMConfig.getInstance(); SOMConfig config = SOMConfig.getInstance();
public static SOMImage scale(SOMImage somImage1, final int type) { public static SOMImage scale(SOMImage somImage1, final int type) {
final SOMImage somImage = somImage1; final SOMImage somImage = somImage1;
Task task = new Task() { Task task = new scaleTask(somImage, type);
@Override
protected SOMImage call() throws Exception {
// Do the scale work
return prepareandStart(somImage, type);
}
};
// open Thread // open Thread
Thread thread = new Thread(task); Thread thread = new Thread(task);
@@ -61,7 +57,7 @@ public class ScaleWorker extends Thread {
return somImages; return somImages;
} }
private static SOMImage prepareandStart(SOMImage somImage, int type) { static SOMImage prepareAndStart(SOMImage somImage, int type) {
// the image before scaling // the image before scaling
@@ -152,13 +148,13 @@ public class ScaleWorker extends Thread {
// for the preview // for the preview
case PREVIEW: case PREVIEW:
targetWidth = SOMLayout.screenWidth; targetWidth = SOMLayout.SCREEN_WIDTH;
targetHeight = SOMLayout.screenHeight; targetHeight = SOMLayout.SCREEN_HEIGHT;
targetFile = somImage.getPrv(); targetFile = somImage.getPrv();
// for the Thumbnail
break; break;
// for the Thumbnail
case THUMBNAIL: case THUMBNAIL:
targetWidth = SOMLayout.getColumn(1); targetWidth = SOMLayout.getColumn(1);
targetHeight = SOMLayout.getRow(1); targetHeight = SOMLayout.getRow(1);
@@ -207,10 +203,10 @@ public class ScaleWorker extends Thread {
} }
// Probably way faster than ImageIcon // Probably way faster than ImageIcon
System.out.println("Scale with Graphics2D:"); log.info("Scale with Graphics2D:");
// Print the File Path // Print the File Path
System.out.println(sourceFile.toString()); log.info(sourceFile.toString());
// SCALE ----------------------------------------------------------- // SCALE -----------------------------------------------------------
// THE ------------------------------------------------------------- // THE -------------------------------------------------------------
@@ -306,7 +302,7 @@ public class ScaleWorker extends Thread {
somImage.updateImageState(); somImage.updateImageState();
System.out.println("Image State Updated: Scaled"); log.info("Image State Updated: Scaled");
// Clean up // Clean up
croppedGraphics.dispose(); croppedGraphics.dispose();
@@ -330,7 +326,7 @@ public class ScaleWorker extends Thread {
somImage.updateImageState(); somImage.updateImageState();
System.out.println("Image State Updated: Scaled"); log.info("Image State Updated: Scaled");
somImage.updateImageState(); somImage.updateImageState();
break; break;
@@ -348,4 +344,20 @@ public class ScaleWorker extends Thread {
e.printStackTrace(); 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"/> <Button fx:id="backButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
<!--ROW 1--> <!--ROW 1-->
<Button fx:id="galleryButton1" mnemonicParsing="false" text="1"> <Button fx:id="galleryButton1" mnemonicParsing="false" text="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/> <Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
@@ -45,6 +46,7 @@
<ImageView fx:id="galleryImageView3" preserveRatio="true"/> <ImageView fx:id="galleryImageView3" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<!--ROW 2--> <!--ROW 2-->
<Button fx:id="galleryButton4" mnemonicParsing="false" text="4" GridPane.rowIndex="1"> <Button fx:id="galleryButton4" mnemonicParsing="false" text="4" GridPane.rowIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/> <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>