diff options
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover')
2 files changed, 60 insertions, 57 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 072a3549..1ce3a781 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -17,7 +17,6 @@ package at.asit.pdfover.gui.composites; // Imports import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.SelectionAdapter; @@ -35,8 +34,6 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Scale; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,7 +56,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { **/ private static final Logger log = LoggerFactory .getLogger(AdvancedConfigurationComposite.class); - SimpleConfigurationComposite simpleComposite; Text txtOutputFolder; Combo cmbBKUAuswahl; String[] bkuStrings; @@ -76,42 +72,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { State state, ConfigurationContainer container) { super(parent, style, state, container); setLayout(new FormLayout()); - - // TODO: Move this tab folder to the ConfigurationComposite - TabFolder tabFolder = new TabFolder(this, SWT.NONE); - FormData fd_tabFolder = new FormData(); - fd_tabFolder.bottom = new FormAttachment(100, -5); - fd_tabFolder.right = new FormAttachment(100, -5); - fd_tabFolder.top = new FormAttachment(0, 5); - fd_tabFolder.left = new FormAttachment(0, 5); - tabFolder.setLayoutData(fd_tabFolder); - - TabItem simpleTabItem = new TabItem(tabFolder, SWT.NULL); - simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ - - FontData[] fD_tabFolder = tabFolder.getFont().getFontData(); - fD_tabFolder[0].setHeight(TEXT_SIZE_NORMAL); - tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); - - this.simpleComposite = new SimpleConfigurationComposite(tabFolder, - SWT.NONE, state, container); - - simpleTabItem.setControl(this.simpleComposite); - tabFolder.setSelection(simpleTabItem); - TabItem advancedTabItem = new TabItem(tabFolder, SWT.NONE); - advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ - - ScrolledComposite advancedCompositeScr = new ScrolledComposite(tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); - advancedTabItem.setControl(advancedCompositeScr); - Composite advancedComposite = new Composite(advancedCompositeScr, SWT.NONE); - advancedCompositeScr.setContent(advancedComposite); - advancedCompositeScr.setExpandHorizontal(true); - advancedCompositeScr.setExpandVertical(true); - - advancedComposite.setLayout(new FormLayout()); - - Group grpSignatur = new Group(advancedComposite, SWT.NONE); + Group grpSignatur = new Group(this, SWT.NONE); grpSignatur.setText(Messages.getString("advanced_config.Signature_Title")); //$NON-NLS-1$ FormLayout layout = new FormLayout(); layout.marginHeight = 10; @@ -168,7 +130,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - Group grpBkuAuswahl = new Group(advancedComposite, SWT.NONE); + Group grpBkuAuswahl = new Group(this, SWT.NONE); grpBkuAuswahl.setText(Messages.getString("advanced_config.BKUSelection_Title")); //$NON-NLS-1$ layout = new FormLayout(); layout.marginHeight = 10; @@ -219,7 +181,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); - Group grpSpeicherort = new Group(advancedComposite, SWT.NONE); + Group grpSpeicherort = new Group(this, SWT.NONE); grpSpeicherort.setText(Messages.getString("advanced_config.OutputFolder_Title")); //$NON-NLS-1$ layout = new FormLayout(); layout.marginHeight = 10; @@ -305,8 +267,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } } }); - - advancedCompositeScr.setMinSize(advancedComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } /* (non-Javadoc) @@ -314,7 +274,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { */ @Override protected void signerChanged() { - this.simpleComposite.setSigner(this.getSigner()); + // Nothing to do here (yet) } void performOutputFolderChanged(String foldername) { @@ -397,8 +357,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { */ @Override public void loadConfiguration() { - this.simpleComposite.loadConfiguration(); - // load advanced settings this.performBKUSelectionChanged(this.configurationContainer.getBKUSelection()); String outputFolder = this.configurationContainer.getOutputFolder(); @@ -414,6 +372,6 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { */ @Override public void validateSettings() throws Exception { - this.simpleComposite.validateSettings(); + // Nothing to do here (yet) } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index b746678d..2086ec40 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -21,6 +21,8 @@ import java.io.IOException; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,6 +41,7 @@ import at.asit.pdfover.signator.SignaturePosition; 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; @@ -70,8 +73,12 @@ public class ConfigurationComposite extends StateComposite { */ public void setSigner(PDFSigner signer) { this.signer = signer; - if(this.configComposite != null) { - this.configComposite.setSigner(getSigner()); + if (this.simpleConfigComposite != null) { + this.simpleConfigComposite.setSigner(getSigner()); + } + if (this.advancedConfigComposite != null) { + // TODO: not needed + this.advancedConfigComposite.setSigner(getSigner()); } } @@ -92,9 +99,14 @@ public class ConfigurationComposite extends StateComposite { ConfigProvider configProvider = null; /** - * current base configuration composite + * simple configuration composite + */ + BaseConfigurationComposite simpleConfigComposite; + + /** + * advanced configuration composite */ - BaseConfigurationComposite configComposite; + BaseConfigurationComposite advancedConfigComposite; /** * configuration container Keeps state for current configuration changes @@ -177,7 +189,8 @@ public class ConfigurationComposite extends StateComposite { log.error("Failed to set proxy port!", e); //$NON-NLS-1$ } - this.configComposite.loadConfiguration(); + this.simpleConfigComposite.loadConfiguration(); + this.advancedConfigComposite.loadConfiguration(); } } @@ -196,10 +209,41 @@ public class ConfigurationComposite extends StateComposite { this.containerComposite = new Composite(this, SWT.FILL | SWT.RESIZE); - this.configComposite = new AdvancedConfigurationComposite( - this.containerComposite, SWT.FILL | style, state, - this.configurationContainer); + TabFolder tabFolder = new TabFolder(this.containerComposite, SWT.NONE); + FormData fd_tabFolder = new FormData(); + fd_tabFolder.bottom = new FormAttachment(100, -5); + fd_tabFolder.right = new FormAttachment(100, -5); + fd_tabFolder.top = new FormAttachment(0, 5); + fd_tabFolder.left = new FormAttachment(0, 5); + tabFolder.setLayoutData(fd_tabFolder); + + TabItem simpleTabItem = new TabItem(tabFolder, SWT.NULL); + simpleTabItem.setText(Messages.getString("config.Simple")); //$NON-NLS-1$ + + FontData[] fD_tabFolder = tabFolder.getFont().getFontData(); + fD_tabFolder[0].setHeight(TEXT_SIZE_NORMAL); + tabFolder.setFont(new Font(Display.getCurrent(), fD_tabFolder[0])); + this.simpleConfigComposite = new SimpleConfigurationComposite(tabFolder, + SWT.NONE, state, this.configurationContainer); + + simpleTabItem.setControl(this.simpleConfigComposite); + tabFolder.setSelection(simpleTabItem); + + TabItem advancedTabItem = new TabItem(tabFolder, SWT.NONE); + advancedTabItem.setText(Messages.getString("config.Advanced")); //$NON-NLS-1$ + + ScrolledComposite advancedCompositeScr = new ScrolledComposite( + tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); + advancedTabItem.setControl(advancedCompositeScr); + this.advancedConfigComposite = new AdvancedConfigurationComposite( + advancedCompositeScr, SWT.NONE, state, this.configurationContainer); + advancedCompositeScr.setContent(this.advancedConfigComposite); + advancedCompositeScr.setExpandHorizontal(true); + advancedCompositeScr.setExpandVertical(true); + advancedCompositeScr.setMinSize( + this.advancedConfigComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + FormData fd_composite = new FormData(); fd_composite.top = new FormAttachment(0, 5); fd_composite.bottom = new FormAttachment(90, -5); @@ -207,7 +251,7 @@ public class ConfigurationComposite extends StateComposite { fd_composite.right = new FormAttachment(100, -5); this.containerComposite.setLayoutData(fd_composite); this.containerComposite.setLayout(this.compositeStack); - this.compositeStack.topControl = this.configComposite; + this.compositeStack.topControl = tabFolder; this.doLayout(); @@ -253,7 +297,8 @@ public class ConfigurationComposite extends StateComposite { boolean storeConfiguration() { try { - this.configComposite.validateSettings(); + this.simpleConfigComposite.validateSettings(); + this.advancedConfigComposite.validateSettings(); // Write current Configuration this.configManipulator.setDefaultBKU(this.configurationContainer |