Exemplo n.º 1
0
        public reportLinkCollection(reportInPackageGroup __group)
        {
            if (__group == null)
            {
                title = "Main";
            }
            else
            {
                title       = __group.name;
                description = __group.description;
            }

            currentGroup = __group;
            groups.Add(__group);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the group.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="description">The description.</param>
        /// <returns></returns>
        public reportInPackageGroup AddGroup(string title, string description, int __priority = -1)
        {
            reportInPackageGroup group = new reportInPackageGroup();

            group.name        = title;
            group.description = description;
            if (__priority == -1)
            {
                if (groups.Any())
                {
                    group.priority = groups.Last().priority + 5;
                }
            }
            else
            {
                group.priority = __priority;
            }
            groups.Add(group);

            currentGroup = group;
            return(group);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates collection of links with correct url paths
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="context">The context.</param>
        /// <param name="format">The format.</param>
        /// <param name="levels">The levels.</param>
        /// <returns></returns>
        /// <exception cref="imbSCI.Reporting.exceptions.aceReportException">CompileLinkCollection - found link with undefined state</exception>
        public static reportLinkCollection CompileLinkCollection(this reportLinkCollection menu, deliveryInstance context, reportOutputFormatName format, List <reportElementLevel> levels)
        {
            if (menu == null)
            {
                return(null);
                //throw new aceReportException(context,"reportLinkCollection sent to metaTools.CompileLinkCollection() was null", aceReportExceptionType.compileScriptError);
            }
            reportLinkCollection output = new reportLinkCollection(menu.GetMainGroup().name, menu.GetMainGroup().description);
            reportInPackageGroup group  = menu.GetMainGroup();

            output.title       = menu.title;
            output.description = menu.description;

            foreach (reportLink link in menu)
            {
                if (link.group != group)
                {
                    var g = output.AddGroup(link.group.name, link.group.description);
                    g.priority = link.group.priority;
                    group      = g;
                }

                reportLink compiledLink = new reportLink(link);

                bool accept = true;

                switch (link.state)
                {
                case reportLinkState.pathIsMetaModelPath:
                    compiledLink.element = context.scope.resolve(metaModelTargetEnum.scopeRelativePath, link.linkPath, null).First();
                    compiledLink.state   = reportLinkState.pathIsUrl;
                    break;

                case reportLinkState.registryQuery:
                    compiledLink.element = ((IHasReportRegistry)context.scope.root).reportRegistry.GetReport(link.registryQuery);
                    if (compiledLink.element == null)
                    {
                        compiledLink.state = reportLinkState.undefined;
                    }
                    else
                    {
                        compiledLink.state = reportLinkState.pathIsUrl;
                    }

                    break;

                case reportLinkState.elementInstance:
                    compiledLink.state = reportLinkState.pathIsUrl;
                    break;

                case reportLinkState.pathIsUrl:
                    // cool
                    break;

                case reportLinkState.undefined:
                    accept = false;
                    throw new aceReportException(context, "CompileLinkCollection - found link with undefined state", aceReportExceptionType.compileScriptError).add(link.linkTitle).add(link.linkDescription);
                    break;
                }
                if (compiledLink.linkPath.isNullOrEmpty() && compiledLink.state == reportLinkState.pathIsUrl)
                {
                    compiledLink.linkPath = link.element.CompileLinkForElemenet(context, format, levels); //path;
                }
                if (compiledLink.state != reportLinkState.pathIsUrl)
                {
                    accept = false;
                }
                if (accept)
                {
                    output.AddLink(compiledLink);
                }
            }

            output.sortup();

            return(output);
        }