using Xpand.Persistent.Base.ModelAdapter;

namespace Xpand.ExpressApp.Win.ListEditors.GridListEditors.LayoutView.Model {
//    public class LayoutViewLstEditorDynamicModelSynchronizer : ModelListSynchronizer {
//        public LayoutViewLstEditorDynamicModelSynchronizer(LayoutViewListEditor columnViewEditor)
//            : base(columnViewEditor, columnViewEditor.Model) {
//
////            ModelSynchronizerList.Add(new LayoutViewLayoutStoreSynchronizer(columnViewEditor));
//            ModelSynchronizerList.Add(new LayoutViewListEditorSynchronizer(columnViewEditor));
////            ModelSynchronizerList.Add(new LayoutViewOptionsSynchronizer(columnViewEditor));
////            ModelSynchronizerList.Add(new LayoutColumnOptionsSynchroniser(columnViewEditor));
////            ModelSynchronizerList.Add(new RepositoryItemColumnViewSynchronizer(columnViewEditor.ColumnView, columnViewEditor.Model));
//
//        }
//    }

//    public class LayoutViewLayoutStoreSynchronizer : ColumnViewEditorLayoutStoreSynchronizer {
//        public LayoutViewLayoutStoreSynchronizer(LayoutViewListEditor control)
//            : base(control, control.Model.OptionsLayoutView.DesignLayoutView) {
//        }
//
//        protected override bool SynchronizeModelCore(){
//            return true;
//        }
//    }

//    public class LayoutViewOptionsSynchronizer : ComponentSynchronizer<XafLayoutView, IModelOptionsLayoutView> {
//        public LayoutViewOptionsSynchronizer(LayoutViewListEditor layoutViewListEditor)
//            : base((XafLayoutView) layoutViewListEditor.ColumnView, layoutViewListEditor.Model.OptionsLayoutView, ((IColumnViewEditor)layoutViewListEditor).OverrideViewDesignMode) {
//        }
//        protected override object GetSynchronizeValuesNodeValue(ModelNode modelNode, ModelValueInfo valueInfo, PropertyDescriptor propertyDescriptor, bool isNullableType, object component) {
//            var overrideViewDesignMode = OverrideViewDesignMode;
//            var synchronizeValuesNodeValue = base.GetSynchronizeValuesNodeValue(modelNode, valueInfo, propertyDescriptor, !overrideViewDesignMode && isNullableType, component);
//            if (overrideViewDesignMode)
//                return PropertyDefaultValue(synchronizeValuesNodeValue, modelNode, propertyDescriptor, valueInfo, component);
//            return synchronizeValuesNodeValue;
//        }
//    }

//    public class LayoutColumnOptionsSynchroniser : ColumnViewEditorColumnOptionsSynchronizer<LayoutViewListEditor, IModelListViewOptionsLayoutView, IModelColumnOptionsLayoutView> {
//        public LayoutColumnOptionsSynchroniser(LayoutViewListEditor control)
//            : base(control, control.Model) {
//        }
//
//        protected override void ApplyModelCore() {
//            base.ApplyModelCore();
//            foreach (GridColumn column in Control.ColumnView.Columns) {
//                column.OptionsColumn.AllowEdit = Control.Model.AllowEdit;
//            }
//        }
//        protected override object GetSynchronizeValuesNodeValue(ModelNode modelNode, ModelValueInfo valueInfo, PropertyDescriptor propertyDescriptor, bool isNullableType, object component) {
//            var overrideViewDesignMode = ((IColumnViewEditor)Control).OverrideViewDesignMode;
//            var synchronizeValuesNodeValue = base.GetSynchronizeValuesNodeValue(modelNode, valueInfo, propertyDescriptor, !overrideViewDesignMode && isNullableType, component);
//            if (overrideViewDesignMode)
//                return PropertyDefaultValue(synchronizeValuesNodeValue, modelNode, propertyDescriptor, valueInfo, component);
//            return synchronizeValuesNodeValue;
//        }
//
//        protected override DevExpress.XtraGrid.Views.Base.ColumnView GetColumnView() {
//            return Control.ColumnView;
//        }
//
//        protected override IModelColumnViewColumnOptions GetColumnOptions(IModelColumnOptionsLayoutView modelColumnOptionsView) {
//            return modelColumnOptionsView.OptionsColumnLayoutView;
//        }
//    }
}
