Пример #1
0
        public bool Process(Enum moduleKind, IModuleObject moduleObject, Folder folder, IGeneratorConfiguration generatorConfiguration)
        {
            var angularModule = (AngularModule)moduleObject;
            var baseObject    = moduleObject.BaseObject;
            IEnumerable <ModuleImportDeclaration> imports;
            var name                = baseObject.GetNavigationName();
            var parentObject        = (IParentBase)baseObject;
            var modulesOrAssemblies = new List <IModuleOrAssembly>();

            if (!moduleObject.ValidateModuleName(name, out string error))
            {
                throw new Exception(error);
            }

            if (generatorConfiguration.KeyValuePairs.ContainsKey("Providers"))
            {
                var providers = (List <Provider>)generatorConfiguration.KeyValuePairs["Providers"];

                foreach (var provider in providers)
                {
                    angularModule.Providers.Add(provider);
                }

                modulesOrAssemblies = providers.Cast <IModuleOrAssembly>().ToList();
                imports             = generatorConfiguration.CreateImports(this, angularModule, modulesOrAssemblies, folder, true);
            }
            else
            {
                imports = generatorConfiguration.CreateImports(this, angularModule, folder, true);
            }

            AppModuleGenerator.GenerateModule(baseObject, angularModule, folder.fullPath, name, generatorConfiguration, imports);

            return(true);
        }
Пример #2
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var             uiAttribute  = (UIAttribute)facet.Attribute;
            var             name         = baseObject.GetNavigationName(UIKind.BlankPage);
            var             parentObject = (IParentBase)baseObject;
            var             pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var             pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var             loadKind     = uiAttribute.UILoadKind;
            IModuleAssembly module;
            IEnumerable <ModuleImportDeclaration> imports;

            if (uiAttribute.UILoadKind == UILoadKind.RootPage)
            {
                this.Raise <ApplicationFacetHandler>();
            }

            imports = generatorConfiguration.CreateImports(this, baseObject, pagesFolder, false, 1);

            module            = generatorConfiguration.PushModuleAssembly <AngularModule>(name);
            module.UILoadKind = uiAttribute.UILoadKind;

            BlankPageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, loadKind);

            return(true);
        }
Пример #3
0
        public bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var uiAttribute  = (UIAttribute)facet.Attribute;
            var name         = baseObject.GetNavigationName();
            var parentObject = (IParentBase)baseObject;
            var pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var imports      = generatorConfiguration.CreateImports(this, baseObject, pagesFolder);
            var module       = new AngularModule(name + "Module");
            var formFields   = new List <FormField>();

            generatorConfiguration.ModuleAssemblies.Push(module);

            foreach (var childObject in parentObject.GetFormFields(generatorConfiguration.PartsAliasResolver))
            {
                if (childObject is IAttribute)
                {
                    formFields.Add(new FormField((IAttribute)childObject, generatorConfiguration));
                }
                else
                {
                }
            }

            $basename$PageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, module, formFields);

            return(true);
        }
Пример #4
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var uiAttribute  = (UIAttribute)facet.Attribute;
            var name         = baseObject.Name;
            var parentObject = (IElement)baseObject;
            var modelsPath   = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Models];
            var modelsFolder = (Folder)generatorConfiguration.FileSystem[modelsPath];
            var imports      = generatorConfiguration.CreateImports(this, baseObject, modelsFolder);
            var formFields   = new List <FormField>();

            foreach (var childObject in parentObject.GetFormFields(generatorConfiguration.PartsAliasResolver))
            {
                if (childObject is IAttribute)
                {
                    formFields.Add(new FormField((IAttribute)childObject, generatorConfiguration));
                }
                else
                {
                }
            }

            ClientModelGenerator.GenerateModel(baseObject, modelsPath, name, generatorConfiguration, imports, formFields);

            return(true);
        }
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var             uiAttribute  = (UIAttribute)facet.Attribute;
            var             name         = baseObject.GetNavigationName();
            var             parentObject = (IParentBase)baseObject;
            var             pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var             pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var             imports      = generatorConfiguration.CreateImports(this, baseObject, pagesFolder, false, 1);
            var             slidingTabs  = new List <SlidingTab>();
            var             featureKind  = uiAttribute.GetFeatureKind();
            var             isComponent  = featureKind.IsComponent();
            IModuleAssembly module;

            foreach (var childObject in parentObject.GetFollowingChildren(generatorConfiguration.PartsAliasResolver, baseObject.Kind != DefinitionKind.StaticContainer))
            {
                slidingTabs.Add(new SlidingTab(childObject, generatorConfiguration));
            }

            module             = generatorConfiguration.PushModuleAssembly <AngularModule>(name);
            module.UILoadKind  = uiAttribute.UILoadKind;
            module.IsComponent = isComponent;

            SlidingTabsPageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, slidingTabs, isComponent);

            return(true);
        }
Пример #6
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var             uiAttribute  = (UIAttribute)facet.Attribute;
            var             name         = baseObject.GetNavigationName();
            var             parentObject = (IParentBase)baseObject;
            var             pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var             pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var             imports      = generatorConfiguration.CreateImports(this, baseObject, pagesFolder, false, 1);
            var             inputObjects = new List <object>(); // TODO - change, preferably to a typed List, to match your needs
            IModuleAssembly module;

            foreach (var childObject in parentObject.GetFollowingChildren(generatorConfiguration.PartsAliasResolver))
            {
                // TODO - add code to capture children elements

                inputObjects.Add(new object());
            }

            module            = generatorConfiguration.PushModuleAssembly <AngularModule>(name);
            module.UILoadKind = uiAttribute.UILoadKind;

            $basename$PageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, module /* , .. TODO - add additional parameters */);

            return(true);
        }
Пример #7
0
        public bool Process(Enum moduleKind, IModuleObject moduleObject, Folder folder, IGeneratorConfiguration generatorConfiguration)
        {
            var angularModule = (AngularModule)moduleObject;
            var baseObject    = moduleObject.BaseObject;
            var imports       = generatorConfiguration.CreateImports(angularModule, folder, true);
            var name          = baseObject.GetNavigationName();
            var parentObject  = (IParentBase)baseObject;

            $basename$ModuleGenerator.GenerateModule(baseObject, angularModule, folder.fullPath, name, generatorConfiguration, imports);

            return(true);
        }
Пример #8
0
        public bool Process(Enum moduleKind, IModuleObject moduleObject, Folder folder, IGeneratorConfiguration generatorConfiguration)
        {
            var angularModule = (AngularModule)moduleObject;
            var baseObject    = moduleObject.BaseObject;
            var imports       = generatorConfiguration.CreateImports(this, angularModule, folder, true);
            var name          = baseObject.GetNavigationName();
            var parentObject  = (IParentBase)baseObject;

            if (!moduleObject.ValidateModuleName(name, out string error))
            {
                throw new Exception(error);
            }

            angularModule.AddImportsAndRoutes(imports);

            SlidingTabsModuleGenerator.GenerateModule(baseObject, angularModule, folder.fullPath, name, generatorConfiguration, imports);

            return(true);
        }
Пример #9
0
        public override bool Process(IBase baseObject, Facet facet, IView view, IGeneratorConfiguration generatorConfiguration)
        {
            var             name         = baseObject.GetNavigationName();
            var             parentObject = (IParentBase)baseObject;
            var             pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var             pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var             imports      = generatorConfiguration.CreateImports(this, baseObject, pagesFolder, false, 1);
            IModuleAssembly module;

            this.BaseObject = baseObject;
            this.Facet      = facet;
            this.Name       = name;

            module = generatorConfiguration.PushModuleAssembly <AngularModule>(name);

            RepeaterPageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, (View)view, this);

            return(true);
        }
Пример #10
0
        public bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var providerAttribute = (UIAttribute)facet.Attribute;
            var name            = baseObject.Name;
            var parentObject    = (IElement)baseObject;
            var providersPath   = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Providers];
            var providersFolder = (Folder)generatorConfiguration.FileSystem[providersPath];
            var imports         = generatorConfiguration.CreateImports(this, baseObject, providersFolder, true);
            var relatedEntities = new List <RelatedEntity>();

            foreach (var childObject in parentObject.GetParentNavigationProperties(generatorConfiguration.PartsAliasResolver))
            {
                relatedEntities.Add(new RelatedEntity(childObject, generatorConfiguration));
            }

            EntityProviderGenerator.GenerateProvider(baseObject, providersPath, name, generatorConfiguration, imports, relatedEntities);

            return(true);
        }
Пример #11
0
        public override bool Process(IBase baseObject, Facet facet, IGeneratorConfiguration generatorConfiguration)
        {
            var             uiAttribute  = (UIAttribute)facet.Attribute;
            var             name         = baseObject.GetNavigationName();
            var             parentObject = (IParentBase)baseObject;
            var             mainObject   = parentObject.ChildElements.Single();
            var             managedLists = new List <ManagedList>();
            var             gridColumns  = new List <GridColumn>();
            var             pagesPath    = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.Pages];
            var             pagesFolder  = (Folder)generatorConfiguration.FileSystem[pagesPath];
            var             featureKind  = uiAttribute.GetFeatureKind();
            var             isComponent  = featureKind.IsComponent();
            IModuleAssembly module;
            IEnumerable <ModuleImportDeclaration> imports;

            if (mainObject is IParentBase)
            {
                foreach (var childObject in mainObject.GetFollowingNavigationChildren(generatorConfiguration.PartsAliasResolver))
                {
                    managedLists.Add(new ManagedList(childObject, generatorConfiguration));
                }
            }

            foreach (var childObject in mainObject.GetGridColumns(generatorConfiguration.PartsAliasResolver))
            {
                gridColumns.Add(new GridColumn(childObject, generatorConfiguration));
            }

            if (uiAttribute.UILoadKind == UILoadKind.RootPage)
            {
                this.Raise <ApplicationFacetHandler>();
            }

            imports = generatorConfiguration.CreateImports(this, baseObject, pagesFolder, false, 1);

            module             = generatorConfiguration.PushModuleAssembly <AngularModule>(name);
            module.UILoadKind  = uiAttribute.UILoadKind;
            module.IsComponent = isComponent;

            NavigationGridPageGenerator.GeneratePage(baseObject, pagesPath, name, generatorConfiguration, module, imports, module, managedLists, gridColumns, isComponent);

            return(true);
        }
Пример #12
0
        public bool Terminate(IGeneratorConfiguration generatorConfiguration)
        {
            var    appPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.App];
            var    folder  = (Folder)generatorConfiguration.FileSystem[appPath];
            var    imports = generatorConfiguration.CreateImports(SurrogateModuleKindHandler.GetInstance(), appModule, folder, true);
            var    pages   = new List <Page>();
            string i18nPath;

            foreach (var page in imports.Select(i => i.ModuleOrAssembly).Cast <Page>().OrderBy(c => c.UILoadKind == UILoadKind.RootPage))
            {
                pages.Add(page);
            }

            i18nPath = generatorConfiguration.ApplicationFolderHierarchy[IonicFileSystemType.i18n];

            AppGenerator.GenerateApp(appPath, "App", generatorConfiguration, imports, pages);
            LanguageTranslationGenerator.GenerateTranslations(i18nPath, generatorConfiguration);

            return(true);
        }