예제 #1
0
        /// <exception cref="RelationshipException">
        /// Cannot create relationship between the two types.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="parentType"/> or <paramref name="innerType"/> is null.
        /// </exception>
        public NestingRelationship AddNesting(INestable parentType, INestableChild innerType)
        {
            NestingRelationship nesting = new NestingRelationship(parentType, innerType);

            AddRelationship(nesting);
            return(nesting);
        }
예제 #2
0
        public NestingRelationship Clone(INestable parentType, INestableChild innerType)
        {
            NestingRelationship nesting = new NestingRelationship(parentType, innerType);

            nesting.CopyFrom(this);
            return(nesting);
        }
예제 #3
0
        internal NestableHelper(INestable nestable)
        {
            if (nestable == null)
            {
                throw new ArgumentException(nameof(nestable));
            }

            this.nestable = nestable;
        }
예제 #4
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="first"/> is null.-or-
        /// <paramref name="second"/> is null.
        /// </exception>
        internal NestingRelationship(INestable first, INestableChild second)
        {
            if (first == null)
            {
                throw new ArgumentNullException("first");
            }
            if (second == null)
            {
                throw new ArgumentNullException("second");
            }

            this.first  = first;
            this.second = second;
            Attach();
        }
예제 #5
0
        public void ProcessSelectStoryNameButton(DataItem sentData)
        {
            PrintableString[] printableDescription = new PrintableString[1];
            //Cast sentData as IPrintable to access explictly implemented Text property.
            IPrintable journalDescriptionPrintable = (IPrintable)sentData;

            printableDescription[0] = new PrintableString(journalDescriptionPrintable.PrintableText);
            SetDisplayableArrayData <DataItem>(printableDescription, 3);
            if (!(sentData is INestable <DataItem>))
            {
                return;
            }
            INestable <DataItem> returnable = (INestable <DataItem>)sentData;

            SetDisplayableArrayData <DataItem>(returnable.GetArray(), 2);
        }
예제 #6
0
 public void Set(DataItem sentData)
 {
     if (textElement != null)
     {
         textElement.SetText(sentData.Text);
     }
     if (subPanel == null)
     {
         return;
     }
     if (sentData is INestable <DataItem> )
     {
         INestable <DataItem> returnable = (INestable <DataItem>)sentData;
         subPanel.SetData(returnable.GetArray());
     }
 }
예제 #7
0
        /// <summary>
        /// Adds the relationships from <paramref name="nrRelationships"/> to the
        /// diagram.
        /// </summary>
        /// <param name="nrRelationships">The relationships to add.</param>
        private void AddRelationships(NRRelationships nrRelationships)
        {
            foreach (NRNesting nrNesting in nrRelationships.Nestings)
            {
                INestable      parentType = types[nrNesting.ParentType] as INestable;
                INestableChild innerType  = types[nrNesting.InnerType];
                if (parentType != null && innerType != null)
                {
                    diagram.AddNesting(parentType, innerType);
                }
            }

            foreach (NRGeneralization nrGeneralization in nrRelationships.Generalizations)
            {
                CompositeType derivedType = types[nrGeneralization.DerivedType] as CompositeType;
                CompositeType baseType    = types[nrGeneralization.BaseType] as CompositeType;
                if (derivedType != null && baseType != null)
                {
                    diagram.AddGeneralization(derivedType, baseType);
                }
            }

            foreach (NRRealization nrRealization in nrRelationships.Realizations)
            {
                CompositeType implementingType = types[nrRealization.ImplementingType] as CompositeType;
                InterfaceType interfaceType    = types[nrRealization.BaseType] as InterfaceType;
                if (implementingType != null && interfaceType != null)
                {
                    diagram.AddRealization(implementingType, interfaceType);
                }
            }

            foreach (NRAssociation nrAssociation in nrRelationships.Associations)
            {
                TypeBase first  = types[nrAssociation.StartType];
                TypeBase second = types[nrAssociation.EndType];
                if (first != null && second != null)
                {
                    AssociationRelationship associationRelationship = diagram.AddAssociation(first, second);
                    associationRelationship.EndMultiplicity   = nrAssociation.EndMultiplicity;
                    associationRelationship.StartMultiplicity = nrAssociation.StartMultiplicity;
                    associationRelationship.EndRole           = nrAssociation.EndRole;
                    associationRelationship.StartRole         = nrAssociation.StartRole;
                }
            }
        }
예제 #8
0
파일: Nesting.cs 프로젝트: xtjatswc/NClass
        protected override bool CloneRelationship(IDiagram diagram, Shape first, Shape second)
        {
            if (diagram.DiagramType != DiagramType.ClassDiagram)
            {
                return(false);
            }

            INestable      firstType  = first.Entity as INestable;
            INestableChild secondType = second.Entity as INestableChild;

            if (firstType != null && secondType != null)
            {
                NestingRelationship clone = nesting.Clone(firstType, secondType);
                return(((ClassDiagram)diagram).InsertNesting(clone));
            }
            else
            {
                return(false);
            }
        }
예제 #9
0
        private void CreateNesting()
        {
            INestable      parent = first.Entity as INestable;
            INestableChild child  = second.Entity as INestableChild;

            try
            {
                if (parent == null)
                {
                    throw new RelationshipException(Strings.ErrorParentNestingNotSupported);
                }

                if (child == null)
                {
                    throw new RelationshipException(Strings.ErrorChildNestingNotSupported);
                }

                diagram.AddNesting(parent, child);
            }
            catch (RelationshipException ex)
            {
                MessageBox.Show(Strings.ErrorCannotCreateRelationship + " " + ex.Message);
            }
        }
예제 #10
0
        public void drawAddRemoveButtons()
        {
            GUILayout.Space(2.0f);
            GUILayout.BeginHorizontal(); // 2
            if (searchDepth == 0)
            {
                if (GUILayout.Button(GUIContent.none, SRWindow.olPlusPlus))
                {
                    SRWindow.Instance.duplicateSearchItem(this);
                }
            }
            GUILayout.FlexibleSpace();
#if PSR_FULL
            if (canSubsearch())
            {
                int selectedIndex = EditorGUILayout.Popup("", 0, new string[] { "Add Subsearch", Keys.PropertyLabel, Keys.GlobalLabel });
                if (selectedIndex > 0)
                {
                    if (selectedIndex == 1)
                    {
                        if (this is SearchItemProperty)
                        {
                            subsearch = (SearchItemProperty)SerializationUtil.Copy(this);
                        }
                        else
                        {
                            subsearch = new SearchItemProperty();
                        }
                    }

                    if (selectedIndex == 2)
                    {
                        if (this is SearchItemGlobal)
                        {
                            subsearch = (SearchItemGlobal)SerializationUtil.Copy(this);
                        }
                        else
                        {
                            subsearch = new SearchItemGlobal();
                        }
                    }
                    OnDeserializeSubSearch();
                    SRWindow.Instance.PersistCurrentSearch();
                }
            }
            GUILayout.FlexibleSpace();
#endif
            bool showMinus = true;
            if (searchDepth == 0 && sortIndex == 0 && SRWindow.Instance.currentSearch.items.Count == 1)
            {
                showMinus = false;
            }
            if (showMinus)
            {
                if (GUILayout.Button(GUIContent.none, SRWindow.olMinusMinus))
                {
                    if (searchDepth == 0)
                    {
                        SRWindow.Instance.RemoveSearchItem(this);
                    }
                    else
                    {
                        parent.subsearch = null;
                        SRWindow.Instance.PersistCurrentSearch();
                    }
                }
            }
            GUILayout.EndHorizontal(); // 2
        }
예제 #11
0
 public NestingRelationship AddNesting(INestable parentType, INestableChild innerType)
 {
     return(model.AddNesting(parentType, innerType));
 }
예제 #12
0
 protected ShapeContainer(IEntity entity) : base(entity)
 {
     this.containerEntity = (INestable)entity;
     this.ChildrenShapes  = new List <Shape>();
 }
예제 #13
0
 public NestingChildEventArgs(INestable element)
 {
     this.element = element;
 }