Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
#15 [Properties] Move own properties files in package i18n.
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoghuman committed Mar 7, 2017
1 parent df2d331 commit 801f152
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 84 deletions.
24 changes: 12 additions & 12 deletions src/main/java/com/github/naoghuman/abclist/TestdataApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.github.naoghuman.abclist;

import com.airhacks.afterburner.injection.Injector;
import com.github.naoghuman.abclist.configuration.ITestdataConfiguration;
import com.github.naoghuman.abclist.configuration.IPropertiesConfiguration;
import com.github.naoghuman.abclist.testdata.TestdataFacade;
import com.github.naoghuman.lib.database.api.DatabaseFacade;
import com.github.naoghuman.lib.logger.api.LoggerFacade;
Expand All @@ -35,15 +35,15 @@
*
* @author PRo
*/
public class TestdataApplication extends Application implements ITestdataConfiguration {
public class TestdataApplication extends Application implements IPropertiesConfiguration {

@Override
public void init() throws Exception {
PropertiesFacade.getDefault().register(DBW__RESOURCE_BUNDLE__TESTDATA);
PropertiesFacade.getDefault().register(KEY__TESTDATA__RESOURCE_BUNDLE);

final char borderSign = this.getProperty(KEY__APPLICATION_TESTDATA__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__APPLICATION_TESTDATA__MESSAGE_START);
final String title = this.getProperty(KEY__APPLICATION_TESTDATA__TITLE);
final char borderSign = this.getProperty(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__TESTDATA_APPLICATION__MESSAGE_START);
final String title = this.getProperty(KEY__TESTDATA_APPLICATION__TITLE);
LoggerFacade.getDefault().message(borderSign, 80, message + title);

final Boolean dropPreferencesFileAtStart = Boolean.FALSE;
Expand All @@ -53,7 +53,7 @@ public void init() throws Exception {
@Override
public void start(Stage primaryStage) throws Exception {
final Scene scene = new Scene(TestdataFacade.getDefault().getView(), 1280.0d, 720.0d);
primaryStage.setTitle(this.getProperty(KEY__APPLICATION_TESTDATA__TITLE) + this.getProperty(KEY__APPLICATION_TESTDATA__VERSION));
primaryStage.setTitle(this.getProperty(KEY__TESTDATA_APPLICATION__TITLE) + this.getProperty(KEY__TESTDATA_APPLICATION__VERSION));
primaryStage.setScene(scene);
primaryStage.setOnCloseRequest((WindowEvent we) -> {
we.consume();
Expand All @@ -65,13 +65,13 @@ public void start(Stage primaryStage) throws Exception {
}

private String getProperty(String propertyKey) {
return PropertiesFacade.getDefault().getProperty(DBW__RESOURCE_BUNDLE__TESTDATA, propertyKey);
return PropertiesFacade.getDefault().getProperty(KEY__TESTDATA__RESOURCE_BUNDLE, propertyKey);
}

private void onCloseRequest() {
final char borderSign = this.getProperty(KEY__APPLICATION_TESTDATA__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__APPLICATION_TESTDATA__MESSAGE_STOP);
final String title = this.getProperty(KEY__APPLICATION_TESTDATA__TITLE);
final char borderSign = this.getProperty(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0);
final String message = this.getProperty(KEY__TESTDATA_APPLICATION__MESSAGE_STOP);
final String title = this.getProperty(KEY__TESTDATA_APPLICATION__TITLE);
LoggerFacade.getDefault().message(borderSign, 80, message + title);

try {
Expand All @@ -82,7 +82,7 @@ private void onCloseRequest() {
Injector.forgetAll();
DatabaseFacade.getDefault().shutdown();

final PauseTransition pt = new PauseTransition(DBW__LITTLE_DELAY__DURATION_125);
final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
pt.setOnFinished((ActionEvent event) -> {
Platform.exit();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package com.github.naoghuman.abclist.configuration;

import javafx.util.Duration;

/**
*
* @author Naoghuman
Expand All @@ -28,5 +30,16 @@ public interface IPropertiesConfiguration {

public static final String INFO__FOUNDED_TERMS = "converter.info.founded.terms"; // NOI18N

public static final Duration LITTLE_DELAY__DURATION_125 = Duration.millis(125.0d);

public static final String KEY__CONVERTER__RESOURCE_BUNDLE = "/com/github/naoghuman/abclist/i18n/converter.properties"; // NOI18N
public static final String KEY__TESTDATA__RESOURCE_BUNDLE = "/com/github/naoghuman/abclist/i18n/testdataapplication.properties"; // NOI18N

public static final String KEY__TESTDATA_APPLICATION__BORDER_SIGN = "application.testdata.border.sign"; // NOI18N
public static final String KEY__TESTDATA_APPLICATION__DATABASE = "application.database"; // NOI18N
public static final String KEY__TESTDATA_APPLICATION__MESSAGE_START = "application.testdata.message.start"; // NOI18N
public static final String KEY__TESTDATA_APPLICATION__MESSAGE_STOP = "application.testdata.message.stop"; // NOI18N
public static final String KEY__TESTDATA_APPLICATION__TITLE = "application.testdata.title"; // NOI18N
public static final String KEY__TESTDATA_APPLICATION__VERSION = "application.testdata.version"; // NOI18N

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import com.airhacks.afterburner.views.FXMLView;
import com.github.naoghuman.abclist.configuration.IPreferencesConfiguration;
import com.github.naoghuman.abclist.configuration.ITestdataConfiguration;
import com.github.naoghuman.abclist.configuration.IPropertiesConfiguration;
import static com.github.naoghuman.abclist.configuration.IPropertiesConfiguration.KEY__TESTDATA_APPLICATION__DATABASE;
import com.github.naoghuman.abclist.model.Exercise;
import com.github.naoghuman.abclist.model.ExerciseTerm;
import com.github.naoghuman.abclist.model.Term;
Expand Down Expand Up @@ -76,7 +77,7 @@
*
* @author PRo
*/
public class TestdataPresenter implements Initializable, IPreferencesConfiguration, ITestdataConfiguration {
public class TestdataPresenter implements Initializable, IPreferencesConfiguration, IPropertiesConfiguration {

private static final Map<String, FXMLView> ENTITIES = FXCollections.observableMap(new LinkedHashMap<String, FXMLView>());

Expand Down Expand Up @@ -319,7 +320,7 @@ private CheckBoxListCellModel getCheckBoxListCellModel(final String key) {
}

private String getProperty(String propertyKey) {
return PropertiesFacade.getDefault().getProperty(DBW__RESOURCE_BUNDLE__TESTDATA, propertyKey);
return PropertiesFacade.getDefault().getProperty(KEY__TESTDATA__RESOURCE_BUNDLE, propertyKey);
}

public void onActionCreateTestdata() {
Expand All @@ -338,7 +339,7 @@ public void onActionCreateTestdata() {
ptDropDatabase.setDuration(Duration.millis(50.0d));
ptDropDatabase.setOnFinished((ActionEvent event) -> {
LoggerFacade.getDefault().debug(this.getClass(), "Drop database"); // NOI18N
DatabaseFacade.getDefault().drop(this.getProperty(KEY__APPLICATION__DATABASE));
DatabaseFacade.getDefault().drop(this.getProperty(KEY__TESTDATA_APPLICATION__DATABASE));
});
sequentialTransition.getChildren().add(ptDropDatabase);
}
Expand All @@ -347,7 +348,7 @@ public void onActionCreateTestdata() {
ptRegisterDatabase.setDuration(Duration.millis(150.0d));
ptRegisterDatabase.setOnFinished((ActionEvent event) -> {
LoggerFacade.getDefault().debug(this.getClass(), "Register database"); // NOI18N
DatabaseFacade.getDefault().register(this.getProperty(KEY__APPLICATION__DATABASE));
DatabaseFacade.getDefault().register(this.getProperty(KEY__TESTDATA_APPLICATION__DATABASE));
});
sequentialTransition.getChildren().add(ptRegisterDatabase);

Expand Down

This file was deleted.

0 comments on commit 801f152

Please sign in to comment.