/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedRelationship">SerializedRelationship.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> protected SerializedRelationshipViewModel(ViewModelStore viewModelStore, SerializedRelationship serializedRelationship, DomainRelationship referencedElement, SerializationClassViewModel parent) : base(viewModelStore, serializedRelationship, referencedElement, parent) { if (this.SerializationElement != null) { // subscribe this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializationRelationshipropertyChanged)); if (this.SerializationElement.SerializedDomainRoles.Count > 0) { sourceRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.SerializedDomainRoles[0], referencedElement, this); this.AddChild(sourceRoleVM); } if (this.SerializationElement.SerializedDomainRoles.Count > 1) { targetRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.SerializedDomainRoles[1], referencedElement, this); if (targetRoleVM.SerializationElement.SerializationClass is SerializedDomainClass) targetClassVM = new SerializedDomainClassViewModel(this.ViewModelStore, targetRoleVM.SerializationElement.SerializationClass as SerializedDomainClass, this); else if (targetRoleVM.SerializationElement.SerializationClass is SerializedReferenceRelationship) targetClassVM = new SerializedReferenceRelationshipViewModel(this.ViewModelStore, targetRoleVM.SerializationElement.SerializationClass as SerializedReferenceRelationship, this); this.AddChild(targetRoleVM); } } }
{ /// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedRelationship">SerializedRelationship.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> public SerializedReferenceRelationshipViewModel(ViewModelStore viewModelStore, SerializedReferenceRelationship serializedRelationship, SerializationClassViewModel parent) : base(viewModelStore, serializedRelationship, serializedRelationship.ReferenceRelationship, parent) { if( this.SerializationElement != null ) if (this.SerializationElement.ReferenceRelationship != null) this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.ReferenceRelationship.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializedReferenceRelationshipPropertyChanged)); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedRelationship">SerializedRelationship.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> protected SerializedRelationshipViewModel(ViewModelStore viewModelStore, SerializedRelationship serializedRelationship, DomainRelationship referencedElement, SerializationClassViewModel parent) : base(viewModelStore, serializedRelationship, referencedElement, parent) { if (this.SerializationElement != null) { // subscribe this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializationRelationshipropertyChanged)); if (this.SerializationElement.SerializedDomainRoles.Count > 0) { sourceRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.SerializedDomainRoles[0], referencedElement, this); this.AddChild(sourceRoleVM); } if (this.SerializationElement.SerializedDomainRoles.Count > 1) { targetRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.SerializedDomainRoles[1], referencedElement, this); if (targetRoleVM.SerializationElement.SerializationClass is SerializedDomainClass) { targetClassVM = new SerializedDomainClassViewModel(this.ViewModelStore, targetRoleVM.SerializationElement.SerializationClass as SerializedDomainClass, this); } else if (targetRoleVM.SerializationElement.SerializationClass is SerializedReferenceRelationship) { targetClassVM = new SerializedReferenceRelationshipViewModel(this.ViewModelStore, targetRoleVM.SerializationElement.SerializationClass as SerializedReferenceRelationship, this); } this.AddChild(targetRoleVM); } } }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializationClass">SerializationClass.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> protected SerializationClassViewModel(ViewModelStore viewModelStore, SerializationClass serializationClass, ModelElement referencedElement, SerializationClassViewModel parent) : base(viewModelStore, serializationClass, referencedElement) { this.childrenVMs = new ObservableCollection <SerializationElementViewModel>(); this.childrenVMsRO = new ReadOnlyObservableCollection <SerializationElementViewModel>(this.childrenVMs); this.attributesVMs = new ObservableCollection <SerializationAttributeElementViewModel>(); this.attributesVMsRO = new ReadOnlyObservableCollection <SerializationAttributeElementViewModel>(attributesVMs); this.parent = parent; if (this.SerializationElement != null) { // Lazy load the child items, if necessary. if (this.HasLoadedChildren) { this.LoadChildren(); } else if (this.SerializationElement.Children.Count > 0) { this.childrenVMs.Add(DummyChild); } this.LoadAttributes(); /* * // Lazy load the attribute items, if necessary. * if (!this.HasLoadedAttributes) * { * this.LoadAttributes(); * } * else if (this.SerializationElement.Attributes.Count > 0) * this.attributesVMs.Add(DummyAttribute); */ // subscribe this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializationClassPropertyChanged)); this.EventManager.GetEvent <ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), true, this.SerializationElement.Id, new Action <ElementAddedEventArgs>(OnChildAdded)); this.EventManager.GetEvent <ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), true, this.SerializationElement.Id, new Action <ElementDeletedEventArgs>(OnChildRemoved)); this.EventManager.GetEvent <ModelRolePlayerMovedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), this.SerializationElement.Id, new Action <RolePlayerOrderChangedEventArgs>(OnChildMoved)); this.EventManager.GetEvent <ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), true, this.SerializationElement.Id, new Action <ElementAddedEventArgs>(OnAttributeAdded)); this.EventManager.GetEvent <ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), true, this.SerializationElement.Id, new Action <ElementDeletedEventArgs>(OnAttributeRemoved)); this.EventManager.GetEvent <ModelRolePlayerMovedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), this.SerializationElement.Id, new Action <RolePlayerOrderChangedEventArgs>(OnAttributeMoved)); } }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedIdProperty">SerializedIdProperty.</param> public SerializedIdPropertyViewModel(ViewModelStore viewModelStore, SerializedIdProperty serializedIdProperty, SerializationClassViewModel parent) : base(viewModelStore, serializedIdProperty, null, parent) { if (this.SerializationElement != null) { // subscribe this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializedIdPropertyPropertyChanged)); } }
{ /// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedRelationship">SerializedRelationship.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> public SerializedEmbeddingRelationshipViewModel(ViewModelStore viewModelStore, SerializedEmbeddingRelationship serializedRelationship, SerializationClassViewModel parent) : base(viewModelStore, serializedRelationship, serializedRelationship.EmbeddingRelationship, parent) { if (this.SerializationElement.EmbeddingRelationship != null) { this.sourceRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.EmbeddingRelationship.Source, this.SerializationElement.EmbeddingRelationship, this); this.targetRoleVM = new SerializedDomainRoleViewModel(this.ViewModelStore, this.SerializationElement.EmbeddingRelationship.Target, this.SerializationElement.EmbeddingRelationship, this); } }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializationClass">SerializationClass.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> protected SerializationClassViewModel(ViewModelStore viewModelStore, SerializationClass serializationClass, ModelElement referencedElement, SerializationClassViewModel parent) : base(viewModelStore, serializationClass, referencedElement) { this.childrenVMs = new ObservableCollection<SerializationElementViewModel>(); this.childrenVMsRO = new ReadOnlyObservableCollection<SerializationElementViewModel>(this.childrenVMs); this.attributesVMs = new ObservableCollection<SerializationAttributeElementViewModel>(); this.attributesVMsRO = new ReadOnlyObservableCollection<SerializationAttributeElementViewModel>(attributesVMs); this.parent = parent; if (this.SerializationElement != null) { // Lazy load the child items, if necessary. if (this.HasLoadedChildren) { this.LoadChildren(); } else if (this.SerializationElement.Children.Count > 0) this.childrenVMs.Add(DummyChild); this.LoadAttributes(); /* // Lazy load the attribute items, if necessary. if (!this.HasLoadedAttributes) { this.LoadAttributes(); } else if (this.SerializationElement.Attributes.Count > 0) this.attributesVMs.Add(DummyAttribute); */ // subscribe this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializationClassPropertyChanged)); this.EventManager.GetEvent<ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), true, this.SerializationElement.Id, new Action<ElementAddedEventArgs>(OnChildAdded)); this.EventManager.GetEvent<ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), true, this.SerializationElement.Id, new Action<ElementDeletedEventArgs>(OnChildRemoved)); this.EventManager.GetEvent<ModelRolePlayerMovedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesChildren.DomainClassId), this.SerializationElement.Id, new Action<RolePlayerOrderChangedEventArgs>(OnChildMoved)); this.EventManager.GetEvent<ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), true, this.SerializationElement.Id, new Action<ElementAddedEventArgs>(OnAttributeAdded)); this.EventManager.GetEvent<ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), true, this.SerializationElement.Id, new Action<ElementDeletedEventArgs>(OnAttributeRemoved)); this.EventManager.GetEvent<ModelRolePlayerMovedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(SerializationClassReferencesAttributes.DomainClassId), this.SerializationElement.Id, new Action<RolePlayerOrderChangedEventArgs>(OnAttributeMoved)); } }
private int GetChildIndex(SerializationClassViewModel viewModel, SerializationElementViewModel childVM) { // get index of childVM in the collection of children of viewModel for (int i = 0; i < viewModel.Children.Count; i++) { if (viewModel.Children[i] == childVM) { return(i); } } return(-1); }
private int GetAttributeIndex(SerializationClassViewModel viewModel, SerializationAttributeElementViewModel attrVM) { // get index of attrVM in the collection of attributes of viewModel for (int i = 0; i < viewModel.Attributes.Count; i++) { if (viewModel.Attributes[i] == attrVM) { return(i); } } return(-1); }
{ /// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedRelationship">SerializedRelationship.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> public SerializedReferenceRelationshipViewModel(ViewModelStore viewModelStore, SerializedReferenceRelationship serializedRelationship, SerializationClassViewModel parent) : base(viewModelStore, serializedRelationship, serializedRelationship.ReferenceRelationship, parent) { if (this.SerializationElement != null) { if (this.SerializationElement.ReferenceRelationship != null) { this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.ReferenceRelationship.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializedReferenceRelationshipPropertyChanged)); } } }
private int GetAttributeIndex(SerializationClassViewModel viewModel, SerializationAttributeElementViewModel attrVM) { // get index of attrVM in the collection of attributes of viewModel for (int i = 0; i < viewModel.Attributes.Count; i++) if (viewModel.Attributes[i] == attrVM) { return i; } return -1; }
private int GetChildIndex(SerializationClassViewModel viewModel, SerializationElementViewModel childVM) { // get index of childVM in the collection of children of viewModel for (int i = 0; i < viewModel.Children.Count; i++) if (viewModel.Children[i] == childVM) { return i; } return -1; }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializationClass">SerializationClass.</param> public SerializedDomainClassViewModel(ViewModelStore viewModelStore, SerializedDomainClass serializationClass, SerializationClassViewModel parent) : base(viewModelStore, serializationClass, serializationClass.DomainClass, parent) { }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializationAttributeElement">SerializationAttributeElement.</param> /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param> protected SerializationAttributeElementViewModel(ViewModelStore viewModelStore, SerializationAttributeElement serializationAttributeElement, ModelElement referencedElement, SerializationClassViewModel parent) : base(viewModelStore, serializationAttributeElement, referencedElement) { this.parent = parent; }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedIdProperty">SerializedIdProperty.</param> public SerializedIdPropertyViewModel(ViewModelStore viewModelStore, SerializedIdProperty serializedIdProperty, SerializationClassViewModel parent) : base(viewModelStore, serializedIdProperty, null, parent) { if (this.SerializationElement != null) { // subscribe this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializedIdPropertyPropertyChanged)); } }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="serializedDomainProperty">SerializedDomainProperty.</param> public SerializedDomainPropertyViewModel(ViewModelStore viewModelStore, SerializedDomainProperty serializedDomainProperty, SerializationClassViewModel parent) : base(viewModelStore, serializedDomainProperty, serializedDomainProperty.DomainProperty, parent) { if (this.SerializationElement != null) { // subscribe this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.SerializationElement.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializedPropertyPropertyChanged)); if (this.SerializationElement.DomainProperty != null) { // TODO: Add, Change, Delete property type } } }