Skip to content

Commit

Permalink
Supports templates managing (fixes #54)
Browse files Browse the repository at this point in the history
Specifically:
- saving templates (fixes #34)
- deleting previously saved templates
- apply a template after the initial import (fixes #50)
  • Loading branch information
Joel Håkansson committed Apr 12, 2018
1 parent ca37438 commit c0687dd
Show file tree
Hide file tree
Showing 27 changed files with 789 additions and 143 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ dependencies {
compile 'com.googlecode.ajui:ajui:1.0.0'

compile 'org.daisy.dotify:dotify.api:4.1.1'
compile 'org.daisy.streamline:streamline-api:1.0.1'
compile 'org.daisy.dotify:dotify.common:4.1.0'
compile 'org.daisy.streamline:streamline-api:1.1.0'
compile 'org.daisy.dotify:dotify.common:4.2.0'
compile ('org.daisy.streamline:streamline-engine:1.1.0') {
exclude module: 'streamline-api'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application.ui.impl.template.UserConfigurationsImpl
7 changes: 6 additions & 1 deletion src/application/common/FeatureSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public enum FeatureSwitch {
/**
* When on, the progress indicator in the Dotify panel uses progress values reported from the task system
*/
REPORT_PROGRESS("on".equalsIgnoreCase(System.getProperty("application.feature.report-progress", "off")));
REPORT_PROGRESS("on".equalsIgnoreCase(System.getProperty("application.feature.report-progress", "off"))),
/**
* When on, the template dialog is opened on import
*/
TEMPLATE_DIALOG_ON_IMPORT("on".equalsIgnoreCase(System.getProperty("application.feature.template-dialog-on-import", "on"))),
;

private final boolean on;
FeatureSwitch(boolean on) {
Expand Down
19 changes: 19 additions & 0 deletions src/application/common/Singleton.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package application.common;

import org.daisy.streamline.api.config.ConfigurationsCatalog;
import org.daisy.streamline.api.config.ConfigurationsCatalogService;

public enum Singleton {
INSTANCE;
public static Singleton getInstance() {
return Singleton.INSTANCE;
}

private ConfigurationsCatalogService configsCatalog;
public synchronized ConfigurationsCatalogService getConfigurationsCatalog() {
if (configsCatalog==null) {
configsCatalog = ConfigurationsCatalog.newInstance();
}
return configsCatalog;
}
}
10 changes: 6 additions & 4 deletions src/application/l10n/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum Messages {
APPLICATION_ENVIRONMENT("application-environment"),
BUTTON_OK("button-ok"),
BUTTON_SELECT("button-select"),
BUTTON_DELETE("button-delete"),
EMBOSS_WINDOW_TITLE("emboss-window-title"),
/**
* The file is invalid and cannot be embossed.
Expand Down Expand Up @@ -83,6 +84,7 @@ public enum Messages {
TITLE_EXPORT_DIALOG("title-export-dialog"),
TITLE_SAVE_AS_DIALOG("title-save-as-dialog"),
TITLE_TEMPLATES_DIALOG("title-templates-dialog"),
TITLE_SAVE_TEMPLATES_DIALOG("title-save-template-dialog"),
LABEL_BRAILLE_FONT("label-braille-font"),
LABEL_TEXT_FONT("label-text-font"),
LABEL_TRANSLATION("label-translation"),
Expand All @@ -100,7 +102,7 @@ public enum Messages {
LABEL_SETUP_INVALID("label-setup-invalid"),
LABEL_CREATE_TEST_DOCUMENT("label-create-test-document"),
LABEL_PAPER_DIMENSIONS("label-paper-dimensions"),
LABEL_NONE("label-none"),
LABEL_EMPTY("label-empty"),
LABEL_HEIGHT("label-height"),
LABEL_WIDTH("label-width"),
LABEL_ROLL_SIZE("label-roll-size"),
Expand All @@ -123,7 +125,7 @@ public enum Messages {
/**
* Confirm delete a custom paper
*/
MESSAGE_CONFIRM_DELETE_PAPER("message-confirm-delete-paper"),
MESSAGE_CONFIRM_DELETE("message-confirm-delete"),
MESSAGE_FILE_MODIFIED_BY_ANOTHER_APPLICATION("message-file-modified-by-another-application"),
MESSAGE_CONFIRM_SAVE_MALFORMED_XML("message-confirm-save-malformed-xml"),
MESSAGE_CONFIRM_QUIT_UNSAVED_CHANGES("message-confirm-quit-unsaved-changes"),
Expand All @@ -140,8 +142,8 @@ public enum Messages {
TOOLTIP_NO_VOLUME_SUPPORT("tooltip-no-volume-support"),
TOOLTIP_ACCURATE_LINE_SPACING("tooltip-accurate-line-spacing"),
TOOLTIP_SIMPLE_LINE_SPACING("tooltip-simple-line-spacing"),
TOOLTIP_SHOW_OPTIONS("tooltip-show-options"),
TOOLTIP_HIDE_OPTIONS("tooltip-hide-options"),
TOOLTIP_SHOW_CONVERTER("tooltip-show-converter"),
TOOLTIP_HIDE_CONVERTER("tooltip-hide-converter"),
VALUE_USE_DEFAULT("value-use-default"),
EXTENSION_FILTER_SUPPORTED_FILES("extension-filter-supported-files"),
EXTENSION_FILTER_ALL_FILES("extension-filter-all-files"),
Expand Down
14 changes: 11 additions & 3 deletions src/application/l10n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ button-select=Select
button-add=Add
button-cancel=Cancel
button-emboss=Emboss
button-delete=Delete
emboss-window-title=Emboss
error-cannot-emboss-invalid-file=Cannot emboss, file has errors
error-failed-to-parse-page-range=Failed to parse page range: {0}
Expand All @@ -37,6 +38,7 @@ title-import-source-document-dialog=Import source document
title-export-dialog=Export
title-save-as-dialog=Save As...
title-templates-dialog=Select template ({0})
title-save-template-dialog=Save template
label-braille-font=Braille font
label-text-font=Text font
label-target-locale=Target locale
Expand Down Expand Up @@ -89,14 +91,15 @@ label-line-numbers=Line numbers
label-merge-order=Merge order
label-target-format=Target format
label-make=Make
label-empty=Empty
message-six-dot-only=6-dot only
message-search-result={0} by {1}
message-unknown-author=Unknown
message-unknown-title=Untitled
message-paper-details={0} - {1} ({2}: {3})
message-book-dimensions={0} cells wide x {1} cells high
message-file-sent-to-embosser=File has been sent to embosser
message-confirm-delete-paper=Do you really want to delete {0}?
message-confirm-delete=Do you really want to delete {0}?
message-file-modified-by-another-application=The file has been modified by another program. Do you want to reload it and lose the changes made here?
message-confirm-save-malformed-xml=The contents is not well-formed XML. Do you want to save anyway?
message-confirm-quit-unsaved-changes=Some open files have been modified but not saved. Do you want to quit anyway?
Expand Down Expand Up @@ -129,6 +132,11 @@ menu-item-toggle-viewing-mode=Toggle viewing mode
menu-item-activate-view=Activate view
menu-item-next-editor=Next editor
menu-item-previous-editor=Previous editor
menu-item-show-converter=Show
menu-item-apply-template=Apply template...
menu-item-save-template=Save template...
menu-item-converter=Converter
menu-item-update=Update
preferences-window-title=Preferences
tab-emboss=Emboss
tab-general=General
Expand All @@ -142,8 +150,8 @@ tooltip-volume-support=Supports volumes
tooltip-no-volume-support=No support for volumes
tooltip-accurate-line-spacing=Supports accurate line spacing
tooltip-simple-line-spacing=Supports simple line spacing only
tooltip-show-options=Show options
tooltip-hide-options=Hide options
tooltip-show-converter=Show converter
tooltip-hide-converter=Hide converter
tooltip-correct-formatting=Correct formatting
tooltip-move-up=Move the selected file up (Alt + Up)
tooltip-move-down=Move the selected file down (Alt + Down)
Expand Down
14 changes: 11 additions & 3 deletions src/application/l10n/messages_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ button-select=Velg
button-add=Legg til
button-cancel=Avbryt
button-emboss=Skriv ut
button-delete=Slette
emboss-window-title=Skriv ut
error-cannot-emboss-invalid-file=Kan ikke skrive ut, filen inneholder feil
error-failed-to-parse-page-range=Klarte ikke å tolke sidespenn: {0}
Expand All @@ -37,6 +38,7 @@ title-import-source-document-dialog=Importer kildedokument
title-export-dialog=Eksporter
title-save-as-dialog=Lagre som...
title-templates-dialog=Velg mal ({0})
title-save-template-dialog=Lagre mal
label-braille-font=Punktskriftfont
label-text-font=Tekstfont
label-target-locale=Målsted
Expand Down Expand Up @@ -88,6 +90,7 @@ label-word-wrap=Tekstbryting
label-line-numbers=Linjenummer
label-target-format=Målformat
label-make=Make
label-empty=Tom
message-six-dot-only=Bare 6-punkt
label-merge-order=Merge order
message-search-result={0} av {1}
Expand All @@ -96,7 +99,7 @@ message-unknown-title=ingen tittel
message-paper-details={0} - {1} ({2}: {3})
message-book-dimensions={0} celler bred x {1} celler høy
message-file-sent-to-embosser=Filen har blitt sendt til punktskriftskriveren
message-confirm-delete-paper=Er du sikker på at du vil slette {0}?
message-confirm-delete=Er du sikker på at du vil slette {0}?
message-file-modified-by-another-application=Filen har blitt endret av et annet program. Vil du laste den inn på nytt og miste endringene du har gjort her?
message-confirm-save-malformed-xml=Innholdet er ikke velformet XML. Vil du lagre alikevel?
message-confirm-quit-unsaved-changes=Noen filer har blitt endret men ikke lagret. Vil du avslutte alikevel?
Expand Down Expand Up @@ -129,6 +132,11 @@ menu-item-toggle-viewing-mode=Toggle viewing mode
menu-item-activate-view=Activate view
menu-item-next-editor=Neste redigeringsprogram
menu-item-previous-editor=Forrige redigeringsprogram
menu-item-show-converter=Vis
menu-item-apply-template=Bruk mal...
menu-item-save-template=Lagre mal...
menu-item-converter=Converter
menu-item-update=Oppdater
preferences-window-title=Innstillinger
tab-emboss=Skriv ut
tab-general=Generelt
Expand All @@ -142,8 +150,8 @@ tooltip-volume-support=St
tooltip-no-volume-support=Støtter ikke hefter
tooltip-accurate-line-spacing=Supports accurate line spacing
tooltip-simple-line-spacing=Supports simple line spacing only
tooltip-show-options=Vis alternativer
tooltip-hide-options=Skjul alternativer
tooltip-show-converter=Show converter
tooltip-hide-converter=Hide converter
tooltip-correct-formatting=Rett formatering
tooltip-move-up=Move the selected file up (Alt + Up)
tooltip-move-down=Move the selected file down (Alt + Down)
Expand Down
14 changes: 11 additions & 3 deletions src/application/l10n/messages_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ button-select=V
button-add=Lägg till
button-cancel=Avbryt
button-emboss=Skriv ut
button-delete=Ta bort
emboss-window-title=Skriv ut
error-cannot-emboss-invalid-file=Kan inte skriva ut, filen innehåller fel
error-failed-to-parse-page-range=Kunde inte tolka sidomfånget: {0}
Expand All @@ -37,6 +38,7 @@ title-import-source-document-dialog=Importera k
title-export-dialog=Exportera
title-save-as-dialog=Spara som...
title-templates-dialog=Välj mall ({0})
title-save-template-dialog=Spara mall
label-braille-font=Punktskriftsfont
label-text-font=Textfont
label-target-locale=Målplats
Expand Down Expand Up @@ -89,14 +91,15 @@ label-line-numbers=Radnummer
label-merge-order=Sammanslagningsordning
label-target-format=Målformat
label-make=Fabrikat
label-empty=Tom
message-six-dot-only=Endast 6-punkt
message-search-result={0} av {1}
message-unknown-author=okänd
message-unknown-title=ingen titel
message-paper-details={0} - {1} ({2}: {3})
message-book-dimensions=Bredd {0} celler, höjd {1} celler
message-file-sent-to-embosser=Filen har skickats till punktskriftsskrivaren
message-confirm-delete-paper=Vill du verkligen ta bort {0}?
message-confirm-delete=Vill du verkligen ta bort {0}?
message-file-modified-by-another-application=Filen har ändrats av ett annat program. Vill du ladda om den och förlora ändringarna som gjorts här?
message-confirm-save-malformed-xml=Innehållet är inte välformad XML. Vill du spara ändå?
message-confirm-quit-unsaved-changes=Vissa öppna filer har ändrats men inte sparats. Vill du avsluta ändå?
Expand Down Expand Up @@ -129,6 +132,11 @@ menu-item-toggle-viewing-mode=V
menu-item-next-editor=Nästa editor
menu-item-activate-view=Aktivera vy
menu-item-previous-editor=Föregående editor
menu-item-show-converter=Visa
menu-item-apply-template=Tillämpa mall...
menu-item-save-template=Spara mall...
menu-item-converter=Konverterare
menu-item-update=Uppdatera
preferences-window-title=Inställningar
tab-emboss=Skriv ut
tab-general=Allmänt
Expand All @@ -142,8 +150,8 @@ tooltip-volume-support=St
tooltip-no-volume-support=Inget stöd för volymer
tooltip-accurate-line-spacing=Stödjer noggrant radavstånd
tooltip-simple-line-spacing=Stödjer endast enkelt radavstånd
tooltip-show-options=Visa alternativ
tooltip-hide-options=Dölj alternativ
tooltip-show-converter=Visa konverterare
tooltip-hide-converter=Dölj konverterare
tooltip-correct-formatting=Rätta formatering
tooltip-move-up=Flytta vald fil uppåt (Alt + Upp)
tooltip-move-down=Flytta vald fil nedåt (Alt + Ner)
Expand Down
31 changes: 26 additions & 5 deletions src/application/ui/Main.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</SplitPane>
</center>
<top>
<MenuBar BorderPane.alignment="CENTER" useSystemMenuBar="false">
<MenuBar fx:id="topMenuBar" BorderPane.alignment="CENTER" useSystemMenuBar="false">
<menus>
<Menu mnemonicParsing="false" text="%menu-item-file">
<items>
Expand Down Expand Up @@ -106,12 +106,28 @@
</Menu>
<Menu mnemonicParsing="false" text="%menu-item-edit">
<items>
<MenuItem fx:id="refreshMenuItem" mnemonicParsing="false" onAction="#refresh" text="%menu-item-refresh">
<accelerator>
<KeyCodeCombination alt="UP" code="F5" control="UP" meta="UP" shift="UP" shortcut="UP" />
</accelerator></MenuItem>
<MenuItem fx:id="openInBrowserMenuItem" mnemonicParsing="false" onAction="#openInBrowser" text="%menu-item-open-browser" />
</items>
</Menu>
<Menu fx:id="convertMenu" mnemonicParsing="false" text="%menu-item-converter">
<items>
<MenuItem fx:id="refreshConverterMenuItem" mnemonicParsing="false" onAction="#refreshConverter" text="%menu-item-update">
<accelerator>
<KeyCodeCombination alt="UP" code="F5" control="UP" meta="UP" shift="DOWN" shortcut="UP" />
</accelerator>
</MenuItem>
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem fx:id="saveTemplateMenuItem" mnemonicParsing="false" onAction="#saveTemplate" text="%menu-item-save-template"/>
<MenuItem fx:id="applyTemplateMenuItem" mnemonicParsing="false" onAction="#applyTemplate" text="%menu-item-apply-template"/>
<SeparatorMenuItem mnemonicParsing="false" />
<CheckMenuItem fx:id="showConverterMenuItem" mnemonicParsing="false" text="%menu-item-show-converter">
<accelerator>
<KeyCodeCombination alt="DOWN" code="O" control="UP" meta="UP" shift="DOWN" shortcut="UP" />
</accelerator>
</CheckMenuItem>
<SeparatorMenuItem mnemonicParsing="false" />
<CheckMenuItem fx:id="watchSourceMenuItem" mnemonicParsing="false" text="%checkbox-watch-source"/>
</items>
</Menu>
<Menu mnemonicParsing="false" text="%menu-item-window">
<items>
Expand All @@ -124,6 +140,11 @@
<KeyCodeCombination alt="DOWN" code="C" control="UP" meta="UP" shift="DOWN" shortcut="UP" />
</accelerator></CheckMenuItem>
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem fx:id="refreshMenuItem" mnemonicParsing="false" onAction="#refresh" text="%menu-item-refresh">
<accelerator>
<KeyCodeCombination alt="UP" code="F5" control="UP" meta="UP" shift="UP" shortcut="UP" />
</accelerator></MenuItem>
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem fx:id="nextEditorViewMenuItem" mnemonicParsing="false" onAction="#nextEditor" text="%menu-item-next-editor">
<accelerator>
<KeyCodeCombination alt="UP" code="F7" control="UP" meta="UP" shift="UP" shortcut="UP" />
Expand Down
Loading

0 comments on commit c0687dd

Please sign in to comment.