|
|
@@ -1,31 +1,34 @@
|
|
|
package net.ranides.assira.ui.query;
|
|
|
|
|
|
-import javax.accessibility.AccessibleContext;
|
|
|
+import net.ranides.assira.generic.LazySupplier;
|
|
|
+import net.ranides.assira.generic.LazySuppliers;
|
|
|
import net.ranides.assira.generic.Ref;
|
|
|
-import net.ranides.assira.reflection.*;
|
|
|
+import net.ranides.assira.reflection.BeanModel;
|
|
|
+import net.ranides.assira.reflection.BeanPropertyBinding;
|
|
|
+import net.ranides.assira.reflection.IClass;
|
|
|
|
|
|
+import javax.accessibility.AccessibleContext;
|
|
|
import java.awt.*;
|
|
|
import java.util.Map;
|
|
|
-import java.util.Optional;
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
|
class RComponent implements IComponent {
|
|
|
|
|
|
private final Component component;
|
|
|
|
|
|
- private final BeanModel model;
|
|
|
+ private final LazySupplier<BeanModel> model;
|
|
|
|
|
|
- private final BeanModel.FluentMap fluent;
|
|
|
+ private final LazySupplier<BeanModel.FluentMap> fluent;
|
|
|
|
|
|
RComponent(Component component) {
|
|
|
this.component = component;
|
|
|
- this.model = BeanModel.typefor(component);
|
|
|
- this.fluent = model.fluent(component);
|
|
|
+ this.model = LazySuppliers.concurrent(() -> BeanModel.typefor(component));
|
|
|
+ this.fluent = LazySuppliers.concurrent(() -> model.compute().fluent(component));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public IClass<?> type() {
|
|
|
- return model.type();
|
|
|
+ return model.compute().type();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -54,12 +57,12 @@ class RComponent implements IComponent {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> properties() {
|
|
|
- return fluent;
|
|
|
+ return fluent.compute();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public BeanPropertyBinding<Object> property(String name) {
|
|
|
- BeanPropertyBinding<Object> binding = fluent.getBinding(name);
|
|
|
+ BeanPropertyBinding<Object> binding = fluent.compute().getBinding(name);
|
|
|
if(binding == null) {
|
|
|
throw new IllegalArgumentException("Unknown property " + component + ":" + name);
|
|
|
}
|
|
|
@@ -68,7 +71,7 @@ class RComponent implements IComponent {
|
|
|
|
|
|
@Override
|
|
|
public void property(String name, Object value) {
|
|
|
- fluent.put(name, value);
|
|
|
+ fluent.compute().put(name, value);
|
|
|
}
|
|
|
|
|
|
@Override
|