org.robobinding.binder.ResolvedBindingAttributesForView 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.binder;
import java.util.Collection;
import java.util.List;
import org.robobinding.BindingContext;
import org.robobinding.viewattribute.AttributeBindingException;
import org.robobinding.viewattribute.ViewAttributeBinder;
import org.robobinding.viewattribute.grouped.AttributeGroupBindingException;
import com.google.common.collect.Lists;
/**
*
* @since 1.0
* @version $Revision: 1.0 $
* @author Robert Taylor
* @author Cheng Wei
*/
public class ResolvedBindingAttributesForView {
private Object view;
private final List viewAttributes;
ResolvedBindingAttributesForView(Object view, Collection viewAttributes) {
this.view = view;
this.viewAttributes = Lists.newArrayList(viewAttributes);
}
public ViewBindingErrors bindTo(BindingContext bindingContext) {
ViewBindingErrors viewBindingError = new ViewBindingErrors(view);
for (ViewAttributeBinder viewAttribute : viewAttributes) {
try {
viewAttribute.bindTo(bindingContext);
} catch (AttributeBindingException e) {
viewBindingError.addAttributeError(e);
} catch (AttributeGroupBindingException e) {
viewBindingError.addAttributeGroupError(e);
}
}
return viewBindingError;
}
public void preinitializeView(BindingContext bindingContext) {
for (ViewAttributeBinder viewAttribute : viewAttributes) {
viewAttribute.preInitializeView(bindingContext);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy