public void AttachSource(IdeaDefinition SourceIdeaDef) { this.DetachSource(); if (SourceIdeaDef == null) { return; } this.SourceIdeaDef = SourceIdeaDef; this.SourceIdeaDef.PropertyChanged += ShowPreview; this.SourceIdeaDef.DefaultSymbolFormat.PropertyChanged += ShowPreview; if (this.SourceRelationshipDef != null) { this.SourceRelationshipDef.DefaultConnectorsFormat.PropertyChanged += ShowPreview; this.SourceRelationshipDef.DefaultConnectorsFormat.HeadPlugs.CollectionChanged += ShowPreview; this.SourceRelationshipDef.DefaultConnectorsFormat.TailPlugs.CollectionChanged += ShowPreview; this.SourceRelationshipDef.OriginOrParticipantLinkRoleDef.AllowedVariants.CollectionChanged += ShowPreview; this.SourceRelationshipDef.TargetLinkRoleDef.AllowedVariants.CollectionChanged += ShowPreview; } else { this.BrdOrigin.SetVisible(false); this.BrdTarget.SetVisible(false); } }
public GlobalDetailsDefinitor(EntityEditEngine EditEngine, IdeaDefinition DefinitorSource, DetailDesignator InitialDesignatorToEdit = null) : this() { this.DefinitorSource = DefinitorSource; this.VisualGlobalDetailDefsSource = DetailDefinitionCard.GenerateGlobalDetailsForDefinitor(this.DefinitorSource); this.GlobalDetailDefsMaintainer.SetDetailDefinitionsSource(EditEngine, this.DefinitorSource, this.VisualGlobalDetailDefsSource, true, InitialDesignatorToEdit); }
public static Idea TestTemplate(Type ExpectedSourceIdeaKind, IdeaDefinition ExpectedSourceIdeaDefinition, string SourceTemplateName, string SourceTemplateText, Composition SourceComposition, Idea SourceIdea = null, bool CanSelectSource = true) { DialogOptionsWindow Dialog = null; var TemplateEd = new TemplateTester(ExpectedSourceIdeaKind, ExpectedSourceIdeaDefinition, SourceTemplateText, SourceComposition, SourceIdea, CanSelectSource); Display.OpenContentDialogWindow(ref Dialog, "Test of " + SourceTemplateName, TemplateEd, 600, 750); return(TemplateEd.SourceIdea); }
// --------------------------------------------------------------------------------------------------------------------------------------------------------- public bool UpdateRelatedDetailDefinitions(IdeaDefinition TargetIdeaDefinition) { // Add and update detail designators foreach (var GlobalDetailDef in this.VisualGlobalDetailDefsSource) { if (!GlobalDetailDef.IsPreexistent) { TargetIdeaDefinition.DetailDesignators.Add(GlobalDetailDef.Designator.Value); } var Index = TargetIdeaDefinition.DetailDesignators.IndexOfMatch(detdsn => detdsn.IsEqual(GlobalDetailDef.Designator.Value)); if (Index >= 0) { TargetIdeaDefinition.DetailDesignators[Index].Name = GlobalDetailDef.Name; TargetIdeaDefinition.DetailDesignators[Index].Summary = GlobalDetailDef.Summary; } } // Delete the no longer existent detail designators var AllDetailDesignators = this.VisualGlobalDetailDefsSource.ToList(); for (int Index = TargetIdeaDefinition.DetailDesignators.Count - 1; Index >= 0; Index--) { var TargetDetailDesignator = TargetIdeaDefinition.DetailDesignators[Index]; if (!AllDetailDesignators.Any(det => det.Designator.Value.IsEqual(TargetDetailDesignator))) { TargetIdeaDefinition.DetailDesignators.RemoveAt(Index); // Propagate deletion to dependent Idea details var Dependents = TargetIdeaDefinition.GetDependentIdeas(); foreach (var DependantIdea in Dependents) { var SelectedItems = DependantIdea.Details.Where(det => det.Designation.IsEqual(TargetDetailDesignator)).ToList(); foreach (var Item in SelectedItems) { DependantIdea.Details.Remove(Item); } } } } // Update the sort of the details TargetIdeaDefinition.DetailDesignators.UpdateSortFrom(this.VisualGlobalDetailDefsSource, ((targetitem, sorteditem) => targetitem.IsEqual(sorteditem.Designator.Value))); return(true); }
public void SetDetailDefinitionsSource(EntityEditEngine EditEngine, IdeaDefinition SourceDefinitor, IList <DetailDefinitionCard> Source, bool IsGlobal, DetailDesignator InitialDesignatorToEdit = null) { this.SourceDefinitor = SourceDefinitor; this.SourceEngine = EditEngine; this.DetailsSource = Source; this.DetailsSourceIsGlobal = IsGlobal; this.InitialDesignatorToEdit = InitialDesignatorToEdit; this.DetailsListBox.ItemsSource = Source; this.DetailsToolPanel.TargetListBox = this.DetailsListBox; // Notice that selection is made (see applied style), but focus highlight is only applied when it happens. if (this.DetailsSource.Count > 0) { this.DetailsListBox.SelectedIndex = 0; } }
public TemplateTester(Type ExpectedSourceIdeaKind, IdeaDefinition ExpectedSourceIdeaDefinition, string SourceTemplateText, Composition SourceComposition, Idea SourceIdea = null, bool CanSelectSource = true) : this() { this.ExpectedSourceIdeaKind = ExpectedSourceIdeaKind; this.ExpectedSourceIdeaDefinition = ExpectedSourceIdeaDefinition; this.SourceTemplateText = SourceTemplateText; this.SourceComposition = SourceComposition; this.SourceIdea = SourceIdea; this.TisSourceSelector.CompositesSource = this.SourceComposition.IntoEnumerable(); this.TisSourceSelector.Value = this.SourceIdea.NullDefault(this.SourceComposition); this.TisSourceSelector.HideSelectNullItemActioner = true; if (CanSelectSource) { this.TisSourceSelector.EditingAction = (source => this.GeneratePreview(source as Idea)); } else { this.TisSourceSelector.IsEnabled = false; } }
/// <summary> /// Creates and returns a collection of global detail editing cards for the supplied definitor. /// </summary> public static EditableList <DetailDefinitionCard> GenerateGlobalDetailsForDefinitor(IdeaDefinition Definitor) { var GeneratedGlobalDetailDefs = new EditableList <DetailDefinitionCard>("GlobalDetailDefs", null); foreach (var PredefDesignator in Definitor.DetailDesignators) { var NewDetEdit = new DetailDefinitionCard(true, new Assignment <DetailDesignator>(PredefDesignator, false)); GeneratedGlobalDetailDefs.Add(NewDetEdit); } return(GeneratedGlobalDetailDefs); }
public static GlobalDetailsDefinitor CreateGlobalDetailsDefinitor(EntityEditEngine EditEngine, IdeaDefinition DefinitorSource, DetailDesignator InitialDesignatorToEdit = null) { return(new GlobalDetailsDefinitor(EditEngine, DefinitorSource, InitialDesignatorToEdit)); }