summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/LocaleSerializer.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java46
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/VersionComparator.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Zipper.java20
6 files changed, 47 insertions, 47 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java
index 7de75749..f15e5f6e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java
@@ -24,7 +24,7 @@ import org.apache.commons.httpclient.methods.multipart.PartSource;
import at.asit.pdfover.signator.DocumentSource;
/**
- *
+ *
*/
public class FileUploadSource implements PartSource {
@@ -32,7 +32,7 @@ public class FileUploadSource implements PartSource {
/**
* Constructor
- *
+ *
* @param source
* the source
*/
@@ -47,7 +47,7 @@ public class FileUploadSource implements PartSource {
@Override
public String getFileName() {
- return "sign.pdf"; //$NON-NLS-1$
+ return "sign.pdf"; //
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java
index d4ad4496..11187c31 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java
@@ -28,10 +28,10 @@ import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
/**
- *
+ *
*/
public class ImageConverter {
-
+
/**
* Convert Image Data to AWT Image
* @param data
@@ -95,7 +95,7 @@ public class ImageConverter {
/**
* Convert AWT Image to SWT Image
- *
+ *
* @param bufferedImage
* @return SWT Image data
*/
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/LocaleSerializer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/LocaleSerializer.java
index cdd5b5cc..18d6e8c1 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/LocaleSerializer.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/LocaleSerializer.java
@@ -19,7 +19,7 @@ package at.asit.pdfover.gui.utils;
import java.util.Locale;
/**
- *
+ *
*/
public class LocaleSerializer {
/**
@@ -28,11 +28,11 @@ public class LocaleSerializer {
* @return the locale
*/
public static Locale parseFromString(String localeString) {
-
+
if(localeString == null || localeString.isEmpty()) {
return null;
}
-
+
Locale targetLocale = null;
Locale[] locale = Locale.getAvailableLocales();
for(int i = 0; i < locale.length; i++) {
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java
index 44e72725..00422b32 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java
@@ -39,7 +39,7 @@ import at.asit.pdfover.signator.Emblem;
import at.asit.pdfover.signator.SignatureParameter;
/**
- *
+ *
*/
public class SignaturePlaceholderCache {
/**
@@ -49,12 +49,12 @@ public class SignaturePlaceholderCache {
.getLogger(SignaturePlaceholderCache.class);
private static void saveImage(BufferedImage image, String fileDir, String fileName, String fileExt) throws IOException {
- File file = new File(fileDir, fileName + "." + fileExt); //$NON-NLS-1$
+ File file = new File(fileDir, fileName + "." + fileExt); //
ImageIO.write(image, fileExt, file); // ignore returned boolean
}
private static Image loadImage(String fileDir, String fileName, String fileExt) throws IOException {
- return ImageIO.read(new File(fileDir, fileName + "." + fileExt)); //$NON-NLS-1$
+ return ImageIO.read(new File(fileDir, fileName + "." + fileExt)); //
}
/**
@@ -65,19 +65,19 @@ public class SignaturePlaceholderCache {
public static Image getPlaceholder(SignatureParameter param) {
final String fileDir = Constants.CONFIG_DIRECTORY;
final String imgFileName = Constants.PLACEHOLDER_CACHE_FILENAME;
- final String imgFileExt = "png"; //$NON-NLS-1$
+ final String imgFileExt = "png"; //
final String propFileName = Constants.PLACEHOLDER_CACHE_PROPS_FILENAME;
- final String sigLangProp = "LANG"; //$NON-NLS-1$
- final String sigEmblProp = "EMBL"; //$NON-NLS-1$
- final String sigEHshProp = "EHSH"; //$NON-NLS-1$
- final String sigPdfAProp = "PDFA"; //$NON-NLS-1$
- final String sigNoteProp = "NOTE"; //$NON-NLS-1$
- final String sigProfProp = "PROF"; //$NON-NLS-1$
+ final String sigLangProp = "LANG"; //
+ final String sigEmblProp = "EMBL"; //
+ final String sigEHshProp = "EHSH"; //
+ final String sigPdfAProp = "PDFA"; //
+ final String sigNoteProp = "NOTE"; //
+ final String sigProfProp = "PROF"; //
String sigLang = param.getSignatureLanguage();
- String sigEmbl = ""; //$NON-NLS-1$
- String sigEHsh = ""; //$NON-NLS-1$
+ String sigEmbl = ""; //
+ String sigEHsh = ""; //
if (param.getEmblem() != null) {
Emblem embl = param.getEmblem();
if (embl instanceof CachedFileNameEmblem) {
@@ -88,9 +88,9 @@ public class SignaturePlaceholderCache {
}
}
String sigPdfA = param.getSignaturePdfACompat() ? Constants.TRUE : Constants.FALSE;
- String sigNote = param.getProperty("SIG_NOTE"); //$NON-NLS-1$
+ String sigNote = param.getProperty("SIG_NOTE"); //
if (sigNote == null)
- sigNote = ""; //$NON-NLS-1$
+ sigNote = ""; //
String profile = param.getSignatureProfile();
if (profile == null){
// set default value
@@ -107,18 +107,18 @@ public class SignaturePlaceholderCache {
sigNote.equals(sigProps.getProperty(sigNoteProp)) &&
sigPdfA.equals(sigProps.getProperty(sigPdfAProp)) &&
profile.equals(sigProps.getProperty(sigProfProp))) {
- log.debug("Placeholder cache hit"); //$NON-NLS-1$
+ log.debug("Placeholder cache hit"); //
return loadImage(fileDir, imgFileName, imgFileExt);
}
- log.debug("Placeholder cache miss (" + //$NON-NLS-1$
- sigLang + "|" + sigProps.getProperty(sigLangProp) + " - " +//$NON-NLS-1$ //$NON-NLS-2$
- sigEmbl + "|" + sigProps.getProperty(sigEmblProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$
- sigEHsh + "|" + sigProps.getProperty(sigEHshProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$
- sigNote + "|" + sigProps.getProperty(sigNoteProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$
- sigPdfA + "|" + sigProps.getProperty(sigPdfAProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$
+ log.debug("Placeholder cache miss (" + //
+ sigLang + "|" + sigProps.getProperty(sigLangProp) + " - " +// //
+ sigEmbl + "|" + sigProps.getProperty(sigEmblProp) + " - " + // //
+ sigEHsh + "|" + sigProps.getProperty(sigEHshProp) + " - " + // //
+ sigNote + "|" + sigProps.getProperty(sigNoteProp) + " - " + // //
+ sigPdfA + "|" + sigProps.getProperty(sigPdfAProp) + " - " + // //
profile + "|" + sigProps.getProperty(sigProfProp) + ")");
} catch (Exception e) {
- log.warn("Can't load signature Placeholder", e); //$NON-NLS-1$
+ log.warn("Can't load signature Placeholder", e); //
}
// create new cache
@@ -135,7 +135,7 @@ public class SignaturePlaceholderCache {
saveImage((BufferedImage) img, fileDir, imgFileName, imgFileExt);
return img;
} catch (IOException e) {
- log.error("Can't save signature Placeholder", e); //$NON-NLS-1$
+ log.error("Can't save signature Placeholder", e); //
return param.getPlaceholder();
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/VersionComparator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/VersionComparator.java
index 3f2d0f3d..6321586b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/VersionComparator.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/VersionComparator.java
@@ -19,7 +19,7 @@ package at.asit.pdfover.gui.utils;
import java.util.Comparator;
/**
- *
+ *
*/
public class VersionComparator implements Comparator<String> {
/* (non-Javadoc)
@@ -27,8 +27,8 @@ public class VersionComparator implements Comparator<String> {
*/
@Override
public int compare(String v1, String v2) {
- String[] v1Parts = v1.split("\\.|-"); //$NON-NLS-1$
- String[] v2Parts = v2.split("\\.|-"); //$NON-NLS-1$
+ String[] v1Parts = v1.split("\\.|-"); //
+ String[] v2Parts = v2.split("\\.|-"); //
int length = Math.max(v1Parts.length, v2Parts.length);
for (int i = 0; i < length; ++i) {
@@ -37,7 +37,7 @@ public class VersionComparator implements Comparator<String> {
if (i < v1Parts.length)
v1Part = Integer.parseInt(v1Parts[i]);
} catch (NumberFormatException e) {
- if (v1Parts[i].equals("SNAPSHOT")) //$NON-NLS-1$
+ if (v1Parts[i].equals("SNAPSHOT")) //
v1Part = Integer.MAX_VALUE;
}
@@ -46,7 +46,7 @@ public class VersionComparator implements Comparator<String> {
if (i < v2Parts.length)
v2Part = Integer.parseInt(v2Parts[i]);
} catch (NumberFormatException e) {
- if (v2Parts[i].equals("SNAPSHOT")) //$NON-NLS-1$
+ if (v2Parts[i].equals("SNAPSHOT")) //
v2Part = Integer.MAX_VALUE;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Zipper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Zipper.java
index b3e07d60..4fd2528a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Zipper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Zipper.java
@@ -42,21 +42,21 @@ public class Zipper {
private static final Logger log = LoggerFactory.getLogger(Zipper.class);
/**
- * Compresses the source path to Zip File output stream
+ * Compresses the source path to Zip File output stream
* @param sourcePath
* @param os
- * @throws IOException
+ * @throws IOException
*/
public static void zip(String sourcePath, OutputStream os) throws IOException {
zip(sourcePath, os, false);
}
/**
- * Compresses the source path to Zip File output stream
+ * Compresses the source path to Zip File output stream
* @param sourcePath
* @param os
* @param doDelete whether to delete content after compression
- * @throws IOException
+ * @throws IOException
*/
public static void zip(String sourcePath, OutputStream os, boolean doDelete) throws IOException {
ZipOutputStream zos = new ZipOutputStream(os);
@@ -90,7 +90,7 @@ public class Zipper {
}
/**
- * Extracts Zip File input stream to target path
+ * Extracts Zip File input stream to target path
* @param is
* @param targetPath
* @throws IOException
@@ -100,17 +100,17 @@ public class Zipper {
ZipEntry entry;
// while there are entries I process them
while ((entry = zis.getNextEntry()) != null) {
- log.debug("entry: " + entry.getName() + ", " //$NON-NLS-1$//$NON-NLS-2$
+ log.debug("entry: " + entry.getName() + ", " ////
+ entry.getSize());
// consume all the data from this entry
if (entry.isDirectory()) {
- log.debug("Extracting directory: " + entry.getName()); //$NON-NLS-1$
-
+ log.debug("Extracting directory: " + entry.getName()); //
+
File nDir = new File(targetPath + File.separator + entry.getName());
if(!nDir.exists()) {
if(!nDir.mkdir()) {
- throw new IOException("Failed to create dir: " + entry.getName()); //$NON-NLS-1$
+ throw new IOException("Failed to create dir: " + entry.getName()); //
}
}
continue;
@@ -121,7 +121,7 @@ public class Zipper {
new FileOutputStream(targetPath + File.separator + entry.getName()));
while ((len = zis.read(buffer)) >= 0)
out.write(buffer, 0, len);
-
+
out.close();
}
}