コード例 #1
0
ファイル: CfgOrProp.cs プロジェクト: ExtTS/generator
        protected void readAndAddCfg(ref ExtClass extClass, ExtObjectMember member, ParsedTypes types, bool ownedByCurrent, bool required)
        {
            string name = this.sanitizeName(member.Name);

            string[]      docs       = this.readJsDocs(member.Doc, JsDocsType.CONFIGURATION, extClass.Name.FullName, name);
            Configuration newCfgItem = new Configuration(
                name, types.CfgOrProp, docs, member.Owner, ownedByCurrent
                );

            newCfgItem.Required = required;
            //newCfgItem.DefaultValue = String.IsNullOrEmpty(member.Default) ? "" : member.Default;
            newCfgItem.DefaultValue = member.Default == "" ? "''" : member.Default;
            newCfgItem.Deprecated   = this.readJsDocsDeprecated(
                member.Deprecated, extClass.Name.FullName, name
                );
            extClass.AddMemberConfiguration(newCfgItem);
        }
コード例 #2
0
ファイル: SpecialsGenerator.cs プロジェクト: ExtTS/generator
        protected void generateEventsInterfacesBases()
        {
            // Complete and add base Events interface:
            ExtClass baseEventsInterface = this.addBaseInterface(
                SpecialsGenerator.BASE_EVENTS_INTERFACE_NAME,
                "Base events interface.",
                ClassType.CLASS_EVENTS
                );

            string[] baseObjectClassIndexerDocs = this.processor.GenerateJsDocs
                                ? new string[] {
                "Any event method or event config.",
            }
                                : null;
            Indexer baseIndexer = new Indexer(
                "events",
                new List <string>()
            {
                "string"
            },
                new List <string>()
            {
                SpecialsGenerator.BASE_EVENTS_CFG_INTERFACE_NAME,
                "Function"
            },
                baseObjectClassIndexerDocs,
                baseEventsInterface.Name.FullName,
                true
                );

            baseEventsInterface.AddMemberIndexer(baseIndexer);
            // Complete and add base EventConfig interface:
            ExtClass baseEventCfgInterface = this.addBaseInterface(
                SpecialsGenerator.BASE_EVENTS_CFG_INTERFACE_NAME,
                "Event config interface.",
                ClassType.CLASS_EVENTS
                );
            Configuration fnCfg = new Configuration(
                "fn", new List <string>()
            {
                "Function"
            },
                new string[] { "Event handler.", "@required" },
                baseEventCfgInterface.Name.FullName, true
                );

            //fnCfg.Required = true;
            baseEventCfgInterface.AddMemberConfiguration(fnCfg);
            baseEventCfgInterface.AddMemberConfiguration(new Configuration(
                                                             "scope", new List <string>()
            {
                "any"
            },
                                                             new string[] { "Event handler `this` context value." },
                                                             baseEventCfgInterface.Name.FullName, true
                                                             ));
            baseEventCfgInterface.AddMemberConfiguration(new Configuration(
                                                             "buffer", new List <string>()
            {
                "number"
            },
                                                             new string[] {
                "Handler is invoked only once every `n` miliseconds in `buffer`, ",
                "regardless of how many times user fire it."
            },
                                                             baseEventCfgInterface.Name.FullName, true
                                                             ));
            baseEventCfgInterface.AddMemberConfiguration(new Configuration(
                                                             "single", new List <string>()
            {
                "boolean"
            },
                                                             new string[] {
                "Handler is invoked only once."
            },
                                                             baseEventCfgInterface.Name.FullName, true
                                                             ));
        }