*** MAYBE NOT WORKING ***

Added Hostname for Booth identification while Upload

Removed Date Structure inside Images Folder
--> CHECK IN BACKUP IF FILES GET OVERWRITTEN

Changed Event date structure with upload Date structure in upload
--> ALSO TESTING NECCESSARY

Changed Splash Screen JPG for Logo PNG in Capture and Picture Panels
--> Testing
This commit is contained in:
2016-12-12 21:07:55 +01:00
parent c459938a9a
commit c3db9d0166
15 changed files with 98 additions and 46 deletions
+2 -2
View File
@@ -82,10 +82,10 @@ public class CaptureCtl {
image.setPreserveRatio(true);
// Set the image to the image View
image.setImage(SOMLayout.SPLASH_IMAGE);
image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen
image.setFitHeight(SOMLayout.screenHeight);
image.setFitWidth(SOMLayout.screenHeight / 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();
+2 -1
View File
@@ -138,7 +138,8 @@ public class GalleryCtl {
imageView.setPreserveRatio(true);
// Set the image to the image View
imageView.setImage(SOMLayout.SPLASH_IMAGE);
// TODO ist this ever used?
imageView.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen
imageView.setFitHeight(SOMLayout.screenHeight / 3);
+22 -6
View File
@@ -10,7 +10,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TouchEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import model.SOMEvent;
import model.SOMImage;
import model.SOMLayout;
@@ -23,7 +23,7 @@ import java.util.List;
*/
public class PictureCtl {
@FXML
public Pane pane;
public StackPane pane;
@FXML
public GridPane grid;
@@ -55,7 +55,7 @@ public class PictureCtl {
private void setPane() {
pane.setPrefSize(SOMLayout.screenWidth, SOMLayout.screenHeight);
pane.setBackground(SOMLayout.WHITE_BG);
pane.setBackground(SOMLayout.BLACK_BG);
}
private void setGrid() {
@@ -240,15 +240,31 @@ public class PictureCtl {
}
private void setImage() {
// // Set the image aspect ratio to be preserved
// image.setPreserveRatio(true);
//
// // Set the image to the image View
// Image splash = SOMLayout.LOGO_IMAGE;
// image.setImage(splash);
//
// // make it fit the height of the Screen
// image.setFitWidth(SOMLayout.screenHeight/2);
// Set the image aspect ratio to be preserved
image.setPreserveRatio(true);
// Set the image to the image View
Image splash = SOMLayout.SPLASH_IMAGE;
image.setImage(splash);
image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen
image.setFitHeight(SOMLayout.screenHeight);
image.setFitWidth(SOMLayout.screenHeight / 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;
image.setX(-offset);
// Get the Event Images
List<SOMImage> somImageList = SOMEvent.getInstance().getImages();
+31 -2
View File
@@ -1,5 +1,7 @@
package model;
import workers.MachineWorker;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -8,6 +10,8 @@ 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")
@@ -17,10 +21,12 @@ public class SOMConfig {
// important Paths
@XmlElement(name = "PICTURES_PATH")
public static final File PICTURES_PATH = new File("images");
@XmlElement(name = "UPLOAD_PATH")
public static final String UPLOAD_PATH = getEventPicDir();
// The Box's ID
// Todo Throw out!! or by MAC Adress
@XmlElement(name = "BOX_ID")
public static final String BOX_ID = "selfomat-42";
public static final String BOX_ID = MachineWorker.getHostName();
// Number of pictures in series mode
@XmlElement(name = "SERIES_COUNTER")
public static final int SERIES_COUNTER = 4;
@@ -59,6 +65,30 @@ public class SOMConfig {
return config;
}
/**
* Gets the Directory for the Event and Creates the Folders
*
* @return
*/
private static String getEventPicDir() {
// get current Date in String for Upload-dir
Calendar cal = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String timeString = df.format(cal.getTime());
File picturesPath = SOMConfig.PICTURES_PATH;
// File eventPicDir = new File(picturesPath.toString() + "/" + timeString
// + "/" + MachineWorker.getHostName());
// TODO catch possible fail
// eventPicDir.mkdirs();
String eventPicDir = picturesPath.toString() + "/" + timeString
+ "/" + MachineWorker.getHostName();
return eventPicDir;
}
// Write Config
private void writeConfig() {
try {
@@ -116,5 +146,4 @@ public class SOMConfig {
java.sql.Timestamp c = new java.sql.Timestamp(now.getTime());
return c.getTime();
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ public class SOMLayout {
public static final javafx.scene.image.Image FORTH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Forth.png").toString()); //TODO LINK right image
//CI
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 Background WHITE_BG = new Background(new BackgroundFill(WHITE, null, null));
// Screen
+5 -30
View File
@@ -16,8 +16,6 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.file.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -52,7 +50,7 @@ public class FilesWorker {
* @return
*/
public static File getSourcePath() {
File src = new File(getEventPicDir().toString() + "/src");
File src = new File(SOMConfig.PICTURES_PATH.toString() + "/src");
// TODO catch possible fail
src.mkdirs();
@@ -66,7 +64,7 @@ public class FilesWorker {
* @return
*/
public static File getPreviewPath() {
File prv = new File(getEventPicDir().toString() + "/prv");
File prv = new File(SOMConfig.PICTURES_PATH.toString() + "/prv");
// TODO catch possible fail
prv.mkdirs();
@@ -80,7 +78,7 @@ public class FilesWorker {
* @return
*/
public static File getThumbPath() {
File tmb = new File(getEventPicDir().toString() + "/tmb");
File tmb = new File(SOMConfig.PICTURES_PATH.toString() + "/tmb");
// TODO catch possible fail
tmb.mkdirs();
@@ -94,7 +92,7 @@ public class FilesWorker {
* @return
*/
public static File getFinalPath() {
File fnl = new File(getEventPicDir().toString() + "/fnl");
File fnl = new File(SOMConfig.PICTURES_PATH.toString() + "/fnl");
// TODO catch possible fail
fnl.mkdirs();
@@ -108,36 +106,13 @@ public class FilesWorker {
* @return
*/
public static File getTempPath() {
File tmp = new File(getEventPicDir().toString() + "/tmp");
File tmp = new File(SOMConfig.PICTURES_PATH.toString() + "/tmp");
// TODO catch possible fail
tmp.mkdirs();
return tmp;
}
/**
* Gets the Directory for the Event and Creates the Folders
*
* @return
*/
private static File getEventPicDir() {
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String timeString = df.format(event.getDate());
String boxID = SOMConfig.BOX_ID;
File picturesPath = SOMConfig.PICTURES_PATH;
File eventPicDir = new File(picturesPath.toString() + "/" + timeString
+ "/" + boxID);
// TODO catch possible fail
eventPicDir.mkdirs();
return eventPicDir;
}
private static boolean internet() {
Socket sock = new Socket();
+30
View File
@@ -0,0 +1,30 @@
package workers;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* 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 static String getHostName() {
try {
InetAddress addr;
addr = InetAddress.getLocalHost();
HostName = addr.getHostName();
} catch (UnknownHostException ex) {
System.out.println("Hostname can not be resolved");
}
return HostName;
}
public static int[] getScreen() {
return Screen;
}
}
+5 -4
View File
@@ -3,9 +3,10 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.*?>
<Pane xmlns:fx="http://javafx.com/fxml/1" fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8"
fx:controller="GUI.PictureCtl">
<StackPane xmlns:fx="http://javafx.com/fxml/1" fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity"
minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8"
fx:controller="GUI.PictureCtl">
<ImageView fx:id="image" pickOnBounds="true" preserveRatio="true">
</ImageView>
@@ -27,4 +28,4 @@
<Button fx:id="seriesBtn" mnemonicParsing="false" prefHeight="183.0" prefWidth="221.0" text="Button"
GridPane.columnIndex="2" GridPane.rowIndex="2"/>
</GridPane>
</Pane>
</StackPane>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB