Пример #1
0
        public static bool ConfigureAndStartGeneration(Composition SourceComposition)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(SourceComposition.CompositeContentDomain.GenerationConfiguration);

            InstanceController.StartEdit();

            var ConfigPanel = new GeneratorSelectionEditor(SourceComposition);

            InstanceController.PostValidate = ((curr, prev) =>
            {
                if (curr.TargetDirectory.IsAbsent() || !Directory.Exists(curr.TargetDirectory))
                {
                    return("Target directory not set or not found".IntoList());
                }

                return(null);
            });
            InstanceController.PreApply = ((curr, prev, args) =>
            {
                curr.ExcludedIdeasGlobalIds.Clear();
                curr.ExcludedIdeasGlobalIds.AddRange(ConfigPanel.SourceConfiguration.CurrentSelection.GetSelection(false)       // Gets the not-selected Ideas
                                                     .Select(sel => sel.SourceIdea.GlobalId.ToString()));
                return(true);
            });

            var EditPanel = Display.CreateEditPanel(SourceComposition.CompositeContentDomain.GenerationConfiguration, ConfigPanel);

            var Result = InstanceController.Edit(EditPanel, "Generate Files", true, null, 700, 500).IsTrue();

            return(Result);
        }
Пример #2
0
        public static bool ConceptDefClusterEdit(Domain OwnerEntity, IList <FormalPresentationElement> EditedList, FormalPresentationElement ConceptDefCluster)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(ConceptDefCluster);

            InstanceController.StartEdit();

            var EditPanel = Display.CreateEditPanel(ConceptDefCluster, null, true, null, null, true, false, true /*, Expositor*/);

            return(InstanceController.Edit(EditPanel, "Edit Concept-Def Cluster - " + ConceptDefCluster.ToString()).IsTrue());
        }
Пример #3
0
        public static bool VariantDefinitionEdit(Domain OwnerEntity, IList <SimplePresentationElement> EditedList, SimplePresentationElement VariantDef)
        {
            /*- if (!ProductDirector.ConfirmImmediateApply("Variant Definition", "DomainEdit.VariantDefinition", "ApplyDialogChangesDirectly"))
             *  return false; */

            var InstanceController = EntityInstanceController.AssignInstanceController(VariantDef);

            InstanceController.StartEdit();

            var EditPanel = Display.CreateEditPanel(VariantDef, null, true, null, null, true, false, true /*, Expositor*/);

            return(InstanceController.Edit(EditPanel, "Edit Link-Role Variant Definition - " + VariantDef.ToString()).IsTrue());
        }
        public static bool RelationshipDefClusterEdit(Domain OwnerEntity, IList <FormalPresentationElement> EditedList, FormalPresentationElement RelationshipDefCluster)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(RelationshipDefCluster);

            InstanceController.StartEdit();

            /* POSTPONED: Ability to edit and reorganize Relationship-Defs via its Cluster-Key.
             * var Expositor = new EntityPropertyExpositor(RelationshipDefCluster.__ClusterKey.TechName);
             * Expositor.LabelMinWidth = 90; */

            var EditPanel = Display.CreateEditPanel(RelationshipDefCluster, null, true, null, null, true, false, true /*, Expositor*/);

            return(InstanceController.Edit(EditPanel, "Edit Relationship-Def Cluster - " + RelationshipDefCluster.ToString()).IsTrue());
        }
Пример #5
0
        public static bool EditReportConfiguration(string ReportTypeName, ReportConfiguration Configuration)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(Configuration);

            InstanceController.StartEdit();

            var ConfigPanel = new ReportConfigurationEditor();

            ConfigPanel.DataContext = Configuration;

            var EditPanel = Display.CreateEditPanel(Configuration, ConfigPanel);

            var Result = InstanceController.Edit(EditPanel, "Generate " + ReportTypeName + " Report",
                                                 true, null, 930, 620).IsTrue();

            return(Result);
        }
Пример #6
0
        public static bool ExternalLanguageEdit(Domain OwnerEntity, IList <ExternalLanguageDeclaration> EditedList, ExternalLanguageDeclaration ExternalLang)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(ExternalLang);

            InstanceController.StartEdit();

            var EditPanel = Display.CreateEditPanel(ExternalLang, null, true, null, null, true, false, true, false /* Maybe some day the Tech-Spec could store particularities of the language */);

            var Result = InstanceController.Edit(EditPanel, "Edit External Language declaration - " + ExternalLang.ToString()).IsTrue();

            if (Result)
            {
                OwnerEntity.CurrentExternalLanguage = ExternalLang;
            }

            return(Result);
        }
Пример #7
0
        public static bool MarkerDefinitionEdit(Domain OwnerEntity, IList <MarkerDefinition> EditedList, MarkerDefinition MarkerDef)
        {
            /*- if (!ProductDirector.ConfirmImmediateApply("Marker Definition", "DomainEdit.MarkerDefinition", "ApplyDialogChangesDirectly"))
             *  return false; */

            var InstanceController = EntityInstanceController.AssignInstanceController(MarkerDef);

            InstanceController.StartEdit();

            /* POSTPONED: Ability to edit and reorganize Markers via its Cluster-Key.
             * var Expositor = new EntityPropertyExpositor(MarkerDefinition.__ClusterKey.TechName);
             * Expositor.LabelMinWidth = 90; */

            var EditPanel = Display.CreateEditPanel(MarkerDef, null, true, null, null, true, false, true /*, Expositor*/);

            return(InstanceController.Edit(EditPanel, "Edit Marker Definition - " + MarkerDef.ToString()).IsTrue());
        }
Пример #8
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public bool DoEditDescriptor(Action <RoleBasedLink> SuccessCompletion, bool FinishSuccessfulCommand = true)
        {
            this.EditEngine.StartCommandVariation("Edit Link-Role Descriptor");

            this.Descriptor = this.Descriptor.NullDefault(new SimplePresentationElement("", ""));
            var InstanceController = EntityInstanceController.AssignInstanceController(this.Descriptor);

            InstanceController.StartEdit();

            var EditPanel = Display.CreateEditPanel(this.Descriptor, null, true, null, null, true, false, false, true);

            var Result = InstanceController.Edit(EditPanel, "Edit Link descriptor.").IsTrue();

            if (!Result)
            {
                this.EditEngine.CompleteCommandVariation();
                this.EditEngine.Undo();
                return(false);
            }

            if (Descriptor.Name.IsAbsent() && this.Descriptor.TechName.IsAbsent() && this.Descriptor.Summary.IsAbsent())
            {
                this.Descriptor = null;
            }

            this.UpdateVersion();

            if (SuccessCompletion != null)
            {
                SuccessCompletion(this);
            }

            if (FinishSuccessfulCommand)
            {
                this.EditEngine.CompleteCommandVariation();
            }

            return(true);
        }
Пример #9
0
        public static bool RelationshipDefinitionEdit(Domain SourceDomain, IList <RelationshipDefinition> EditedList, RelationshipDefinition RelationshipDef)
        {
            /*- if (!ProductDirector.ConfirmImmediateApply("Relationship Definition", "DomainEdit.RelationshipDefinition", "ApplyDialogChangesDirectly"))
             *  return false; */

            var CurrentWindow = Display.GetCurrentWindow();

            CurrentWindow.Cursor = Cursors.Wait;

            var InstanceController = EntityInstanceController.AssignInstanceController(RelationshipDef,
                                                                                       (current, previous, editpanels) =>
            {
                var CurrentDetailsEditor = (GlobalDetailsDefinitor)editpanels.First(editpanel => editpanel is GlobalDetailsDefinitor);

                // IMPORTANT: Ensure that at least one linking variant is available.
                if (current.OriginOrParticipantLinkRoleDef.AllowedVariants.Count < 1)
                {
                    current.OriginOrParticipantLinkRoleDef.AllowedVariants.Add(current.OwnerDomain.LinkRoleVariants.FirstOrDefault());
                }

                if (current.TargetLinkRoleDef != null && current.TargetLinkRoleDef.AllowedVariants.Count < 1)
                {
                    current.TargetLinkRoleDef.AllowedVariants.Add(current.OwnerDomain.LinkRoleVariants.FirstOrDefault());
                }

                return(CurrentDetailsEditor.UpdateRelatedDetailDefinitions(current));
            });

            var DetDefEd = GlobalDetailsDefinitor.CreateGlobalDetailsDefinitor(InstanceController.EntityEditor, RelationshipDef);

            InstanceController.StartEdit();

            var ExtraGeneralContentsPanel = new Grid();

            ExtraGeneralContentsPanel.ColumnDefinitions.Add(new ColumnDefinition());
            ExtraGeneralContentsPanel.ColumnDefinitions.Add(new ColumnDefinition());

            var ExtraGenContentPanelLeft = new StackPanel();

            Grid.SetColumn(ExtraGenContentPanelLeft, 0);
            ExtraGeneralContentsPanel.Children.Add(ExtraGenContentPanelLeft);

            var ExtraGenContentPanelRight = new StackPanel();

            Grid.SetColumn(ExtraGenContentPanelRight, 1);
            ExtraGeneralContentsPanel.Children.Add(ExtraGenContentPanelRight);

            var Expositor = new EntityPropertyExpositor(RelationshipDefinition.__IsComposable.TechName);

            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(ConceptDefinition.__IsVersionable.TechName);
            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(ConceptDefinition.__HasGroupRegion.TechName);
            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(ConceptDefinition.__HasGroupLine.TechName);
            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(RelationshipDefinition.__RepresentativeShape.TechName);
            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);
            Expositor.PostCall(expo =>
            {
                var Combo = expo.ValueEditor as ComboBox;
                if (Combo != null)
                {
                    var Panel = new FrameworkElementFactory(typeof(WrapPanel));
                    Panel.SetValue(WrapPanel.WidthProperty, 810.0);
                    Panel.SetValue(WrapPanel.ItemWidthProperty, 200.0);
                    // Don't work as expected: Panel.SetValue(WrapPanel.OrientationProperty, Orientation.Vertical);
                    var Templ        = new ItemsPanelTemplate(Panel);
                    Combo.ItemsPanel = Templ;
                }
            }, true);

            Expositor = new EntityPropertyExpositor(ConceptDefinition.__PreciseConnectByDefault.TechName);
            Expositor.LabelMinWidth = 180;
            ExtraGenContentPanelLeft.Children.Add(Expositor);

            var ClosuredExpositor = new EntityPropertyExpositor(IdeaDefinition.__Cluster.TechName);

            ClosuredExpositor.LabelMinWidth = 210;
            ExtraGenContentPanelRight.Children.Add(ClosuredExpositor);
            var PropCtl = InstanceController.GetPropertyController(IdeaDefinition.__Cluster.TechName);

            PropCtl.ComplexOptionsProviders =
                Tuple.Create <IRecognizableElement, Action <object> >(
                    new SimplePresentationElement("Edit Clusters", "EditClusters", "Edit Clusters", Display.GetAppImage("def_clusters.png")),
                    obj =>
            {
                if (DomainServices.DefineDomainIdeaDefClusters(SourceDomain, DomainServices.TABKEY_IDEF_CLUSTER_RELATIONSHIP))
                {
                    ClosuredExpositor.RetrieveAvailableItems();
                }
            }).IntoArray();

            Expositor = new EntityPropertyExpositor(RelationshipDefinition.__CanAutomaticallyCreateRelatedConcepts.TechName);
            Expositor.LabelMinWidth = 210;
            ExtraGenContentPanelRight.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(RelationshipDefinition.__IsSimple.TechName);
            Expositor.LabelMinWidth = 210;
            ExtraGenContentPanelRight.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(RelationshipDefinition.__HideCentralSymbolWhenSimple.TechName);
            Expositor.LabelMinWidth = 210;
            ExtraGenContentPanelRight.Children.Add(Expositor);

            Expositor = new EntityPropertyExpositor(RelationshipDefinition.__ShowNameIfHidingCentralSymbol.TechName);
            Expositor.LabelMinWidth = 210;
            ExtraGenContentPanelRight.Children.Add(Expositor);

            var VisualSymbolFormatter     = new VisualSymbolFormatSubform("DefaultSymbolFormat");
            var VisualConnectorsFormatter = new VisualConnectorsFormatSubform("DefaultConnectorsFormat", RelationshipDef.DefaultConnectorsFormat);

            var TemplateEd = new TemplateEditor();

            TemplateEd.Initialize(SourceDomain, SourceDomain.CurrentExternalLanguage.TechName, typeof(Relationship), RelationshipDef,
                                  IdeaDefinition.__OutputTemplates, Domain.__OutputTemplatesForRelationships, false,
                                  Tuple.Create <string, ImageSource, string, Action <string> >("Insert predefined...", Display.GetAppImage("page_white_wrench.png"), "Inserts a system predefined Output-Template text, at the current selection.",
                                                                                               text => { var tpl = DomainServices.GetPredefinedOutputTemplate(); if (tpl != null)
                                                                                                         {
                                                                                                             TemplateEd.SteSyntaxEditor.ReplaceTextAtSelection(tpl);
                                                                                                         }
                                                                                               }),
                                  Tuple.Create <string, ImageSource, string, Action <string> >("Test", Display.GetAppImage("page_white_wrench.png"), "Test the Template against a source Relationship.",
                                                                                               text => RememberedTemplateTestRelationship[SourceDomain.OwnerComposition] =
                                                                                                   TemplateTester.TestTemplate(typeof(Relationship), RelationshipDef, IdeaDefinition.__OutputTemplates.Name,
                                                                                                                               RelationshipDef.GetGenerationFinalTemplate(TemplateEd.CurrentTemplate.Language, text, TemplateEd.ChbExtendsBaseTemplate.IsChecked.IsTrue()),
                                                                                                                               SourceDomain.OwnerComposition,
                                                                                                                               RememberedTemplateTestRelationship.GetValueOrDefault(SourceDomain.OwnerComposition)
                                                                                                                               .NullDefault(SourceDomain.OwnerComposition.CompositeIdeas.OrderBy(idea => idea.Name)
                                                                                                                                            .FirstOrDefault(idea => idea.IdeaDefinitor == RelationshipDef)
                                                                                                                                            .NullDefault(SourceDomain.OwnerComposition.DeclaredIdeas
                                                                                                                                                         .FirstOrDefault(idea => idea is Relationship))))));
            var TemplateTab = TabbedEditPanel.CreateTab(DomainServices.TABKEY_DEF_OUTTEMPLATE, "Output-Templates", "Definition of Output-Templates", TemplateEd);

            var SpecTabs = General.CreateList(
                TabbedEditPanel.CreateTab(DomainServices.TABKEY_DEF_ARRANGE, "Arrange", "Settings for relate and group ideas.",
                                          new ArrangeTabForRelationshipDef(RelationshipDef)),
                TabbedEditPanel.CreateTab(TABKEY_DEF_REL_LINKROLEDEF_ORIPAR, "Origin/Participant Link-Role Def.", "Definition of Link-Role for Origin or Participant.",
                                          new LinkRoleDefSpecSubform("OriginOrParticipantLinkRoleDef", false, RelationshipDef.OriginOrParticipantLinkRoleDef, RelationshipDef)),
                TabbedEditPanel.CreateTab(TABKEY_DEF_REL_LINKROLEDEF_TARGET, "Target Link-Role Def.", "Definition of Link-Role for Target.",
                                          new LinkRoleDefSpecSubform("TargetLinkRoleDef", true, RelationshipDef.TargetLinkRoleDef, RelationshipDef)),
                TabbedEditPanel.CreateTab(DomainServices.TABKEY_DEF_FORMAT, "Symbol format", "Definition for the Central/Main-Symbol format.",
                                          VisualSymbolFormatter),
                TabbedEditPanel.CreateTab(TABKEY_DEF_REL_CONNFORMAT, "Connectors format", "Definition for the Connectors format.",
                                          VisualConnectorsFormatter),
                TabbedEditPanel.CreateTab(DomainServices.TABKEY_DEF_DETAILS, "Details", "Details definition.", DetDefEd),
                TemplateTab);

            var EditPanel = Display.CreateEditPanel(RelationshipDef, SpecTabs, true, null, Display.TABKEY_TECHSPEC + General.STR_SEPARATOR + DomainServices.TABKEY_DEF_OUTTEMPLATE,
                                                    true, false, true, true, ExtraGeneralContentsPanel);

            EditPanel.Loaded +=
                ((sender, args) =>
            {
                var OwnerWindow = EditPanel.GetNearestVisualDominantOfType <Window>();
                OwnerWindow.MinWidth = 750;
                OwnerWindow.MinHeight = 550;
                OwnerWindow.PostCall(wnd => CurrentWindow.Cursor = Cursors.Arrow);
            });

            if (IdeaDefinition.__OutputTemplates.IsAdvanced)
            {
                EditPanel.ShowAdvancedMembersChanged +=
                    ((show) =>
                {
                    TemplateTab.SetVisible(show);
                    if (!show)
                    {
                        var OwnerTabControl = TemplateTab.GetNearestDominantOfType <TabControl>();
                        if (OwnerTabControl.SelectedItem == TemplateTab)
                        {
                            OwnerTabControl.SelectedIndex = 0;
                        }
                    }
                });
            }

            var Previewer = new VisualElementPreviewer(VisualSymbolFormatter.VisualElementFormatter.ExpoLineBrush,
                                                       VisualSymbolFormatter.VisualElementFormatter.ExpoLineThickness,
                                                       VisualSymbolFormatter.VisualElementFormatter.ExpoLineDash,
                                                       VisualSymbolFormatter.VisualElementFormatter.ExpoMainBackground,
                                                       VisualConnectorsFormatter.VisualElementFormatter.ExpoLineBrush,
                                                       VisualConnectorsFormatter.VisualElementFormatter.ExpoLineThickness,
                                                       VisualConnectorsFormatter.VisualElementFormatter.ExpoLineDash,
                                                       VisualConnectorsFormatter.VisualElementFormatter.ExpoMainBackground);

            Previewer.AttachSource(RelationshipDef);
            Previewer.Margin        = new Thickness(4);
            EditPanel.HeaderContent = Previewer;
            Previewer.PostCall(prv => prv.ShowPreview());   // Required because of initially unpopulated properties of old Domains.

            var Result = InstanceController.Edit(EditPanel, "Edit Relationship Definition - " + RelationshipDef.ToString(), true, null,
                                                 RELDEFWND_INI_WIDTH, RELDEFWND_INI_HEIGHT).IsTrue();

            return(Result);
        }
Пример #10
0
        public static bool PrepareAndMergeCompositions(Composition SourceComposition, Composition TargetComposition)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(TargetComposition);

            InstanceController.StartEdit();

            var Randomizer      = new Random();
            var SourceSelection = SchemaMemberSelection.CreateSelectionTree(SourceComposition, null, null,
                                                                            obj =>
            {
                var MrgActIdx = Randomizer.Next(0, 3);
                return(Tuple.Create(MrgActIdx != 0 || !SchemaMemberSelection.GetAccesor(obj)
                                    .ChildrenGetter(obj).IsEmpty(),                                                         // Is-Selectable
                                    MrgActIdx != 0 && MrgActIdx != 3,                                                       // Is-Selected
                                    !(obj is SchemaMemberGroup),                                                            // Can-show-is-selected
                                    (IRecognizableElement)MergingManager.MergeActions[MrgActIdx]));                         // Merge-Action
            });

            var TargetSelection = SchemaMemberSelection.CreateSelectionTree(TargetComposition);

            var PreparePanel = new MergePreparer(SourceComposition, TargetComposition, SourceSelection, TargetSelection);

            /*
             * InstanceController.PostValidate = ((curr, prev) =>
             * {
             *  if (curr.TargetDirectory.IsAbsent() || !Directory.Exists(curr.TargetDirectory))
             *      return "Target directory not set or not found".IntoList();
             *
             *  return null;
             * });
             * InstanceController.PreApply = ((curr, prev, args) =>
             * {
             *  curr.ExcludedIdeasGlobalIds.Clear();
             *  curr.ExcludedIdeasGlobalIds.AddRange(ConfigPanel.TargetConfiguration.CurrentSelection.GetSelection(false)   // Gets the not-selected Ideas
             *                                              .Select(sel => sel.TargetIdea.GlobalId.ToString()));
             *  return true;
             * }); */

            var EditPanel = Display.CreateEditPanel(TargetComposition, PreparePanel);

            var Title   = "Merge '" + TargetComposition.Name + "' with '" + SourceComposition.Name + "'";
            var DoMerge = InstanceController.Edit(EditPanel, "Merge Compositions/Domains content", true, null, 950, 650).IsTrue();

            if (DoMerge)
            {
                var Merger = CreateMerger(SourceComposition, TargetComposition, SourceSelection);

                var Started = ProgressiveThreadedExecutor <int> .Execute <int>(Title, Merger.Merge,
                                                                               (opresult) =>
                {
                    if (!opresult.WasSuccessful)
                    {
                        Display.DialogMessage("Merge not completed!", opresult.Message, EMessageType.Warning);
                        return;
                    }

                    if (opresult.Message != null)
                    {
                        Console.WriteLine(opresult.Message);
                    }

                    Display.DialogMessage("Merge completed", opresult.Message.AbsentDefault("Compositions Merge successfully executed."));
                });
            }

            return(DoMerge);
        }
Пример #11
0
        public static bool FieldDefinitionEdit(TableDefinition OwnerTableDef, IList <FieldDefinition> EditedList, FieldDefinition FieldDef)
        {
            var InstanceController = EntityInstanceController.AssignInstanceController(FieldDef);

            InstanceController.StartEdit();

            var ExtraControls = new List <UIElement>();
            MModelPropertyDefinitor ExposedProperty = null;

            // Declare expositor for hidden field
            var HideInDiagramExpositor = new EntityPropertyExpositor(FieldDefinition.__HideInDiagram.TechName);

            HideInDiagramExpositor.LabelMinWidth = 90;

            // Declare expositor for available values-sources
            var AvailableValuesSourcesExpositor = new EntityPropertyExpositor();

            ExposedProperty = FieldDefinition.__ValuesSource;

            AvailableValuesSourcesExpositor.ExposedProperty = ExposedProperty.TechName;
            AvailableValuesSourcesExpositor.LabelMinWidth   = 90;
            AvailableValuesSourcesExpositor.IsEnabled       = (FieldDef.FieldType is NumberType ||
                                                               FieldDef.FieldType.IsOneOf(DataType.DataTypeTableRecordRef, DataType.DataTypeText)); // Initial setting

            // Declare expositor for available Ideas
            var IdeaReferencingPropertyExpositor = new EntityPropertyExpositor();

            ExposedProperty = FieldDefinition.__IdeaReferencingProperty;

            IdeaReferencingPropertyExpositor.ExposedProperty = ExposedProperty.TechName;
            IdeaReferencingPropertyExpositor.LabelMinWidth   = 90;
            IdeaReferencingPropertyExpositor.SetAvailable(FieldDef.FieldType.IsOneOf(DataType.DataTypeIdeaRef, DataType.DataTypeText));  // Initial setting

            // Declare button for table-definition assignation button
            var TableDefAssignationPanel = new StackPanel();
            // TableDefAssignationPanel.Orientation = Orientation.Horizontal;

            var TableDefAssignSingleRecordCbx = new EntityPropertyExpositor(FieldDefinition.__ContainedTableIsSingleRecord.TechName);

            TableDefAssignSingleRecordCbx.LabelMinWidth = 90;

            /* var TableDefAssignSingleRecordCbx = new CheckBox();
             * TableDefAssignSingleRecordCbx.Content = FieldDefinition.__ContainedTableIsSingleRecord.Name; //  "Is Single-Record";
             * TableDefAssignSingleRecordCbx.ToolTip = FieldDefinition.__ContainedTableIsSingleRecord.Summary;
             * TableDefAssignSingleRecordCbx.FontSize = 8;
             * TableDefAssignSingleRecordCbx.Margin = new Thickness(2); */
            TableDefAssignSingleRecordCbx.IsEnabled = FieldDef.FieldType.IsEqual(DataType.DataTypeTable);

            var TableDefAssignationButtonArea = new StackPanel();

            TableDefAssignationButtonArea.Orientation = Orientation.Horizontal;

            var TableDefAssignationButtonPrefix = new TextBlock();

            TableDefAssignationButtonPrefix.Text          = "Table-Structure";
            TableDefAssignationButtonPrefix.TextAlignment = TextAlignment.Right;
            TableDefAssignationButtonPrefix.FontSize      = 10;
            TableDefAssignationButtonPrefix.Width         = 90;
            TableDefAssignationButtonPrefix.Margin        = new Thickness(0, 6, 2, 2);
            TableDefAssignationButtonPrefix.SetAvailable(FieldDef.FieldType == DataType.DataTypeTable);  // Initial setting

            var TableDefAssignationButton = new PaletteButton("Definition...", Display.GetAppImage("table.png"));

            TableDefAssignationButton.Margin    = new Thickness(2 /*45*/, 2, 2, 2);
            TableDefAssignationButton.IsEnabled = FieldDef.FieldType.IsEqual(DataType.DataTypeTable);

            TableDefAssignationButtonArea.Children.Add(TableDefAssignationButtonPrefix);
            TableDefAssignationButtonArea.Children.Add(TableDefAssignationButton);

            TableDefAssignationButton.Click +=
                ((sender, args) =>
            {
                var DsnName = OwnerTableDef.Name + " - " + FieldDef.Name;

                if (FieldDef.ContainedTableDesignator == null)
                {
                    var ContainedTableDef = new TableDefinition(OwnerTableDef.OwnerDomain, DsnName, DsnName.TextToIdentifier());
                    FieldDef.ContainedTableDesignator = new TableDetailDesignator(Ownership.Create <IdeaDefinition, Idea>(OwnerTableDef.OwnerDomain),
                                                                                  ContainedTableDef, true /* Very important! */,
                                                                                  DsnName, DsnName.TextToIdentifier(), "", null, FieldDef);
                }
                else
                if (FieldDef.ContainedTableDesignator.Name != DsnName)
                {
                    FieldDef.ContainedTableDesignator.Name = DsnName;
                    FieldDef.ContainedTableDesignator.TechName = DsnName.TextToIdentifier();
                }

                var TableDefAssigner = new TableDetailDesignatorStructSubform(FieldDef.ContainedTableDesignator, null, true);

                DialogOptionsWindow TableDesfAssignationWindow = null;          // Do not move outside this lambda

                OwnerTableDef.EditEngine.StartCommandVariation("Edit Field-Definition type assignment of Table-Structure Definition");

                var Response = Display.OpenContentDialogWindow(ref TableDesfAssignationWindow,
                                                               "Table-Structure for Field '" + FieldDef.Name + "'",
                                                               TableDefAssigner);
                OwnerTableDef.EditEngine.CompleteCommandVariation();

                if (Response.IsTrue())
                {
                    FieldDef.ContainedTableDesignator.DeclaringTableDefinition.AlterStructure();
                }
                else
                {
                    OwnerTableDef.EditEngine.Undo();
                }
            });

            // Declare expositor for field-type
            var FieldTypeExpositor = new EntityPropertyExpositor();

            ExposedProperty = FieldDefinition.__FieldType;

            FieldDef.PropertyChanged +=
                ((sender, args) =>
            {
                if (args.PropertyName != FieldDefinition.__FieldType.TechName ||
                    FieldDef.FieldType == null)
                {
                    return;
                }

                // Postcalls to be applied after the load initialization.

                var CanSelectValues = (FieldDef.FieldType is NumberType ||
                                       FieldDef.FieldType.IsOneOf(DataType.DataTypeTableRecordRef, DataType.DataTypeText));
                AvailableValuesSourcesExpositor.PostCall(
                    expo =>
                {
                    expo.SetAvailable(CanSelectValues);

                    if (!CanSelectValues)
                    {
                        FieldDef.ValuesSource = null;
                    }
                });

                var CanSelectIdeas = FieldDef.FieldType.IsOneOf(DataType.DataTypeIdeaRef, DataType.DataTypeText);
                IdeaReferencingPropertyExpositor.PostCall(
                    expo =>
                {
                    expo.SetAvailable(CanSelectIdeas);

                    if (!CanSelectIdeas)
                    {
                        FieldDef.IdeaReferencingProperty = null;
                    }
                });

                var CanAssignTableDef = FieldDef.FieldType.IsEqual(DataType.DataTypeTable);
                TableDefAssignationButton.PostCall(
                    ctrl =>
                {
                    // ctrl.SetAvailable(CanAssignTableDef);
                    ctrl.IsEnabled = CanAssignTableDef;

                    /* Cancelled (better is to save user's data)...
                     * if (!CanAssignTableDef)
                     * {
                     *  FieldDef.DeclaringTableDefinition = null;
                     *  FieldDef.DeclaringTableDefIsOwned = false;
                     * } */
                });
                TableDefAssignSingleRecordCbx.PostCall(ctrl => ctrl.IsEnabled = CanAssignTableDef);
            });

            FieldTypeExpositor.ExposedProperty = ExposedProperty.TechName;
            FieldTypeExpositor.LabelMinWidth   = 90;

            // Add the just created extra controls
            ExtraControls.Add(HideInDiagramExpositor);
            ExtraControls.Add(FieldTypeExpositor);
            ExtraControls.Add(AvailableValuesSourcesExpositor);
            ExtraControls.Add(IdeaReferencingPropertyExpositor);

            TableDefAssignationPanel.Children.Add(TableDefAssignationButtonArea);
            // POSTPONED: TableDefAssignationPanel.Children.Add(TableDefAssignSingleRecordCbx);
            ExtraControls.Add(TableDefAssignationPanel);

            var Result = InstanceController.Edit(Display.CreateEditPanel(FieldDef, null, true, null, null, true, false, false, true, ExtraControls.ToArray()),
                                                 "Edit Field Definition - " + FieldDef.ToString(), InitialWidth: 700).IsTrue();

            return(Result);
        }