Skip to content

Commit cd27a3f

Browse files
committed
update docz
1 parent c2e3e8f commit cd27a3f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.adoc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ When you develop a Java Swing GUI in practice, you face the following additional
3030

3131
* how to enforce the proper threading (view elements like JPanel, JButton, ... should be only accessed by AWT-EventDispatchThread)
3232
* how to keep the view "responsive" by kicking off background actions (-> SwingWorker, new Thread(...), ExecutorService, ...)
33-
* how to connect an ActionListener on e.g. a "Cancel" button with a just started SwingWorker and disconnect it after the SwingWorker finished
3433
* how to combine the results from multiple asynchronous actions (multiple SwingWorker's, Thread's, Future's, ...) into one result for the view
3534
* how to implement Undo/Redo, Validation, Exception-Handling, Timeouts, ...
3635
* how to enforce acyclic relationships between "stuff" to get good (isolated) testability
36+
* how to connect an ActionListener on e.g. a "Cancel" button with a just started SwingWorker and disconnect it after the SwingWorker finished
3737
* ...
3838

3939
So, which GUI architecture should you choose? What are the benefits and drawbacks in general? And for your current project?
@@ -47,12 +47,12 @@ One day, I had a deep lock at https://en.wikipedia.org/wiki/Model_View_ViewModel
4747

4848
* using https://github.com/ReactiveX/RxJava[RxJava]'s http://reactivex.io/documentation/subject.html[Subject] objects as "listenable" value objects for the ViewModel
4949
* https://github.com/ReactiveX/RxSwing[RxSwing] to connect the View widgets (JButton, JTextField, ...) to the ViewModel-Subjects as "data binding"
50-
* https://github.com/ReactiveX/RxJava[RxJava] to react on changes of the ViewModel-Subjects and interact with the Model (backend)
50+
* https://github.com/ReactiveX/RxJava[RxJava] to react on changes of the ViewModel-Subjects and interact with the Model (backend) -> fluent API for "flows" (aka streams, pipeline)
5151
* use RxJava's http://reactivex.io/documentation/scheduler.html[Scheduler] and the RxSwing https://github.com/ReactiveX/RxSwing/blob/0.x/src/main/java/rx/schedulers/SwingScheduler.java[SwingScheduler] to do the threading
5252

5353
image::Java_MVVM_RxJava_basic_idea.png[]
5454

55-
I started with some small examples for different aspects. The solution was really nice IMO and I'd like to share it with you through this github repo.
55+
I started with some small examples for different aspects. The examples were really nice IMO and I'd like to share it with you through this github repo.
5656

5757
== Implementing MVVM using RxJava and RxSwing
5858

@@ -79,7 +79,7 @@ image::MVVM_dependencies.png[]
7979

8080
* Threading
8181
** All the action between View and ViewModel happens on the `SwingScheduler`
82-
** All the action between ViewModel and Model happens on `Schedulers.io()` (= cached thread pool)
82+
** All the action between ViewModel and Model happens "async" on `Schedulers.io()` (= cached thread pool)
8383

8484
* View
8585
** DataBinding
@@ -90,11 +90,11 @@ image::MVVM_dependencies.png[]
9090
* ViewModel
9191
** Per View exits a ViewModel
9292
*** The ViewModel represents the structure of the View 1:1
93-
** We use http://reactivex.io/documentation/subject.html[Subject]'s as "fields" in the ViewModel
93+
** We use http://reactivex.io/documentation/subject.html[Rx Subject]'s as "fields" in the ViewModel
9494
*** Each subject "field" in the ViewModel corresponds to one widget in the View
9595
*** We use a little prefix for the "field" name like `v2vm_` or `vm2v_` to indicate the flow direction
9696
*** We use the `BehaviorSubject` class for Subject instances, which is a stateful Subject to have the "current" state, an initial state and easy testability
97-
** The ViewModel handles all the "complicated" interaction stuff between View and Model
97+
** The ViewModel handles all the "complicated" interaction stuff between View and Model (threading, exception handling, flows, ...)
9898

9999
* Model
100100
** The Model doesn't care about it's presentation and just offers an API
@@ -108,6 +108,9 @@ together with some additional fluent API code for "nice" DataBinding.
108108

109109
The examples start simple and get more and more complicated, adding additional aspects and features.
110110

111+
There is not a "full example" which shows all aspects at the moment, since this is just some code to figure out
112+
how to build MVVM using RxJava and RxSwing. Every example shows just one or more aspects.
113+
111114
Scope: +
112115
The *current* examples are all "everything in one process" examples: View, ViewModel and Model run in one process in the same JVM. +
113116
Upcoming examples might include JavaFx, Android, Web and of course some kind of remoting to split "things" across multiple processes.

0 commit comments

Comments
 (0)