use of org.qi4j.lib.swing.binding.SwingAdapter in project qi4j-sdk by Qi4j.
the class BoundAssociation method use.
public void use(Association<T> actualAssociation) {
actual = actualAssociation;
T value = null;
if (actualAssociation != null) {
value = actualAssociation.get();
}
stateModel.use(value);
for (JComponent component : components) {
SwingAdapter adapter = adapters.get(component.getClass());
adapter.fromAssociationToSwing(component, actualAssociation);
for (FocusListener listener : component.getFocusListeners()) {
if (AssociationFocusLostListener.class.isInstance(listener)) {
((AssociationFocusLostListener) listener).use(adapter, actual);
}
}
}
}
use of org.qi4j.lib.swing.binding.SwingAdapter in project qi4j-sdk by Qi4j.
the class BoundProperty method use.
public void use(Property<T> actualProperty) {
T value = null;
if (actualProperty != null) {
value = actualProperty.get();
}
stateModel.use(value);
for (JComponent component : components) {
SwingAdapter adapter = adapters.get(component.getClass());
adapter.fromPropertyToSwing(component, actualProperty);
for (FocusListener listener : component.getFocusListeners()) {
if (PropertyFocusLostListener.class.isInstance(listener)) {
((PropertyFocusLostListener) listener).use(adapter, actualProperty);
}
}
}
}
use of org.qi4j.lib.swing.binding.SwingAdapter in project qi4j-sdk by Qi4j.
the class AbstractBinding method setupAdapters.
private void setupAdapters(Iterable<SwingAdapter> allAdapters) {
adapters = new HashMap<Class<? extends JComponent>, SwingAdapter>();
for (SwingAdapter adapterCandidate : allAdapters) {
Set<SwingAdapter.Capabilities> canHandle = adapterCandidate.canHandle();
for (SwingAdapter.Capabilities capabilities : canHandle) {
if (requiredCapabilitySatisfied(capabilities)) {
if (capabilities.type.equals(this.type)) {
Class<? extends JComponent> component = capabilities.component;
adapters.put(component, adapterCandidate);
}
}
}
}
}
Aggregations