summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
authorTobias Kellner <imcybot@gmail.com>2015-10-07 03:29:35 +0200
committerTobias Kellner <imcybot@gmail.com>2015-10-07 03:29:35 +0200
commitac590679a176f1663f7bbdf7ca65d1ba4ba669ad (patch)
tree1bf640647d1d855d36f9797815ab1e6a14fbe8b1 /pdf-over-gui/src
parente65c41e64dbd6d3ea89a3f0e452fad8dc24eddb1 (diff)
downloadpdf-over-ac590679a176f1663f7bbdf7ca65d1ba4ba669ad.tar.gz
pdf-over-ac590679a176f1663f7bbdf7ca65d1ba4ba669ad.tar.bz2
pdf-over-ac590679a176f1663f7bbdf7ca65d1ba4ba669ad.zip
Add about dialog to config
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java127
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties2
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties2
3 files changed, 117 insertions, 14 deletions
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 407b493b..ca61d098 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
@@ -16,19 +16,35 @@
package at.asit.pdfover.gui.composites;
// Imports
+import java.awt.Desktop;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.custom.StackLayout;
+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.program.Program;
+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.Link;
import org.eclipse.swt.widgets.TabFolder;
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.controls.ErrorDialog;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
+import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.exceptions.InvalidEmblemFile;
import at.asit.pdfover.gui.exceptions.InvalidNumberException;
import at.asit.pdfover.gui.exceptions.InvalidPortException;
@@ -41,18 +57,6 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationContainerImpl;
import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider;
import at.asit.pdfover.gui.workflow.states.State;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.custom.StackLayout;
-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.FormLayout;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormAttachment;
-
/**
* Composite for hosting configuration composites
*/
@@ -127,6 +131,20 @@ public class ConfigurationComposite extends StateComposite {
advancedCompositeScr.setMinSize(this.advancedConfigComposite
.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ this.aboutTabItem = new TabItem(tabFolder, SWT.NONE);
+ this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$
+
+ ScrolledComposite aboutCompositeScr = new ScrolledComposite(
+ tabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
+ this.aboutTabItem.setControl(aboutCompositeScr);
+ AboutComposite aboutConfigComposite = new AboutComposite(
+ aboutCompositeScr, SWT.NONE);
+ aboutCompositeScr.setContent(aboutConfigComposite);
+ aboutCompositeScr.setExpandHorizontal(true);
+ aboutCompositeScr.setExpandVertical(true);
+ aboutCompositeScr.setMinSize(aboutConfigComposite
+ .computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
tabFolder.setSelection(this.simpleTabItem);
this.btnSpeichern = new Button(this, SWT.NONE);
@@ -204,7 +222,7 @@ public class ConfigurationComposite extends StateComposite {
/**
* SLF4J Logger instance
**/
- private static final Logger log = LoggerFactory
+ static final Logger log = LoggerFactory
.getLogger(ConfigurationComposite.class);
/**
@@ -256,10 +274,90 @@ public class ConfigurationComposite extends StateComposite {
private TabItem advancedTabItem;
+ private TabItem aboutTabItem;
+
private Button btnSpeichern;
private Button btnAbbrechen;
+ private class AboutComposite extends StateComposite {
+ private Link lnkAbout;
+ /**
+ * @param parent
+ * @param style
+ */
+ public AboutComposite(Composite parent, int style) {
+ super(parent, style, null);
+
+ setLayout(new FormLayout());
+
+ /*Group grpAbout = new Group(this, SWT.NONE | SWT.RESIZE);
+ FormData fd_grpAbout = new FormData();
+ fd_grpAbout.right = new FormAttachment(100, -5);
+ fd_grpAbout.left = new FormAttachment(0, 5);
+ fd_grpAbout.top = new FormAttachment(0, 5);
+ grpAbout.setLayoutData(fd_grpAbout);
+ grpAbout.setLayout(new FillLayout());
+
+ FontData[] fD_grpAbout = grpAbout.getFont()
+ .getFontData();
+ fD_grpAbout[0].setHeight(Constants.TEXT_SIZE_NORMAL);
+ grpAbout.setFont(new Font(Display.getCurrent(),
+ fD_grpAbout[0]));*/
+
+ this.lnkAbout = new Link(this, SWT.NONE);
+
+ FormData fd_lnkAbout = new FormData();
+ fd_lnkAbout.right = new FormAttachment(100, -5);
+ fd_lnkAbout.left = new FormAttachment(0, 5);
+ fd_lnkAbout.top = new FormAttachment(0, 5);
+ this.lnkAbout.setLayoutData(fd_lnkAbout);
+
+ FontData[] fD_lnkAbout = this.lnkAbout.getFont().getFontData();
+ fD_lnkAbout[0].setHeight(Constants.TEXT_SIZE_NORMAL);
+ this.lnkAbout.setFont(new Font(Display.getCurrent(),
+ fD_lnkAbout[0]));
+
+ this.lnkAbout.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ URI url = new URI("http://demo.a-sit.at/lizenzbedingungen/"); //$NON-NLS-1$
+ log.debug("Trying to open " + url.toString()); //$NON-NLS-1$
+ if (Desktop.isDesktopSupported()) {
+ Desktop.getDesktop().browse(url);
+ } else {
+ log.info("SWT Desktop is not supported on this platform"); //$NON-NLS-1$
+ Program.launch(url.toString());
+ }
+ } catch (IOException ex) {
+ log.error("AboutComposite: ", ex); //$NON-NLS-1$
+ } catch (URISyntaxException ex) {
+ log.error("AboutComposite: ", ex); //$NON-NLS-1$
+ }
+ }
+ });
+ // Load localized strings
+ reloadResources();
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.composites.StateComposite#doLayout()
+ */
+ @Override
+ public void doLayout() {
+ // Nothing to do here
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources()
+ */
+ @Override
+ public void reloadResources() {
+ this.lnkAbout.setText(Messages.getString("config.AboutText")); //$NON-NLS-1$
+ }
+ }
+
/**
* Sets the configuration manipulator
*
@@ -532,6 +630,7 @@ public class ConfigurationComposite extends StateComposite {
public void reloadResources() {
this.simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$
this.advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$
+ this.aboutTabItem.setText(String.format(Messages.getString("config.About"), Constants.APP_NAME)); //$NON-NLS-1$
this.btnSpeichern.setText(Messages.getString("common.Save")); //$NON-NLS-1$
this.btnAbbrechen.setText(Messages.getString("common.Cancel")); //$NON-NLS-1$
}
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
index cd5a104e..9b00bccc 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
@@ -81,6 +81,8 @@ common.browse=&Browse
common.info=Information
common.open=Open
common.warning=Warning
+config.About=A&bout %s
+config.AboutText=This software is freely provided by A-SIT under the conditions of the EUPL.\nTerms and details at <a>http://demo.a-sit.at/lizenzbedingungen/</a>.\n\nNotice that components can have different licenses,\npartly restricting their free use to EUPL-licensed software.
config.Advanced=Ad&vanced
config.Simple=Basi&c
dataSourceSelection.DropLabel=Drag document here
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
index 00d55023..0463a302 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
@@ -81,6 +81,8 @@ common.browse=&Durchsuchen
common.info=Information
common.open=\u00D6ffnen
common.warning=Warnung
+config.About=\u00DC&ber %s
+config.AboutText=Diese Software wird von A-SIT unter den Bedingungen der EUPL frei zur Verfügung gestellt.\nLizenbedingungen unter <a>http://demo.a-sit.at/lizenzbedingungen/</a>.\n\nBeachten Sie, dass Komponenten unter eigenen Lizenzen zur Verfügung gestellt werden,\ndie teilweise nur für EUPL-lizensierte Software zur freien Verwendung vorgesehen sind.
config.Advanced=Er&weitert
config.Simple=&Einfach
dataSourceSelection.DropLabel=Dokument hierher ziehen