Пример #1
0
 /// <summary>
 /// Refreshes the selected settings.
 /// </summary>
 /// <param name="isAggregationEnabled">if set to <c>true</c> then aggregation is enabled.</param>
 /// <param name="aggregationKind">The aggregation kind.</param>
 private void RefreshSelectedSettings(bool isAggregationEnabled, AggregationKind aggregationKind)
 {
     if (!isAggregationEnabled)
     {
         SelectedSettings = NoneSettings;
     }
     else if (aggregationKind == AggregationKind.Average)
     {
         SelectedSettings = AverageSettings;
     }
     else if (aggregationKind == AggregationKind.First)
     {
         SelectedSettings = FirstSettings;
     }
     else if (aggregationKind == AggregationKind.Last)
     {
         SelectedSettings = LastSettings;
     }
     else if (aggregationKind == AggregationKind.Maximum)
     {
         SelectedSettings = MaximumSettings;
     }
     else if (aggregationKind == AggregationKind.Minimum)
     {
         SelectedSettings = MinimumSettings;
     }
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UmlInformationAttribute"/> class.
 /// </summary>
 /// <param name="aggregation">The kind of aggregation</param>
 /// <param name="isDerived">A value indicating whether the property is derived</param>
 /// <param name="isOrdered">A value indicating whether the property is ordered</param>
 /// <param name="isNullable">A value indicating whether the property may be null</param>
 /// <param name="isPersistent">A value indicating whether the property is persistent in a data-store</param>
 public UmlInformationAttribute(AggregationKind aggregation, bool isDerived, bool isOrdered, bool isNullable = false, bool isPersistent = true)
 {
     this.IsDerived    = isDerived;
     this.IsOrdered    = isOrdered;
     this.Aggregation  = aggregation;
     this.IsNullable   = isNullable;
     this.IsPersistent = isPersistent;
 }
Пример #3
0
        public void ChangeAggregation(AssociationEnd end, AggregationKind newAggregation)
        {
            ChangeAssociationAggregationCommand associationAggregationCommand =
                (ChangeAssociationAggregationCommand)ChangeAssociationAggregationCommandFactory.Factory().Create(DiagramController.ModelController);

            associationAggregationCommand.AssociationEnd     = end;
            associationAggregationCommand.NewAggregationKind = newAggregation;
            associationAggregationCommand.Execute();
        }
Пример #4
0
        public static EJunctionCapStyle GetCap(AggregationKind kind)
        {
            switch (kind)
            {
            case AggregationKind.composite:
                return(EJunctionCapStyle.FullDiamond);

            case AggregationKind.shared:
                return(EJunctionCapStyle.Diamond);

            default: return(EJunctionCapStyle.Straight);
            }
        }
        ///<summary>
        /// The method creates an ASBIESpec based on an element, a Name, the ABIE it is associated to
        /// and the type of aggregation. A corresponding ASBIESpec of the association between the element
        /// and it's associated ABIE is then returned through the return parameter.
        ///</summary>
        ///<param name="element">
        /// The XSD element holding the ASBIE.
        ///</param>
        ///<param name="asbieName">
        /// The Name of the ASBIE to be created.
        ///</param>
        ///<param name="associatedAbie">
        /// The associated ABIE.
        ///</param>
        ///<param name="aggregationKind">
        /// The aggregation Type can be either composite or shared.
        ///</param>
        ///<returns>
        /// The method returns an ASBIESpec holding the association between
        /// <paramref name="element"/> and <paramref name="associatedAbie"/>.
        ///</returns>
        public static AsbieSpec CumulateAsbieSpec(Element element, string asbieName, IAbie associatedAbie,
                                                  AggregationKind aggregationKind)
        {
            var asbieSpec = new AsbieSpec
            {
                AssociatedAbie  = associatedAbie,
                Name            = asbieName,
                LowerBound      = ResolveMinOccurs(element.MinOccurs),
                UpperBound      = ResolveMaxOccurs(element.MaxOccurs),
                AggregationKind = aggregationKind
            };

            return(asbieSpec);
        }
Пример #6
0
        private void bOk_Click(object sender, RoutedEventArgs e)
        {
            modelController.BeginMacro();
            modelController.CreatedMacro.Description = CommandDescription.UPDATE_ASSOCIATION_MACRO;

            if (tbName.ValueChanged)
            {
                associationController.RenameElement(tbName.Text);
            }
            if (tbOnto.ValueChanged)
            {
                NamedElementController.ChangeOntologyEquivalent(Association, tbOnto.Text, modelController);
            }

            foreach (AssociationEndEditor endEditor in endEditors)
            {
                if (endEditor.tbRole.ValueChanged)
                {
                    NamedElementController.RenameElement(endEditor.AssociationEnd, endEditor.tbRole.Text, modelController, null);
                }

                if (endEditor.tbLower.ValueChanged ||
                    endEditor.tbUpper.ValueChanged)
                {
                    uint?            lower;
                    UnlimitedNatural upper;
                    try
                    {
                        lower = MultiplicityElementController.ParseNullabelUint(endEditor.tbLower.Text);
                        upper = MultiplicityElementController.ParseUnlimitedNatural(endEditor.tbUpper.Text);
                    }
                    catch (FormatException)
                    {
                        CommandCantExecuteDialog dialog = new CommandCantExecuteDialog();
                        dialog.tbCommand.Content = "Wrong multiplicity format";
                        dialog.tbExMsg.Content   = String.Format("{0}..{1} is not a correct format for multiplicity.", endEditor.tbLower.Text, endEditor.tbUpper.Text);
                        dialog.ShowDialog();
                        return;
                    }
                    MultiplicityElementController.ChangeMultiplicityOfElement(endEditor.AssociationEnd, Association, lower, upper, modelController);
                }

                if (endEditor.cbType.SelectedIndex != endEditor.oldKindIndex)
                {
                    AggregationKind aggregationKind = AggregationKind.none;
                    switch (endEditor.cbType.SelectedIndex)
                    {
                    case 0:
                        aggregationKind = AggregationKind.none;
                        break;

                    case 1:
                        aggregationKind = AggregationKind.shared;
                        break;

                    case 2:
                        aggregationKind = AggregationKind.composite;
                        break;
                    }

                    associationController.ChangeAggregation(endEditor.AssociationEnd, aggregationKind);
                }
            }

            modelController.CommitMacro();
            DialogResult = true;
            Close();
        }
 internal override void CommandOperation()
 {
     AssociatedElements.Add(AssociationEnd.Association);
     oldAggregationKind         = AssociationEnd.Aggregation;
     AssociationEnd.Aggregation = NewAggregationKind;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyMetaInfo"/> class
 /// </summary>
 /// <param name="name">The name of the property which meta-data are copied in this<see cref="PropertyMetaInfo"/></param>
 /// <param name="typeName">The name of the property type</param>
 /// <param name="propertyKind">The <see cref="PropertyKind"/></param>
 /// <param name="aggregation">The <see cref="AggregationKind"/></param>
 /// <param name="isDerived">A value indicating whether the property is derived</param>
 /// <param name="isOrdered">A value indicating whether the property is ordered</param>
 /// <param name="isPersistent">A value indicating whether the property is persisted</param>
 /// <param name="lowerCardinality">The lower cardinality of the property</param>
 /// <param name="upperCardinality">The upper cardinality</param>
 /// <param name="isDataMember">A value indicating whether the property shall be serialized or deserialized</param>
 public PropertyMetaInfo(string name, string typeName, PropertyKind propertyKind, AggregationKind aggregation, bool isDerived, bool isOrdered, bool isPersistent, int?lowerCardinality, string upperCardinality, bool isDataMember)
     : base(aggregation, isDerived, isOrdered, lowerCardinality == 0 && upperCardinality == "1", isPersistent)
 {
     this.Name             = name;
     this.TypeName         = typeName;
     this.PropertyKind     = propertyKind;
     this.LowerCardinality = lowerCardinality;
     this.UpperCardinality = upperCardinality;
     this.IsDataMember     = isDataMember;
 }