Esempio n. 1
0
 public GnosisGalleryItemController(
     GnosisGalleryItem galleryItem,
     //  IGnosisGalleryItemImplementation galleryItemImplementation,
     GnosisInstanceController instanceController,
     GnosisGalleryItemController parent)
     : base(galleryItem, instanceController, parent)
 {
     childControllers = new List <GnosisGalleryItemController>();
 }
Esempio n. 2
0
        public static GnosisGalleryItem CreateGnosisGalleryItem(int order, bool expanded)
        {
            GnosisGalleryItem galleryItem = new GnosisGalleryItem();

            galleryItem.ID             = GlobalData.Singleton.GetNewControlID();
            galleryItem.GnosisName     = "GalleryItem" + galleryItem.ID;
            galleryItem.Order          = order;
            galleryItem.ControlType    = ControlTypeMapping.GetControlTypeName(typeof(GnosisGalleryItem));
            galleryItem.GnosisExpanded = expanded;

            return(galleryItem);
        }
        public void LoadData(GnosisInstance instance, bool expanded)
        {
            //Get the data rows from the instance
            IEnumerable <XElement> dataRows = instanceController.GetDataRows(galleryDatasetItem.Dataset);

            //Find the attribute to use for the caption
            GnosisGallerySearchAttribute captionGalleryAttribute = galleryDatasetItem.GalleryAttributes.Where(a => a.GalleryRole.Equals("Caption")).First();
            string captionAttributeName = instanceController.GetTargetAttributeName(captionGalleryAttribute.Dataset, captionGalleryAttribute.DatasetItem);
            int    order = 1;
            int    index = 0;

            foreach (var row in dataRows)
            {
                GnosisGalleryItem galleryItem = GnosisControlCreator.CreateGnosisGalleryItem(order++, expanded);
                // IGnosisGalleryItemImplementation galleryItemImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisGalleryItemImplementation();
                GnosisGalleryItemController itemController = new GnosisGalleryItemController(galleryItem, instanceController, parent);
                itemController.Setup();

                galleryItem.Caption = row.Attribute(captionAttributeName).Value;

                foreach (GnosisGallerySearchItem searchItem in galleryDatasetItem.GallerySearchItems)
                {
                    GnosisGallerySearchItem searchItemClone = GnosisControlCreator.CreateGnosisGallerySearchItem(searchItem);
                    // IGnosisGalleryItemImplementation childImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisGalleryItemImplementation();
                    GnosisGallerySearchItemController childController = new GnosisGallerySearchItemController(searchItemClone, instanceController, itemController, index);
                    childController.Setup();

                    itemController.AddGalleryItemController(childController);
                    // galleryItem.GnosisAddChild(searchItemClone);
                    //galleryItemImplementation.AddGalleryItem(childImplementation);
                }

                foreach (GnosisGalleryDocumentItem docItem in galleryDatasetItem.GalleryDocumentItems)
                {
                    // IGnosisGalleryItemImplementation childImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisGalleryItemImplementation();
                    GnosisGalleryDocumentItem           docItemClone    = GnosisControlCreator.CreateGnosisGalleryDocumentItem(docItem);
                    GnosisGalleryDocumentItemController childController = new GnosisGalleryDocumentItemController(docItemClone, instanceController, itemController, index);
                    childController.Setup();

                    itemController.AddGalleryItemController(childController);
                    //  galleryItem.GnosisAddChild(docItemClone);
                }

                // itemController.LoadGalleryItems();

                index++;
                parent.AddGalleryItemController(itemController);
                //  ((GnosisGalleryItem)parent.ControlImplementation).GnosisAddChild(itemController.ControlImplementation);
                //   ((IGnosisGalleryImplementation)parent.ControlImplementation).AddGalleryItem(galleryItemImplementation);
            }

            // parent.LoadGalleryItems();
        }