nbrugger-tgm / reactj

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

[Feature] Super object binding #30

Closed nbrugger-tgm closed 3 years ago

nbrugger-tgm commented 3 years ago

At the moment you can just bind to a single property.

Example:

Car (object)
  |-- name (string)
  +-- broken (boolean)

At the moment if you create a JLabel you can just bind name or broken to the text of the label. But you cannot combine them

Solution

Enable super binding. Super binding means that you bind to multiple properties and then receive the whole Car object instead of just one property

Examples

binder.superBind(label::setText,this::nameComposition,"name","broken");

with

public String nameComposition(Car c){
  return (c.broken ? "(broken)" : "" )+c.name;
}

The second option offers more features and would most likely the choice for implementation

nbrugger-tgm commented 3 years ago

Done

The feature is aviable since