summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java26
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java74
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java131
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java83
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java1
13 files changed, 271 insertions, 82 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
index 809c1d7d..e650cfc4 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
@@ -39,7 +39,7 @@ public class Main {
public static void main(String[] args) {
StateMachineImpl stateMachine = new StateMachineImpl(args);
- File configDir = new File(System.getProperty("user.home")+"/.pdfover");
+ File configDir = new File(System.getProperty("user.home")+"/.pdfover"); //$NON-NLS-1$//$NON-NLS-2$
if(!configDir.exists()) {
configDir.mkdir();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 1086992b..7cf7df23 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -192,16 +192,16 @@ public class MainWindow {
Composite composite = new Composite(getShell(), SWT.NONE);
composite.setLayout(new FormLayout());
this.mainBarFormData = new FormData();
- this.mainBarFormData.left = new FormAttachment(0, 5);
- this.mainBarFormData.right = new FormAttachment(100, -5);
- this.mainBarFormData.top = new FormAttachment(0, 5);
- this.mainBarFormData.bottom = new FormAttachment(0, 50);
+ this.mainBarFormData.left = new FormAttachment(0, 10);
+ this.mainBarFormData.right = new FormAttachment(100, -10);
+ this.mainBarFormData.top = new FormAttachment(0, 10);
+ this.mainBarFormData.bottom = new FormAttachment(0, 67);
composite.setLayoutData(this.mainBarFormData);
this.btn_config = new MainBarRectangleButton(composite, SWT.NONE);
FormData fd_btn_config = new FormData();
- fd_btn_config.bottom = new FormAttachment(0, 45);
- fd_btn_config.right = new FormAttachment(0,45);
+ fd_btn_config.bottom = new FormAttachment(100);
+ fd_btn_config.right = new FormAttachment(0,57);
fd_btn_config.top = new FormAttachment(0);
fd_btn_config.left = new FormAttachment(0, 2);
this.btn_config.setLayoutData(fd_btn_config);
@@ -233,10 +233,10 @@ public class MainWindow {
this.btn_open = new MainBarStartButton(composite, SWT.NONE);
FormData fd_btn_open = new FormData();
- fd_btn_open.bottom = new FormAttachment(0, 45);
+ fd_btn_open.bottom = new FormAttachment(100);
fd_btn_open.right = new FormAttachment(35, 5);
fd_btn_open.top = new FormAttachment(0);
- fd_btn_open.left = new FormAttachment(0, 45);
+ fd_btn_open.left = new FormAttachment(0, 57);
this.btn_open.setLayoutData(fd_btn_open);
this.btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$
this.btn_open.setToolTipText(Messages.getString("common.open")); //$NON-NLS-1$
@@ -262,7 +262,7 @@ public class MainWindow {
this.btn_position = new MainBarMiddleButton(composite, SWT.NONE);
FormData fd_btn_position = new FormData();
- fd_btn_position.bottom = new FormAttachment(0, 45);
+ fd_btn_position.bottom = new FormAttachment(100);
fd_btn_position.right = new FormAttachment(60, 5);
fd_btn_position.top = new FormAttachment(0);
fd_btn_position.left = new FormAttachment(35, -5);
@@ -291,7 +291,7 @@ public class MainWindow {
this.btn_sign = new MainBarMiddleButton(composite, SWT.NONE);
FormData fd_btn_sign = new FormData();
- fd_btn_sign.bottom = new FormAttachment(0, 45);
+ fd_btn_sign.bottom = new FormAttachment(100);
fd_btn_sign.right = new FormAttachment(85, 5);
fd_btn_sign.top = new FormAttachment(0);
fd_btn_sign.left = new FormAttachment(60, -5);
@@ -302,8 +302,8 @@ public class MainWindow {
MainBarEndButton end = new MainBarEndButton(composite, SWT.NONE);
FormData fd_btn_end = new FormData();
- fd_btn_end.bottom = new FormAttachment(0, 45);
- fd_btn_end.right = new FormAttachment(100, -2);
+ fd_btn_end.bottom = new FormAttachment(100);
+ fd_btn_end.right = new FormAttachment(100, -10);
fd_btn_end.top = new FormAttachment(0);
fd_btn_end.left = new FormAttachment(85, -5);
end.setLayoutData(fd_btn_end);
@@ -315,7 +315,7 @@ public class MainWindow {
FormData fd_composite_1 = new FormData();
fd_composite_1.bottom = new FormAttachment(100, -5);
fd_composite_1.right = new FormAttachment(100, -5);
- fd_composite_1.top = new FormAttachment(0, 50);
+ fd_composite_1.top = new FormAttachment(0, 70);
fd_composite_1.left = new FormAttachment(0, 5);
this.container.setLayoutData(fd_composite_1);
this.stack = new StackLayout();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java
index af16c8a1..429f8782 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java
@@ -21,12 +21,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import org.slf4j.Logger;
@@ -58,7 +53,7 @@ public class Unzipper {
if (entry.isDirectory()) {
log.debug("Extracting directory: " + entry.getName()); //$NON-NLS-1$
- // This is not robust, just for demonstration purposes.
+
File nDir =new File(targetPath + "/" + entry.getName()); //$NON-NLS-1$
if(!nDir.exists()) {
if(!nDir.mkdir()) {
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
index 1784988a..ccc7121a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
@@ -25,21 +25,23 @@ import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,14 +127,31 @@ public class DataSourceSelectComposite extends StateComposite {
// Color back = new Color(Display.getCurrent(), 77, 190, 250);
- this.drop_area = new Composite(this, SWT.RESIZE | SWT.BORDER);
+ this.drop_area = new Composite(this, SWT.RESIZE);
FormData fd_drop_area = new FormData();
- fd_drop_area.left = new FormAttachment(0, 0);
- fd_drop_area.right = new FormAttachment(100, 0);
- fd_drop_area.top = new FormAttachment(0, 0);
- fd_drop_area.bottom = new FormAttachment(100, 0);
+ fd_drop_area.left = new FormAttachment(0, 30);
+ fd_drop_area.right = new FormAttachment(100, -30);
+ fd_drop_area.top = new FormAttachment(0, 30);
+ fd_drop_area.bottom = new FormAttachment(100, -30);
this.drop_area.setLayoutData(fd_drop_area);
this.drop_area.setLayout(new FormLayout());
+
+ this.drop_area.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle clientArea = DataSourceSelectComposite.this
+ .drop_area.getClientArea();
+
+ e.gc.setForeground(new Color(getDisplay(), 0x76, 0xC4, 0xC8));
+ e.gc.setLineStyle(SWT.LINE_DASH);
+ e.gc.drawRoundRectangle(clientArea.x,
+ clientArea.y, clientArea.width - 2, clientArea.height - 2,
+ 10, 10);
+ }
+ });
+
+ //this.drop_area.
// this.drop_area.setBackground(back);
DropTarget dnd_target = new DropTarget(this.drop_area, DND.DROP_DEFAULT
@@ -198,22 +217,42 @@ public class DataSourceSelectComposite extends StateComposite {
}
});
+ final Label lbl_drag2 = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
+
final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE );
this.fd_lbl_drag = new FormData();
this.fd_lbl_drag.left = new FormAttachment(0, 10);
this.fd_lbl_drag.right = new FormAttachment(100, -10);
- this.fd_lbl_drag.top = new FormAttachment(0, 10);
- // fd_lbl_drag.bottom = new FormAttachment(100, -10);
+ //this.fd_lbl_drag.top = new FormAttachment(40, -10);
+ this.fd_lbl_drag.bottom = new FormAttachment(lbl_drag2, -10);
lbl_drag.setLayoutData(this.fd_lbl_drag);
FontData[] fD = lbl_drag.getFont().getFontData();
- fD[0].setHeight(18);
+ fD[0].setHeight(20);
lbl_drag.setFont(new Font(Display.getCurrent(), fD[0]));
lbl_drag.setText(Messages.getString("dataSourceSelection.DropLabel")); //$NON-NLS-1$
lbl_drag.setAlignment(SWT.CENTER);
+
+ this.fd_lbl_drag2 = new FormData();
+ this.fd_lbl_drag2.left = new FormAttachment(0, 10);
+ this.fd_lbl_drag2.right = new FormAttachment(100, -10);
+ this.fd_lbl_drag2.top = new FormAttachment(50, -10);
+ // fd_lbl_drag.bottom = new FormAttachment(100, -10);
+ lbl_drag2.setLayoutData(this.fd_lbl_drag2);
+ FontData[] fD2 = lbl_drag2.getFont().getFontData();
+ fD2[0].setHeight(12);
+ lbl_drag2.setFont(new Font(Display.getCurrent(), fD2[0]));
+ lbl_drag2.setText(Messages.getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$
+ lbl_drag2.setAlignment(SWT.CENTER);
+
final Button btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE);
- btn_open.setText(Messages.getString("common.browse")); //$NON-NLS-1$
+ btn_open.setText(Messages.getString("dataSourceSelection.browse")); //$NON-NLS-1$
+
+ FontData[] fD_open = btn_open.getFont().getFontData();
+ fD_open[0].setHeight(14);
+ btn_open.setFont(new Font(Display.getCurrent(), fD_open[0]));
+ /*
lbl_drag.addListener(SWT.Resize, new Listener() {
@Override
@@ -234,14 +273,16 @@ public class DataSourceSelectComposite extends StateComposite {
50, (lbl_drag.getSize().y / 2) + 10 + size.y);
}
});
+ */
// lbl_drag.setBackground(back);
Point size = btn_open.computeSize(SWT.DEFAULT, SWT.DEFAULT);
this.fd_btn_open = new FormData();
- this.fd_btn_open.left = new FormAttachment(100, size.x * -1 - 10);
- this.fd_btn_open.right = new FormAttachment(100, -5);
- this.fd_btn_open.top = new FormAttachment(100, size.y * -1 - 10);
- this.fd_btn_open.bottom = new FormAttachment(100, -5);
+ this.fd_btn_open.left = new FormAttachment(50, (size.x / 2 ) * -1);
+ //this.fd_btn_open.right = new FormAttachment(100, -5);
+ //this.fd_btn_open.top = new FormAttachment(100, size.y * -1 - 10);
+ this.fd_btn_open.top = new FormAttachment(lbl_drag2, 10);
+ //this.fd_btn_open.bottom = new FormAttachment(100, -5);
btn_open.setLayoutData(this.fd_btn_open);
// btn_open.setBackground(back);
@@ -251,9 +292,10 @@ public class DataSourceSelectComposite extends StateComposite {
private boolean press = false;
- private Composite drop_area;
+ Composite drop_area;
FormData fd_lbl_drag;
+ FormData fd_lbl_drag2;
FormData fd_btn_open;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
index f19ee361..9f232ca0 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
@@ -17,6 +17,8 @@ package at.asit.pdfover.gui.composites;
// Imports
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FormAttachment;
@@ -204,6 +206,19 @@ public class MobileBKUEnterTANComposite extends StateComposite {
this.txt_tan.setEditable(true);
this.txt_tan.setLayoutData(fd_text);
+ this.txt_tan.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+
+ String text = MobileBKUEnterTANComposite.this.txt_tan.getText();
+
+ if(text.length() > 3 && MobileBKUEnterTANComposite.this.getVergleichswert().startsWith(text.trim())) {
+ MobileBKUEnterTANComposite.this.setMessage(Messages.getString("error.EnteredReferenceValue")); //$NON-NLS-1$
+ }
+ }
+ });
+
this.lbl_tries = new Label(this, SWT.WRAP | SWT.NATIVE);
FormData fd_lbl_tries = new FormData();
fd_lbl_tries.left = new FormAttachment(15, 5);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
index 1b24b678..cf579b7b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
@@ -18,8 +18,11 @@ package at.asit.pdfover.gui.composites;
// Imports
import java.awt.Desktop;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
+import org.apache.commons.io.FilenameUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -28,7 +31,9 @@ import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,8 +50,66 @@ public class OutputComposite extends StateComposite {
/**
* SLF4J Logger instance
**/
- static final Logger log = LoggerFactory
- .getLogger(OutputComposite.class);
+ static final Logger log = LoggerFactory.getLogger(OutputComposite.class);
+
+ private File inputFile;
+
+ /**
+ * Sets the input file
+ *
+ * @param inputFile
+ * the input file
+ */
+ public void setInputFile(File inputFile) {
+ this.inputFile = inputFile;
+ }
+
+ /**
+ * Gets the input file
+ *
+ * @return the input file
+ */
+ public File getInputFile() {
+ return this.inputFile;
+ }
+
+ /**
+ * Saves the file
+ *
+ * @throws IOException
+ */
+ void saveFile() throws IOException {
+ FileDialog save = new FileDialog(OutputComposite.this.getShell(),
+ SWT.SAVE | SWT.NATIVE);
+ save.setFilterExtensions(new String[] { "*.pdf" }); //$NON-NLS-1$
+ save.setFilterNames(new String[] { Messages
+ .getString("common.PDFExtension_Description") }); //$NON-NLS-1$
+
+ String proposed = OutputComposite.this.getInputFile().getAbsolutePath();
+
+ String extension = FilenameUtils.getExtension(proposed);
+
+ proposed = FilenameUtils.removeExtension(proposed);
+
+ proposed = proposed + "_signed." + extension; //$NON-NLS-1$
+
+ save.setFileName(proposed);
+
+ String target = save.open();
+
+ if (target != null) {
+ File targetFile = new File(target);
+
+ DocumentSource source = OutputComposite.this.getSignedDocument();
+
+ FileOutputStream outstream = new FileOutputStream(targetFile);
+ outstream.write(source.getByteArray(), 0,
+ source.getByteArray().length);
+ outstream.close();
+
+ OutputComposite.this.savedFile = targetFile;
+ }
+ }
/**
* SelectionListener for save button
@@ -61,24 +124,7 @@ public class OutputComposite extends StateComposite {
@Override
public void widgetSelected(SelectionEvent e) {
try {
- FileDialog save = new FileDialog(OutputComposite.this.getShell(), SWT.SAVE | SWT.NATIVE);
- save.setFilterExtensions(new String[] {"*.pdf"}); //$NON-NLS-1$
- save.setFilterNames(new String[] {Messages.getString("common.PDFExtension_Description")}); //$NON-NLS-1$
-
- String target = save.open();
-
- File targetFile = new File(target);
-
- DocumentSource source = OutputComposite.this
- .getSignedDocument();
-
- FileOutputStream outstream = new FileOutputStream(targetFile);
- outstream.write(source.getByteArray(), 0,
- source.getByteArray().length);
- outstream.close();
-
- OutputComposite.this.savedFile = targetFile;
-
+ OutputComposite.this.saveFile();
} catch (Exception ex) {
log.error("SaveSelectionListener: ", ex); //$NON-NLS-1$
}
@@ -105,9 +151,11 @@ public class OutputComposite extends StateComposite {
File open = OutputComposite.this.savedFile;
if (open == null) {
// Save as temp file ...
- java.util.Date date= new java.util.Date();
- String fileName = String.format("%d_tmp_signed.pdf", date.getTime()); //$NON-NLS-1$
- open = new File(OutputComposite.this.tempDirectory + "/" + fileName); //$NON-NLS-1$
+ java.util.Date date = new java.util.Date();
+ String fileName = String.format(
+ "%d_tmp_signed.pdf", date.getTime()); //$NON-NLS-1$
+ open = new File(OutputComposite.this.tempDirectory
+ + "/" + fileName); //$NON-NLS-1$
FileOutputStream outstream = new FileOutputStream(open);
outstream.write(source.getByteArray(), 0,
source.getByteArray().length);
@@ -121,9 +169,11 @@ public class OutputComposite extends StateComposite {
}
} else {
log.error("OutputComposite:OpenSelectionListener:widgetSelected -> source is null!!"); //$NON-NLS-1$
- ErrorDialog dialog = new ErrorDialog(getShell(),
- SWT.NONE, Messages.getString("error.FailedToGetSignedDocument"),//$NON-NLS-1$
- "", false); //$NON-NLS-1$
+ ErrorDialog dialog = new ErrorDialog(
+ getShell(),
+ SWT.NONE,
+ Messages.getString("error.FailedToGetSignedDocument"),//$NON-NLS-1$
+ "", false); //$NON-NLS-1$
dialog.open();
}
} catch (Exception ex) {
@@ -155,10 +205,10 @@ public class OutputComposite extends StateComposite {
btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$
// Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_open = new FormData();
- //fd_btn_open.left = new FormAttachment(40, 0);
+ // fd_btn_open.left = new FormAttachment(40, 0);
fd_btn_open.right = new FormAttachment(50, -5);
fd_btn_open.top = new FormAttachment(40, 0);
- //fd_btn_open.bottom = new FormAttachment(55, 0);
+ // fd_btn_open.bottom = new FormAttachment(55, 0);
btn_open.setLayoutData(fd_btn_open);
btn_open.addSelectionListener(new OpenSelectionListener());
@@ -171,26 +221,27 @@ public class OutputComposite extends StateComposite {
// Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT);
FormData fd_btn_save = new FormData();
fd_btn_save.left = new FormAttachment(50, 5);
- //fd_btn_save.right = new FormAttachment(60, 0);
+ // fd_btn_save.right = new FormAttachment(60, 0);
fd_btn_save.top = new FormAttachment(40, 0);
- //fd_btn_save.bottom = new FormAttachment(55, 0);
+ // fd_btn_save.bottom = new FormAttachment(55, 0);
btn_save.setLayoutData(fd_btn_save);
btn_save.addSelectionListener(new SaveSelectionListener());
- this.pack();
+ //this.pack();
}
String tempDirectory;
-
+
/**
* @param tempDirectory
*/
public void setTempDirectory(String tempDirectory) {
this.tempDirectory = tempDirectory;
}
-
+
/**
* Gets the signed document
+ *
* @return the signed document
*/
public DocumentSource getSignedDocument() {
@@ -199,7 +250,9 @@ public class OutputComposite extends StateComposite {
/**
* Sets the signed document
- * @param signedDocument the signed document
+ *
+ * @param signedDocument
+ * the signed document
*/
public void setSignedDocument(final DocumentSource signedDocument) {
this.signedDocument = signedDocument;
@@ -210,6 +263,8 @@ public class OutputComposite extends StateComposite {
// Disable the check that prevents subclassing of SWT components
}
+ private boolean save_showed = false;
+
/*
* (non-Javadoc)
*
@@ -218,6 +273,14 @@ public class OutputComposite extends StateComposite {
@Override
public void doLayout() {
// Nothing to do
+ try {
+ if (!this.save_showed) {
+ OutputComposite.this.saveFile();
+ this.save_showed = true;
+ }
+ } catch (Exception ex) {
+ log.error("SaveSelectionListener: ", ex); //$NON-NLS-1$
+ }
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
index 45a8d230..d67ecfc3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
@@ -21,6 +21,7 @@ import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Region;
@@ -65,7 +66,9 @@ public abstract class MainBarButton extends Canvas {
this.inactiveBackground = new Color(getDisplay(), 0x4B, 0x95, 0x00);
this.activeBackground = new Color(getDisplay(), 0x98, 0xF2, 0x3D);
-
+ this.textColor = this.getForeground();
+ this.borderColor = new Color(getDisplay(), 0x76, 0xC4, 0xC8);
+ this.textsize = 12;
}
private Color inactiveBackground = null;
@@ -86,6 +89,53 @@ public abstract class MainBarButton extends Canvas {
this.activeBackground = activeBackground;
}
+ /**
+ * the text size
+ */
+ protected int textsize = 12;
+
+ /**
+ * @return the textsize
+ */
+ public int getTextsize() {
+ return this.textsize;
+ }
+
+ /**
+ * @param textsize the textsize to set
+ */
+ public void setTextsize(int textsize) {
+ this.textsize = textsize;
+ }
+
+ /**
+ * the used text color
+ */
+ protected Color textColor = null;
+
+ /**
+ * @param textColor the textColor to set
+ */
+ public void setTextColor(Color textColor) {
+ this.textColor = textColor;
+ }
+
+ /**
+ * @return the borderColor
+ */
+ public Color getBorderColor() {
+ return this.borderColor;
+ }
+
+ /**
+ * @param borderColor the borderColor to set
+ */
+ public void setBorderColor(Color borderColor) {
+ this.borderColor = borderColor;
+ }
+
+ private Color borderColor = null;
+
private Color activeBackground = null;
private String text = ""; //$NON-NLS-1$
@@ -165,6 +215,7 @@ public abstract class MainBarButton extends Canvas {
*/
protected void paintBackground(PaintEvent e) {
+ /*
Point size = this.getSize();
int height = size.y - 2;
@@ -176,9 +227,8 @@ public abstract class MainBarButton extends Canvas {
e.gc.fillGradientRectangle(0, 0, width, factor, true);
// BOTTOM
- e.gc.fillGradientRectangle(0, height, width, -1 * (factor),
- true);
-
+ e.gc.fillGradientRectangle(0, height, width, -1 * (factor), true);
+ */
// LEFT
//e.gc.fillGradientRectangle(0, 0, factor, height, false);
@@ -194,7 +244,15 @@ public abstract class MainBarButton extends Canvas {
*/
void paintControl(PaintEvent e) {
this.paintBackground(e);
+
+ Color current = e.gc.getForeground();
+
+ e.gc.setForeground(getBorderColor());
+
this.paintButton(e);
+
+ e.gc.setForeground(current);
+
this.paintText(e);
}
@@ -224,11 +282,26 @@ public abstract class MainBarButton extends Canvas {
if (this.getText() != null) {
textlen = this.getText().length();
}
-
+
+ Color current = e.gc.getForeground();
+
+ e.gc.setForeground(this.textColor);
+
+ String font_name = e.gc.getFont().getFontData()[0].getName();
+
+ Font font = new Font(this.getDisplay(), font_name, this.getTextsize(), e.gc.getFont().getFontData()[0].getStyle() );
+
+ e.gc.setFont(font);
+
int texty = (height - e.gc.getFontMetrics().getHeight()) / 2;
int textx = (width - e.gc.getFontMetrics().getAverageCharWidth()
* textlen) / 2;
+
e.gc.drawText(this.getText(), textx, texty);
+
+ font.dispose();
+
+ e.gc.setForeground(current);
} else {
int imgx = (width - height) / 2;
Image tmp = new Image(getDisplay(), this.image.getImageData()
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
index 923df73e..1b749883 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
@@ -52,13 +52,13 @@ public class MainBarEndButton extends MainBarButton {
@Override
protected void paintButton(PaintEvent e) {
Point size = this.getSize();
- int height = size.y - 2;
+ int height = size.y - 3;
int split = 10;
- int width = size.x;
+ int width = size.x - 1;
e.gc.drawLine(0, 0, width, 0);
- e.gc.drawLine(width, 0, width+split, (height) / 2);
+ e.gc.drawLine(width, 0, width, height);
e.gc.drawLine(width, height, 0, height);
e.gc.drawLine(0, height, 0+split, (height) / 2);
e.gc.drawLine(0+split, (height) / 2, 0, 0);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
index 5e64826f..e6d469b6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
@@ -50,7 +50,7 @@ public class MainBarMiddleButton extends MainBarButton {
Point size = this.getSize();
- int height = size.y - 2;
+ int height = size.y - 3;
int split = 10;
int width = size.x - split;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
index aff1fa7e..6f8b8340 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
@@ -52,7 +52,7 @@ public class MainBarRectangleButton extends MainBarButton {
Point size = this.getSize();
- int height = size.y - 2;
+ int height = size.y - 3;
int width = size.x;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
index 8cdafefa..cbdfc05d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
@@ -50,7 +50,7 @@ public class MainBarStartButton extends MainBarButton {
Point size = this.getSize();
- int height = size.y - 2;
+ int height = size.y - 3;
int split = 10;
int width = size.x - split;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index a5cb5d68..cb712678 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -273,7 +273,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
public void saveCurrentConfiguration() throws IOException {
String filename = this.getConfigurationFile();
- File configFile = new File(filename);
+ File configFile = new File(this.getConfigurationDirectory() + "/" + filename); //$NON-NLS-1$
Properties props = new Properties();
props.clear();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
index 47f3d4f8..5213fec6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -65,6 +65,7 @@ public class OutputState extends State {
}
this.outputComposite.setTempDirectory(tmpDir.getAbsolutePath());
+ this.outputComposite.setInputFile(this.stateMachine.getStatus().getDocument());
}
return this.outputComposite;