/** * create data-binding for target object. * * @param target the target object. */ public DataBinding(T target) { Throwables.checkNull(target); this.mTarget = target; }
public FamilyManager(BaseMediator<T> mediator, List<FamilyGroup> groups) { Throwables.checkEmpty(groups); Throwables.checkNull(mediator); this.mMediator = mediator; //prepare for (FamilyGroup fg : groups) { List<FamilyGroup> list = mGroups.get(fg.type); if (list == null) { list = new ArrayList<>(4); mGroups.put(fg.type, list); } list.add(fg); } }
/** * set item on target index. * @param index the index to set * @param newT the new item to set . * @return this * @since 1.1.2 */ public ListPropertyEditor<D, T> set(int index ,T newT){ Throwables.checkNegativeValue(index); Throwables.checkNull(newT); if(mList.size() <= index){ throw new IllegalArgumentException(); } T old = mList.set(index, newT); //dispatch if need. if (mMediator != null) { mMediator.dispatchItemChanged(mProperty, old, newT, index); } return this; }
/** * remove the index data from collection. * @param index the index data * @return this */ public ListPropertyEditor<D, T> remove(int index){ Throwables.checkNegativeValue(index); if(mList.size()> index){ T t = mList.remove(index); if(mMediator != null && t != null) { ensureTempNotNull(); mTemp.add(t); mMediator.dispatchRemoveValues(mProperty, mList, mTemp); mTemp.clear(); } } return this; } /**
public FamilyManager(BaseMediator<T> mediator, List<FamilyGroup> groups) { Throwables.checkEmpty(groups); Throwables.checkNull(mediator); this.mMediator = mediator; //prepare for (FamilyGroup fg : groups) { List<FamilyGroup> list = mGroups.get(fg.type); if (list == null) { list = new ArrayList<>(4); mGroups.put(fg.type, list); } list.add(fg); } }
/** * set item on target index. * @param index the index to set * @param newT the new item to set . * @return this * @since 1.1.2 */ public ListPropertyEditor<D, T> set(int index ,T newT){ Throwables.checkNegativeValue(index); Throwables.checkNull(newT); if(mList.size() <= index){ throw new IllegalArgumentException(); } T old = mList.set(index, newT); //dispatch if need. if (mMediator != null) { mMediator.dispatchItemChanged(mProperty, old, newT, index); } return this; }
/** * remove the index data from collection. * @param index the index data * @return this */ public ListPropertyEditor<D, T> remove(int index){ Throwables.checkNegativeValue(index); if(mList.size()> index){ T t = mList.remove(index); if(mMediator != null && t != null) { ensureTempNotNull(); mTemp.add(t); mMediator.dispatchRemoveValues(mProperty, mList, mTemp); mTemp.clear(); } } return this; } /**
/** * create list binder callback with item manager. * @param mCallback the item manager. */ public BaseListPropertyCallback(IItemManager<T> mCallback) { Throwables.checkNull(mCallback); this.mCallback = mCallback; }
/** * set the property interceptor . default is {@linkplain PropertyInterceptor#NULL} * @param interceptor the target property interceptor. * @since 1.1.3 */ protected void _setPropertyInterceptor(PropertyInterceptor interceptor) { Throwables.checkNull(interceptor); this._mInterceptor = interceptor; }
/** * set the equals comparator * * @param comparator the equals comparator * @since 1.0.2 */ protected void _setEqualsComparator(EqualsComparator comparator) { Throwables.checkNull(comparator); this._mEqualsComparator = comparator; }
/** * create batch base view binder for target view * @param mBinder the binder impl * @param view the view . on android is any child of 'android.view.View'. */ public BatchViewBinder(Binder<T> mBinder, Object view) { Throwables.checkNull(mBinder); Throwables.checkNull(view); this.mBinder = mBinder; this.mView = view; }
/** * set the equals comparator * * @param comparator the equals comparator * @since 1.0.2 */ protected void _setEqualsComparator(EqualsComparator comparator) { Throwables.checkNull(comparator); this._mEqualsComparator = comparator; }
/** * set the property interceptor . default is {@linkplain PropertyInterceptor#NULL} * @param interceptor the target property interceptor. * @since 1.1.3 */ protected void _setPropertyInterceptor(PropertyInterceptor interceptor) { Throwables.checkNull(interceptor); this._mInterceptor = interceptor; }
/** * create list binder callback with item manager. * @param mCallback the item manager. */ public BaseListPropertyCallback(IItemManager<T> mCallback) { Throwables.checkNull(mCallback); this.mCallback = mCallback; }
/** * create data-binding for target object. * * @param target the target object. */ public DataBinding(T target) { Throwables.checkNull(target); this.mTarget = target; }
/** * create batch base view binder for target view * @param mBinder the binder impl * @param view the view . on android is any child of 'android.view.View'. */ public BatchViewBinder(Binder<T> mBinder, Object view) { Throwables.checkNull(mBinder); Throwables.checkNull(view); this.mBinder = mBinder; this.mView = view; }
/** * apply the all properties with target interceptor. * * @param interceptor the interceptor * @since 1.0.8 */ public void applyProperties(PropertyInterceptor interceptor) { Throwables.checkNull(interceptor); throw new UnsupportedOperationException("you must override this method."); }
/** * apply the all properties with target interceptor. * * @param interceptor the interceptor * @since 1.0.8 */ public void applyProperties(PropertyInterceptor interceptor) { Throwables.checkNull(interceptor); throw new UnsupportedOperationException("you must override this method."); }
/** * create {@linkplain DataMediatorCallback} by target property name and callback. * @param propertyName the property name * @param callback the common property callback * @param <T> the module data type * @return the data mediator callback. * @since 1.0.8 */ public static <T> DataMediatorCallback<T> create(final String propertyName, final PropertyCallback<? super T> callback) { Throwables.checkNull(propertyName); Throwables.checkNull(callback); return new NameableCallback<T>(propertyName) { @Override public void onPropertyValueChanged(T data, Property prop, Object oldValue, Object newValue) { if (allow(prop)) { callback.onPropertyValueChanged(data, prop, oldValue, newValue); } } @Override public void onPropertyApplied(T data, Property prop, Object value) { if (allow(prop)) { callback.onPropertyApplied(data, prop, value); } } }; }
/** * create {@linkplain DataMediatorCallback} by target property name and callback. * @param propertyName the property name * @param callback the common property callback * @param <T> the module data type * @return the data mediator callback. * @since 1.0.8 */ public static <T> DataMediatorCallback<T> create(final String propertyName, final PropertyCallback<? super T> callback) { Throwables.checkNull(propertyName); Throwables.checkNull(callback); return new NameableCallback<T>(propertyName) { @Override public void onPropertyValueChanged(T data, Property prop, Object oldValue, Object newValue) { if (allow(prop)) { callback.onPropertyValueChanged(data, prop, oldValue, newValue); } } @Override public void onPropertyApplied(T data, Property prop, Object value) { if (allow(prop)) { callback.onPropertyApplied(data, prop, value); } } }; }