public GnosisGalleryDocumentItemController( GnosisGalleryDocumentItem searchItem, // IGnosisGalleryItemImplementation searchItemImplementation, GnosisInstanceController instanceController, GnosisGalleryItemController parent, int _index) : base(searchItem, instanceController, parent) { index = _index; }
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(); }
internal static GnosisGalleryDocumentItem CreateGnosisGalleryDocumentItem(GnosisGalleryDocumentItem docItem) { GnosisGalleryDocumentItem galleryItem = new GnosisGalleryDocumentItem(); galleryItem.ID = GlobalData.Singleton.GetNewControlID(); galleryItem.GnosisName = "GallerySearchItem" + galleryItem.ID.ToString(); galleryItem.Order = docItem.Order; galleryItem.ControlType = ControlTypeMapping.GetControlTypeName(typeof(GnosisGalleryDocumentItem)); galleryItem.Caption = docItem.Caption; galleryItem.GnosisExpanded = docItem.GnosisExpanded; galleryItem.DocumentEntityID = docItem.DocumentEntityID; galleryItem.DocumentSystemID = docItem.DocumentSystemID; galleryItem.DocumentAction = docItem.DocumentAction; return(galleryItem); }