From 636ef1ea3e246323a2e9ddcb9f38ba8c1a5d6abd Mon Sep 17 00:00:00 2001 From: msrocka Date: Thu, 12 Mar 2020 14:17:20 +0100 Subject: [PATCH] enable / disable content declarations and Q meta data tabs via settings --- src/app/AppSettings.java | 16 ++++++++++++++ src/app/M.java | 2 ++ src/app/editors/epd/EpdEditor.java | 12 +++++++++-- src/app/editors/settings/DataSetSection.java | 22 ++++++++++++++++++++ src/app/messages.properties | 4 +++- src/app/messages_de.properties | 4 +++- 6 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/app/AppSettings.java b/src/app/AppSettings.java index acd95e8..48e4f52 100644 --- a/src/app/AppSettings.java +++ b/src/app/AppSettings.java @@ -32,6 +32,18 @@ public class AppSettings { */ public String validationProfile; + /** + * Indicates whether the editor tab for content declarations should be shown + * in the EPD editor or not. + */ + public boolean showContentDeclarations = false; + + /** + * Indicates whether the editor tab for Q meta data should be shown in the + * EPD editor or not. + */ + public boolean showQMetadata = false; + public void save() { Json.write(this, new File(App.workspace, "settings.json")); } @@ -51,6 +63,8 @@ public AppSettings clone() { clone.lang = lang; clone.showDataSetXML = showDataSetXML; clone.showDataSetDependencies = showDataSetDependencies; + clone.showContentDeclarations = showContentDeclarations; + clone.showQMetadata = showQMetadata; clone.validationProfile = validationProfile; clone.syncRefDataOnStartup = syncRefDataOnStartup; clone.checkEPDsOnProductUpdates = checkEPDsOnProductUpdates; @@ -64,6 +78,8 @@ public void setValues(AppSettings from) { lang = from.lang; showDataSetXML = from.showDataSetXML; showDataSetDependencies = from.showDataSetDependencies; + showContentDeclarations = from.showContentDeclarations; + showQMetadata = from.showQMetadata; validationProfile = from.validationProfile; syncRefDataOnStartup = from.syncRefDataOnStartup; checkEPDsOnProductUpdates = from.checkEPDsOnProductUpdates; diff --git a/src/app/M.java b/src/app/M.java index ae29345..29f83a2 100644 --- a/src/app/M.java +++ b/src/app/M.java @@ -224,8 +224,10 @@ public class M extends NLS { public static String SetAsReference; public static String Settings; public static String ShortName; + public static String ShowContentDeclarationEditor; public static String ShowDependenciesInEditors; public static String ShowDetails; + public static String ShowQMetadataEditor; public static String ShowXMLInEditors; public static String Source; public static String Sources; diff --git a/src/app/editors/epd/EpdEditor.java b/src/app/editors/epd/EpdEditor.java index 34601fc..b579d67 100644 --- a/src/app/editors/epd/EpdEditor.java +++ b/src/app/editors/epd/EpdEditor.java @@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory; import app.App; +import app.AppSettings; import app.M; import app.editors.BaseEditor; import app.editors.Editors; @@ -67,8 +68,15 @@ protected void addPages() { addPage(new ModelingPage(this)); addPage(new AdminPage(this)); addPage(new ModulePage(this)); - addPage(new ContentDeclarationPage(this)); - addPage(new QMetaDataPage(this)); + + // pages that are configurable via the settings + AppSettings settings = App.settings(); + if (settings.showContentDeclarations) { + addPage(new ContentDeclarationPage(this)); + } + if (settings.showQMetadata) { + addPage(new QMetaDataPage(this)); + } Editors.addInfoPages(this, dataSet.process); } catch (Exception e) { log.error("failed to add editor page", e); diff --git a/src/app/editors/settings/DataSetSection.java b/src/app/editors/settings/DataSetSection.java index d8a63e2..c1df3f1 100644 --- a/src/app/editors/settings/DataSetSection.java +++ b/src/app/editors/settings/DataSetSection.java @@ -56,6 +56,8 @@ void render(Composite body, FormToolkit tk) { dependencyCheck(comp, tk); syncCheck(comp, tk); productUpdateCheck(comp, tk); + contentDeclarationsCheck(comp, tk); + qMetaCheck(comp, tk); qMetaDataFile(comp, tk); } @@ -90,6 +92,26 @@ private void syncCheck(Composite comp, FormToolkit tk) { }); } + private void contentDeclarationsCheck(Composite comp, FormToolkit tk) { + Button check = UI.formCheckBox(comp, tk, + M.ShowContentDeclarationEditor); + check.setSelection(settings().showContentDeclarations); + Controls.onSelect(check, e -> { + settings().showContentDeclarations = check.getSelection(); + page.setDirty(); + }); + } + + private void qMetaCheck(Composite comp, FormToolkit tk) { + Button check = UI.formCheckBox(comp, tk, + M.ShowQMetadataEditor); + check.setSelection(settings().showQMetadata); + Controls.onSelect(check, e -> { + settings().showQMetadata = check.getSelection(); + page.setDirty(); + }); + } + private void productUpdateCheck(Composite comp, FormToolkit tk) { Button check = UI.formCheckBox(comp, tk, M.CheckEPDsOnProductUpdates); diff --git a/src/app/messages.properties b/src/app/messages.properties index 7503ac8..1c2568a 100644 --- a/src/app/messages.properties +++ b/src/app/messages.properties @@ -1,4 +1,4 @@ -#Mon Nov 26 10:12:53 CET 2018 +#Thu Mar 12 14:10:55 CET 2020 AboutEPDEditor=About EPD Editor AccessRestrictions=Access restrictions AccreditedThirdPartyReview=Accredited third party review @@ -204,8 +204,10 @@ SetAsActiveProfile=Set as active profile SetAsReference=Set as reference Settings=Settings ShortName=Short name +ShowContentDeclarationEditor=Show content declaration editor ShowDependenciesInEditors=Show dependencies in editors ShowDetails=Show details +ShowQMetadataEditor=Show Q Metadata editor ShowXMLInEditors=Show XML pages in editors Source=Source Sources=Sources diff --git a/src/app/messages_de.properties b/src/app/messages_de.properties index 01add16..99525d3 100644 --- a/src/app/messages_de.properties +++ b/src/app/messages_de.properties @@ -1,4 +1,4 @@ -#Mon Nov 26 10:12:53 CET 2018 +#Thu Mar 12 14:10:55 CET 2020 AboutEPDEditor=\u00DCber den EPD-Editor AccessRestrictions=Zugangsbeschr\u00E4nkungen AccreditedThirdPartyReview=Akkreditierte Pr\u00FCfung durch Dritte @@ -204,8 +204,10 @@ SetAsActiveProfile=Als aktives Profil setzen SetAsReference=Als Referenz setzen Settings=Einstellungen ShortName=Kurzname +ShowContentDeclarationEditor=Editor f\u00FCr Inhaltsangaben anzeigen ShowDependenciesInEditors=Abh\u00E4ngigkeiten in den Editoren anzeigen ShowDetails=Details anzeigen +ShowQMetadataEditor=Editor f\u00FCr Q-Metadaten anzeigen ShowXMLInEditors=XML Seiten in Editoren anzeigen Source=Quellenangabe Sources=Quellenangaben