From dff2e350246d462dd8a70fb211e08554bcf95723 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 3 Oct 2012 08:42:03 +0200 Subject: Main Bar improvements Configuration fixed --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 88 ++++++++------- .../composites/AdvancedConfigurationComposite.java | 2 + .../gui/composites/DataSourceSelectComposite.java | 2 +- .../pdfover/gui/composites/OutputComposite.java | 90 ++++++++++----- .../asit/pdfover/gui/controls/MainBarButton.java | 125 ++++++++++++++------- .../pdfover/gui/controls/MainBarEndButton.java | 11 +- .../pdfover/gui/controls/MainBarMiddleButton.java | 5 +- .../gui/controls/MainBarRectangleButton.java | 73 +++++++++++- .../pdfover/gui/controls/MainBarStartButton.java | 74 +++++++++++- .../gui/workflow/states/MobileBKUState.java | 3 + .../at/asit/pdfover/gui/messages.properties | 4 +- .../pdf-over-gui/src/main/resources/img/config.png | Bin 2129 -> 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(Buttons.class); + this.buttonMap = new EnumMap( + 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; @@ -311,8 +342,20 @@ 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 here +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 Binary files a/trunk/pdf-over-gui/src/main/resources/img/config.png and b/trunk/pdf-over-gui/src/main/resources/img/config.png differ -- cgit v1.2.3 From 920aa71511071ba92b00467696537bf45f64fa47 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 3 Oct 2012 13:51:12 +0200 Subject: Fixed BKU cancel Bug --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 19 +++++ ...ConfigurationUIState.java~Configuration Changes | 93 ++++++++++++++++++++++ .../pdfover/gui/workflow/states/OutputState.java | 3 + .../pdfover/gui/workflow/states/SigningState.java | 2 +- 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes 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 c291f31f..e904bc09 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 @@ -43,6 +43,7 @@ import at.asit.pdfover.gui.controls.MainBarMiddleButton; import at.asit.pdfover.gui.controls.MainBarRectangleButton; import at.asit.pdfover.gui.controls.MainBarStartButton; import at.asit.pdfover.gui.workflow.StateMachine; +import at.asit.pdfover.gui.workflow.states.BKUSelectionState; import at.asit.pdfover.gui.workflow.states.ConfigurationUIState; import at.asit.pdfover.gui.workflow.states.OpenState; import at.asit.pdfover.gui.workflow.states.PositioningState; @@ -302,6 +303,24 @@ public class MainWindow { 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$ + this.btn_sign.addMouseListener(new MouseListener() { + + @Override + public void mouseUp(MouseEvent e) { + MainWindow.this.stateMachine.jumpToState(new BKUSelectionState( + MainWindow.this.stateMachine)); + } + + @Override + public void mouseDown(MouseEvent e) { + // NOTHING TO DO HERE + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + // NOTHING TO DO HERE + } + }); this.buttonMap.put(Buttons.SIGN, this.btn_sign); MainBarEndButton end = new MainBarEndButton(composite, SWT.NONE); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes new file mode 100644 index 00000000..4b468ad8 --- /dev/null +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java~Configuration Changes @@ -0,0 +1,93 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.gui.workflow.states; + +// Imports +import org.eclipse.swt.SWT; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.composites.ConfigurationComposite; +import at.asit.pdfover.gui.workflow.StateMachine; +import at.asit.pdfover.gui.workflow.Status; + +/** + * + */ +public class ConfigurationUIState extends State { + /** + * SLF4J Logger instance + **/ + private static final Logger log = LoggerFactory + .getLogger(ConfigurationUIState.class); + + + private ConfigurationComposite configurationComposite = null; + + private ConfigurationComposite getConfigurationComposite() { + if (this.configurationComposite == null) { + this.configurationComposite = + this.stateMachine.getGUIProvider().createComposite(ConfigurationComposite.class, SWT.RESIZE, this); + this.configurationComposite.setConfigManipulator(this.stateMachine.getConfigManipulator()); + } + + return this.configurationComposite; + } + + /** + * @param stateMachine + */ + public ConfigurationUIState(StateMachine stateMachine) { + super(stateMachine); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#run() + */ + @Override + public void run() { + Status status = this.stateMachine.getStatus(); + + ConfigurationComposite config = this.getConfigurationComposite(); + + this.stateMachine.getGUIProvider().display(config); + + if(config.isUserDone()) + { + this.setNextState(status.getPreviousState()); + } + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() + */ + @Override + public void cleanUp() { + if(this.configurationComposite != null) + this.configurationComposite.dispose(); + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.states.State#updateMainWindowBehavior() + */ + @Override + public void updateMainWindowBehavior() { + // Leave the state as it is + } + +} diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index 5213fec6..b5e14286 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -115,6 +115,9 @@ public class OutputState extends State { */ @Override public void cleanUp() { + + this.stateMachine.getStatus().setSignResult(null); + if (this.outputComposite != null) this.outputComposite.dispose(); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java index 6079893b..3b782119 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java @@ -91,7 +91,7 @@ public class SigningState extends State { SWT.NONE, Messages.getString("error.Signatur"), this.threadException, true); //$NON-NLS-1$ this.threadException = null; if(error.open()) { - this.stateMachine.update(); + this.setNextState(new BKUSelectionState(this.stateMachine)); } else { this.stateMachine.exit(); } -- cgit v1.2.3 From 4dd054cc2ff1a8533645b19d09caa43700941b48 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 4 Oct 2012 11:59:45 +0200 Subject: + Implemented behavior with set default output folder + centralized font sizes + added comments for documentation --- .../main/java/at/asit/pdfover/gui/MainWindow.java | 2 +- .../main/java/at/asit/pdfover/gui/Messages.java | 2 +- .../main/java/at/asit/pdfover/gui/Unzipper.java | 2 +- .../pdfover/gui/cliarguments/ArgumentHandler.java | 2 +- .../asit/pdfover/gui/cliarguments/BKUArgument.java | 2 +- .../asit/pdfover/gui/cliarguments/CLIArgument.java | 2 +- .../gui/cliarguments/ConfigFileArgument.java | 2 +- .../pdfover/gui/cliarguments/EmblemArgument.java | 2 +- .../pdfover/gui/cliarguments/HelpArgument.java | 2 +- .../gui/cliarguments/InputDocumentArgument.java | 2 +- .../gui/cliarguments/OutputFolderArgument.java | 2 +- .../pdfover/gui/cliarguments/PasswordArgument.java | 2 +- .../gui/cliarguments/PhoneNumberArgument.java | 2 +- .../gui/cliarguments/ProxyHostArgument.java | 2 +- .../gui/cliarguments/ProxyPortArgument.java | 2 +- .../composites/AdvancedConfigurationComposite.java | 41 ++++- .../gui/composites/BKUSelectionComposite.java | 13 +- .../gui/composites/BaseConfigurationComposite.java | 2 +- .../gui/composites/ConfigurationComposite.java | 20 ++- .../gui/composites/DataSourceSelectComposite.java | 11 +- .../composites/MobileBKUEnterNumberComposite.java | 2 +- .../gui/composites/MobileBKUEnterTANComposite.java | 3 +- .../pdfover/gui/composites/OutputComposite.java | 172 +++++++++++++-------- .../composites/SimpleConfigurationComposite.java | 57 ++++++- .../pdfover/gui/composites/StateComposite.java | 20 +++ .../asit/pdfover/gui/controls/MainBarButton.java | 19 ++- .../pdfover/gui/workflow/states/OutputState.java | 1 + 27 files changed, 292 insertions(+), 99 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 e904bc09..2bf827b6 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 @@ -186,7 +186,7 @@ public class MainWindow { */ protected void createContents() { this.shell = new Shell(); - getShell().setSize(500, 800); + getShell().setSize(1024, 768); getShell().setText(Messages.getString("main.title")); //$NON-NLS-1$ getShell().setLayout(new FormLayout()); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java index 3f700f14..1e8f899a 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java @@ -20,7 +20,7 @@ import java.util.MissingResourceException; import java.util.ResourceBundle; /** - * + * Localizes string messages for PDFOver GUI */ public class Messages { private static final String BUNDLE_NAME = "at.asit.pdfover.gui.messages"; //$NON-NLS-1$ diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java index 429f8782..cc500f68 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Unzipper.java @@ -28,7 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * Unzipper to extract default configuration */ public class Unzipper { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java index badf37da..6ba19809 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java @@ -28,7 +28,7 @@ import at.asit.pdfover.gui.exceptions.InitializationException; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * Handler to process CLI Arguments */ public class ArgumentHandler { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java index 3117780e..b44b3f80 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java @@ -22,7 +22,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.signator.BKUs; /** - * + * CLI Argument to set the BKU to use */ public class BKUArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java index 7f8d4366..26c3d12f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java @@ -19,7 +19,7 @@ import at.asit.pdfover.gui.exceptions.InitializationException; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument base class */ public abstract class CLIArgument { diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java index 417b85cb..146d83bc 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java @@ -25,7 +25,7 @@ import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to set the configuration file */ public class ConfigFileArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java index a89bef78..9ca952a4 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java @@ -28,7 +28,7 @@ import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to set the emblem file to use for signature */ public class EmblemArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java index bd015984..3e19d9e4 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java @@ -24,7 +24,7 @@ import at.asit.pdfover.gui.exceptions.InitializationException; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to show the useage message */ public class HelpArgument extends CLIArgument { diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java index 9152a6fd..58afdce1 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java @@ -28,7 +28,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; /** - * + * CLI Argument to set the input document to sign */ public class InputDocumentArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java index 60ef8c59..cbaf7600 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java @@ -29,7 +29,7 @@ import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to show the usage message */ public class OutputFolderArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java index c30e6748..d0f60bed 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java @@ -26,7 +26,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper; /** - * + * CLI Argument to provide Mobile BKU password */ public class PasswordArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java index a9c14d18..bb99c173 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java @@ -26,7 +26,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper; /** - * + * CLI Argument to provide Mobile BKU phone number to use */ public class PhoneNumberArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java index da7945a6..da8a5a25 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java @@ -25,7 +25,7 @@ import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to provide the proxy host */ public class ProxyHostArgument extends CLIArgument { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java index 51ef7554..0dfdd428 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java @@ -26,7 +26,7 @@ import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.StateMachine; /** - * + * CLI Argument to provide the proxy port */ public class ProxyPortArgument extends CLIArgument { /** 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 d0e1b256..67cd7253 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 @@ -34,17 +34,20 @@ import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Text; /** - * + * Composite for advanced configuration */ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { /** @@ -69,6 +72,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { TabItem simpleTabItem = new TabItem(tabFolder, SWT.NULL); simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + FontData[] fD_tabFolder = tabFolder.getFont().getFontData(); + fD_tabFolder[0].setHeight(TEXT_SIZE_NORMAL); + tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); + this.simpleComposite = new SimpleConfigurationComposite(tabFolder, SWT.NONE, state, container); @@ -92,6 +99,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_grpSignaturPosition.left = new FormAttachment(0, 5); grpSignaturPosition.setLayoutData(fd_grpSignaturPosition); + FontData[] fD_grpSignaturPosition = grpSignaturPosition.getFont().getFontData(); + fD_grpSignaturPosition[0].setHeight(TEXT_SIZE_NORMAL); + grpSignaturPosition.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0])); + this.btnAutomatischePositionierung = new Button(grpSignaturPosition, SWT.CHECK); FormData fd_btnAutomatischePositionierung = new FormData(); @@ -102,6 +113,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .setLayoutData(fd_btnAutomatischePositionierung); this.btnAutomatischePositionierung.setText(Messages.getString("advanced_config.AutoPosition")); //$NON-NLS-1$ + FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung.getFont().getFontData(); + fD_btnAutomatischePositionierung[0].setHeight(TEXT_SIZE_BUTTON); + this.btnAutomatischePositionierung.setFont(new Font(Display.getCurrent(), fD_btnAutomatischePositionierung[0])); + this.btnAutomatischePositionierung.addSelectionListener(new SelectionListener() { @Override @@ -126,12 +141,20 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_grpBkuAuswahl.bottom = new FormAttachment(66, -5); grpBkuAuswahl.setLayoutData(fd_grpBkuAuswahl); + FontData[] fD_grpBkuAuswahl = grpBkuAuswahl.getFont().getFontData(); + fD_grpBkuAuswahl[0].setHeight(TEXT_SIZE_NORMAL); + grpBkuAuswahl.setFont(new Font(Display.getCurrent(), fD_grpBkuAuswahl[0])); + this.cmbBKUAuswahl = new Combo(grpBkuAuswahl, SWT.NONE); FormData fd_cmbBKUAuswahl = new FormData(); fd_cmbBKUAuswahl.right = new FormAttachment(100, -5); fd_cmbBKUAuswahl.top = new FormAttachment(0, 5); fd_cmbBKUAuswahl.left = new FormAttachment(0, 5); + FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont().getFontData(); + fD_cmbBKUAuswahl[0].setHeight(TEXT_SIZE_NORMAL); + this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(), fD_cmbBKUAuswahl[0])); + int blen = BKUs.values().length; this.bkuStrings = new String[blen]; @@ -172,6 +195,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_grpSpeicherort.bottom = new FormAttachment(100, -5); grpSpeicherort.setLayoutData(fd_grpSpeicherort); + FontData[] fD_grpSpeicherort = grpSpeicherort.getFont().getFontData(); + fD_grpSpeicherort[0].setHeight(TEXT_SIZE_NORMAL); + grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0])); + Label lblDefaultOutputFolder = new Label(grpSpeicherort, SWT.NONE); FormData fd_lblDefaultOutputFolder = new FormData(); fd_lblDefaultOutputFolder.top = new FormAttachment(0, 5); @@ -179,12 +206,20 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { lblDefaultOutputFolder.setLayoutData(fd_lblDefaultOutputFolder); lblDefaultOutputFolder.setText(Messages.getString("advanced_config.OutputFolder")); //$NON-NLS-1$ + FontData[] fD_lblDefaultOutputFolder = lblDefaultOutputFolder.getFont().getFontData(); + fD_lblDefaultOutputFolder[0].setHeight(TEXT_SIZE_NORMAL); + lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); + this.txtOutputFolder = new Text(grpSpeicherort, SWT.BORDER); FormData fd_text = new FormData(); fd_text.top = new FormAttachment(lblDefaultOutputFolder, 5); fd_text.left = new FormAttachment(0, 5); this.txtOutputFolder.setLayoutData(fd_text); + FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont().getFontData(); + fD_txtOutputFolder[0].setHeight(TEXT_SIZE_NORMAL); + this.txtOutputFolder.setFont(new Font(Display.getCurrent(), fD_txtOutputFolder[0])); + this.txtOutputFolder.addFocusListener(new FocusListener() { @Override @@ -201,6 +236,10 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { Button btnBrowse = new Button(grpSpeicherort, SWT.NONE); fd_text.right = new FormAttachment(btnBrowse, -5); + FontData[] fD_btnBrowse = btnBrowse.getFont().getFontData(); + fD_btnBrowse[0].setHeight(TEXT_SIZE_BUTTON); + btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); + FormData fd_btnBrowse = new FormData(); fd_btnBrowse.top = new FormAttachment(lblDefaultOutputFolder, 5); fd_btnBrowse.right = new FormAttachment(100, -5); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index dc8640de..c59d50f9 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -19,6 +19,8 @@ package at.asit.pdfover.gui.composites; 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.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.layout.FormAttachment; @@ -26,6 +28,7 @@ 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.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +37,7 @@ import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.BKUs; /** - * + * Composite for BKU selection */ public class BKUSelectionComposite extends StateComposite { @@ -125,6 +128,10 @@ public class BKUSelectionComposite extends StateComposite { btn_mobile.setImage(mobile); + FontData[] fD_btn_mobile = btn_mobile.getFont().getFontData(); + fD_btn_mobile[0].setHeight(TEXT_SIZE_BUTTON); + btn_mobile.setFont(new Font(Display.getCurrent(), fD_btn_mobile[0])); + Button btn_card = new Button(this, SWT.NATIVE | SWT.RESIZE); btn_card.setText(Messages.getString("bku_selection.card")); //$NON-NLS-1$ //Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT); @@ -136,6 +143,10 @@ public class BKUSelectionComposite extends StateComposite { btn_card.setLayoutData(fd_btn_card); btn_card.addSelectionListener(new LocalSelectionListener()); + FontData[] fD_btn_card = btn_card.getFont().getFontData(); + fD_btn_card[0].setHeight(TEXT_SIZE_BUTTON); + btn_card.setFont(new Font(Display.getCurrent(), fD_btn_card[0])); + Image karte = new Image(getDisplay(), new ImageData(this.getClass().getResourceAsStream("/img/karte.gif"))); //$NON-NLS-1$ btn_card.setImage(karte); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BaseConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BaseConfigurationComposite.java index 3c79e124..d97f3a5f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BaseConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BaseConfigurationComposite.java @@ -22,7 +22,7 @@ import at.asit.pdfover.gui.workflow.ConfigurationContainer; import at.asit.pdfover.gui.workflow.states.State; /** - * + * Base class for configuration composites */ public abstract class BaseConfigurationComposite extends StateComposite { diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index abd2edb0..25cedaf0 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -20,6 +20,7 @@ import java.io.IOException; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,15 +42,17 @@ import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormAttachment; /** - * + * Composite for hosting configuration composites */ public class ConfigurationComposite extends StateComposite { - + /** * Configuration Mode selection listener */ @@ -250,6 +253,10 @@ public class ConfigurationComposite extends StateComposite { }); btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$ + FontData[] fD_btnSpeichern = btnSpeichern.getFont().getFontData(); + fD_btnSpeichern[0].setHeight(TEXT_SIZE_BUTTON); + btnSpeichern.setFont(new Font(Display.getCurrent(), fD_btnSpeichern[0])); + Button btnAbbrechen = new Button(this, SWT.NONE); FormData fd_btnAbrechen = new FormData(); fd_btnAbrechen.left = new FormAttachment(btnSpeichern, 10); @@ -264,6 +271,10 @@ public class ConfigurationComposite extends StateComposite { } }); + FontData[] fD_btnAbbrechen = btnAbbrechen.getFont().getFontData(); + fD_btnAbbrechen[0].setHeight(TEXT_SIZE_BUTTON); + btnAbbrechen.setFont(new Font(Display.getCurrent(), fD_btnAbbrechen[0])); + this.btnAdvanced = new Button(this, SWT.NONE); FormData fd_btnAdvanced = new FormData(); fd_btnAdvanced.right = new FormAttachment(100, -5); @@ -272,7 +283,10 @@ public class ConfigurationComposite extends StateComposite { this.btnAdvanced.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ this.btnAdvanced .addSelectionListener(new ConfigurationModeSelectionListener()); - + + FontData[] fD_btnAdvanced = this.btnAdvanced.getFont().getFontData(); + fD_btnAdvanced[0].setHeight(TEXT_SIZE_BUTTON); + this.btnAdvanced.setFont(new Font(Display.getCurrent(), fD_btnAdvanced[0])); } boolean storeConfiguration() { 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 16a5dd84..dffa38e7 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 @@ -49,13 +49,12 @@ import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.workflow.states.State; /** - * - * + * Composite for input document selection */ public class DataSourceSelectComposite extends StateComposite { /** - * + * Selection adapter for file browsing */ private final class FileBrowseDialogListener extends SelectionAdapter { /** @@ -227,7 +226,7 @@ public class DataSourceSelectComposite extends StateComposite { 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(20); + fD[0].setHeight(TEXT_SIZE_BIG); lbl_drag.setFont(new Font(Display.getCurrent(), fD[0])); lbl_drag.setText(Messages.getString("dataSourceSelection.DropLabel")); //$NON-NLS-1$ lbl_drag.setAlignment(SWT.CENTER); @@ -240,7 +239,7 @@ public class DataSourceSelectComposite extends StateComposite { // 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); + fD2[0].setHeight(TEXT_SIZE_NORMAL); lbl_drag2.setFont(new Font(Display.getCurrent(), fD2[0])); lbl_drag2.setText(Messages.getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$ lbl_drag2.setAlignment(SWT.CENTER); @@ -249,7 +248,7 @@ public class DataSourceSelectComposite extends StateComposite { btn_open.setText(Messages.getString("dataSourceSelection.browse")); //$NON-NLS-1$ FontData[] fD_open = btn_open.getFont().getFontData(); - fD_open[0].setHeight(14); + fD_open[0].setHeight(TEXT_SIZE_BUTTON); btn_open.setFont(new Font(Display.getCurrent(), fD_open[0])); /* diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index befde87a..1c7e371a 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -36,7 +36,7 @@ import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.gui.workflow.states.mobilebku.ATrustHelper; /** - * + * Composite for entering the phone number for the mobile BKU */ public class MobileBKUEnterNumberComposite extends StateComposite { /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index 9f232ca0..92a3515b 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -35,9 +35,10 @@ import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.workflow.states.State; /** - * + * Composite for entering the TAN for the mobile BKU */ public class MobileBKUEnterTANComposite extends StateComposite { + /** * */ 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 1d47da9e..566ee560 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,6 +18,7 @@ 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; @@ -40,7 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Messages; -import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.DocumentSource; @@ -57,7 +57,24 @@ public class OutputComposite extends StateComposite { private File inputFile; File outputFile = null; - + + String outputDir = null; + + /** + * @return the outputDir + */ + public String getOutputDir() { + return this.outputDir; + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(String outputDir) { + this.outputDir = outputDir; + } + /** * Sets the input file * @@ -91,39 +108,73 @@ public class OutputComposite extends StateComposite { String proposed = OutputComposite.this.getInputFile().getAbsolutePath(); - String extension = FilenameUtils.getExtension(proposed); - - proposed = FilenameUtils.removeExtension(proposed); + String path = this.getOutputDir(); - proposed = proposed + "_signed." + extension; //$NON-NLS-1$ - - save.setFileName(proposed); + if (path == null || path.equals("")) { //$NON-NLS-1$ + path = FilenameUtils.getFullPath(proposed); + } - String target = save.open(); + if(!path.endsWith(File.separator)) { + path += File.separator; + } + + String name = FilenameUtils.getName(proposed); - if (target != null) { - File targetFile = new File(target); + String extension = FilenameUtils.getExtension(proposed); - DocumentSource source = OutputComposite.this.getSignedDocument(); + name = FilenameUtils.removeExtension(name); - FileOutputStream outstream = new FileOutputStream(targetFile); - outstream.write(source.getByteArray(), 0, - source.getByteArray().length); - outstream.close(); + proposed = path + name + "_signed." + extension; //$NON-NLS-1$ - OutputComposite.this.savedFile = targetFile; + if (this.getOutputDir() != null && !this.getOutputDir().equals("")) //$NON-NLS-1$ + { + // Output directory is set save there without asking user... - 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); + saveResultAsFile(proposed); } else { - // Show save message ... - this.lnk_saved_file.setText(Messages.getString("output.link_save_message")); //$NON-NLS-1$ - this.btn_save.setVisible(true); + + save.setFileName(proposed); + + String target = save.open(); + + if (target != null) { + saveResultAsFile(target); + } else { + // Show save message ... + this.lnk_saved_file.setText(Messages + .getString("output.link_save_message")); //$NON-NLS-1$ + this.btn_save.setVisible(true); + } } } + /** + * @param target + * @throws FileNotFoundException + * @throws IOException + */ + private void saveResultAsFile(String target) throws FileNotFoundException, + IOException { + 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; + + this.outputFile = targetFile; + // Show open message ... + this.lnk_saved_file.setText(Messages + .getString("output.link_open_message")); //$NON-NLS-1$ + this.layout(true); + this.btn_save.setVisible(false); + } + /** * SelectionListener for save button */ @@ -162,7 +213,12 @@ public class OutputComposite extends StateComposite { if (OutputComposite.this.outputFile.exists()) { // Desktop supported check allready done in constructor - Desktop.getDesktop().open(OutputComposite.this.outputFile); + if (Desktop.isDesktopSupported()) { + Desktop.getDesktop().open( + OutputComposite.this.outputFile); + } else { + log.error("SWT Desktop is not supported on this platform!"); //$NON-NLS-1$ + } return; } } @@ -198,60 +254,45 @@ public class OutputComposite extends StateComposite { 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$ - + lbl_success_message.setText(Messages + .getString("output.success_message")); //$NON-NLS-1$ + FontData[] fD1 = lbl_success_message.getFont().getFontData(); - fD1[0].setHeight(12); + fD1[0].setHeight(TEXT_SIZE_BIG); 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$ + + 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); + 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()); - + + FontData[] fD2 = this.lnk_saved_file.getFont().getFontData(); + fD2[0].setHeight(TEXT_SIZE_NORMAL); + this.lnk_saved_file.setFont(new Font(Display.getCurrent(), fD2[0])); + this.btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE); this.btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - + + FontData[] fD_btn_save = this.btn_save.getFont().getFontData(); + fD_btn_save[0].setHeight(TEXT_SIZE_BUTTON); + this.btn_save.setFont(new Font(Display.getCurrent(), fD_btn_save[0])); + 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); + 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); - FormData fd_btn_open = new FormData(); - // 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); - btn_open.setLayoutData(fd_btn_open); - btn_open.addSelectionListener(new OpenSelectionListener()); - - if (!Desktop.isDesktopSupported()) { - btn_open.setEnabled(false); - } - Button btn_save = new Button(this, SWT.NATIVE | SWT.RESIZE); - btn_save.setText(Messages.getString("common.Save")); //$NON-NLS-1$ - // 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.top = new FormAttachment(40, 0); - // fd_btn_save.bottom = new FormAttachment(55, 0); - btn_save.setLayoutData(fd_btn_save); - btn_save.addSelectionListener(new SaveSelectionListener()); - */ - //this.pack(); } String tempDirectory; @@ -301,6 +342,7 @@ public class OutputComposite extends StateComposite { @Override public void doLayout() { // Nothing to do + this.layout(true); try { if (!this.save_showed) { OutputComposite.this.saveFile(); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index f70ff85e..c8e7f84a 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -32,6 +32,8 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.TraverseEvent; import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.Point; @@ -42,6 +44,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; 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.Group; @@ -352,12 +355,20 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { grpHandySignatur.setText(Messages.getString("simple_config.MobileBKU_Title")); //$NON-NLS-1$ grpHandySignatur.setLayout(new GridLayout(2, false)); + FontData[] fD_grpHandySignatur = grpHandySignatur.getFont().getFontData(); + fD_grpHandySignatur[0].setHeight(TEXT_SIZE_NORMAL); + grpHandySignatur.setFont(new Font(Display.getCurrent(), fD_grpHandySignatur[0])); + Label lblMobileNumber = new Label(grpHandySignatur, SWT.NONE | SWT.RESIZE); lblMobileNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); lblMobileNumber.setText(Messages.getString("simple_config.PhoneNumber")); //$NON-NLS-1$ + FontData[] fD_lblMobileNumber = lblMobileNumber.getFont().getFontData(); + fD_lblMobileNumber[0].setHeight(TEXT_SIZE_NORMAL); + lblMobileNumber.setFont(new Font(Display.getCurrent(), fD_lblMobileNumber[0])); + Composite composite_2 = new Composite(grpHandySignatur, SWT.NONE); composite_2.setLayout(new FormLayout()); composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, @@ -382,6 +393,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.txtMobileNumberErrorMarker .setLayoutData(this.fd_txtMobileNumberErrorMarker); + FontData[] fD_txtMobileNumber = this.txtMobileNumber.getFont().getFontData(); + fD_txtMobileNumber[0].setHeight(TEXT_SIZE_NORMAL); + this.txtMobileNumber.setFont(new Font(Display.getCurrent(), fD_txtMobileNumber[0])); + this.txtMobileNumber.addTraverseListener(new TraverseListener() { @Override @@ -415,6 +430,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_grpBildmarke.top = new FormAttachment(20, 5); grpBildmarke.setLayoutData(fd_grpBildmarke); grpBildmarke.setLayout(new GridLayout(5, false)); + + FontData[] fD_grpBildmarke = grpBildmarke.getFont().getFontData(); + fD_grpBildmarke[0].setHeight(TEXT_SIZE_NORMAL); + grpBildmarke.setFont(new Font(Display.getCurrent(), fD_grpBildmarke[0])); + grpBildmarke.setText(Messages.getString("simple_config.Emblem_Title")); //$NON-NLS-1$ new Label(grpBildmarke, SWT.NONE); new Label(grpBildmarke, SWT.NONE); @@ -433,6 +453,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } }); + FontData[] fD_lblEmblem = this.lblEmblem.getFont().getFontData(); + fD_lblEmblem[0].setHeight(TEXT_SIZE_NORMAL); + this.lblEmblem.setFont(new Font(Display.getCurrent(), fD_lblEmblem[0])); + DropTarget dnd_target = new DropTarget(this.lblEmblem, DND.DROP_DEFAULT | DND.DROP_COPY); final FileTransfer fileTransfer = FileTransfer.getInstance(); @@ -525,22 +549,36 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { }); new Label(grpBildmarke, SWT.NONE); + + + FontData[] fD_btnUseImage = this.btnUseImage.getFont().getFontData(); + fD_btnUseImage[0].setHeight(TEXT_SIZE_BUTTON); + this.btnUseImage.setFont(new Font(Display.getCurrent(), fD_btnUseImage[0])); + Button btnBrowseEmblem = new Button(grpBildmarke, SWT.NONE); btnBrowseEmblem.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnBrowseEmblem.addSelectionListener(new ImageFileBrowser()); btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$ + FontData[] fD_btnBrowseEmblem = btnBrowseEmblem.getFont().getFontData(); + fD_btnBrowseEmblem[0].setHeight(TEXT_SIZE_BUTTON); + btnBrowseEmblem.setFont(new Font(Display.getCurrent(), fD_btnBrowseEmblem[0])); + Group grpProxy = new Group(this, SWT.NONE); FormData fd_grpProxy = new FormData(); fd_grpProxy.right = new FormAttachment(100, -5); fd_grpProxy.top = new FormAttachment(65, 5); fd_grpProxy.left = new FormAttachment(0, 5); - fd_grpProxy.bottom = new FormAttachment(90, -5); + fd_grpProxy.bottom = new FormAttachment(100, -5); grpProxy.setLayoutData(fd_grpProxy); grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ grpProxy.setLayout(new GridLayout(2, false)); + FontData[] fD_grpProxy = grpProxy.getFont().getFontData(); + fD_grpProxy[0].setHeight(TEXT_SIZE_NORMAL); + grpProxy.setFont(new Font(Display.getCurrent(), fD_grpProxy[0])); + Label lblNewLabel = new Label(grpProxy, SWT.NONE); GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); @@ -549,6 +587,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { lblNewLabel.setBounds(0, 0, 57, 15); lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ + FontData[] fD_lblNewLabel = lblNewLabel.getFont().getFontData(); + fD_lblNewLabel[0].setHeight(TEXT_SIZE_NORMAL); + lblNewLabel.setFont(new Font(Display.getCurrent(), fD_lblNewLabel[0])); + Composite composite = new Composite(grpProxy, SWT.NONE); composite.setLayout(new FormLayout()); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, @@ -560,6 +602,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_txtProxyHost.top = new FormAttachment(0); fd_txtProxyHost.left = new FormAttachment(0, 5); + FontData[] fD_txtProxyHost = this.txtProxyHost.getFont().getFontData(); + fD_txtProxyHost[0].setHeight(TEXT_SIZE_NORMAL); + this.txtProxyHost.setFont(new Font(Display.getCurrent(), fD_txtProxyHost[0])); + this.proxyHostErrorMarker = new ErrorMarker(composite, SWT.NONE, null, "", this.txtProxyHost); //$NON-NLS-1$ @@ -601,6 +647,10 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { lblNewLabel_1.setBounds(0, 0, 57, 15); lblNewLabel_1.setText(Messages.getString("simple_config.ProxyPort")); //$NON-NLS-1$ + FontData[] fD_lblNewLabel_1 = lblNewLabel_1.getFont().getFontData(); + fD_lblNewLabel_1[0].setHeight(TEXT_SIZE_NORMAL); + lblNewLabel_1.setFont(new Font(Display.getCurrent(), fD_lblNewLabel_1[0])); + Composite composite_1 = new Composite(grpProxy, SWT.NONE); composite_1.setLayout(new FormLayout()); composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, @@ -613,6 +663,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.fd_txtProxyPort.right = new FormAttachment(100, -42); this.fd_txtProxyPort.bottom = new FormAttachment(100); this.txtProxyPort.setLayoutData(this.fd_txtProxyPort); + + FontData[] fD_txtProxyPort = this.txtProxyPort.getFont().getFontData(); + fD_txtProxyPort[0].setHeight(TEXT_SIZE_NORMAL); + this.txtProxyPort.setFont(new Font(Display.getCurrent(), fD_txtProxyPort[0])); + this.txtProxyPort.addTraverseListener(new TraverseListener() { @Override diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index f3d9e362..ce35755f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -25,6 +25,26 @@ import at.asit.pdfover.gui.workflow.states.State; */ public abstract class StateComposite extends Composite { + /** + * Normal Text size + */ + public static final int TEXT_SIZE_NORMAL = 12; + + /** + * + */ + public static final int TEXT_SIZE_BIG = 14; + + /** + * + */ + public static final int TEXT_SIZE_SMALL = 10; + + /** + * + */ + public static final int TEXT_SIZE_BUTTON = 12; + /** * Current State */ 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 e0e33427..4992ef1a 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 @@ -32,12 +32,23 @@ import org.eclipse.swt.widgets.Listener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.composites.StateComposite; + /** * Main Bar Button implementation */ public abstract class MainBarButton extends Canvas { + /** + * If borders are drawn with a gradient effect this sets the size + */ public static final int GradientFactor = 4; + + /** + * Number of pixel of the altitude of the triangle representing the arrow within the button shapes + * + * This should be a multiple of 2! + */ public static final int SplitFactor = 10; /** @@ -73,7 +84,7 @@ public abstract class MainBarButton extends Canvas { this.textColor = this.getForeground(); this.borderColor = new Color(getDisplay(), 0x7E, 0x9F, 0xA5); this.inactiveText = new Color(getDisplay(), 0x6E, 0x6C, 0x6E); - this.textsize = 12; + this.textsize = StateComposite.TEXT_SIZE_BUTTON; } @@ -98,7 +109,7 @@ public abstract class MainBarButton extends Canvas { /** * the text size */ - protected int textsize = 12; + protected int textsize = StateComposite.TEXT_SIZE_BUTTON; /** * @return the textsize @@ -236,8 +247,8 @@ public abstract class MainBarButton extends Canvas { int width = size.x; - e.gc.setForeground(activeBackground); - e.gc.setBackground(inactiveBackground); + e.gc.setForeground(this.activeBackground); + e.gc.setBackground(this.inactiveBackground); e.gc.fillGradientRectangle(0, height, width, -1 * height, true); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index b5e14286..e6ba02d8 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -64,6 +64,7 @@ public class OutputState extends State { tmpDir.mkdir(); } + this.outputComposite.setOutputDir(this.stateMachine.getConfigProvider().getDefaultOutputFolder()); this.outputComposite.setTempDirectory(tmpDir.getAbsolutePath()); this.outputComposite.setInputFile(this.stateMachine.getStatus().getDocument()); } -- cgit v1.2.3 From c6b237e388377bdb47ae85b1113ec4ae0b7bb0af Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 9 Oct 2012 10:10:21 +0200 Subject: Missing Messages changes --- .../src/main/resources/at/asit/pdfover/gui/messages.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2c92b321..7f7e8590 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 @@ -30,7 +30,7 @@ advanced_config.OutputFolder.Dialog_Title=Select Output folder advanced_config.OutputFolder.Dialog=Select a folder simple_config.Emblem_Title=Emblem -simple_config.EmblemEmpty=No Image. Drag and Drop a Image. Or use the browse button to select an emblem. +simple_config.EmblemEmpty=No image.\nDrag and Drop an image.\nOr use the browse button to select an emblem. simple_config.UseEmblem=Use emblem simple_config.MobileBKU_Title=Mobile signature simple_config.PhoneNumber=Mobile number: -- cgit v1.2.3 From 8a08fb663f3034e8368c407a6780336080ea77dd Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 9 Oct 2012 15:50:00 +0200 Subject: Not scaling config image --- .../src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 4992ef1a..576c1216 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 @@ -346,8 +346,7 @@ public abstract class MainBarButton extends Canvas { e.gc.setForeground(current); } else { int imgx = (width - height) / 2; - Image tmp = new Image(getDisplay(), this.image.getImageData() - .scaledTo(height, height)); + Image tmp = new Image(getDisplay(), this.image.getImageData()); e.gc.drawImage(tmp, imgx, 0); } -- cgit v1.2.3 From 0bf8251acd3806d311dc815d750f19c725238f9b Mon Sep 17 00:00:00 2001 From: vkrnjic Date: Tue, 9 Oct 2012 16:16:22 +0200 Subject: pdf-over-icon --- .../src/main/resources/img/pdf-over-icon-1.png | Bin 0 -> 10335 bytes .../src/main/resources/img/pdf-over-icon.png | Bin 0 -> 13796 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon-1.png create mode 100644 trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon.png diff --git a/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon-1.png b/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon-1.png new file mode 100644 index 00000000..a040b547 Binary files /dev/null and b/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon-1.png differ diff --git a/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon.png b/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon.png new file mode 100644 index 00000000..ceffae90 Binary files /dev/null and b/trunk/pdf-over-gui/src/main/resources/img/pdf-over-icon.png differ -- cgit v1.2.3 From 8fcc2eeadbefa7e84554cf62a325a26db9687ac6 Mon Sep 17 00:00:00 2001 From: vkrnjic Date: Tue, 9 Oct 2012 16:17:34 +0200 Subject: config-button --- trunk/pdf-over-gui/src/main/resources/img/config.png | Bin 2722 -> 1103 bytes 1 file changed, 0 insertions(+), 0 deletions(-) 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 4da048a6..e679af23 100644 Binary files a/trunk/pdf-over-gui/src/main/resources/img/config.png and b/trunk/pdf-over-gui/src/main/resources/img/config.png differ -- cgit v1.2.3 From 00a903a6afda07526e6c123cb8b758b609e6ad5b Mon Sep 17 00:00:00 2001 From: vkrnjic Date: Wed, 17 Oct 2012 14:07:52 +0200 Subject: new colors based on buergerkarte.at --- .../at/asit/pdfover/gui/controls/MainBarButton.java | 20 ++++++++++++-------- .../pdf-over-gui/src/main/resources/img/config.png | Bin 1103 -> 1370 bytes trunk/pdf-over-gui/src/main/resources/img/icon.png | Bin 0 -> 2749 bytes 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 trunk/pdf-over-gui/src/main/resources/img/icon.png 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 576c1216..5ee261f1 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 @@ -42,7 +42,7 @@ public abstract class MainBarButton extends Canvas { /** * If borders are drawn with a gradient effect this sets the size */ - public static final int GradientFactor = 4; + public static final int GradientFactor = 5; /** * Number of pixel of the altitude of the triangle representing the arrow within the button shapes @@ -79,16 +79,19 @@ public abstract class MainBarButton extends Canvas { this.setCursor(hand); - this.inactiveBackground = new Color(getDisplay(), 0xC7, 0xDD, 0xE7); - this.activeBackground = new Color(getDisplay(), 0x7A, 0xC2, 0xD3); + + this.inactiveBackground = new Color(getDisplay(),0xD4, 0xE7, 0xF1); + this.activeBackground1 = new Color(getDisplay(),0x6B, 0xA5, 0xD9); + this.activeBackground = new Color(getDisplay(),0xB4, 0xCD, 0xEC); this.textColor = this.getForeground(); - this.borderColor = new Color(getDisplay(), 0x7E, 0x9F, 0xA5); - this.inactiveText = new Color(getDisplay(), 0x6E, 0x6C, 0x6E); + this.borderColor = new Color(getDisplay(), 0xf9, 0xf9, 0xf9); + this.inactiveText = new Color(getDisplay(), 0x40, 0x40, 0x40); this.textsize = StateComposite.TEXT_SIZE_BUTTON; } private Color inactiveBackground = null; + private Color activeBackground1 = null; /** * @param inactiveBackground @@ -153,6 +156,7 @@ public abstract class MainBarButton extends Canvas { public void setBorderColor(Color borderColor) { this.borderColor = borderColor; } + private Color borderColor = null; @@ -243,12 +247,12 @@ public abstract class MainBarButton extends Canvas { */ protected void paintBackground(PaintEvent e) { Point size = this.getSize(); - int height = size.y - 2; + int height = size.y - 4; int width = size.x; - e.gc.setForeground(this.activeBackground); - e.gc.setBackground(this.inactiveBackground); + e.gc.setForeground(this.activeBackground1); + e.gc.setBackground(this.activeBackground); e.gc.fillGradientRectangle(0, height, width, -1 * height, true); 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 e679af23..71783015 100644 Binary files a/trunk/pdf-over-gui/src/main/resources/img/config.png and b/trunk/pdf-over-gui/src/main/resources/img/config.png differ diff --git a/trunk/pdf-over-gui/src/main/resources/img/icon.png b/trunk/pdf-over-gui/src/main/resources/img/icon.png new file mode 100644 index 00000000..24f46564 Binary files /dev/null and b/trunk/pdf-over-gui/src/main/resources/img/icon.png differ -- cgit v1.2.3