diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-24 17:05:49 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-24 17:05:49 +0000 |
commit | fe0792b721755bee25c8cdd62c417f16f09fc1c1 (patch) | |
tree | 1be0df594c45a027b0eb4586ed56c512c5ffac60 /trunk | |
parent | 0da217b5325ddfea9434a79f2f191bbb7f6031d8 (diff) | |
download | pdf-over-fe0792b721755bee25c8cdd62c417f16f09fc1c1.tar.gz pdf-over-fe0792b721755bee25c8cdd62c417f16f09fc1c1.tar.bz2 pdf-over-fe0792b721755bee25c8cdd62c417f16f09fc1c1.zip |
Add all files filter to DataSourceSelectComposite
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12399 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/GUI.java | 100 | ||||
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java | 18 |
2 files changed, 109 insertions, 9 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/GUI.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/GUI.java new file mode 100644 index 00000000..9b9f8a63 --- /dev/null +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/GUI.java @@ -0,0 +1,100 @@ +/* + * 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; + +// Imports +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * + */ +public class GUI { + /** + * Main window + */ + protected Shell shell; + + /** + * Launch the application. + * @param args + */ + public static void main(String[] args) { + try { + GUI window = new GUI(); + window.open(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Open the window. + */ + public void open() { + Display display = Display.getDefault(); + createContents(); + this.shell.open(); + this.shell.layout(); + while (!this.shell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + } + + /** + * Create contents of the window. + */ + protected void createContents() { + this.shell = new Shell(); + this.shell.setSize(640, 480); + this.shell.setText("PDF-Over 4.0"); + + final Composite compOpenFile = new Composite(this.shell, SWT.NONE); + compOpenFile.setBounds(0, 0, 640, 480); + + final Composite compPosition = new Composite(this.shell, SWT.NONE); + compPosition.setBounds(0, 0, 640, 480); + + + Label lblPage1 = new Label(compOpenFile, SWT.NONE); + lblPage1.setBounds(20, 20, 70, 17); + lblPage1.setText("Open file"); + + Button btnNext = new Button(compOpenFile, SWT.NONE); + btnNext.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent arg0) { + compPosition.moveAbove(compOpenFile); + } + }); + btnNext.setBounds(20, 50, 91, 29); + btnNext.setText("Next"); + + Label lblPage2 = new Label(compPosition, SWT.NONE); + lblPage2.setBounds(20, 20, 140, 17); + lblPage2.setText("Position signature"); + + + } +} 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 b68ffa03..9b6539d2 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 @@ -64,16 +64,16 @@ public class DataSourceSelectComposite extends StateComposite { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(DataSourceSelectComposite.this.getShell(), SWT.OPEN); - dialog.setFilterExtensions(new String[] {"*.pdf"}); //$NON-NLS-1$ - dialog.setFilterNames(new String[] {"PDF Dateien"}); + dialog.setFilterExtensions(new String[] {"*.pdf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(new String[] {"PDF documents", "All files"}); String fileName = dialog.open(); - File file = null; - if (fileName != null) { - file = new File(fileName); - if(file.exists()) { - DataSourceSelectComposite.this.setSelected(file); - } - } + File file = null; + if (fileName != null) { + file = new File(fileName); + if (file.exists()) { + DataSourceSelectComposite.this.setSelected(file); + } + } } @Override |