nbrugger-tgm / reactj

A reactive ui lib for easy MVC
LaTeX Project Public License v1.3c
10 stars 0 forks source link

[Feature] Pseudo Proxy #31

Closed nbrugger-tgm closed 3 years ago

nbrugger-tgm commented 3 years ago

In order to use generic and automatic reactive Objects you need to use ReactiveProxy<M>.

The problem is that you always have to use ReactiveProxy<MyObject> instead of MyObject, which is a little inconvenient

nbrugger-tgm commented 3 years ago

implemented

The changes are now implemented.

Changes

  1. You can now make your data class implement ProxySubject (markup interface, no methods needed)
  2. "Old style" proxies will now be created using ReactiveProxy.createProxy
  3. "New style" proxies will now be created using ReactiveProxy.create
nbrugger-tgm commented 3 years ago

[BUG] Proxy subject methods not forwarded correctly

When binding a proxy subject (properly created) to a UI changes in the UI don't reflect in the object/subject

this is due to a wong condition in ReactiveProxy

if (thisMethod.getDeclaringClass().equals(ProxySubject.class)) {
            return this.forwardProxySubjectCallToMyself(thisMethod, args);
}

this will allways return false as the declaring class is still Reactable

nbrugger-tgm commented 3 years ago

Reproduced

The bug was reporduced and is now covered by a testcase.

The previous explanation was only partial right.

if (thisMethod.getDeclaringClass().equals(ProxySubject.class)) {
            return this.forwardProxySubjectCallToMyself(thisMethod, args);
}

worked for the most part as only one method slips through. This is due to ReactiveSubject overwriting all methods except one. Therefore mentioned method (set(Map<String,Object>)) didn't activated the if statement

nbrugger-tgm commented 3 years ago

fix merged

the fix will be shipped version 3.1.0b2