move to git.simongehrig.de
This commit is contained in:
@@ -3,11 +3,11 @@ package model;
|
||||
import workers.FilesWorker;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
public class SOMImage {
|
||||
|
||||
private static String name; // the filename
|
||||
private final String imageName; // the filename
|
||||
|
||||
private final SOMConfig config = SOMConfig.getInstance();
|
||||
|
||||
@@ -22,68 +22,62 @@ public class SOMImage {
|
||||
private boolean srcthere; // source status
|
||||
private boolean fnlthere; // final status
|
||||
|
||||
SOMImage(String name) {
|
||||
|
||||
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
|
||||
|
||||
File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name);
|
||||
|
||||
File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
|
||||
|
||||
File fnl = new File(FilesWorker.getFinalPath().toString() + "/" + name);
|
||||
|
||||
File tmp = new File(FilesWorker.getTempPath().toString() + "/" + name);
|
||||
|
||||
this.tmb = tmb;
|
||||
this.prv = prv;
|
||||
this.src = src;
|
||||
this.fnl = fnl;
|
||||
this.tmp = tmp;
|
||||
|
||||
this.updateImageState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically generates an SOMImage Object
|
||||
* with an incremented Number and all th Paths
|
||||
*/
|
||||
public SOMImage() {
|
||||
super();
|
||||
// super();
|
||||
|
||||
SOMEvent somEvent = SOMEvent.getInstance();
|
||||
int nrOfEventPics;
|
||||
List<SOMImage> somEventImages = somEvent.getImages();
|
||||
|
||||
nrOfEventPics = somEventImages.size();
|
||||
|
||||
int numberOfEventPictures = SOMEvent.getInstance().getImages().size();
|
||||
String fill = "00000";
|
||||
int nmb = (numberOfEventPictures + 1);
|
||||
int nmb = (nrOfEventPics + 1);
|
||||
String number = String.valueOf(nmb);
|
||||
String filledNumber = fill.substring(number.length()) + number;
|
||||
name = filledNumber + ".jpg";
|
||||
|
||||
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
|
||||
File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name);
|
||||
File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
|
||||
File fnl = new File(FilesWorker.getFinalPath().toString() + "/" + name);
|
||||
File tmp = new File(FilesWorker.getTempPath().toString() + "/" + name);
|
||||
int numberLength = number.length();
|
||||
String filledNumber = fill.substring(numberLength) + number;
|
||||
|
||||
this.tmb = tmb;
|
||||
this.prv = prv;
|
||||
this.src = src;
|
||||
this.fnl = fnl;
|
||||
this.tmp = tmp;
|
||||
this.imageName = filledNumber + ".jpg";
|
||||
|
||||
File sourcePath = FilesWorker.getSourcePath();
|
||||
this.src = new File(sourcePath + "/" + this.imageName);
|
||||
|
||||
File previewPath = FilesWorker.getPreviewPath();
|
||||
this.prv = new File(previewPath + "/" + this.imageName);
|
||||
|
||||
File thumbPath = FilesWorker.getThumbPath();
|
||||
this.tmb = new File(thumbPath + "/" + this.imageName);
|
||||
|
||||
File finalPath = FilesWorker.getFinalPath();
|
||||
this.fnl = new File(finalPath + "/" + this.imageName);
|
||||
|
||||
File tempPath = FilesWorker.getTempPath();
|
||||
this.tmp = new File(tempPath + "/" + this.imageName);
|
||||
|
||||
this.updateImageState();
|
||||
}
|
||||
|
||||
public void updateImageState() {
|
||||
public final void updateImageState() {
|
||||
// tmb
|
||||
tmbthere = Files.exists(tmb.toPath());
|
||||
this.tmbthere = this.tmb.isFile();
|
||||
// prv
|
||||
prvthere = Files.exists(prv.toPath());
|
||||
this.prvthere = this.prv.isFile();
|
||||
// src
|
||||
srcthere = Files.exists(src.toPath());
|
||||
this.srcthere = this.src.isFile();
|
||||
// fnl
|
||||
fnlthere = Files.exists(fnl.toPath());
|
||||
this.fnlthere = this.fnl.isFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
* @return the imageName
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.imageName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,79 +91,55 @@ public class SOMImage {
|
||||
* @return the prv
|
||||
*/
|
||||
public File getPrv() {
|
||||
return prv;
|
||||
return this.prv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the src
|
||||
*/
|
||||
public File getSrc() {
|
||||
return src;
|
||||
return this.src;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fnl
|
||||
*/
|
||||
public File getFnl() {
|
||||
return fnl;
|
||||
return this.fnl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tmp
|
||||
*/
|
||||
public File getTmp() {
|
||||
return tmp;
|
||||
return this.tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tmbthere
|
||||
*/
|
||||
public boolean isTmbthere() {
|
||||
return tmbthere;
|
||||
return this.tmbthere;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prvthere
|
||||
*/
|
||||
public boolean isPrvthere() {
|
||||
return prvthere;
|
||||
return this.prvthere;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the srcthere
|
||||
*/
|
||||
public boolean isSrcthere() {
|
||||
return srcthere;
|
||||
return this.srcthere;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fnlthere
|
||||
*/
|
||||
public boolean isFnlthere() {
|
||||
return fnlthere;
|
||||
return this.fnlthere;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 0 = thumb, 1 = preview, 2 = full Size
|
||||
* @return
|
||||
*/
|
||||
// public ImageIcon toImageIcon(int type) {
|
||||
// File imagepath;
|
||||
// switch (type) {
|
||||
// case 0:
|
||||
// imagepath = getTmb();
|
||||
// break;
|
||||
// case 1:
|
||||
// imagepath = getPrv();
|
||||
// break;
|
||||
// case 2:
|
||||
// imagepath = getSrc();
|
||||
// break;
|
||||
// default:
|
||||
// imagepath = null;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// return new ImageIcon(imagepath.getPath());
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user