Skip to content

Commit

Permalink
enable / disable content declarations and Q meta data tabs via settings
Browse files Browse the repository at this point in the history
  • Loading branch information
msrocka committed Mar 12, 2020
1 parent 3446fe8 commit 636ef1e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/app/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/app/M.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/app/editors/epd/EpdEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
22 changes: 22 additions & 0 deletions src/app/editors/settings/DataSetSection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/app/messages.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/app/messages_de.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 636ef1e

Please sign in to comment.