Пример #1
0
 internal TreeModelDataSet(BcfTreeView.Bcf.TreeModelDataSetSetup dataSetSetup)
     : base(dataSetSetup, GetTableFactory())
 {
     InitializeSchemaProperties();
     Initialized();
 }
Пример #2
0
 private static void InitSetup(TreeModelDataSetSetup dss)
 {
     dss.Name   = "TreeModel";
     dss.Tables = new System.Collections.Generic.List <CalculationWorks.BusinessModel.Design.BcfTableSetup>()
     {
         new CalculationWorks.BusinessModel.Design.BcfTableSetup <TreeModelTableOptions>()
         {
             Name    = "Controls",
             Columns = new System.Collections.Generic.List <CalculationWorks.BusinessModel.Design.BcfColumnSetup>()
             {
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "NodeIndent",
                     DefaultValue = 16,
                 },
                 new BcfNotNullableValueTypeColumnSetup <Size, TreeModelColumnOptions>()
                 {
                     Name         = "NodeTextMinSize",
                     DefaultValue = new Size(23, 16),
                 },
                 new BcfNotNullableValueTypeColumnSetup <Size, TreeModelColumnOptions>()
                 {
                     Name         = "NodeTextMaxSize",
                     DefaultValue = new Size(300, 150),
                 },
                 new BcfReferenceTypeColumnSetup <Font, TreeModelColumnOptions>()
                 {
                     Name      = "Font",
                     AllowNull = true,
                 },
                 new BcfReferenceTypeColumnSetup <StringFormat, TreeModelColumnOptions>()
                 {
                     Name         = "StringFormat",
                     DefaultValue = StringFormat.GenericDefault,
                 },
                 new BcfReferenceTypeColumnSetup <Graphics, TreeModelColumnOptions>()
                 {
                     Name          = "StringMeasureGraphics",
                     AllowNull     = true,
                     DiscardAction = (c, v) => v.Dispose(),
                 },
                 new BcfNotNullableValueTypeColumnSetup <Size, TreeModelColumnOptions>()
                 {
                     Name         = "AutoScrollMinSize",
                     DefaultValue = default(Size),
                     Function     = new BcfFunctionSetup <Size>()
                     {
                         Func       = ControlsTableAutoScrollMinSizeFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "right",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("ClientAreaRight", new CalculationWorks.BusinessModel.Design.BcfRelationStep(false, "ControlToRootNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "bottom",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("ClientAreaBottom", new CalculationWorks.BusinessModel.Design.BcfRelationStep(false, "ControlToRootNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfReferenceTypeColumnSetup <Func <object, string>, TreeModelColumnOptions>()
                 {
                     Name         = "NodeObjectToString",
                     DefaultValue = o => o?.ToString() ?? string.Empty,
                 },
                 new BcfReferenceTypeColumnSetup <TreeView, TreeModelColumnOptions>()
                 {
                     Name      = "TreeView",
                     AllowNull = true,
                 },
             },
         },
         new CalculationWorks.BusinessModel.Design.BcfTableSetup <TreeModelTableOptions>()
         {
             Name    = "Nodes",
             Columns = new System.Collections.Generic.List <CalculationWorks.BusinessModel.Design.BcfColumnSetup>()
             {
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "Level",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableLevelFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <int> {
                                 Name = "parentNodeLevel",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Level", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToChildNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "SiblingIndex",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableSiblingIndexFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <int> {
                                 Name = "prevSiblingIndex",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("SiblingIndex", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToNextSiblings", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <bool, TreeModelColumnOptions>()
                 {
                     Name         = "Visible",
                     DefaultValue = default(bool),
                     Function     = new BcfFunctionSetup <bool>()
                     {
                         Func       = NodesTableVisibleFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <bool> {
                                 Name = "parentVisible",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Visible", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToChildNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <bool> {
                                 Name = "parentExpanded",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Expanded", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToChildNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <bool, TreeModelColumnOptions>()
                 {
                     Name         = "CanExpand",
                     DefaultValue = default(bool),
                     Function     = new BcfFunctionSetup <bool>()
                     {
                         Func       = NodesTableCanExpandFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <object> {
                                 Name = "childProp",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeObject", new CalculationWorks.BusinessModel.Design.BcfRelationStep(false, "NodeToChildNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <bool> {
                                 Name = "hasNonMaterializedChildren",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("HasNonMaterializedChildren"),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <bool, TreeModelColumnOptions>()
                 {
                     Name         = "Expanded",
                     DefaultValue = default(bool),
                     Trigger      = Util.NodeExpandedTrigger,
                 },
                 new BcfNotNullableValueTypeColumnSetup <bool, TreeModelColumnOptions>()
                 {
                     Name         = "ChildNodesInitialized",
                     DefaultValue = default(bool),
                 },
                 new BcfNotNullableValueTypeColumnSetup <bool, TreeModelColumnOptions>()
                 {
                     Name         = "HasNonMaterializedChildren",
                     DefaultValue = default(bool),
                 },
                 new BcfReferenceTypeColumnSetup <object, TreeModelColumnOptions>()
                 {
                     Name      = "NodeObject",
                     AllowNull = true,
                 },
                 new BcfReferenceTypeColumnSetup <string, TreeModelColumnOptions>()
                 {
                     Name         = "Text",
                     DefaultValue = string.Empty,
                     Function     = new BcfFunctionSetup <string>()
                     {
                         Func       = NodesTableTextFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Func <object, string> > {
                                 Name = "toString",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeObjectToString", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <object> {
                                 Name = "obj",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeObject"),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <Size, TreeModelColumnOptions>()
                 {
                     Name         = "Size",
                     DefaultValue = default(Size),
                     Function     = new BcfFunctionSetup <Size>()
                     {
                         Func       = NodesTableSizeFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <StringFormat> {
                                 Name = "sf",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("StringFormat", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Font> {
                                 Name = "f",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Font"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Graphics> {
                                 Name = "g",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("StringMeasureGraphics", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <string> {
                                 Name = "text",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Text"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <Size> {
                                 Name = "minSize",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeTextMinSize", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <Size> {
                                 Name = "maxSize",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeTextMaxSize", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "Top",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableTopFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <int> {
                                 Name = "prevSiblingChildBottom",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("ClientAreaBottom", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToNextSiblings", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <int> {
                                 Name = "parentNodeBottom",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Bottom", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "NodeToChildNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "Left",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableLeftFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "level",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Level"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfNullableLinkedParameterSetup <int> {
                                 Name = "indent",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("NodeIndent", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "Bottom",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableBottomFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <bool> {
                                 Name = "visible",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Visible"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "top",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Top"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Size> {
                                 Name = "size",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Size"),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "Right",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableRightFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <bool> {
                                 Name = "visible",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Visible"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "left",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Left"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Size> {
                                 Name = "size",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Size"),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "ClientAreaBottom",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableClientAreaBottomFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "childBottoms",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("ClientAreaBottom", new CalculationWorks.BusinessModel.Design.BcfRelationStep(false, "NodeToChildNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "bottom",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Bottom"),
                             },
                         },
                     },
                 },
                 new BcfNotNullableValueTypeColumnSetup <int, TreeModelColumnOptions>()
                 {
                     Name         = "ClientAreaRight",
                     DefaultValue = default(int),
                     Function     = new BcfFunctionSetup <int>()
                     {
                         Func       = NodesTableClientAreaRightFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "childRight",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("ClientAreaRight", new CalculationWorks.BusinessModel.Design.BcfRelationStep(false, "NodeToChildNodes", false)),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <int> {
                                 Name = "right",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Right"),
                             },
                         },
                     },
                 },
                 new BcfReferenceTypeColumnSetup <Font, TreeModelColumnOptions>()
                 {
                     Name      = "Font",
                     AllowNull = true,
                     Trigger   = (c, v, u) => c.OwningRow.SetValueObject("FontSet", v),
                     Function  = new BcfFunctionSetup <Font>()
                     {
                         Func       = NodesTableFontFunction,
                         Parameters = new List <CalculationWorks.BusinessModel.Design.BcfParameterSetup>()
                         {
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Font> {
                                 Name = "fontSet",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("FontSet"),
                             },
                             new CalculationWorks.BusinessModel.Design.BcfLinkedParameterSetup <Font> {
                                 Name = "controlFont",
                                 ParameterAccessPath = new CalculationWorks.BusinessModel.Design.BcfParameterAccessPath("Font", new CalculationWorks.BusinessModel.Design.BcfRelationStep(true, "ControlToAllNodes", false)),
                             },
                         },
                     },
                 },
                 new BcfReferenceTypeColumnSetup <Font, TreeModelColumnOptions>()
                 {
                     Name      = "FontSet",
                     AllowNull = true,
                 },
             },
         },
     };
     dss.Relations = new System.Collections.Generic.List <CalculationWorks.BusinessModel.Design.BcfRelationSetup>()
     {
         new CalculationWorks.BusinessModel.Design.BcfRelationSetup <TreeModelRelationOptions>()
         {
             Name        = "ControlToAllNodes",
             ParentTable = "Controls",
             ChildTable  = "Nodes",
             UpdateRule  = BcfRelationRule.NoAction,
             DeleteRule  = BcfRelationRule.Cascade,
             HasParentEndNotNullConstraint = true,
         },
         new CalculationWorks.BusinessModel.Design.BcfRelationSetup <TreeModelRelationOptions>()
         {
             Name                  = "NodeToNextSiblings",
             ParentTable           = "Nodes",
             ChildTable            = "Nodes",
             UpdateRule            = BcfRelationRule.NoAction,
             DeleteRule            = BcfRelationRule.NoAction,
             ChildEndMaxConstraint = 1,
         },
         new CalculationWorks.BusinessModel.Design.BcfRelationSetup <TreeModelRelationOptions>()
         {
             Name        = "NodeToChildNodes",
             ParentTable = "Nodes",
             ChildTable  = "Nodes",
             UpdateRule  = BcfRelationRule.NoAction,
             DeleteRule  = BcfRelationRule.Cascade,
         },
         new CalculationWorks.BusinessModel.Design.BcfRelationSetup <TreeModelRelationOptions>()
         {
             Name        = "ControlToSelectedNodes",
             ParentTable = "Controls",
             ChildTable  = "Nodes",
             UpdateRule  = BcfRelationRule.NoAction,
             DeleteRule  = BcfRelationRule.NoAction,
         },
         new CalculationWorks.BusinessModel.Design.BcfRelationSetup <TreeModelRelationOptions>()
         {
             Name        = "ControlToRootNodes",
             ParentTable = "Controls",
             ChildTable  = "Nodes",
             UpdateRule  = BcfRelationRule.NoAction,
             DeleteRule  = BcfRelationRule.Cascade,
         },
     };
 }