Skip to content

Commit

Permalink
Use ResourceBundle instead of own file look-up/parsing for i18n, allow
Browse files Browse the repository at this point in the history
setting of UI language via Preferences dialog, add spreadsheet export
for AIS module to file menu
  • Loading branch information
CarstenWickner committed Sep 13, 2015
1 parent 1ec7fa8 commit f2cd52f
Show file tree
Hide file tree
Showing 27 changed files with 849 additions and 510 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ModelParseServiceImpl implements IModelParseService<AisProject> {
/** The embedded/export stylesheet for the conversion to a html page. */
private static final ExportOption HTML_EXPORT = new ExportOption(AisMessage.PROJECT_EXPORT_HTML, ExportOption.TargetFileType.HTML,
"/org/hmx/scitos/ais/stylesheet.xsl");
private static final ExportOption ODS_RESULT_EXPORT = new ExportOption(AisMessage.PROJECT_EXPORT_ODS, ExportOption.TargetFileType.ODS, null);
/*
* Collection of the XML tags and attributes for representing an AIS module's project in its persisted form.
*/
Expand Down Expand Up @@ -105,7 +106,7 @@ public ModelParseServiceImpl() {

@Override
public List<ExportOption> getSupportedExports() {
return Arrays.asList(ModelParseServiceImpl.HTML_EXPORT);
return Arrays.asList(ModelParseServiceImpl.HTML_EXPORT, ModelParseServiceImpl.ODS_RESULT_EXPORT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package org.hmx.scitos.ais.core.i18n;

import java.util.Locale;

import org.hmx.scitos.core.i18n.ILocalizableMessage;
import org.hmx.scitos.core.i18n.Translator;

Expand All @@ -31,6 +29,7 @@ public enum AisMessage implements ILocalizableMessage {
// general project actions
PROJECT_NEW("Ais.Project.New"),
PROJECT_EXPORT_HTML("Ais.Project.Export.Html"),
PROJECT_EXPORT_ODS("Ais.Project.Export.Ods"),
PROJECT_CHANGE_CATEGORIES("Ais.Project.ChangeDetailCategories"),
// the matching dialog for detail category changes on an active project
PROJECT_CHANGE_CATEGORIES_MATCHING("Ais.Project.ChangeDetailCategories.MatchOldToNew"),
Expand Down Expand Up @@ -100,12 +99,7 @@ public String getKey() {

@Override
public String get() {
return this.get(Locale.getDefault());
}

@Override
public String get(final Locale locale) {
return AisMessage.TRANSLATOR.getLocalizedMessage(this, locale);
return AisMessage.TRANSLATOR.getLocalizedMessage(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Category assignments without a selected replacement are being discarded.</entry>
<entry key="Ais.Project.ChangeDetailCategories.OldCategory">Old Detail Category</entry>
<entry key="Ais.Project.ChangeDetailCategories.AffectedTokens">Number of Affected Tokens</entry>
<entry key="Ais.Project.ChangeDetailCategories.ReplacingCategory">Replaced With New Category</entry>
<entry key="Ais.Project.Export.Html">HTML file</entry>
<entry key="Ais.Project.Export.Html">HTML File</entry>
<entry key="Ais.Project.Export.Ods">Spreadsheet (only Results)</entry>
<entry key="Ais.Project.New">Where to save the new AIS Project?</entry>
</properties>
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ Zugeordnete Kategorien ohne Entsprechung im neuen Modell werden verworfen!</entr
<entry key="Ais.Project.ChangeDetailCategories.OldCategory">Alte Kategorie</entry>
<entry key="Ais.Project.ChangeDetailCategories.ReplacingCategory">Ersetzt durch neue Kategorie</entry>
<entry key="Ais.Project.Export.Html">HTML-Datei</entry>
<entry key="Ais.Project.Export.Ods">ODS-Datei (Ergebnistabellen)</entry>
<entry key="Ais.Project.New">Wo soll das neue AIS Projekt gespeichert werden?</entry>
</properties>
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,16 @@ public void saveAs(final File path) throws HmxException {

@Override
public void export(final ExportOption type, final File path) throws HmxException {
this.client.getModelParseProvider().export(this.getModelObject(), type.getStylesheetPath(), path);
switch (type.getTargetFileType()) {
case HTML:
this.client.getModelParseProvider().export(this.getModelObject(), type.getStylesheetPath(), path);
break;
case ODS:
new PatternAnalysisModel(this).exportToSpreadSheet(path);
break;
default:
throw new IllegalArgumentException();
}
}

@Override
Expand Down
Loading

0 comments on commit f2cd52f

Please sign in to comment.