summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authortkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:36:17 +0000
committertkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:36:17 +0000
commit1e75c1d793a3d7264662344de7efdbdb65b6d7a7 (patch)
tree126739110afa3089d975f490867e5231499585c9 /trunk
parente3fd80899e714e60c329aca6e2d3654cf2fbc93a (diff)
downloadpdf-over-1e75c1d793a3d7264662344de7efdbdb65b6d7a7.tar.gz
pdf-over-1e75c1d793a3d7264662344de7efdbdb65b6d7a7.tar.bz2
pdf-over-1e75c1d793a3d7264662344de7efdbdb65b6d7a7.zip
Main Bar improvements
Configuration fixed git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12656 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java88
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java2
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java2
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java90
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java125
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java11
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java5
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java73
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java74
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java3
-rw-r--r--trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties4
-rw-r--r--trunk/pdf-over-gui/src/main/resources/img/config.pngbin2129 -> 2722 bytes
12 files changed, 351 insertions, 126 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 7cf7df23..c291f31f 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -73,23 +73,23 @@ public class MainWindow {
/**
* the configuration button
*/
- CONFIG,
-
+ CONFIG,
+
/**
* the open button
*/
- OPEN,
-
+ OPEN,
+
/**
* the position button
*/
- POSITION,
-
+ POSITION,
+
/**
* the signature button
*/
- SIGN,
-
+ SIGN,
+
/**
* the final button
*/
@@ -111,7 +111,8 @@ public class MainWindow {
this.stateMachine = stateMachine;
- this.buttonMap = new EnumMap<MainWindow.Buttons, MainBarButton>(Buttons.class);
+ this.buttonMap = new EnumMap<MainWindow.Buttons, MainBarButton>(
+ Buttons.class);
}
/**
@@ -201,61 +202,64 @@ public class MainWindow {
this.btn_config = new MainBarRectangleButton(composite, SWT.NONE);
FormData fd_btn_config = new FormData();
fd_btn_config.bottom = new FormAttachment(100);
- fd_btn_config.right = new FormAttachment(0,57);
+ fd_btn_config.right = new FormAttachment(0, 57);
fd_btn_config.top = new FormAttachment(0);
- fd_btn_config.left = new FormAttachment(0, 2);
+ fd_btn_config.left = new FormAttachment(0);
this.btn_config.setLayoutData(fd_btn_config);
this.btn_config.setText(Messages.getString("main.configuration")); //$NON-NLS-1$
- this.btn_config.setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$
+ this.btn_config
+ .setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$
this.btn_config.addMouseListener(new MouseListener() {
-
+
@Override
public void mouseUp(MouseEvent e) {
- MainWindow.this.stateMachine.jumpToState(new ConfigurationUIState(
- MainWindow.this.stateMachine));
+ MainWindow.this.stateMachine
+ .jumpToState(new ConfigurationUIState(
+ MainWindow.this.stateMachine));
}
-
+
@Override
public void mouseDown(MouseEvent e) {
// NOTHING TO DO HERE
}
-
+
@Override
public void mouseDoubleClick(MouseEvent e) {
- // NOTHING TO DO HERE
+ // NOTHING TO DO HERE
}
});
this.buttonMap.put(Buttons.CONFIG, this.btn_config);
-
+
InputStream is = this.getClass().getResourceAsStream("/img/config.png"); //$NON-NLS-1$
-
- this.btn_config.setImage(new Image(Display.getDefault(), new ImageData(is)));
-
+
+ this.btn_config.setImage(new Image(Display.getDefault(), new ImageData(
+ is)));
+
this.btn_open = new MainBarStartButton(composite, SWT.NONE);
FormData fd_btn_open = new FormData();
fd_btn_open.bottom = new FormAttachment(100);
- fd_btn_open.right = new FormAttachment(35, 5);
+ fd_btn_open.right = new FormAttachment(35, (MainBarButton.SplitFactor / 2));
fd_btn_open.top = new FormAttachment(0);
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$
this.btn_open.addMouseListener(new MouseListener() {
-
+
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine.jumpToState(new OpenState(
MainWindow.this.stateMachine));
}
-
+
@Override
public void mouseDown(MouseEvent e) {
// NOTHING TO DO HERE
}
-
+
@Override
public void mouseDoubleClick(MouseEvent e) {
- // NOTHING TO DO HERE
+ // NOTHING TO DO HERE
}
});
this.buttonMap.put(Buttons.OPEN, this.btn_open);
@@ -263,28 +267,28 @@ public class MainWindow {
this.btn_position = new MainBarMiddleButton(composite, SWT.NONE);
FormData fd_btn_position = new FormData();
fd_btn_position.bottom = new FormAttachment(100);
- fd_btn_position.right = new FormAttachment(60, 5);
+ fd_btn_position.right = new FormAttachment(60, (MainBarButton.SplitFactor / 2));
fd_btn_position.top = new FormAttachment(0);
- fd_btn_position.left = new FormAttachment(35, -5);
+ fd_btn_position.left = new FormAttachment(35, -1 * (MainBarButton.SplitFactor / 2));
this.btn_position.setLayoutData(fd_btn_position);
this.btn_position.setText(Messages.getString("main.position")); //$NON-NLS-1$
this.btn_position.setToolTipText(Messages.getString("main.position")); //$NON-NLS-1$
this.btn_position.addMouseListener(new MouseListener() {
-
+
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine.jumpToState(new PositioningState(
MainWindow.this.stateMachine));
}
-
+
@Override
public void mouseDown(MouseEvent e) {
// NOTHING TO DO HERE
}
-
+
@Override
public void mouseDoubleClick(MouseEvent e) {
- // NOTHING TO DO HERE
+ // NOTHING TO DO HERE
}
});
this.buttonMap.put(Buttons.POSITION, this.btn_position);
@@ -292,9 +296,9 @@ public class MainWindow {
this.btn_sign = new MainBarMiddleButton(composite, SWT.NONE);
FormData fd_btn_sign = new FormData();
fd_btn_sign.bottom = new FormAttachment(100);
- fd_btn_sign.right = new FormAttachment(85, 5);
+ fd_btn_sign.right = new FormAttachment(85, (MainBarButton.SplitFactor / 2));
fd_btn_sign.top = new FormAttachment(0);
- fd_btn_sign.left = new FormAttachment(60, -5);
+ fd_btn_sign.left = new FormAttachment(60, -1 * (MainBarButton.SplitFactor / 2));
this.btn_sign.setLayoutData(fd_btn_sign);
this.btn_sign.setText(Messages.getString("main.signature")); //$NON-NLS-1$
this.btn_sign.setToolTipText(Messages.getString("main.signature")); //$NON-NLS-1$
@@ -303,20 +307,20 @@ public class MainWindow {
MainBarEndButton end = new MainBarEndButton(composite, SWT.NONE);
FormData fd_btn_end = new FormData();
fd_btn_end.bottom = new FormAttachment(100);
- fd_btn_end.right = new FormAttachment(100, -10);
+ fd_btn_end.right = new FormAttachment(100);
fd_btn_end.top = new FormAttachment(0);
- fd_btn_end.left = new FormAttachment(85, -5);
+ fd_btn_end.left = new FormAttachment(85, -1 * (MainBarButton.SplitFactor / 2));
end.setLayoutData(fd_btn_end);
end.setText(Messages.getString("main.done")); //$NON-NLS-1$
end.setToolTipText(Messages.getString("main.done")); //$NON-NLS-1$
this.buttonMap.put(Buttons.FINAL, end);
-
+
this.container = new Composite(getShell(), SWT.RESIZE);
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.bottom = new FormAttachment(100, -10);
+ fd_composite_1.right = new FormAttachment(100, -10);
fd_composite_1.top = new FormAttachment(0, 70);
- fd_composite_1.left = new FormAttachment(0, 5);
+ fd_composite_1.left = new FormAttachment(0, 10);
this.container.setLayoutData(fd_composite_1);
this.stack = new StackLayout();
this.container.setLayout(this.stack);
@@ -343,7 +347,7 @@ public class MainWindow {
}
}
- if(behavior.getMainBarVisible()) {
+ if (behavior.getMainBarVisible()) {
this.mainBarFormData.bottom = new FormAttachment(0, 60);
} else {
this.mainBarFormData.bottom = new FormAttachment(0, 0);
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
index 4b342cad..d0e1b256 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java
@@ -240,6 +240,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite {
// Nothing to do
}
});
+
+ tabFolder.setSelection(advancedTabItem);
}
void performOutputFolderChanged(String foldername) {
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
index ccc7121a..16a5dd84 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
@@ -143,7 +143,7 @@ public class DataSourceSelectComposite extends StateComposite {
Rectangle clientArea = DataSourceSelectComposite.this
.drop_area.getClientArea();
- e.gc.setForeground(new Color(getDisplay(), 0x76, 0xC4, 0xC8));
+ e.gc.setForeground(new Color(getDisplay(), 0x7E, 0x9F, 0xA5));
e.gc.setLineStyle(SWT.LINE_DASH);
e.gc.drawRoundRectangle(clientArea.x,
clientArea.y, clientArea.width - 2, clientArea.height - 2,
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
index cf579b7b..1d47da9e 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
@@ -18,7 +18,6 @@ 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;
@@ -26,14 +25,17 @@ import org.apache.commons.io.FilenameUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
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.Event;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,6 +56,8 @@ public class OutputComposite extends StateComposite {
private File inputFile;
+ File outputFile = null;
+
/**
* Sets the input file
*
@@ -108,6 +112,15 @@ public class OutputComposite extends StateComposite {
outstream.close();
OutputComposite.this.savedFile = targetFile;
+
+ this.outputFile = targetFile;
+ // Show open message ...
+ this.lnk_saved_file.setText(Messages.getString("output.link_open_message")); //$NON-NLS-1$
+ this.btn_save.setVisible(false);
+ } else {
+ // Show save message ...
+ this.lnk_saved_file.setText(Messages.getString("output.link_save_message")); //$NON-NLS-1$
+ this.btn_save.setVisible(true);
}
}
@@ -144,37 +157,14 @@ public class OutputComposite extends StateComposite {
@Override
public void widgetSelected(SelectionEvent e) {
try {
- DocumentSource source = OutputComposite.this
- .getSignedDocument();
-
- if (source != null) {
- 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$
- FileOutputStream outstream = new FileOutputStream(open);
- outstream.write(source.getByteArray(), 0,
- source.getByteArray().length);
- outstream.close();
- }
- if (open.exists()) {
+ if (OutputComposite.this.outputFile != null) {
+
+ if (OutputComposite.this.outputFile.exists()) {
// Desktop supported check allready done in constructor
- Desktop.getDesktop().open(open);
+ Desktop.getDesktop().open(OutputComposite.this.outputFile);
return;
}
- } 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$
- dialog.open();
}
} catch (Exception ex) {
log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$
@@ -201,6 +191,40 @@ public class OutputComposite extends StateComposite {
this.setLayout(new FormLayout());
+ Label lbl_success_message = new Label(this, SWT.NATIVE | SWT.RESIZE);
+ FormData fd_lbl_success_message = new FormData();
+ fd_lbl_success_message.top = new FormAttachment(40, 0);
+ fd_lbl_success_message.left = new FormAttachment(0);
+ fd_lbl_success_message.right = new FormAttachment(100);
+ lbl_success_message.setLayoutData(fd_lbl_success_message);
+ lbl_success_message.setAlignment(SWT.CENTER);
+ lbl_success_message.setText(Messages.getString("output.success_message")); //$NON-NLS-1$
+
+ FontData[] fD1 = lbl_success_message.getFont().getFontData();
+ fD1[0].setHeight(12);
+ lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0]));
+
+ this.lnk_saved_file = new Link(this, SWT.NATIVE | SWT.RESIZE);
+ this.lnk_saved_file.setText(Messages.getString("output.link_save_message")); //$NON-NLS-1$
+ FormData fd_lnk_saved_file = new FormData();
+ fd_lnk_saved_file.top = new FormAttachment(lbl_success_message, 10);
+ fd_lnk_saved_file.left = new FormAttachment(lbl_success_message, 0, SWT.CENTER);
+ //fd_lnk_saved_file.right = new FormAttachment(100);
+ this.lnk_saved_file.setLayoutData(fd_lnk_saved_file);
+
+ this.lnk_saved_file.addSelectionListener(new OpenSelectionListener());
+
+ this.btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE);
+ this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$
+
+ FormData fd_btn_save = new FormData();
+ fd_btn_save.top = new FormAttachment(this.lnk_saved_file, 10);
+ fd_btn_save.left = new FormAttachment(this.lnk_saved_file, 0, SWT.CENTER);
+ this.btn_save.setLayoutData(fd_btn_save);
+
+ this.btn_save.setVisible(false);
+ this.btn_save.addSelectionListener(new SaveSelectionListener());
+ /*
Button btn_open = new Button(this, SWT.NATIVE | SWT.RESIZE);
btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$
// Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -226,7 +250,7 @@ public class OutputComposite extends StateComposite {
// fd_btn_save.bottom = new FormAttachment(55, 0);
btn_save.setLayoutData(fd_btn_save);
btn_save.addSelectionListener(new SaveSelectionListener());
-
+ */
//this.pack();
}
@@ -265,6 +289,10 @@ public class OutputComposite extends StateComposite {
private boolean save_showed = false;
+ private Link lnk_saved_file;
+
+ private Button btn_save;
+
/*
* (non-Javadoc)
*
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
index d67ecfc3..e0e33427 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java
@@ -36,6 +36,10 @@ import org.slf4j.LoggerFactory;
* Main Bar Button implementation
*/
public abstract class MainBarButton extends Canvas {
+
+ public static final int GradientFactor = 4;
+ public static final int SplitFactor = 10;
+
/**
* @param parent
* @param style
@@ -64,11 +68,13 @@ public abstract class MainBarButton extends Canvas {
this.setCursor(hand);
- this.inactiveBackground = new Color(getDisplay(), 0x4B, 0x95, 0x00);
- this.activeBackground = new Color(getDisplay(), 0x98, 0xF2, 0x3D);
+ this.inactiveBackground = new Color(getDisplay(), 0xC7, 0xDD, 0xE7);
+ this.activeBackground = new Color(getDisplay(), 0x7A, 0xC2, 0xD3);
this.textColor = this.getForeground();
- this.borderColor = new Color(getDisplay(), 0x76, 0xC4, 0xC8);
+ this.borderColor = new Color(getDisplay(), 0x7E, 0x9F, 0xA5);
+ this.inactiveText = new Color(getDisplay(), 0x6E, 0x6C, 0x6E);
this.textsize = 12;
+
}
private Color inactiveBackground = null;
@@ -93,7 +99,7 @@ public abstract class MainBarButton extends Canvas {
* the text size
*/
protected int textsize = 12;
-
+
/**
* @return the textsize
*/
@@ -102,7 +108,8 @@ public abstract class MainBarButton extends Canvas {
}
/**
- * @param textsize the textsize to set
+ * @param textsize
+ * the textsize to set
*/
public void setTextsize(int textsize) {
this.textsize = textsize;
@@ -114,7 +121,8 @@ public abstract class MainBarButton extends Canvas {
protected Color textColor = null;
/**
- * @param textColor the textColor to set
+ * @param textColor
+ * the textColor to set
*/
public void setTextColor(Color textColor) {
this.textColor = textColor;
@@ -128,15 +136,18 @@ public abstract class MainBarButton extends Canvas {
}
/**
- * @param borderColor the borderColor to set
+ * @param borderColor
+ * the borderColor to set
*/
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
private Color borderColor = null;
-
+
private Color activeBackground = null;
+
+ private Color inactiveText = null;
private String text = ""; //$NON-NLS-1$
@@ -146,6 +157,7 @@ public abstract class MainBarButton extends Canvas {
/**
* Gets the image
+ *
* @return the image
*/
public Image getImage() {
@@ -154,7 +166,9 @@ public abstract class MainBarButton extends Canvas {
/**
* Sets the Image
- * @param image the imgage to set
+ *
+ * @param image
+ * the imgage to set
*/
public void setImage(Image image) {
this.image = image;
@@ -187,6 +201,7 @@ public abstract class MainBarButton extends Canvas {
/**
* Gets the button text
+ *
* @return the text
*/
public String getText() {
@@ -195,7 +210,9 @@ public abstract class MainBarButton extends Canvas {
/**
* Sets the text for the button
- * @param text the text to set
+ *
+ * @param text
+ * the text to set
*/
public void setText(String text) {
this.text = text;
@@ -214,50 +231,54 @@ public abstract class MainBarButton extends Canvas {
* @param e
*/
protected void paintBackground(PaintEvent e) {
-
- /*
Point size = this.getSize();
int height = size.y - 2;
int width = size.x;
-
- int factor = 4;
-
- // TOP
- e.gc.fillGradientRectangle(0, 0, width, factor, true);
-
- // BOTTOM
- e.gc.fillGradientRectangle(0, height, width, -1 * (factor), true);
- */
+
+ e.gc.setForeground(activeBackground);
+ e.gc.setBackground(inactiveBackground);
+
+ e.gc.fillGradientRectangle(0, height, width, -1 * height, true);
+
+ //e.gc.setBackground(activeBackground);
+
// LEFT
- //e.gc.fillGradientRectangle(0, 0, factor, height, false);
+ // e.gc.fillGradientRectangle(0, 0, factor, height, false);
// RIGTH
- //e.gc.fillGradientRectangle(width, 0, -1 * (width / factor), height,
- // false);
+ // e.gc.fillGradientRectangle(width, 0, -1 * (width / factor), height,
+ // false);
}
/**
* Main painting method
+ *
* @param e
*/
void paintControl(PaintEvent e) {
- this.paintBackground(e);
-
- Color current = e.gc.getForeground();
+ Color forecurrent = e.gc.getForeground();
+ Color backcurrent = e.gc.getBackground();
e.gc.setForeground(getBorderColor());
+ if(this.getActive()) {
+ this.paintBackground(e);
+ }
+
+ e.gc.setForeground(getBorderColor());
this.paintButton(e);
-
- e.gc.setForeground(current);
-
+
+ e.gc.setForeground(forecurrent);
+ e.gc.setBackground(backcurrent);
+
this.paintText(e);
}
/**
* paint the inner button
+ *
* @param e
*/
protected void paintButton(PaintEvent e) {
@@ -266,6 +287,7 @@ public abstract class MainBarButton extends Canvas {
/**
* Paint the text or image on the button
+ *
* @param e
*/
protected void paintText(PaintEvent e) {
@@ -282,25 +304,34 @@ public abstract class MainBarButton extends Canvas {
if (this.getText() != null) {
textlen = this.getText().length();
}
-
+
Color current = e.gc.getForeground();
-
- e.gc.setForeground(this.textColor);
-
+
+ if(this.getActive() && this.isEnabled()) {
+ e.gc.setForeground(this.textColor);
+ } else {
+ e.gc.setForeground(this.inactiveText);
+ }
+
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() );
-
+
+ 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;
+
+ textx = this.changeTextPosition(textx);
- e.gc.drawText(this.getText(), textx, texty);
-
+ e.gc.drawText(this.getText(), textx, texty, true);
+
font.dispose();
-
+
e.gc.setForeground(current);
} else {
int imgx = (width - height) / 2;
@@ -312,7 +343,19 @@ public abstract class MainBarButton extends Canvas {
}
/**
+ * change the text position
+ *
+ * @param positionX
+ * the position
+ * @return the new position
+ */
+ protected int changeTextPosition(int positionX) {
+ return positionX;
+ }
+
+ /**
* Gets the region of the button
+ *
* @return the button region
*/
protected abstract Region getCustomRegion();
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
index 1b749883..636de621 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java
@@ -76,7 +76,7 @@ public class MainBarEndButton extends MainBarButton {
int height = size.y - 2;
- int split = 10;
+ int split = SplitFactor;
int width = size.x;
@@ -86,4 +86,13 @@ public class MainBarEndButton extends MainBarButton {
return reg;
}
+ /**
+ * change the text position
+ * @param positionX the position
+ * @return the new position
+ */
+ @Override
+ protected int changeTextPosition(int positionX) {
+ return positionX + (SplitFactor / 2);
+ }
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
index e6d469b6..6d992799 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java
@@ -52,7 +52,7 @@ public class MainBarMiddleButton extends MainBarButton {
int height = size.y - 3;
- int split = 10;
+ int split = SplitFactor;
int width = size.x - split;
e.gc.drawLine(0, 0, width, 0);
@@ -64,6 +64,7 @@ public class MainBarMiddleButton extends MainBarButton {
}
+
/* (non-Javadoc)
* @see at.asit.pdfover.gui.controls.MainBarButton#getCustomRegion()
*/
@@ -73,7 +74,7 @@ public class MainBarMiddleButton extends MainBarButton {
int height = size.y - 2;
- int split = 10;
+ int split = SplitFactor;
int width = size.x - split;
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
index 6f8b8340..102d2c07 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
@@ -44,26 +44,89 @@ public class MainBarRectangleButton extends MainBarButton {
private static final Logger log = LoggerFactory
.getLogger(MainBarRectangleButton.class);
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.controls.MainBarButton#paintButton(org.eclipse.swt.events.PaintEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.asit.pdfover.gui.controls.MainBarButton#paintButton(org.eclipse.swt
+ * .events.PaintEvent)
*/
@Override
protected void paintButton(PaintEvent e) {
-
+
Point size = this.getSize();
int height = size.y - 3;
int width = size.x;
-
+
e.gc.drawLine(0, 0, width, 0);
e.gc.drawLine(width, 0, width, height);
e.gc.drawLine(width, height, 0, height);
e.gc.drawLine(0, height, 0, 0);
+
+ }
+
+ @Override
+ protected void paintBackground(PaintEvent e) {
+ Point size = this.getSize();
+ int height = size.y - 2;
+
+ int width = size.x;
+
+ int factor = GradientFactor;
+
+ Region left_reg = new Region();
+ left_reg.add(new int[] { 0, 0, factor, factor, factor, height-factor, 0, height, 0, 0 });
+
+ Region right_reg = new Region();
+ right_reg.add(new int[] { width, 0,
+ width - factor, factor,
+ width - factor, height-factor, width, height, width, 0 });
+
+ Region top_reg = new Region();
+ top_reg.add(new int[] {
+ 0, 0,
+ factor, factor,
+ width - factor, factor,
+ width, 0,
+ 0, 0 });
+
+ Region bottom_reg = new Region();
+ bottom_reg.add(new int[] {
+ 0, height,
+ factor, height-factor,
+ width - factor, height-factor,
+ width, height, 0, height });
+
+ e.gc.setClipping(top_reg);
+
+ //TOP
+ e.gc.fillGradientRectangle(0, 0, width, factor, true);
+
+ e.gc.setClipping(bottom_reg);
+
+ //BOTTOM
+ e.gc.fillGradientRectangle(0, height, width, -1 * (factor),
+ true);
+
+ e.gc.setClipping(left_reg);
+
+ // LEFT
+ e.gc.fillGradientRectangle(0, 0, factor, height, false);
+
+
+ e.gc.setClipping(right_reg);
+ // RIGTH
+ e.gc.fillGradientRectangle(width, 0, -1 * factor, height,
+ false);
+ e.gc.setClipping((Region)null);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see at.asit.pdfover.gui.controls.MainBarButton#getCustomRegion()
*/
@Override
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
index cbdfc05d..489f17b3 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java
@@ -42,6 +42,66 @@ public class MainBarStartButton extends MainBarButton {
private static final Logger log = LoggerFactory
.getLogger(MainBarStartButton.class);
+ @Override
+ protected void paintBackground(PaintEvent e) {
+ super.paintBackground(e);
+ /*
+ Point size = this.getSize();
+ int height = size.y - 2;
+
+ int split = SplitFactor;
+ int width = size.x - split;
+
+ int factor = GradientFactor;
+
+ Region left_reg = new Region();
+ left_reg.add(new int[] { 0, 0, factor, factor, factor, height-factor, 0, height, 0, 0 });
+
+ Region right1_reg = new Region();
+ right1_reg.add(new int[] { width, 0,
+ width - factor, factor,
+ width - factor, height-factor, width, height, width, 0 });
+
+ Region top_reg = new Region();
+ top_reg.add(new int[] {
+ 0, 0,
+ factor, factor,
+ width - factor, factor,
+ width, 0,
+ 0, 0 });
+
+ Region bottom_reg = new Region();
+ bottom_reg.add(new int[] {
+ 0, height,
+ factor, height-factor,
+ width - factor, height-factor,
+ width, height, 0, height });
+
+ e.gc.setClipping(top_reg);
+
+ //TOP
+ e.gc.fillGradientRectangle(0, 0, width, factor, true);
+
+ e.gc.setClipping(bottom_reg);
+
+ //BOTTOM
+ e.gc.fillGradientRectangle(0, height, width, -1 * (factor),
+ true);
+
+ e.gc.setClipping(left_reg);
+
+ // LEFT
+ e.gc.fillGradientRectangle(0, 0, factor, height, false);
+
+
+ e.gc.setClipping(right1_reg);
+ // RIGTH
+ e.gc.fillGradientRectangle(width, 0, -1 * factor, height,
+ false);
+
+ e.gc.setClipping((Region)null);*/
+ }
+
/* (non-Javadoc)
* @see at.asit.pdfover.gui.controls.MainBarButton#paintButton(org.eclipse.swt.events.PaintEvent)
*/
@@ -52,7 +112,7 @@ public class MainBarStartButton extends MainBarButton {
int height = size.y - 3;
- int split = 10;
+ int split = SplitFactor;
int width = size.x - split;
e.gc.drawLine(0, 0, width, 0);
@@ -72,7 +132,7 @@ public class MainBarStartButton extends MainBarButton {
int height = size.y - 2;
- int split = 10;
+ int split = SplitFactor;
int width = size.x - split;
@@ -82,4 +142,14 @@ public class MainBarStartButton extends MainBarButton {
return reg;
}
+
+ /**
+ * change the text position
+ * @param positionX the position
+ * @return the new position
+ */
+ @Override
+ protected int changeTextPosition(int positionX) {
+ return positionX - (SplitFactor / 2);
+ }
}
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index 18f913ef..bf624083 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -298,6 +298,9 @@ public class MobileBKUState extends State {
behavior.setActive(Buttons.OPEN, true);
behavior.setActive(Buttons.POSITION, true);
behavior.setActive(Buttons.SIGN, true);
+ behavior.setEnabled(Buttons.OPEN, true);
+ behavior.setEnabled(Buttons.POSITION, true);
+ //behavior.setEnabled(Buttons.SIGN, true);
}
@Override
diff --git a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
index c18af347..2c92b321 100644
--- a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
+++ b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
@@ -41,7 +41,9 @@ simple_config.ProxyHostTemplate=Hostname or IP of proxy server
simple_config.ProxyPort=Port:
simple_config.ProxyPortTemplate=port proxy server [1-65535]
-
+output.success_message=Signature was successful
+output.link_open_message=You can open the signed file <a>here</a>
+output.link_save_message=You can save the signed file
dataSourceSelection.DropLabel=Drag document here
dataSourceSelection.DropLabel2=Or, if you prefer
diff --git a/trunk/pdf-over-gui/src/main/resources/img/config.png b/trunk/pdf-over-gui/src/main/resources/img/config.png
index 6e52db7c..4da048a6 100644
--- a/trunk/pdf-over-gui/src/main/resources/img/config.png
+++ b/trunk/pdf-over-gui/src/main/resources/img/config.png
Binary files differ