/// <summary> /// Executes the appropriate action for creating a new item for the specified Palette. /// </summary> public override void ApplyPaletteItemCreation(IRecognizableElement Palette) { if (Palette.IsIn(this.TargetComposition.Engine.GetExposedConceptsPalettes())) { CurrentView.Engine.StartCommandVariation("Create Concept Definition"); var Result = DomainMaintainer.ConceptDefinitionCreate(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.ConceptDefinitions); if (Result != null) { CurrentView.Engine.TargetComposition.CompositeContentDomain.ConceptDefinitions.Add(Result); DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } } else if (Palette.IsIn(this.TargetComposition.Engine.GetExposedRelationshipsPalettes())) { CurrentView.Engine.StartCommandVariation("Create Relationship Definition"); var Result = DomainMaintainer.RelationshipDefinitionCreate(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.RelationshipDefinitions); if (Result != null) { CurrentView.Engine.TargetComposition.CompositeContentDomain.RelationshipDefinitions.Add(Result); DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } } else if (Palette.IsIn(this.TargetComposition.CompositeContentDomain.MarkerClusters)) { CurrentView.Engine.StartCommandVariation("Create Marker Definition"); var Result = DomainMaintainer.MarkerDefinitionCreate(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.MarkerDefinitions); if (Result != null) { CurrentView.Engine.TargetComposition.CompositeContentDomain.MarkerDefinitions.Add(Result); DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } } }
public WidgetItemsPalette(DocumentEngine Engine, IRecognizableElement Palette) : this() { this.CurrentEngine = Engine; this.Palette = Palette; var OwnerPanel = this.GetNearestVisualDominantOfType <EntitledPanel>(); if (OwnerPanel == null) { return; } OwnerPanel.CreationText = "Create new Definition..."; }
/// <summary> /// Executes the appropriate action for when the supplied Item, of the specified Palette, was selected or activated and intended for immediate use. /// </summary> public abstract void ApplyPaletteItemSelection(IRecognizableElement Item, IRecognizableElement Palette, bool ImmediateUse);
/// <summary> /// Executes the appropriate action for creating a new item for the specified Palette. /// </summary> public abstract void ApplyPaletteItemCreation(IRecognizableElement Palette);
/// <summary> /// Returns the currently exposed Items of the specified Complement Palette of this Document Engine. /// </summary> public abstract IEnumerable <IRecognizableElement> GetExposedItemsOfComplementPalette(IRecognizableElement Palette);
/// <summary> /// Returns the currently exposed Items of the specified Relationship Palette of this Document Engine. /// </summary> public abstract IEnumerable <IRecognizableElement> GetExposedItemsOfRelationshipPalette(IRecognizableElement Palette);
public SelectionButton(IRecognizableElement SourceElement, Action <string> ButtonAction) : this(SourceElement.TechName, SourceElement.Name, SourceElement.Summary, SourceElement.Pictogram, ButtonAction) { }
/// <summary> /// Executes the appropriate action for when the supplied Item, of the specified Palette, was selected or activated and intended for immediate action. /// </summary> public override void ApplyPaletteItemSelection(IRecognizableElement Item, IRecognizableElement Palette, bool IsForImmediateAction) { var IsMarker = Palette.IsIn(this.TargetComposition.CompositeContentDomain.MarkerClusters); var IsComplement = (Palette == UniqueComplementsPalette); if (!(Item is ConceptDefinition || Item is RelationshipDefinition) && !IsMarker && !IsComplement) { return; } if (this.RunningMouseCommand != null) { this.DoCancelOperation(false, null); } CurrentView.Manipulator.Abort(); if (IsMarker) { if (IsForImmediateAction) { CurrentView.Engine.StartCommandVariation("Modify Marker Definition"); if (DomainMaintainer.MarkerDefinitionEdit(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.MarkerDefinitions, (MarkerDefinition)Item)) { DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } //ALT: Assign marker to currently selected representation // MarkerAssignmentCommand.CreateMarker(this, (MarkerDefinition)Item, this.CurrentView, CurrentView.SelectedRepresentations.FirstOrDefault()); } else { this.RunningMouseCommand = new MarkerAssignmentCommand(this, (MarkerDefinition)Item); } } else if (IsComplement) { this.RunningMouseCommand = new ComplementCreationCommand(this, (SimplePresentationElement)Item); } else if (Item is ConceptDefinition) { if (IsForImmediateAction) { CurrentView.Engine.StartCommandVariation("Modify Concept Definition"); if (DomainMaintainer.ConceptDefinitionEdit(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.ConceptDefinitions, (ConceptDefinition)Item)) { DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); ProductDirector.ContentTreeControl.Refresh(); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } } else { this.RunningMouseCommand = new ConceptCreationCommand(this, (ConceptDefinition)Item); } } else if (Item is RelationshipDefinition) { if (IsForImmediateAction) { CurrentView.Engine.StartCommandVariation("Modify Relationship Definition"); if (DomainMaintainer.RelationshipDefinitionEdit(CurrentView.Engine.TargetComposition.CompositeContentDomain, CurrentView.Engine.TargetComposition.CompositeContentDomain.RelationshipDefinitions, (RelationshipDefinition)Item)) { DomainServices.UpdateDomainDependants(CurrentView.Engine.TargetComposition.CompositeContentDomain); ProductDirector.ContentTreeControl.Refresh(); CurrentView.Engine.CompleteCommandVariation(); } else { CurrentView.Engine.DiscardCommandVariation(); } } else { this.RunningMouseCommand = new RelationshipCreationCommand(this, (RelationshipDefinition)Item); } } else { throw new UsageAnomaly("Unknown palette item type.", Item); } if (this.RunningMouseCommand != null) { this.RunningMouseCommand.Execute(); } }
/// <summary> /// Returns the currently exposed Items of the specified Complement Palette of this View. /// </summary> public override IEnumerable <IRecognizableElement> GetExposedItemsOfComplementPalette(IRecognizableElement Palette) { return(Domain.StandardComplementDefinitions); }
/// <summary> /// Returns the currently exposed Items of the specified Marker Palette of this View. /// </summary> public override IEnumerable <IRecognizableElement> GetExposedItemsOfMarkerPalette(IRecognizableElement Palette) { // NOTE: Here is safe to use Tech-Name to locate the Palette because Marker clusters are not be editable (cannot be renamed) return(this.TargetComposition.CompositeContentDomain.MarkerDefinitions .Where(mrk => mrk.ClusterKey == Palette.TechName).ToList()); }
/// <summary> /// Returns the currently exposed Items of the specified Relationship Palette of this View. /// </summary> public override IEnumerable <IRecognizableElement> GetExposedItemsOfRelationshipPalette(IRecognizableElement Palette) { // IMPORTANT: Do not refer here to "this.TargetComposition.IdeaDefinitor.Definitions" return(this.TargetComposition.CompositeContentDomain.RelationshipDefinitions.Where(rdef => rdef.Cluster.TechName == Palette.TechName).ToList()); }