Example #1
0
        public DecorationsController(IDecorationPresenter <LineDecorationModel> decoratorPresenter)
        {
            this.decorationPresenter     = decoratorPresenter;
            this.rowLinesElementsPool    = new DecorationPool <LineDecorationModel>(decoratorPresenter);
            this.columnLinesElementsPool = new DecorationPool <LineDecorationModel>(decoratorPresenter);

            this.displayedRowDecorationsMap    = new Dictionary <int, LineDecorationModel>();
            this.displayedColumnDecorationsMap = new Dictionary <int, LineDecorationModel>();
        }
Example #2
0
        private static void RecycleDecorator(int id, DecorationPool <LineDecorationModel> displayData, Dictionary <int, LineDecorationModel> decorators)
        {
            LineDecorationModel decorator;

            if (decorators.TryGetValue(id, out decorator))
            {
                displayData.Recycle(decorator);
                decorators.Remove(id);
            }
        }
Example #3
0
        private static LineDecorationModel CreateDecorator(ItemInfo itemInfo, DecorationType decoratorElementType, DecorationPool <LineDecorationModel> displayData, IDecorationPresenter <LineDecorationModel> owner)
        {
            if (owner == null)
            {
                return(null);
            }

            var lineDecorator = displayData.GetRecycledElement();

            if (lineDecorator == null)
            {
                lineDecorator           = new LineDecorationModel();
                lineDecorator.Container = owner.GenerateContainerForDecorator();
            }

            lineDecorator.ItemInfo = itemInfo;

            owner.ApplyDecoratorProperties(lineDecorator, decoratorElementType);

            displayData.AddToDisplayedElements(lineDecorator);

            return(lineDecorator);
        }
Example #4
0
        private static void GenerateDecorator(int id, ItemInfo itemInfo, DecorationType decoratorElementType, DecorationPool <LineDecorationModel> decorationPool, Dictionary <int, LineDecorationModel> decorators, IDecorationPresenter <LineDecorationModel> owner)
        {
            LineDecorationModel decorator = null;

            if (owner != null && !decorators.TryGetValue(id, out decorator))
            {
                decorator = CreateDecorator(itemInfo, decoratorElementType, decorationPool, owner);
                decorators.Add(id, decorator);
            }
            else if (owner != null)
            {
                decorator.ItemInfo = itemInfo;
                owner.ApplyDecoratorProperties(decorator, decoratorElementType);
            }
        }
Example #5
0
 public SelectionRegionController(IDecorationPresenter <SelectionRegionModel> decoratorPresenter)
 {
     this.decoratorPresenter   = decoratorPresenter;
     this.selectionRegionsPool = new DecorationPool <SelectionRegionModel>(decoratorPresenter);
 }