Skip to content

Commit 23be3ee

Browse files
committed
refactoring, small fixes.
1 parent d2d9322 commit 23be3ee

7 files changed

Lines changed: 120 additions & 15 deletions

File tree

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ dependencies {
5757
compile "com.github.JavaSaBr.jmonkeyengine:jme3-effects:$jmeVersion"
5858
compile "com.github.JavaSaBr.jmonkeyengine:jme3-blender:$jmeVersion"
5959
compile "com.github.JavaSaBr.jmonkeyengine:jme3-jogg:$jmeVersion"
60-
compile "com.github.JavaSaBr.jmonkeyengine:jme3-testdata:$jmeVersion"
60+
compile ("com.github.JavaSaBr.jmonkeyengine:jme3-testdata:$jmeVersion") {
61+
exclude group: 'lessvoid'
62+
}
6163

6264
// LWJGL
6365
compile "org.lwjgl:lwjgl:${lwjglVersion}"

src/main/java/com/ss/editor/ui/component/editor/impl/AbstractFileEditor.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ protected AbstractFileEditor() {
161161
*
162162
* @param editor3DState the editor app state
163163
*/
164+
@FXThread
164165
protected void addEditorState(@NotNull final Editor3DState editor3DState) {
165166
this.editorStates.add(editor3DState);
166167
}
@@ -170,13 +171,15 @@ protected void addEditorState(@NotNull final Editor3DState editor3DState) {
170171
*
171172
* @param file the edit file.
172173
*/
174+
@FXThread
173175
protected void setEditFile(@NotNull final Path file) {
174176
this.file = file;
175177
}
176178

177179
/**
178180
* Create content of this editor.
179181
*/
182+
@FXThread
180183
protected void createContent() {
181184

182185
final VBox container = new VBox();
@@ -218,6 +221,7 @@ protected void createContent() {
218221
/**
219222
* Handle the mouse released event.
220223
*/
224+
@FXThread
221225
private void processMouseReleased(@NotNull final MouseEvent mouseEvent) {
222226
setButtonLeftDown(mouseEvent.isPrimaryButtonDown());
223227
setButtonMiddleDown(mouseEvent.isMiddleButtonDown());
@@ -227,6 +231,7 @@ private void processMouseReleased(@NotNull final MouseEvent mouseEvent) {
227231
/**
228232
* Handle the mouse pressed event.
229233
*/
234+
@FXThread
230235
private void processMousePressed(@NotNull final MouseEvent mouseEvent) {
231236
setButtonLeftDown(mouseEvent.isPrimaryButtonDown());
232237
setButtonMiddleDown(mouseEvent.isMiddleButtonDown());
@@ -317,8 +322,8 @@ protected Button createSaveAction() {
317322
return action;
318323
}
319324

320-
@FXThread
321325
@Override
326+
@FXThread
322327
public void save() {
323328
if(isSaving()) return;
324329
notifyStartSaving();
@@ -391,19 +396,22 @@ protected boolean needToolbar() {
391396

392397
@NotNull
393398
@Override
399+
@FXThread
394400
public Pane getPage() {
395401
final R pane = notNull(root);
396402
return (Pane) pane.getParent().getParent();
397403
}
398404

399405
@NotNull
400406
@Override
407+
@FXThread
401408
public Path getEditFile() {
402409
return notNull(file);
403410
}
404411

405412
@NotNull
406413
@Override
414+
@FXThread
407415
public String getFileName() {
408416
final Path editFile = getEditFile();
409417
final Path fileName = editFile.getFileName();
@@ -428,11 +436,13 @@ public void openFile(@NotNull final Path file) {
428436

429437
@NotNull
430438
@Override
439+
@FXThread
431440
public BooleanProperty dirtyProperty() {
432441
return dirtyProperty;
433442
}
434443

435444
@Override
445+
@FXThread
436446
public boolean isDirty() {
437447
return dirtyProperty.get();
438448
}
@@ -442,22 +452,26 @@ public boolean isDirty() {
442452
*
443453
* @param dirty the dirty
444454
*/
455+
@FXThread
445456
protected void setDirty(final boolean dirty) {
446457
this.dirtyProperty.setValue(dirty);
447458
}
448459

449460
@NotNull
450461
@Override
462+
@FXThread
451463
public Array<Editor3DState> get3DStates() {
452464
return editorStates;
453465
}
454466

455467
@Override
468+
@FXThread
456469
public void notifyRenamed(@NotNull final Path prevFile, @NotNull final Path newFile) {
457470
notifyChangedEditedFile(prevFile, newFile);
458471
}
459472

460473
@Override
474+
@FXThread
461475
public void notifyMoved(@NotNull final Path prevFile, final @NotNull Path newFile) {
462476
notifyChangedEditedFile(prevFile, newFile);
463477
}
@@ -500,6 +514,7 @@ public void notifyChangedCamera(@NotNull final Vector3f cameraLocation, final fl
500514
}
501515

502516
@Override
517+
@FXThread
503518
public void notifyShowed() {
504519
this.showedTime = LocalTime.now();
505520

@@ -508,6 +523,7 @@ public void notifyShowed() {
508523
}
509524

510525
@Override
526+
@FXThread
511527
public void notifyHided() {
512528

513529
final Duration duration = Duration.between(showedTime, LocalTime.now());
@@ -520,6 +536,7 @@ public void notifyHided() {
520536
}
521537

522538
@Override
539+
@FXThread
523540
public void notifyClosed() {
524541
FX_EVENT_MANAGER.removeEventHandler(FileChangedEvent.EVENT_TYPE, getFileChangedHandler());
525542

@@ -570,6 +587,7 @@ protected void handleExternalChanges() {
570587
* @return the file changes listener.
571588
*/
572589
@NotNull
590+
@FXThread
573591
private EventHandler<Event> getFileChangedHandler() {
574592
return fileChangedHandler;
575593
}
@@ -587,6 +605,7 @@ public String toString() {
587605
*
588606
* @param buttonLeftDown the left button is pressed.
589607
*/
608+
@FXThread
590609
protected void setButtonLeftDown(final boolean buttonLeftDown) {
591610
this.buttonLeftDown = buttonLeftDown;
592611
}
@@ -596,6 +615,7 @@ protected void setButtonLeftDown(final boolean buttonLeftDown) {
596615
*
597616
* @param buttonMiddleDown the middle button is pressed.
598617
*/
618+
@FXThread
599619
protected void setButtonMiddleDown(final boolean buttonMiddleDown) {
600620
this.buttonMiddleDown = buttonMiddleDown;
601621
}
@@ -605,6 +625,7 @@ protected void setButtonMiddleDown(final boolean buttonMiddleDown) {
605625
*
606626
* @param buttonRightDown the right button is pressed.
607627
*/
628+
@FXThread
608629
protected void setButtonRightDown(final boolean buttonRightDown) {
609630
this.buttonRightDown = buttonRightDown;
610631
}
@@ -614,6 +635,7 @@ protected void setButtonRightDown(final boolean buttonRightDown) {
614635
*
615636
* @return true if left button is pressed.
616637
*/
638+
@FXThread
617639
protected boolean isButtonLeftDown() {
618640
return buttonLeftDown;
619641
}
@@ -623,6 +645,7 @@ protected boolean isButtonLeftDown() {
623645
*
624646
* @return true if middle button is pressed.
625647
*/
648+
@FXThread
626649
protected boolean isButtonMiddleDown() {
627650
return buttonMiddleDown;
628651
}
@@ -632,6 +655,7 @@ protected boolean isButtonMiddleDown() {
632655
*
633656
* @return true if right button is pressed.
634657
*/
658+
@FXThread
635659
protected boolean isButtonRightDown() {
636660
return buttonRightDown;
637661
}
@@ -641,6 +665,7 @@ protected boolean isButtonRightDown() {
641665
*
642666
* @return the boolean
643667
*/
668+
@FXThread
644669
protected boolean isSaving() {
645670
return saving;
646671
}
@@ -650,13 +675,15 @@ protected boolean isSaving() {
650675
*
651676
* @param saving the saving
652677
*/
678+
@FXThread
653679
protected void setSaving(final boolean saving) {
654680
this.saving = saving;
655681
}
656682

657683
/**
658684
* Notify start saving.
659685
*/
686+
@FXThread
660687
protected void notifyStartSaving() {
661688
final EditorFXScene scene = JFX_APPLICATION.getScene();
662689
scene.incrementLoading();
@@ -666,6 +693,7 @@ protected void notifyStartSaving() {
666693
/**
667694
* Notify finish saving.
668695
*/
696+
@FXThread
669697
protected void notifyFinishSaving() {
670698
setSaving(false);
671699
final EditorFXScene scene = JFX_APPLICATION.getScene();

src/main/java/com/ss/editor/ui/component/editor/impl/model/ModelFileEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private ModelFileEditor() {
9595

9696
@NotNull
9797
@Override
98-
protected ModelEditor3DState createEditorAppState() {
98+
protected ModelEditor3DState createEditor3DState() {
9999
return new ModelEditor3DState(this);
100100
}
101101

0 commit comments

Comments
 (0)