org.robobinding.viewattribute.property.PropertyViewAttributeBinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robobinding Show documentation
Show all versions of robobinding Show documentation
A Presentation Model(MVVM) framework for the Android platform
package org.robobinding.viewattribute.property;
import org.robobinding.BindingContext;
import org.robobinding.viewattribute.AttributeBindingException;
import org.robobinding.viewattribute.ViewAttributeBinder;
/**
*
* @since 1.0
* @version $Revision: 1.0 $
* @author Robert Taylor
* @author Cheng Wei
*/
public class PropertyViewAttributeBinder implements ViewAttributeBinder {
private final AbstractBindingProperty bindingProperty;
private final String attributeName;
public PropertyViewAttributeBinder(AbstractBindingProperty bindingProperty,
String attributeName) {
this.bindingProperty = bindingProperty;
this.attributeName = attributeName;
}
@Override
public void bindTo(BindingContext bindingContext) {
try {
bindingProperty.performBind(bindingContext);
if (bindingProperty.isAlwaysPreInitializingView()) {
bindingProperty.preInitializeView(bindingContext);
}
} catch (RuntimeException e) {
throw new AttributeBindingException(attributeName, e);
}
}
@Override
public void preInitializeView(BindingContext bindingContext) {
if (bindingProperty.isAlwaysPreInitializingView()) {
return;
}
try {
bindingProperty.preInitializeView(bindingContext);
} catch (RuntimeException e) {
throw new AttributeBindingException(attributeName, e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy