diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:08:50 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:08:50 +0000 |
commit | 31c595076c0574bd3f084c68fcd2f9a7ac163477 (patch) | |
tree | 5b3cdd263b9c988ebc384c2162376aeee644900e /pdf-over-gui | |
parent | c9c5ab74fb8e71b840d4c1584f437fa42d3aea3a (diff) | |
download | mocca-31c595076c0574bd3f084c68fcd2f9a7ac163477.tar.gz mocca-31c595076c0574bd3f084c68fcd2f9a7ac163477.tar.bz2 mocca-31c595076c0574bd3f084c68fcd2f9a7ac163477.zip |
Move constants to separate class
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@157 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui')
17 files changed, 172 insertions, 134 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java new file mode 100644 index 00000000..6924b435 --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -0,0 +1,73 @@ +/* + * 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; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; + +/** + * Various constants + */ +public class Constants { + + /** Current display - used for Colors */ + static private Display display = Display.getCurrent(); + + /** Main window height */ + public static final int MAINWINDOW_HEIGHT = 768; + + /** Main window width */ + public static final int MAINWINDOW_WIDTH = 550; + + /** Main bar height */ + public static final int MAINBAR_HEIGHT = 60; + + /** Main bar active background - light start of gradient */ + public static final Color MAINBAR_ACTIVE_BACK_LIGHT = new Color(display, 0x6B, 0xA5, 0xD9); + + /** Main bar active background - dark end of gradient */ + public static final Color MAINBAR_ACTIVE_BACK_DARK = new Color(display, 0xB4, 0xCD, 0xEC); + + /** Main bar inactive background */ + public static final Color MAINBAR_INACTIVE_BACK = new Color(display, 0xD4, 0xE7, 0xF1); + + /** Main bar active text color */ + public static final Color MAINBAR_ACTIVE_TEXTCOLOR = new Color(display, 0x00, 0x00, 0x00); + + /** Main bar inactive text color */ + public static final Color MAINBAR_INACTIVE_TEXTCOLOR = new Color(display, 0x40, 0x40, 0x40); + + /** Drop border color */ + public static final Color DROP_BORDER_COLOR = MAINBAR_ACTIVE_BACK_DARK; + + /** Normal text size */ + public static final int TEXT_SIZE_NORMAL = 12; + + /** Button text size */ + public static final int TEXT_SIZE_BUTTON = 12; + + /** Small text size */ + public static final int TEXT_SIZE_SMALL = 10; + + /** Big text size */ + public static final int TEXT_SIZE_BIG = 14; + + /** How far to displace the signature with the arrow keys */ + public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15; + + /** File suffix for the signed document */ + public final static String SIGNED_SUFFIX = "_signed"; //$NON-NLS-1$ +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index a69d7096..c3f9b529 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -61,10 +61,6 @@ public class MainWindow { **/ static final Logger log = LoggerFactory.getLogger(MainWindow.class); - /** Main bar height */ - private static final int MAINBAR_HEIGHT = 60; - - private Shell shell; private Composite mainbar; private FormData mainBarFormData; @@ -173,7 +169,7 @@ public class MainWindow { */ protected void createContents() { this.shell = new Shell(); - getShell().setSize(550, 768); + getShell().setSize(Constants.MAINWINDOW_WIDTH, Constants.MAINWINDOW_HEIGHT); try { Display display = Display.getCurrent(); Monitor primary = display.getPrimaryMonitor(); @@ -202,7 +198,7 @@ public class MainWindow { this.mainBarFormData.left = new FormAttachment(0, 10); this.mainBarFormData.right = new FormAttachment(100, -10); this.mainBarFormData.top = new FormAttachment(0, 10); - this.mainBarFormData.bottom = new FormAttachment(0, MAINBAR_HEIGHT); + this.mainBarFormData.bottom = new FormAttachment(0, Constants.MAINBAR_HEIGHT); this.mainbar.setLayoutData(this.mainBarFormData); this.btn_config = new MainBarRectangleButton(this.mainbar, SWT.NONE); @@ -303,7 +299,7 @@ public class MainWindow { this.containerFormData = new FormData(); this.containerFormData.bottom = new FormAttachment(100, -10); this.containerFormData.right = new FormAttachment(100, -10); - this.containerFormData.top = new FormAttachment(0, MAINBAR_HEIGHT + 10); + this.containerFormData.top = new FormAttachment(0, Constants.MAINBAR_HEIGHT + 10); this.containerFormData.left = new FormAttachment(0, 10); this.container.setLayoutData(this.containerFormData); this.stack = new StackLayout(); @@ -332,8 +328,8 @@ public class MainWindow { } if (behavior.getMainBarVisible()) { - this.mainBarFormData.bottom = new FormAttachment(0, MAINBAR_HEIGHT); - this.containerFormData.top = new FormAttachment(0, MAINBAR_HEIGHT + 10); + this.mainBarFormData.bottom = new FormAttachment(0, Constants.MAINBAR_HEIGHT); + this.containerFormData.top = new FormAttachment(0, Constants.MAINBAR_HEIGHT + 10); } else { this.mainBarFormData.bottom = new FormAttachment(0, 0); this.containerFormData.top = new FormAttachment(0, 10); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index e264aa48..8e70f502 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.ConfigurationContainer; @@ -89,7 +90,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { grpSignatur.setLayoutData(fd_grpSignatur); FontData[] fD_grpSignaturPosition = grpSignatur.getFont().getFontData(); - fD_grpSignaturPosition[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpSignaturPosition[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpSignatur.setFont(new Font(Display.getCurrent(), fD_grpSignaturPosition[0])); @@ -105,7 +106,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_btnAutomatischePositionierung = this.btnAutomatischePositionierung .getFont().getFontData(); - fD_btnAutomatischePositionierung[0].setHeight(TEXT_SIZE_BUTTON); + fD_btnAutomatischePositionierung[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btnAutomatischePositionierung.setFont(new Font(Display .getCurrent(), fD_btnAutomatischePositionierung[0])); @@ -131,7 +132,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getString("advanced_config.SigPHTransparency")); //$NON-NLS-1$ FontData[] fD_lblTransparenz = lblTransparenz.getFont().getFontData(); - fD_lblTransparenz[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblTransparenz[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblTransparenz.setFont(new Font(Display.getCurrent(), fD_lblTransparenz[0])); @@ -145,7 +146,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_lblTransparenzLinks = lblTransparenzLinks.getFont() .getFontData(); - fD_lblTransparenzLinks[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblTransparenzLinks[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblTransparenzLinks.setFont(new Font(Display.getCurrent(), fD_lblTransparenzLinks[0])); @@ -159,7 +160,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_lblTransparenzRechts = lblTransparenzRechts.getFont() .getFontData(); - fD_lblTransparenzRechts[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblTransparenzRechts[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblTransparenzRechts.setFont(new Font(Display.getCurrent(), fD_lblTransparenzRechts[0])); @@ -195,7 +196,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { grpBkuAuswahl.setLayoutData(fd_grpBkuAuswahl); FontData[] fD_grpBkuAuswahl = grpBkuAuswahl.getFont().getFontData(); - fD_grpBkuAuswahl[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpBkuAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpBkuAuswahl.setFont(new Font(Display.getCurrent(), fD_grpBkuAuswahl[0])); @@ -207,7 +208,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_cmbBKUAuswahl = this.cmbBKUAuswahl.getFont() .getFontData(); - fD_cmbBKUAuswahl[0].setHeight(TEXT_SIZE_NORMAL); + fD_cmbBKUAuswahl[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbBKUAuswahl.setFont(new Font(Display.getCurrent(), fD_cmbBKUAuswahl[0])); @@ -254,7 +255,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { grpSpeicherort.setLayoutData(fd_grpSpeicherort); FontData[] fD_grpSpeicherort = grpSpeicherort.getFont().getFontData(); - fD_grpSpeicherort[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpSpeicherort[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpSpeicherort.setFont(new Font(Display.getCurrent(), fD_grpSpeicherort[0])); @@ -268,7 +269,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_lblDefaultOutputFolder = lblDefaultOutputFolder.getFont() .getFontData(); - fD_lblDefaultOutputFolder[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblDefaultOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblDefaultOutputFolder.setFont(new Font(Display.getCurrent(), fD_lblDefaultOutputFolder[0])); @@ -280,7 +281,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_txtOutputFolder = this.txtOutputFolder.getFont() .getFontData(); - fD_txtOutputFolder[0].setHeight(TEXT_SIZE_NORMAL); + fD_txtOutputFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtOutputFolder.setFont(new Font(Display.getCurrent(), fD_txtOutputFolder[0])); @@ -297,7 +298,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { fd_text.right = new FormAttachment(btnBrowse, -5); FontData[] fD_btnBrowse = btnBrowse.getFont().getFontData(); - fD_btnBrowse[0].setHeight(TEXT_SIZE_BUTTON); + fD_btnBrowse[0].setHeight(Constants.TEXT_SIZE_BUTTON); btnBrowse.setFont(new Font(Display.getCurrent(), fD_btnBrowse[0])); FormData fd_btnBrowse = new FormData(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 522b3bad..64c4d0a0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.BKUs; @@ -133,7 +134,7 @@ 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); + fD_btn_mobile[0].setHeight(Constants.TEXT_SIZE_BUTTON); btn_mobile.setFont(new Font(Display.getCurrent(), fD_btn_mobile[0])); Button btn_card = new Button(this, SWT.NATIVE | SWT.RESIZE); @@ -148,7 +149,7 @@ public class BKUSelectionComposite extends StateComposite { btn_card.addSelectionListener(new LocalSelectionListener()); FontData[] fD_btn_card = btn_card.getFont().getFontData(); - fD_btn_card[0].setHeight(TEXT_SIZE_BUTTON); + fD_btn_card[0].setHeight(Constants.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$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index b7b0aa1d..2b62d651 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.TabItem; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; @@ -218,7 +219,7 @@ public class ConfigurationComposite extends StateComposite { tabFolder.setLayoutData(fd_tabFolder); FontData[] fD_tabFolder = tabFolder.getFont().getFontData(); - fD_tabFolder[0].setHeight(TEXT_SIZE_NORMAL); + fD_tabFolder[0].setHeight(Constants.TEXT_SIZE_NORMAL); tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); TabItem simpleTabItem = new TabItem(tabFolder, SWT.NONE); @@ -268,7 +269,7 @@ 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); + fD_btnSpeichern[0].setHeight(Constants.TEXT_SIZE_BUTTON); btnSpeichern.setFont(new Font(Display.getCurrent(), fD_btnSpeichern[0])); Button btnAbbrechen = new Button(this, SWT.NONE); @@ -286,7 +287,7 @@ public class ConfigurationComposite extends StateComposite { }); FontData[] fD_btnAbbrechen = btnAbbrechen.getFont().getFontData(); - fD_btnAbbrechen[0].setHeight(TEXT_SIZE_BUTTON); + fD_btnAbbrechen[0].setHeight(Constants.TEXT_SIZE_BUTTON); btnAbbrechen.setFont(new Font(Display.getCurrent(), fD_btnAbbrechen[0])); FormData fd_composite = new FormData(); @@ -338,7 +339,7 @@ public class ConfigurationComposite extends StateComposite { log.error("Settings validation failed!", e); //$NON-NLS-1$ ErrorDialog dialog = new ErrorDialog( getShell(), - e.getMessage(), //$NON-NLS-1$ + e.getMessage(), false); dialog.open(); return false; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 530e0f03..43b84b24 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.Label; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.workflow.states.State; @@ -149,12 +150,12 @@ public class DataSourceSelectComposite extends StateComposite { public DataSourceSelectComposite(Composite parent, int style, State state) { super(parent, style, state); - this.activeBackground = new Color(getDisplay(),0xB4, 0xCD, 0xEC); - this.inactiveBackground = new Color(getDisplay(),0xD4, 0xE7, 0xF1); - this.inactiveBorder = new Color(getDisplay(),0xB4, 0xCD, 0xEC); - this.activeBorder = new Color(getDisplay(),0x6B, 0xA5, 0xD9); + this.activeBackground = Constants.MAINBAR_ACTIVE_BACK_DARK; + this.inactiveBackground = Constants.MAINBAR_INACTIVE_BACK; + this.inactiveBorder = Constants.MAINBAR_ACTIVE_BACK_DARK; + this.activeBorder = Constants.MAINBAR_ACTIVE_BACK_LIGHT; this.backgroundColor = this.inactiveBackground; - this.borderColor = this.inactiveBorder; + this.borderColor = Constants.DROP_BORDER_COLOR; this.setLayout(new FormLayout()); @@ -276,7 +277,7 @@ public class DataSourceSelectComposite extends StateComposite { this.fd_lbl_drag.bottom = new FormAttachment(this.lbl_drag2, -10); this.lbl_drag.setLayoutData(this.fd_lbl_drag); FontData[] fD = this.lbl_drag.getFont().getFontData(); - fD[0].setHeight(TEXT_SIZE_BIG); + fD[0].setHeight(Constants.TEXT_SIZE_BIG); this.lbl_drag.setFont(new Font(Display.getCurrent(), fD[0])); this.lbl_drag.setText(Messages.getString("dataSourceSelection.DropLabel")); //$NON-NLS-1$ this.lbl_drag.setAlignment(SWT.CENTER); @@ -289,7 +290,7 @@ public class DataSourceSelectComposite extends StateComposite { // fd_lbl_drag.bottom = new FormAttachment(100, -10); this.lbl_drag2.setLayoutData(this.fd_lbl_drag2); FontData[] fD2 = this.lbl_drag2.getFont().getFontData(); - fD2[0].setHeight(TEXT_SIZE_NORMAL); + fD2[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.lbl_drag2.setFont(new Font(Display.getCurrent(), fD2[0])); this.lbl_drag2.setText(Messages.getString("dataSourceSelection.DropLabel2")); //$NON-NLS-1$ this.lbl_drag2.setAlignment(SWT.CENTER); @@ -298,7 +299,7 @@ public class DataSourceSelectComposite extends StateComposite { this.btn_open.setText(Messages.getString("dataSourceSelection.browse")); //$NON-NLS-1$ FontData[] fD_open = this.btn_open.getFont().getFontData(); - fD_open[0].setHeight(TEXT_SIZE_BUTTON); + fD_open[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btn_open.setFont(new Font(Display.getCurrent(), fD_open[0])); /* diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index fb716104..3cd7372f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -23,7 +23,6 @@ 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.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.Rectangle; @@ -37,6 +36,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.exceptions.InvalidNumberException; import at.asit.pdfover.gui.exceptions.InvalidPasswordException; @@ -182,7 +182,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite { Rectangle clientArea = containerComposite.getClientArea(); //e.gc.setForeground(); - e.gc.setForeground(new Color(getDisplay(),0x6B, 0xA5, 0xD9)); + e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_LIGHT); e.gc.setLineWidth(3); e.gc.setLineStyle(SWT.LINE_SOLID); e.gc.drawRoundRectangle(clientArea.x, diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index 0ad7617a..7f73d0c8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Link; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.DocumentSource; @@ -54,8 +55,6 @@ public class OutputComposite extends StateComposite { **/ static final Logger log = LoggerFactory.getLogger(OutputComposite.class); - private final static String SIGNED_SUFFIX = "_signed"; //$NON-NLS-1$ - private File inputFile; File outputFile = null; @@ -127,7 +126,7 @@ public class OutputComposite extends StateComposite { name = FilenameUtils.removeExtension(name); - proposed = path + name + SIGNED_SUFFIX + "." + extension; //$NON-NLS-1$ + proposed = path + name + Constants.SIGNED_SUFFIX + "." + extension; //$NON-NLS-1$ if (this.getOutputDir() != null && !this.getOutputDir().equals("")) //$NON-NLS-1$ { @@ -261,7 +260,7 @@ public class OutputComposite extends StateComposite { .getString("output.success_message")); //$NON-NLS-1$ FontData[] fD1 = lbl_success_message.getFont().getFontData(); - fD1[0].setHeight(TEXT_SIZE_BIG); + fD1[0].setHeight(Constants.TEXT_SIZE_BIG); lbl_success_message.setFont(new Font(Display.getCurrent(), fD1[0])); this.lnk_saved_file = new Link(this, SWT.NATIVE | SWT.RESIZE); @@ -277,14 +276,14 @@ public class OutputComposite extends StateComposite { this.lnk_saved_file.addSelectionListener(new OpenSelectionListener()); FontData[] fD2 = this.lnk_saved_file.getFont().getFontData(); - fD2[0].setHeight(TEXT_SIZE_NORMAL); + fD2[0].setHeight(Constants.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); + fD_btn_save[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btn_save.setFont(new Font(Display.getCurrent(), fD_btn_save[0])); FormData fd_btn_save = new FormData(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index acb2eed5..e2379926 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.ScrollBar; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.SignaturePosition; @@ -54,9 +55,6 @@ public class PositioningComposite extends StateComposite { static final Logger log = LoggerFactory .getLogger(PositioningComposite.class); - /** How far to displace the signature with the arrow keys */ - private static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15; - private SignaturePanel viewer = null; private PDFFile pdf = null; @@ -171,19 +169,19 @@ public class PositioningComposite extends StateComposite { break; case SWT.ARROW_LEFT: - sigXOffset -= SIGNATURE_KEYBOARD_POSITIONING_OFFSET; + sigXOffset -= Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET; break; case SWT.ARROW_RIGHT: - sigXOffset += SIGNATURE_KEYBOARD_POSITIONING_OFFSET; + sigXOffset += Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET; break; case SWT.ARROW_UP: - sigYOffset -= SIGNATURE_KEYBOARD_POSITIONING_OFFSET; + sigYOffset -= Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET; break; case SWT.ARROW_DOWN: - sigYOffset += SIGNATURE_KEYBOARD_POSITIONING_OFFSET; + sigYOffset += Constants.SIGNATURE_KEYBOARD_POSITIONING_OFFSET; break; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 9511255f..3e0d772b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -34,6 +34,8 @@ import javax.swing.JPanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; + import com.sun.pdfview.PDFFile; import com.sun.pdfview.PDFPage; @@ -90,13 +92,13 @@ public class SignaturePanel extends JPanel { int prevSigScreenHeight = 0; /** - * Create a new PagePanel, with a default size of 800 by 600 pixels. + * Create a new PagePanel. * @param pdf the PDFFile to display */ public SignaturePanel(PDFFile pdf) { super(new BorderLayout()); setDocument(pdf); - setPreferredSize(new Dimension(800, 600)); + setPreferredSize(new Dimension(Constants.MAINWINDOW_WIDTH, Constants.MAINWINDOW_HEIGHT - Constants.MAINBAR_HEIGHT)); setFocusable(true); addMouseListener(this.mouseListener); addMouseMotionListener(this.mouseListener); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index ebb99260..4b118a89 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -34,7 +34,6 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.TraverseEvent; import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; @@ -57,6 +56,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Constants; import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -97,7 +97,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_grpHandySignatur = grpHandySignatur.getFont() .getFontData(); - fD_grpHandySignatur[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpHandySignatur[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpHandySignatur.setFont(new Font(Display.getCurrent(), fD_grpHandySignatur[0])); @@ -109,7 +109,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { .setText(Messages.getString("simple_config.PhoneNumber")); //$NON-NLS-1$ FontData[] fD_lblMobileNumber = lblMobileNumber.getFont().getFontData(); - fD_lblMobileNumber[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblMobileNumber.setFont(new Font(Display.getCurrent(), fD_lblMobileNumber[0])); @@ -139,7 +139,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { FontData[] fD_txtMobileNumber = this.txtMobileNumber.getFont() .getFontData(); - fD_txtMobileNumber[0].setHeight(TEXT_SIZE_NORMAL); + fD_txtMobileNumber[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtMobileNumber.setFont(new Font(Display.getCurrent(), fD_txtMobileNumber[0])); @@ -174,7 +174,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { grpBildmarke.setText(Messages.getString("simple_config.Emblem_Title")); //$NON-NLS-1$ FontData[] fD_grpBildmarke = grpBildmarke.getFont().getFontData(); - fD_grpBildmarke[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpBildmarke[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpBildmarke .setFont(new Font(Display.getCurrent(), fD_grpBildmarke[0])); @@ -200,7 +200,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { @Override public void paintControl(PaintEvent e) { // e.gc.setForeground(); - e.gc.setForeground(new Color(getDisplay(),0xB4, 0xCD, 0xEC)); + e.gc.setForeground(Constants.DROP_BORDER_COLOR); e.gc.setLineWidth(3); e.gc.setLineStyle(SWT.LINE_DASH); e.gc.drawRoundRectangle(e.x, e.y, e.width - 2, e.height - 2, @@ -254,7 +254,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { }); FontData[] fD_lblEmblem = this.lblEmblem.getFont().getFontData(); - fD_lblEmblem[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblEmblem[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.lblEmblem.setFont(new Font(Display.getCurrent(), fD_lblEmblem[0])); DropTarget dnd_target = new DropTarget(controlComposite, @@ -330,7 +330,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { }); FontData[] fD_btnUseImage = this.btnClearImage.getFont().getFontData(); - fD_btnUseImage[0].setHeight(TEXT_SIZE_BUTTON); + fD_btnUseImage[0].setHeight(Constants.TEXT_SIZE_BUTTON); this.btnClearImage.setFont(new Font(Display.getCurrent(), fD_btnUseImage[0])); @@ -351,7 +351,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { btnBrowseEmblem.setText(Messages.getString("common.browse")); //$NON-NLS-1$ FontData[] fD_btnBrowseEmblem = btnBrowseEmblem.getFont().getFontData(); - fD_btnBrowseEmblem[0].setHeight(TEXT_SIZE_BUTTON); + fD_btnBrowseEmblem[0].setHeight(Constants.TEXT_SIZE_BUTTON); btnBrowseEmblem.setFont(new Font(Display.getCurrent(), fD_btnBrowseEmblem[0])); @@ -365,7 +365,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { grpProxy.setText(Messages.getString("simple_config.Proxy_Title")); //$NON-NLS-1$ FontData[] fD_grpProxy = grpProxy.getFont().getFontData(); - fD_grpProxy[0].setHeight(TEXT_SIZE_NORMAL); + fD_grpProxy[0].setHeight(Constants.TEXT_SIZE_NORMAL); grpProxy.setFont(new Font(Display.getCurrent(), fD_grpProxy[0])); Label lblNewLabel = new Label(grpProxy, SWT.NONE); @@ -377,7 +377,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { lblNewLabel.setText(Messages.getString("simple_config.ProxyHost")); //$NON-NLS-1$ FontData[] fD_lblNewLabel = lblNewLabel.getFont().getFontData(); - fD_lblNewLabel[0].setHeight(TEXT_SIZE_NORMAL); + fD_lblNewLabel[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblNewLabel.setFont(new Font(Display.getCurrent(), fD_lblNewLabel[0])); Composite composite = new Composite(grpProxy, SWT.NONE); @@ -392,7 +392,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fd_txtProxyHost.left = new FormAttachment(0, 5); FontData[] fD_txtProxyHost = this.txtProxyHost.getFont().getFontData(); - fD_txtProxyHost[0].setHeight(TEXT_SIZE_NORMAL); + fD_txtProxyHost[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtProxyHost.setFont(new Font(Display.getCurrent(), fD_txtProxyHost[0])); @@ -434,7 +434,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { 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); + fD_lblNewLabel_1[0].setHeight(Constants.TEXT_SIZE_NORMAL); lblNewLabel_1.setFont(new Font(Display.getCurrent(), fD_lblNewLabel_1[0])); @@ -452,7 +452,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.txtProxyPort.setLayoutData(this.fd_txtProxyPort); FontData[] fD_txtProxyPort = this.txtProxyPort.getFont().getFontData(); - fD_txtProxyPort[0].setHeight(TEXT_SIZE_NORMAL); + fD_txtProxyPort[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.txtProxyPort.setFont(new Font(Display.getCurrent(), fD_txtProxyPort[0])); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index ce35755f..c7d69c92 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -24,32 +24,12 @@ import at.asit.pdfover.gui.workflow.states.State; * Composite interface for workflow state gui implementations */ 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 */ protected State state; - + /** * The base class for state composites * @@ -61,7 +41,7 @@ public abstract class StateComposite extends Composite { super(parent, style); this.state = state; } - + /** * Performs layout for all children in composite * (SWT layout(...) only layouts children no grandchildren!) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java index 5c7af927..531937b4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java @@ -29,10 +29,8 @@ import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import at.asit.pdfover.gui.composites.StateComposite; +import at.asit.pdfover.gui.Constants; /** * Main Bar Button implementation @@ -50,7 +48,31 @@ public abstract class MainBarButton extends Canvas { * This should be a multiple of 2! */ public static final int SplitFactor = 10; - + + /** + * the used text color + */ + protected Color textColor = null; + + /** + * the text size + */ + protected int textsize = Constants.TEXT_SIZE_BUTTON; + + private Color inactiveBackground = null; + private Color activeBackground1 = null; + private Color borderColor = null; + private Color activeBackground = null; + + private Color inactiveText = null; + + private String text = ""; //$NON-NLS-1$ + + private boolean active = true; + + private Image image = null; + + /** * @param parent * @param style @@ -80,21 +102,18 @@ public abstract class MainBarButton extends Canvas { this.setCursor(hand); - 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.inactiveBackground = Constants.MAINBAR_INACTIVE_BACK; + this.activeBackground1 = Constants.MAINBAR_ACTIVE_BACK_LIGHT; + this.activeBackground = Constants.MAINBAR_ACTIVE_BACK_DARK; //this.textColor = this.getForeground(); - this.textColor = new Color(getDisplay(), 0x00, 0x00, 0x00); + this.textColor = Constants.MAINBAR_ACTIVE_TEXTCOLOR; //this.borderColor = new Color(getDisplay(), 0xf9, 0xf9, 0xf9); this.borderColor = this.getBackground(); - this.inactiveText = new Color(getDisplay(), 0x40, 0x40, 0x40); - this.textsize = StateComposite.TEXT_SIZE_BUTTON; + this.inactiveText = Constants.MAINBAR_INACTIVE_TEXTCOLOR; + this.textsize = Constants.TEXT_SIZE_BUTTON; } - private Color inactiveBackground = null; - private Color activeBackground1 = null; - /** * @param inactiveBackground * the inactiveBackground to set @@ -112,11 +131,6 @@ public abstract class MainBarButton extends Canvas { } /** - * the text size - */ - protected int textsize = StateComposite.TEXT_SIZE_BUTTON; - - /** * @return the textsize */ public int getTextsize() { @@ -132,11 +146,6 @@ public abstract class MainBarButton extends Canvas { } /** - * the used text color - */ - protected Color textColor = null; - - /** * @param textColor * the textColor to set */ @@ -160,18 +169,6 @@ public abstract class MainBarButton extends Canvas { } - private Color borderColor = null; - - private Color activeBackground = null; - - private Color inactiveText = null; - - private String text = ""; //$NON-NLS-1$ - - private boolean active = true; - - private Image image = null; - /** * Gets the image * @@ -236,13 +233,6 @@ public abstract class MainBarButton extends Canvas { } /** - * SLF4J Logger instance - **/ - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory - .getLogger(MainBarButton.class); - - /** * Paint 3D style borders * * @param e diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java index 0cdc459c..db20bde3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java @@ -18,7 +18,6 @@ package at.asit.pdfover.gui.workflow; //Imports import java.lang.reflect.Constructor; -import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index e09f2a03..234b4317 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -20,7 +20,6 @@ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.PostMethod; -import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index eceed545..e5117768 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -23,7 +23,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java index a173bb21..e16e4cb3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java @@ -16,7 +16,6 @@ package at.asit.pdfover.gui.workflow.states; //Imports -import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; |