File tree Expand file tree Collapse file tree 7 files changed +18
-18
lines changed
src/main/java/ch/petikoch/examples/mvvm_rxjava Expand file tree Collapse file tree 7 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 2323
2424import java .awt .event .ActionEvent ;
2525
26- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
26+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
2727
2828@ ThreadSafe
2929class Example_2_ViewModel implements IViewModel <Example_2_Model > {
@@ -46,7 +46,7 @@ private void wireInternally() {
4646
4747 @ Override
4848 public void connectTo (final Example_2_Model model ) {
49- bindViewModel (vm2m_nameFirstname ).toAction (model ::submit );
49+ onEventFrom (vm2m_nameFirstname ).execute (model ::submit );
5050 }
5151
5252}
Original file line number Diff line number Diff line change 2525
2626import java .awt .event .ActionEvent ;
2727
28- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
28+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
2929
3030@ ThreadSafe
3131class Example_3_ViewModel implements IViewModel <Example_3_Model > {
@@ -54,6 +54,6 @@ private void wireInternally() {
5454
5555 @ Override
5656 public void connectTo (final Example_3_Model model ) {
57- bindViewModel (vm2m_nameFirstname ).toAction (model ::submit );
57+ onEventFrom (vm2m_nameFirstname ).execute (model ::submit );
5858 }
5959}
Original file line number Diff line number Diff line change 2525
2626import java .awt .event .ActionEvent ;
2727
28- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
28+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
2929
3030@ ThreadSafe
3131class Example_4_ViewModel implements IViewModel <Example_4_Model > {
@@ -63,7 +63,7 @@ private void wireInternally() {
6363
6464 @ Override
6565 public void connectTo (final Example_4_Model model ) {
66- bindViewModel (vm2m_nameFirstname ).toAction (nameFirstname -> {
66+ onEventFrom (vm2m_nameFirstname ).execute (nameFirstname -> {
6767 model .submit (nameFirstname );
6868
6969 vm2v_nameEnabled .onNext (true );
Original file line number Diff line number Diff line change 2828
2929import java .awt .event .ActionEvent ;
3030
31- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
31+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
3232
3333@ ThreadSafe
3434class Example_5_ViewModel implements IViewModel <Example_5_Model > {
@@ -70,7 +70,7 @@ private void wireInternally() {
7070
7171 @ Override
7272 public void connectTo (final Example_5_Model model ) {
73- bindViewModel (vm2m_nameFirstname ).toAction (nameFirstname -> {
73+ onEventFrom (vm2m_nameFirstname ).execute (nameFirstname -> {
7474
7575 Single <Boolean > modelCallFinished = Single .<Boolean >create (singleSubscriber -> {
7676 try {
Original file line number Diff line number Diff line change 2626
2727import java .awt .event .ActionEvent ;
2828
29- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
29+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
3030
3131@ ThreadSafe
3232class Example_5a_ViewModel implements IViewModel <Example_5a_Model > {
@@ -68,7 +68,7 @@ private void wireInternally() {
6868
6969 @ Override
7070 public void connectTo (final Example_5a_Model model ) {
71- bindViewModel (vm2m_nameFirstname ).toAction (nameFirstname -> {
71+ onEventFrom (vm2m_nameFirstname ).execute (nameFirstname -> {
7272
7373 Single .merge (model .submit (nameFirstname ), v2vm_cancelButtonEvents .first ().toSingle ())
7474 .toBlocking ()
Original file line number Diff line number Diff line change 2727
2828import java .awt .event .ActionEvent ;
2929
30- import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxViewModel2ModelBinder . bindViewModel ;
30+ import static ch .petikoch .examples .mvvm_rxjava .rxjava_mvvm .RxModelInvoker . onEventFrom ;
3131
3232@ ThreadSafe
3333class Example_6_ViewModel implements IViewModel <Example_6_Model > {
@@ -77,7 +77,7 @@ private void wireInternally() {
7777
7878 @ Override
7979 public void connectTo (final Example_6_Model model ) {
80- bindViewModel (vm2m_nameFirstname ).toAction (nameFirstname -> {
80+ onEventFrom (vm2m_nameFirstname ).execute (nameFirstname -> {
8181
8282 vm2v_resultat1 .onNext ("Creating acount..." );
8383 vm2v_resultat2 .onNext ("Sending email..." );
Original file line number Diff line number Diff line change 1919import rx .functions .Action1 ;
2020import rx .schedulers .Schedulers ;
2121
22- public class RxViewModel2ModelBinder {
22+ public class RxModelInvoker {
2323
24- public static <T > BindOfAble <T > bindViewModel (Observable <T > source ) {
25- return new BindOfAble <>(source );
24+ public static <T > ModelInvoker <T > onEventFrom (Observable <T > source ) {
25+ return new ModelInvoker <>(source );
2626 }
2727
28- public static class BindOfAble <T > {
28+ public static class ModelInvoker <T > {
2929
3030 private final Observable <T > source ;
3131
32- private BindOfAble (final Observable <T > source ) {
32+ private ModelInvoker (final Observable <T > source ) {
3333 this .source = source ;
3434 }
3535
36- public void toAction (final Action1 <? super T > onNext ) {
36+ public void execute (final Action1 <? super T > onNext ) {
3737 source .observeOn (Schedulers .io ()).subscribe (onNext );
3838 }
3939
You can’t perform that action at this time.
0 commit comments