Skip to content

Commit ca45e20

Browse files
committed
fix pom, code improvements
1 parent a288f6c commit ca45e20

File tree

12 files changed

+34
-56
lines changed

12 files changed

+34
-56
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@
116116
<artifactId>jaxb-api</artifactId>
117117
<version>${version.jaxb}</version>
118118
</dependency>
119+
<dependency>
120+
<groupId>com.sun.xml.bind</groupId>
121+
<artifactId>jaxb-core</artifactId>
122+
<version>${version.jaxb}</version>
123+
</dependency>
119124
<dependency>
120125
<groupId>com.sun.xml.bind</groupId>
121126
<artifactId>jaxb-impl</artifactId>

src/main/java/ch/hsr/ogv/MainApp.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ public class MainApp extends Application {
1818

1919
private final static Logger logger = LoggerFactory.getLogger(MainApp.class);
2020

21-
private final static UncaughtExceptionHandler ueHandler = new UncaughtExceptionHandler() {
22-
public void uncaughtException(Thread thread, final Throwable throwable) {
23-
logger.debug("Error in thread " + thread + ": " + throwable.getMessage());
24-
throwable.printStackTrace();
25-
}
21+
private final static UncaughtExceptionHandler ueHandler = (thread, throwable) -> {
22+
logger.debug("Error in thread " + thread + ": " + throwable.getMessage());
23+
throwable.printStackTrace();
2624
};
2725

2826
public static void main(String[] args) {

src/main/java/ch/hsr/ogv/StageBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ch.hsr.ogv;
22

33
import ch.hsr.ogv.controller.*;
4-
import ch.hsr.ogv.dataaccess.Persistancy;
4+
import ch.hsr.ogv.dataaccess.Persistence;
55
import ch.hsr.ogv.dataaccess.UserPreferences;
66
import ch.hsr.ogv.util.FXMLResourceUtil;
77
import ch.hsr.ogv.util.ResourceLocator;
@@ -36,7 +36,7 @@ public class StageBuilder {
3636

3737
private ModelViewConnector mvConnector;
3838
private ObjectGraph objectGraph;
39-
private Persistancy persistancy;
39+
private Persistence persistence;
4040

4141
private ViewController viewController = new ViewController();
4242
private SelectionController selectionController = new SelectionController();
@@ -119,15 +119,15 @@ private void initObjectGraph() {
119119

120120
private void initPersistancy() {
121121
UserPreferences.setOGVFilePath(null); // reset user preferences of file path
122-
persistancy = new Persistancy(this.mvConnector.getModelManager());
122+
persistence = new Persistence(this.mvConnector.getModelManager());
123123
}
124124

125125
private void initViewController() {
126126
this.viewController.setPrimaryStage(this.primaryStage);
127127
this.viewController.setSubSceneAdapter(this.subSceneAdapter);
128128
this.viewController.setMVConnector(this.mvConnector);
129129
this.viewController.setObjectGraph(this.objectGraph);
130-
this.viewController.setPersistancy(this.persistancy);
130+
this.viewController.setPersistence(this.persistence);
131131
this.viewController.setSelectionController(this.selectionController);
132132
this.viewController.setCameraController(this.cameraController);
133133
this.viewController.setRelationCreationController(this.relationCreationController);

src/main/java/ch/hsr/ogv/controller/ViewController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ViewController implements Observer, Initializable {
3535
private SubSceneAdapter subSceneAdapter;
3636
private ModelViewConnector mvConnector;
3737
private ObjectGraph objectGraph;
38-
private Persistancy persistancy;
38+
private Persistence persistence;
3939
private SelectionController selectionController;
4040
private CameraController cameraController;
4141
private RelationCreationController relationCreationController;
@@ -60,8 +60,8 @@ public void setObjectGraph(ObjectGraph objectGraph) {
6060
this.objectGraph = objectGraph;
6161
}
6262

63-
public void setPersistancy(Persistancy persistancy) {
64-
this.persistancy = persistancy;
63+
public void setPersistence(Persistence persistence) {
64+
this.persistence = persistence;
6565
}
6666

6767
public void setSelectionController(SelectionController selectionController) {
@@ -116,7 +116,7 @@ private void handleOpen() {
116116
if (file != null) {
117117
UserPreferences.setOGVFilePath(file);
118118
MessageBar.setText("Loading file: \"" + file.getPath() + "\"...", MessageLevel.WARN);
119-
persistancy.loadOGVDataAsync(file, new LoadCallback(this.primaryStage, this.appTitle, file));
119+
persistence.loadOGVDataAsync(file, new LoadCallback(this.primaryStage, this.appTitle, file));
120120
exitObjectGraphMode();
121121
}
122122
}
@@ -141,7 +141,7 @@ private void handleImport() {
141141
UserPreferences.setXMIFilePath(file);
142142
UserPreferences.setOGVFilePath(null);
143143
MessageBar.setText("Importing file: \"" + file.getPath() + "\"...", MessageLevel.WARN);
144-
persistancy.loadXMIDataAsync(file, new ImportCallback(this.primaryStage, this.appTitle, file));
144+
persistence.loadXMIDataAsync(file, new ImportCallback(this.primaryStage, this.appTitle, file));
145145
exitObjectGraphMode();
146146
}
147147
}
@@ -154,7 +154,7 @@ private void handleSave() {
154154
File file = UserPreferences.getOGVFilePath();
155155
if (file != null) {
156156
MessageBar.setText("Saving file: \"" + file.getPath() + "\"...", MessageLevel.WARN);
157-
persistancy.saveOGVDataAsync(file, new SaveCallback(this.primaryStage, this.appTitle, file));
157+
persistence.saveOGVDataAsync(file, new SaveCallback(this.primaryStage, this.appTitle, file));
158158
}
159159
else {
160160
handleSaveAs();
@@ -185,7 +185,7 @@ private void handleSaveAs() {
185185
}
186186
UserPreferences.setOGVFilePath(file);
187187
MessageBar.setText("Saving file: \"" + file.getPath() + "\"...", MessageLevel.WARN);
188-
persistancy.saveOGVDataAsync(file, new SaveCallback(this.primaryStage, this.appTitle, file));
188+
persistence.saveOGVDataAsync(file, new SaveCallback(this.primaryStage, this.appTitle, file));
189189
}
190190
else {
191191
MessageBar.setText("Could not save data. No save file specified.", MessageLevel.ALERT);

src/main/java/ch/hsr/ogv/dataaccess/ImportCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import java.io.File;
88

9-
public class ImportCallback implements PersistencyCallback {
9+
public class ImportCallback implements PersistenceCallback {
1010

1111
private Stage primaryStage;
1212
private String appTitle;

src/main/java/ch/hsr/ogv/dataaccess/LoadCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import java.io.File;
88

9-
public class LoadCallback implements PersistencyCallback {
9+
public class LoadCallback implements PersistenceCallback {
1010

1111
private Stage primaryStage;
1212
private String appTitle;

src/main/java/ch/hsr/ogv/dataaccess/Persistancy.java renamed to src/main/java/ch/hsr/ogv/dataaccess/Persistence.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,22 @@
1010
import java.util.ArrayList;
1111
import java.util.LinkedHashSet;
1212

13-
public class Persistancy {
14-
13+
public class Persistence {
1514

1615
private ModelManager modelManager;
1716

18-
public Persistancy(ModelManager modelManager) {
17+
public Persistence(ModelManager modelManager) {
1918
this.modelManager = modelManager;
2019
}
2120

22-
public void saveOGVDataAsync(File file, PersistencyCallback callback) {
21+
public void saveOGVDataAsync(File file, PersistenceCallback callback) {
2322
OGVSerialization ogvSerialization = new OGVSerialization();
2423
saveDataAsync(ogvSerialization, file, callback);
2524
}
2625

27-
private void saveDataAsync(SerializationStrategy serialStrategy, File file, PersistencyCallback callback) {
28-
serialStrategy.setClasses(new LinkedHashSet<ModelClass>(modelManager.getClasses()));
29-
serialStrategy.setRelations(new LinkedHashSet<Relation>(modelManager.getRelations()));
26+
private void saveDataAsync(SerializationStrategy serialStrategy, File file, PersistenceCallback callback) {
27+
serialStrategy.setClasses(new LinkedHashSet<>(modelManager.getClasses()));
28+
serialStrategy.setRelations(new LinkedHashSet<>(modelManager.getRelations()));
3029
Task<Void> loadTask = new Task<Void>() {
3130
@Override
3231
public Void call() {
@@ -51,17 +50,17 @@ private boolean saveData(SerializationStrategy serialStrategy, File file) {
5150
return serialStrategy.serialize(file);
5251
}
5352

54-
public void loadOGVDataAsync(File file, PersistencyCallback callback) {
53+
public void loadOGVDataAsync(File file, PersistenceCallback callback) {
5554
OGVSerialization ogvSerialization = new OGVSerialization();
5655
loadDataAsync(ogvSerialization, file, callback);
5756
}
5857

59-
public void loadXMIDataAsync(File file, PersistencyCallback callback) {
58+
public void loadXMIDataAsync(File file, PersistenceCallback callback) {
6059
XMISerialization xmiSerialization = new XMISerialization();
6160
loadDataAsync(xmiSerialization, file, callback);
6261
}
6362

64-
private void loadDataAsync(SerializationStrategy serialStrategy, File file, PersistencyCallback callback) {
63+
private void loadDataAsync(SerializationStrategy serialStrategy, File file, PersistenceCallback callback) {
6564
Task<Void> loadTask = new Task<Void>() {
6665
@Override
6766
public Void call() {
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ch.hsr.ogv.dataaccess;
22

33
@FunctionalInterface
4-
public interface PersistencyCallback {
4+
public interface PersistenceCallback {
55
void completed(boolean success);
66
}

src/main/java/ch/hsr/ogv/dataaccess/SaveCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import java.io.File;
88

9-
public class SaveCallback implements PersistencyCallback {
9+
public class SaveCallback implements PersistenceCallback {
1010

1111
private Stage primaryStage;
1212
private String appTitle;

src/main/java/ch/hsr/ogv/model/RelationType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum RelationType {
2121
private final EndpointType endType;
2222
private final LineType lineType;
2323

24-
private RelationType(EndpointType startType, EndpointType endType, LineType lineType) {
24+
RelationType(EndpointType startType, EndpointType endType, LineType lineType) {
2525
this.startType = startType;
2626
this.endType = endType;
2727
this.lineType = lineType;

0 commit comments

Comments
 (0)