summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/components')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java167
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java296
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java327
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java120
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java32
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java66
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenEnabled.java45
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenPositionEnabled.java45
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllDisabled.java46
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllEnable.java46
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowBehavior.java29
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/OnlyConfigEnabled.java45
12 files changed, 0 insertions, 1264 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java
deleted file mode 100644
index 84b38a07..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.workflow.StateMachine;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs;
-
-/**
- *
- */
-public class BKUSelectionComposite extends Composite implements StateComposite {
-
-
- /**
- * Listener for local bku selection
- */
- private final class LocalSelectionListener implements SelectionListener {
-
- /**
- * Default constructor
- */
- public LocalSelectionListener() {
- // Nothing here
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- log.debug("Setting BKU to LOCAL");
- setSelected(BKUs.LOCAL);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing here
- }
- }
-
- /**
- * Listener for mobile bku selection
- */
- private final class MobileSelectionListener implements SelectionListener {
-
- /**
- * Default constructor
- */
- public MobileSelectionListener() {
- // Nothing here
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- log.debug("Setting BKU to MOBILE");
- setSelected(BKUs.MOBILE);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing here
- }
- }
-
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(BKUSelectionComposite.class);
-
- private BKUSelectionState state;
-
- private BKUs selected = BKUs.NONE;
-
- /**
- * Gets selected BKU type
- * @return BKUS enum
- */
- public BKUs getSelected() {
- return this.selected;
- }
-
- /**
- * Sets selected BKU and updates workflow
- * @param selected
- */
- public void setSelected(final BKUs selected) {
- this.selected = selected;
- this.state.updateStateMachine();
- }
-
- /**
- * Create the composite.
- * @param parent
- * @param style
- * @param state
- */
- public BKUSelectionComposite(Composite parent, int style, BKUSelectionState state) {
- super(parent, style);
-
- this.state = state;
-
- this.setLayout(new FormLayout());
-
-
- Button btn_mobile = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_mobile.setText("MOBILE");
- //Point mobile_size = btn_mobile.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- FormData fd_btn_mobile = new FormData();
- fd_btn_mobile.left = new FormAttachment(40, 0);
- fd_btn_mobile.right = new FormAttachment(50, 0);
- fd_btn_mobile.top = new FormAttachment(45, 0);
- fd_btn_mobile.bottom = new FormAttachment(55, 0);
- btn_mobile.setLayoutData(fd_btn_mobile);
- btn_mobile.addSelectionListener(new MobileSelectionListener());
-
- Button btn_card = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_card.setText("CARD");
- //Point card_size = btn_card.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- FormData fd_btn_card = new FormData();
- fd_btn_card.left = new FormAttachment(50, 0);
- fd_btn_card.right = new FormAttachment(60, 0);
- fd_btn_card.top = new FormAttachment(45, 0);
- fd_btn_card.bottom = new FormAttachment(55, 0);
- btn_card.setLayoutData(fd_btn_card);
- btn_card.addSelectionListener(new LocalSelectionListener());
-
- this.pack();
- }
-
- @Override
- protected void checkSubclass() {
- // Disable the check that prevents subclassing of SWT components
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.StateComposite#doLayout()
- */
- @Override
- public void doLayout() {
- this.layout(true, true);
- }
-
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
deleted file mode 100644
index fe0cb2ee..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import java.io.File;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-
-import at.asit.pdfover.gui.workflow.StateMachineImpl;
-
-/**
- *
- *
- */
-public class DataSourceSelectComposite extends Composite implements
- StateComposite {
-
- /**
- *
- */
- private final class FileBrowseDialog implements SelectionListener {
- /**
- *
- */
- public FileBrowseDialog() {
- // Nothing to do here
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(DataSourceSelectComposite.this.getShell(), SWT.OPEN);
- dialog.setFilterExtensions(new String[] {"*.pdf"});
- dialog.setFilterNames(new String[] {"PDF Dateien"});
- String fileName = dialog.open();
- File file = null;
- if (fileName != null) {
- file = new File(fileName);
- if(file.exists()) {
- DataSourceSelectComposite.this.setSelected(file);
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing to do here
- }
- }
-
- /**
- * SFL4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(DataSourceSelectComposite.class);
-
- private StateMachineImpl workflow;
-
- /**
- * Set this value through the setter method!!
- */
- private File selected = null;
-
- /**
- * Sets the selected file and calls update to the workflow
- * @param selected
- */
- protected void setSelected(File selected) {
- this.selected = selected;
- workflow.update();
- }
-
- /**
- * Gets the selected file
- *
- * @return the selected file
- */
- public File getSelected() {
- return this.selected;
- }
-
- /**
- * Create the composite.
- *
- * @param parent
- * @param style
- * @param flow
- */
- public DataSourceSelectComposite(Composite parent, int style, StateMachineImpl flow) {
- super(parent, style);
-
- this.workflow = flow;
-
- this.setLayout(new FormLayout());
-
- Color back = new Color(Display.getCurrent(), 77, 190, 250);
-
- this.drop_area = new Composite(this, SWT.RESIZE | SWT.BORDER_DASH);
- FormData fd_drop_area = new FormData();
- fd_drop_area.left = new FormAttachment(0, 0);
- fd_drop_area.right = new FormAttachment(100, 0);
- fd_drop_area.top = new FormAttachment(0, 0);
- fd_drop_area.bottom = new FormAttachment(100, 0);
- this.drop_area.setLayoutData(fd_drop_area);
- this.drop_area.setLayout(new FormLayout());
- this.drop_area.setBackground(back);
-
- DropTarget dnd_target = new DropTarget(this.drop_area, DND.DROP_DEFAULT
- | DND.DROP_COPY);
- final FileTransfer fileTransfer = FileTransfer.getInstance();
- Transfer[] types = new Transfer[] { fileTransfer };
- dnd_target.setTransfer(types);
-
- dnd_target.addDropListener(new DropTargetListener() {
-
- @Override
- public void dropAccept(DropTargetEvent event) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void drop(DropTargetEvent event) {
- if (fileTransfer.isSupportedType(event.currentDataType)){
- String[] files = (String[])event.data;
- if(files.length > 0) {
- // Only taking first file ...
- File file = new File(files[0]);
- if(!file.exists())
- {
- log.error("File: " + files[0] + " doesnot exists!");
- return;
- }
- DataSourceSelectComposite.this.setSelected(file);
- }
- }
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void dragOperationChanged(DropTargetEvent event) {
- if (event.detail == DND.DROP_DEFAULT) {
- if ((event.operations & DND.DROP_COPY) != 0) {
- event.detail = DND.DROP_COPY;
- } else {
- event.detail = DND.DROP_NONE;
- }
- }
- }
-
- @Override
- public void dragLeave(DropTargetEvent event) {
- // No need to do anything here...
- }
-
- @Override
- public void dragEnter(DropTargetEvent event) {
- if (event.detail == DND.DROP_DEFAULT) {
- if ((event.operations & DND.DROP_COPY) != 0) {
- event.detail = DND.DROP_COPY;
- } else {
- event.detail = DND.DROP_NONE;
- }
- }
- // Only drop one item!
- if(event.dataTypes.length > 1) {
- event.detail = DND.DROP_NONE;
- return;
- }
- // will accept text but prefer to have files dropped
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (fileTransfer.isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- // files should only be copied
- if (event.detail != DND.DROP_COPY) {
- event.detail = DND.DROP_NONE;
- }
- break;
- }
- }
- }
- });
-
- final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE);
- FormData fd_lbl_drag = new FormData();
- fd_lbl_drag.left = new FormAttachment(5, 5);
- fd_lbl_drag.right = new FormAttachment(100, -5);
- fd_lbl_drag.top = new FormAttachment(5, 5);
- fd_lbl_drag.bottom = new FormAttachment(55, -5);
- lbl_drag.setLayoutData(fd_lbl_drag);
- FontData[] fD = lbl_drag.getFont().getFontData();
- fD[0].setHeight(18);
- lbl_drag.setFont(new Font(Display.getCurrent(), fD[0]));
- lbl_drag.setText("Drag and Drop");
- lbl_drag.setAlignment(SWT.CENTER);
- lbl_drag.setBackground(back);
-
- Button btn_open = new Button(this.drop_area, SWT.NATIVE | SWT.RESIZE);
- btn_open.setText("Choose file ...");
- Point size = btn_open.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- FormData fd_btn_open = new FormData();
- fd_btn_open.left = new FormAttachment(100, size.x * -1 - 10);
- fd_btn_open.right = new FormAttachment(100, -5);
- fd_btn_open.top = new FormAttachment(100, size.y * -1 - 10);
- fd_btn_open.bottom = new FormAttachment(100, -5);
- btn_open.setLayoutData(fd_btn_open);
- btn_open.setBackground(back);
- btn_open.addSelectionListener(new FileBrowseDialog());
- this.drop_area.pack();
-
- /*
- * Button btn = new Button(this, SWT.NATIVE); btn.setBounds(50, 20, 100,
- * 50); btn.setText("Click Me"); btn.addSelectionListener(new
- * SelectionListener() {
- *
- * @Override public void widgetSelected(SelectionEvent arg0) {
- * DataSourceSelectComposite.this.setPress(true);
- * DataSourceSelectComposite.this.workflow.update(); }
- *
- * @Override public void widgetDefaultSelected(SelectionEvent arg0) { //
- * TODO Auto-generated method stub
- *
- * } });
- */
- }
-
- private boolean press = false;
-
- private Composite drop_area;
-
- @Override
- protected void checkSubclass() {
- // Disable the check that prevents subclassing of SWT components
- }
-
- /**
- * @return the press
- */
- public boolean isPress() {
- return this.press;
- }
-
- /**
- * @param press
- * the press to set
- */
- public void setPress(boolean press) {
- this.press = press;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see at.asit.pdfover.gui.components.StateComposite#doLayout()
- */
- @Override
- public void doLayout() {
- this.layout(true, true);
- this.drop_area.layout(true, true);
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
deleted file mode 100644
index 96195780..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.main_behavior.ConfigOpenEnabled;
-import at.asit.pdfover.gui.components.main_behavior.ConfigOpenPositionEnabled;
-import at.asit.pdfover.gui.components.main_behavior.MainWindowAllDisabled;
-import at.asit.pdfover.gui.components.main_behavior.MainWindowBehavior;
-import at.asit.pdfover.gui.components.main_behavior.OnlyConfigEnabled;
-import at.asit.pdfover.gui.workflow.State;
-import at.asit.pdfover.gui.workflow.StateMachine;
-import at.asit.pdfover.gui.workflow.StateMachineImpl;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
-import at.asit.pdfover.gui.workflow.states.DataSourceSelectionState;
-import at.asit.pdfover.gui.workflow.states.LocalBKUState;
-import at.asit.pdfover.gui.workflow.states.MobileBKUState;
-import at.asit.pdfover.gui.workflow.states.OutputState;
-import at.asit.pdfover.gui.workflow.states.PositioningState;
-import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
-import at.asit.pdfover.gui.workflow.states.PrepareSigningState;
-import at.asit.pdfover.gui.workflow.states.SigningState;
-
-/**
- * The Main Window of PDFOver 4.0
- */
-public class MainWindow {
-
- /**
- *
- */
- private final class DataSourceSelectionListener implements
- SelectionListener {
- /**
- *
- */
- public DataSourceSelectionListener() {
- // Nothing to do here
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- MainWindow.this.stateMachine.setState(new DataSourceSelectionState());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing to do here
- }
- }
-
- /**
- * SFL4J Logger instance
- **/
- private static final Logger log = LoggerFactory.getLogger(MainWindow.class);
- private Shell shell;
- private CLabel lbl_status;
- private Composite container;
- private StackLayout stack;
- private StateMachine stateMachine;
- private Button btn_sign;
-
- /**
- * Gets the sign button
- * @return the sign button
- */
- public Button getBtn_sign() {
- return this.btn_sign;
- }
-
- private Button btn_position;
-
- /**
- * Gets the position button
- * @return the position button
- */
- public Button getBtn_position() {
- return this.btn_position;
- }
-
- private Button btn_open;
-
- /**
- * Gets the open button
- * @return the open button
- */
- public Button getBtn_open() {
- return this.btn_open;
- }
-
- private Button btn_config;
-
- /**
- * Gets the config button
- * @return the config button
- */
- public Button getBtn_config() {
- return this.btn_config;
- }
-
- private Map<Class, MainWindowBehavior> behavior = new HashMap<Class, MainWindowBehavior>();
-
- /**
- * Default contsructor
- * @param stateMachine The main workflow
- */
- public MainWindow(StateMachine stateMachine) {
- super();
-
- this.behavior.put(PrepareConfigurationState.class, new MainWindowAllDisabled());
- this.behavior.put(PrepareSigningState.class, new MainWindowAllDisabled());
- this.behavior.put(SigningState.class, new MainWindowAllDisabled());
- this.behavior.put(LocalBKUState.class, new MainWindowAllDisabled());
- this.behavior.put(MobileBKUState.class, new MainWindowAllDisabled());
-
- this.behavior.put(OutputState.class, new MainWindowAllDisabled());
-
- this.behavior.put(DataSourceSelectionState.class, new OnlyConfigEnabled());
-
- this.behavior.put(PositioningState.class, new ConfigOpenEnabled());
-
- this.behavior.put(BKUSelectionState.class, new ConfigOpenPositionEnabled());
-
- this.stateMachine = stateMachine;
- }
-
- /**
- * Set current status (may be removed in production release)
- * @param value
- */
- public void setStatus(String value) {
- if(this.getShell().isDisposed()) {
- return;
- }
- this.lbl_status.setText("[DEBUG]: Current workflow state: " + value);
- }
-
- /**
- * Sets top level composite for stack layout
- * @param ctrl
- */
- public void setTopControl(Control ctrl) {
- log.debug("Top control: " + ctrl.toString());
- this.stack.topControl = ctrl;
- this.doLayout();
- }
-
- /**
- * Layout the Main Window
- */
- public void doLayout() {
- Control ctrl = this.stack.topControl;
- this.container.layout(true, true);
- this.shell.layout(true, true);
- // Note: SWT only layouts children! No grandchildren!
- if(ctrl instanceof StateComposite) {
- ((StateComposite)ctrl).doLayout();
- }
- }
-
- /**
- * Gets the container composite
- * @return
- */
- public Composite getContainer() {
- return this.container;
- }
-
- /**
- * Entrance point for swt designer
- * @param args
- */
- public static void main(String[] args) {
- Display display = Display.getDefault();
-
- MainWindow window = new MainWindow(null);
-
- window.open();
-
- window.getShell().open();
- window.getShell().layout();
- while (!window.getShell().isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- }
-
- /**
- * Open the window.
- * @wbp.parser.entryPoint
- */
- public void open() {
- createContents();
- }
-
- /**
- * Create contents of the window.
- */
- protected void createContents() {
- this.shell = new Shell();
- getShell().setSize(450, 329);
- getShell().setText("PDF OVER 4.0! :)");
-
- getShell().setLayout(new FormLayout());
-
-
-
- Composite composite = new Composite(getShell(), SWT.NONE);
- FormData fd_composite = new FormData();
- fd_composite.left = new FormAttachment(0, 5);
- fd_composite.right = new FormAttachment(100, -5);
- fd_composite.top = new FormAttachment(0, 5);
- fd_composite.bottom = new FormAttachment(0, 40);
- composite.setLayoutData(fd_composite);
- composite.setLayout(new FormLayout());
-
- this.btn_config = new Button(composite, SWT.NONE);
- FormData fd_config = new FormData();
- fd_config.left = new FormAttachment(0, 0);
- fd_config.right = new FormAttachment(25, 0);
- fd_config.top = new FormAttachment(0, 0);
- fd_config.bottom = new FormAttachment(100, 0);
- this.btn_config.setLayoutData(fd_config);
- this.btn_config.setText("Config ...");
-
- this.btn_open = new Button(composite, SWT.NONE);
- FormData fd_open = new FormData();
- fd_open.left = new FormAttachment(25, 0);
- fd_open.right = new FormAttachment(50, 0);
- fd_open.top = new FormAttachment(0, 0);
- fd_open.bottom = new FormAttachment(100, 0);
- this.btn_open.setLayoutData(fd_open);
- this.btn_open.setText("Open ...");
- this.btn_open.addSelectionListener(new DataSourceSelectionListener());
-
- this.btn_position = new Button(composite, SWT.NONE);
- FormData fd_position = new FormData();
- fd_position.left = new FormAttachment(50, 0);
- fd_position.right = new FormAttachment(75, 0);
- fd_position.top = new FormAttachment(0, 0);
- fd_position.bottom = new FormAttachment(100, 0);
- this.btn_position.setLayoutData(fd_position);
- this.btn_position.setText("Positon ...");
-
- this.btn_sign = new Button(composite, SWT.NONE);
- FormData fd_sign = new FormData();
- fd_sign.left = new FormAttachment(75, 0);
- fd_sign.right = new FormAttachment(100, 0);
- fd_sign.top = new FormAttachment(0, 0);
- fd_sign.bottom = new FormAttachment(100, 0);
- this.btn_sign.setLayoutData(fd_sign);
- this.btn_sign.setText("Sign ...");
-
- this.container = new Composite(getShell(), SWT.BORDER | SWT.RESIZE);
- FormData fd_composite_1 = new FormData();
- fd_composite_1.bottom = new FormAttachment(100, -25);
- fd_composite_1.right = new FormAttachment(100, -5);
- fd_composite_1.top = new FormAttachment(0, 45);
- fd_composite_1.left = new FormAttachment(0, 5);
- this.container.setLayoutData(fd_composite_1);
- this.stack = new StackLayout();
- this.container.setLayout(this.stack);
-
- this.lbl_status = new CLabel(getShell(), SWT.NONE);
- FormData fd_lblNewLabel = new FormData();
- fd_lblNewLabel.right = new FormAttachment(100, -5);
- fd_lblNewLabel.bottom = new FormAttachment(100, -5);
- fd_lblNewLabel.top = new FormAttachment(100, -20);
- fd_lblNewLabel.left = new FormAttachment(0, 5);
- this.lbl_status.setLayoutData(fd_lblNewLabel);
- this.lbl_status.setText("New Label");
-
- }
-
- /**
- * Update MainWindow to fit new status
- */
- public void UpdateNewState() {
- State state = this.stateMachine.getState();
-
- log.debug("Updating MainWindow state for : " + state.toString());
-
- if(this.behavior.containsKey(state.getClass())) {
- this.behavior.get(state.getClass()).SetState(this);
- }
- }
-
- /**
- * @return the shell
- */
- public Shell getShell() {
- return this.shell;
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
deleted file mode 100644
index c924ef79..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.workflow.StateMachineImpl;
-import at.asit.pdfover.signator.SignaturePosition;
-
-/**
- *
- *
- */
-public class PositioningComposite extends Composite implements StateComposite {
-
- /**
- * Selection listener when position was fixed
- */
- private final class PositionSelectedListener implements SelectionListener {
-
- /**
- * Default constructor
- */
- public PositionSelectedListener() {
- // Nothing to do
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- // TODO: FIX to get real position
- PositioningComposite.this.setPosition(new SignaturePosition()); // Setting auto position for testing
- PositioningComposite.this.workflow.update();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing to do
- }
- }
-
- /**
- * SFL4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(PositioningComposite.class);
-
- private StateMachineImpl workflow;
-
- private SignaturePosition position = null;
-
- /**
- * Gets the Position
- * @return
- */
- public SignaturePosition getPosition() {
- return this.position;
- }
-
- /**
- * Sets the position
- * @param position
- */
- public void setPosition(SignaturePosition position) {
- this.position = position;
- }
-
- /**
- * Create the composite.
- * @param parent
- * @param style
- */
- public PositioningComposite(Composite parent, int style, StateMachineImpl workflow) {
- super(parent, style);
-
- this.workflow = workflow;
-
- Label test = new Label(this, SWT.NATIVE);
- test.setBounds(10, 20, 100, 30);
- test.setText("POSITIONING ---- TODO!!");
-
- Button btn_position = new Button(this, SWT.NATIVE | SWT.RESIZE);
- btn_position.setBounds(10, 50, 100, 30);
- btn_position.setText("FAKE Position");
- btn_position.addSelectionListener(new PositionSelectedListener());
- }
-
- @Override
- protected void checkSubclass() {
- // Disable the check that prevents subclassing of SWT components
- }
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.StateComposite#doLayout()
- */
- @Override
- public void doLayout() {
- this.layout(true, true);
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java
deleted file mode 100644
index 0bfd7b87..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/StateComposite.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Composite interface for workflow state gui implementations
- */
-public interface StateComposite {
-
- /**
- * Performs layout for all children in composite
- * (SWT layout(...) only layouts children no grandchildren!)
- */
- public void doLayout();
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java
deleted file mode 100644
index 6ce53b22..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.components;
-
-// Imports
-import org.eclipse.swt.widgets.Composite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.eclipse.swt.widgets.ProgressBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormAttachment;
-
-import at.asit.pdfover.gui.workflow.StateMachineImpl;
-
-/**
- *
- */
-public class WaitingComposite extends Composite {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(WaitingComposite.class);
-
- private StateMachineImpl workflow;
-
- /**
- * Create the composite.
- * @param parent
- * @param style
- */
- public WaitingComposite(Composite parent, int style, StateMachineImpl workflow) {
- super(parent, style);
- setLayout(new FormLayout());
-
- this.workflow = workflow;
-
- ProgressBar progressBar = new ProgressBar(this, SWT.HORIZONTAL | SWT.INDETERMINATE);
- FormData fd_progressBar = new FormData();
- fd_progressBar.top = new FormAttachment(50, -15);
- fd_progressBar.bottom = new FormAttachment(50, +15);
- fd_progressBar.left = new FormAttachment(50, -100);
- fd_progressBar.right = new FormAttachment(50, +100);
- progressBar.setLayoutData(fd_progressBar);
- }
-
- @Override
- protected void checkSubclass() {
- // Disable the check that prevents subclassing of SWT components
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenEnabled.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenEnabled.java
deleted file mode 100644
index a9280624..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenEnabled.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.components.main_behavior;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public class ConfigOpenEnabled implements MainWindowBehavior {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(ConfigOpenEnabled.class);
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.MainWindowBehavior#SetState(at.asit.pdfover.gui.components.MainWindow)
- */
- @Override
- public void SetState(MainWindow window) {
- log.debug("ENABLING config & open");
- window.getBtn_config().setEnabled(true);
- window.getBtn_open().setEnabled(true);
- window.getBtn_position().setEnabled(false);
- window.getBtn_sign().setEnabled(false);
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenPositionEnabled.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenPositionEnabled.java
deleted file mode 100644
index 7e1af1ef..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/ConfigOpenPositionEnabled.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.components.main_behavior;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public class ConfigOpenPositionEnabled implements MainWindowBehavior {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(ConfigOpenPositionEnabled.class);
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.MainWindowBehavior#SetState(at.asit.pdfover.gui.components.MainWindow)
- */
- @Override
- public void SetState(MainWindow window) {
- log.debug("ENABLING config & open & position");
- window.getBtn_config().setEnabled(true);
- window.getBtn_open().setEnabled(true);
- window.getBtn_position().setEnabled(true);
- window.getBtn_sign().setEnabled(false);
- }
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllDisabled.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllDisabled.java
deleted file mode 100644
index c5b70852..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllDisabled.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.components.main_behavior;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public class MainWindowAllDisabled implements MainWindowBehavior {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(MainWindowAllDisabled.class);
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.MainWindowBehavior#SetState(at.asit.pdfover.gui.components.MainWindow)
- */
- @Override
- public void SetState(MainWindow window) {
- log.debug("DISABLING ALL");
- window.getBtn_config().setEnabled(false);
- window.getBtn_open().setEnabled(false);
- window.getBtn_position().setEnabled(false);
- window.getBtn_sign().setEnabled(false);
- }
-
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllEnable.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllEnable.java
deleted file mode 100644
index 91d5237a..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowAllEnable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package at.asit.pdfover.gui.components.main_behavior;
-/*
- * 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.
- */
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public class MainWindowAllEnable implements MainWindowBehavior {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(MainWindowAllEnable.class);
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.MainWindowBehavior#SetState(at.asit.pdfover.gui.components.MainWindow)
- */
- @Override
- public void SetState(MainWindow window) {
- log.debug("ENABLING ALL");
- window.getBtn_config().setEnabled(true);
- window.getBtn_open().setEnabled(true);
- window.getBtn_position().setEnabled(true);
- window.getBtn_sign().setEnabled(true);
- }
-
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowBehavior.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowBehavior.java
deleted file mode 100644
index b36f6b51..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/MainWindowBehavior.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.components.main_behavior;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public interface MainWindowBehavior {
- /**
- * Changes the state of the main window
- * @param window
- */
- public void SetState(MainWindow window);
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/OnlyConfigEnabled.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/OnlyConfigEnabled.java
deleted file mode 100644
index 2a7e863f..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/main_behavior/OnlyConfigEnabled.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.components.main_behavior;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.gui.components.MainWindow;
-
-/**
- *
- */
-public class OnlyConfigEnabled implements MainWindowBehavior {
- /**
- * SLF4J Logger instance
- **/
- private static final Logger log = LoggerFactory
- .getLogger(OnlyConfigEnabled.class);
-
- /* (non-Javadoc)
- * @see at.asit.pdfover.gui.components.MainWindowBehavior#SetState(at.asit.pdfover.gui.components.MainWindow)
- */
- @Override
- public void SetState(MainWindow window) {
- log.debug("ENABLING ONLY config");
- window.getBtn_config().setEnabled(true);
- window.getBtn_open().setEnabled(false);
- window.getBtn_position().setEnabled(false);
- window.getBtn_sign().setEnabled(false);
- }
-}