Esempio n. 1
0
        //private IControlsAttributes classController;

        public override void SetDisplayedObject(object property, object diagram)
        {
            this.PIMAttribute = (PIMAttribute)property;

            //this.classController = classController;

            ExolutioContextMenu exolutioContextMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAttribute, (Diagram)diagram);

            exolutioContextMenu.ScopeObject = property;
            exolutioContextMenu.Diagram     = diagram;
            ContextMenu = exolutioContextMenu;


#if SILVERLIGHT
            ContextMenuService.SetContextMenu(this, ContextMenu);
#else
            MouseDoubleClick += PIMAttributeTextBox_MouseDoubleClick;
            MouseDown        += PIMAttributeTextBox_MouseDown;
            PreviewMouseDown += PIMAttributeTextBox_PreviewMouseDown;
#endif

            this.PIMAttribute.PropertyChanged += OnPropertyChangedEvent;
            Background = ViewToolkitResources.TransparentBrush;
            RefreshTextContent();
            BindType();
        }
Esempio n. 2
0
        public override void SetDisplayedObject(object property, object diagram)
        {
            this.PSMAttribute = (PSMAttribute)property;

            //this.classController = classController;

            #region property context menu

            ExolutioContextMenu exolutioContextMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMAttribute, (Diagram)diagram);
            exolutioContextMenu.ScopeObject = property;
            exolutioContextMenu.Diagram     = diagram;
            ContextMenu = exolutioContextMenu;

//#if SILVERLIGHT
//            change.Icon = ExolutioResourceNames.GetResourceImageSource(ExolutioResourceNames.pencil);
//            remove.Icon = ExolutioResourceNames.GetResourceImageSource(ExolutioResourceNames.delete2);
//#else
//            change.Icon = ExolutioResourceNames.GetResourceImageSource(ExolutioResourceNames.pencil);
//            remove.Icon = ExolutioResourceNames.GetResourceImageSource(ExolutioResourceNames.delete2);
//#endif

            #endregion

            this.PSMAttribute.PropertyChanged += OnPropertyChangedEvent;
#if SILVERLIGHT
            ContextMenuService.SetContextMenu(this, ContextMenu);
#else
            MouseDoubleClick += PSMAttributeTextBox_MouseDoubleClick;
            MouseDown        += PSMAttributeTextBox_MouseDown;
            PreviewMouseDown += PSMAttributeTextBox_PreviewMouseDown;
#endif
            Background = ViewToolkitResources.TransparentBrush;
            RefreshTextContent();
            BindType();
        }
Esempio n. 3
0
        private void CreateMenus()
        {
            associationMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociation, DiagramView.Diagram);
            AddConnectorCommands(associationMenu);
            ContextMenu = associationMenu;

            startPointMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociationEnd, DiagramView.Diagram);
            Connector.StartPoint.ContextMenu = startPointMenu;

            endPointMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociationEnd, DiagramView.Diagram);
            Connector.EndPoint.ContextMenu = endPointMenu;

            #if SILVERLIGHT
            // for some reason the menus can not be shared and have to be created again
            associationMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociation, DiagramView.Diagram);
            AddConnectorCommands(associationMenu);
            NameLabel.ContextMenu = associationMenu;
            startPointMenu        = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociationEnd, DiagramView.Diagram);
            SourceCardinalityLabel.ContextMenu = startPointMenu;
            endPointMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMAssociationEnd, DiagramView.Diagram);
            TargetCardinalityLabel.ContextMenu = endPointMenu;
            #else
            //NameLabel.ContextMenu = associationMenu;
            //SourceCardinalityLabel.ContextMenu = startPointMenu;
            //TargetCardinalityLabel.ContextMenu = endPointMenu;
            #endif
        }
Esempio n. 4
0
        public override IEnumerable <ComponentViewBase> LoadDiagram(Diagram diagram)
        {
            IEnumerable <ComponentViewBase> withoutViewHelpers = base.LoadDiagram(diagram);

            foreach (ComponentViewBase withoutViewHelper in withoutViewHelpers)
            {
                if (withoutViewHelper is PIMClassView)
                {
                    ((PIMClassView)withoutViewHelper).ViewHelper.X = RandomGenerator.Next(300);
                    ((PIMClassView)withoutViewHelper).ViewHelper.Y = RandomGenerator.Next(300);
                }
            }
            ExolutioContextMenu diagramMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMDiagram, this.Diagram);

            ExolutioCanvas.ContextMenu = diagramMenu;

            ((ExolutioContextMenu)ExolutioCanvas.ContextMenu).ScopeObject = PIMDiagram;
            ((ExolutioContextMenu)ExolutioCanvas.ContextMenu).Diagram     = PIMDiagram;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(ExolutioCanvas, diagramMenu);
            MenuHelper.CreateSubmenuForCommandsWithoutScope(diagramMenu);
#else
            ContextMenuItem otherItemsMenu = new ContextMenuItem("Other operations");
            MenuHelper.CreateSubmenuForCommandsWithoutScope(otherItemsMenu);
            ExolutioCanvas.ContextMenu.Items.Add(otherItemsMenu);
#endif

            return(withoutViewHelpers);
        }
Esempio n. 5
0
        public PSMDiagramView()
        {
            this.RepresentantsCollection.Registrations.Add(typeof(PSMClass), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMClassView(),
                                                               () => new PSMClassViewHelper(this.Diagram),
                                                               typeof(PSMClass),
                                                               typeof(PSMClassViewHelper),
                                                               typeof(PSMClassView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMSchemaClass), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMSchemaClassView(),
                                                               () => new PSMSchemaClassViewHelper(this.Diagram),
                                                               typeof(PSMSchemaClass),
                                                               typeof(PSMSchemaClassViewHelper),
                                                               typeof(PSMSchemaClassView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMContentModel), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMContentModelView(),
                                                               () => new PSMContentModelViewHelper(this.Diagram),
                                                               typeof(PSMContentModel),
                                                               typeof(PSMContentModelViewHelper),
                                                               typeof(PSMContentModelView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMAssociation), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMAssociationView(),
                                                               () => new PSMAssociationViewHelper(this.Diagram),
                                                               typeof(PSMAssociation),
                                                               typeof(ConnectionViewHelper),
                                                               typeof(PSMAssociationView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMGeneralization), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMGeneralizationView(),
                                                               () => new PSMGeneralizationViewHelper(this.Diagram),
                                                               typeof(PSMGeneralization),
                                                               typeof(ConnectionViewHelper),
                                                               typeof(PSMGeneralizationView)));

            LayoutManager = new LayoutManager();

            ExolutioCanvas.MouseLeftButtonUp += ExolutioCanvas_MouseLeftButtonUp;
            ExolutioCanvas.Loaded            += ExolutioCanvas_Loaded;
            ExolutioCanvas.ContentChanged    += ExolutioCanvas_ContentChanged;

            ExolutioContextMenu diagramMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMSchema, this.Diagram);

            ExolutioCanvas.ContextMenu = diagramMenu;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(ExolutioCanvas, diagramMenu);
            MenuHelper.CreateSubmenuForCommandsWithoutScope(diagramMenu);
#else
            ContextMenuItem otherItemsMenu = new ContextMenuItem("Other operations");
            MenuHelper.CreateSubmenuForCommandsWithoutScope(otherItemsMenu);
            ExolutioCanvas.ContextMenu.Items.Add(otherItemsMenu);
#endif
            ExolutioCanvas.Tag = "PSM";
        }
Esempio n. 6
0
        protected override void BindModelView()
        {
            base.BindModelView();
            ExolutioContextMenu psmAssociationMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMAssociation, this.DiagramView.Diagram);

            this.ContextMenu      = psmAssociationMenu;
            NameLabel.ContextMenu = psmAssociationMenu;
            #if SILVERLIGHT
            ContextMenuService.SetContextMenu(NameLabel, ContextMenu);
            ContextMenuService.SetContextMenu(Connector, ContextMenu);
            #endif
            ((ExolutioContextMenu)ContextMenu).ScopeObject = PSMAssociation;
            ((ExolutioContextMenu)ContextMenu).Diagram     = DiagramView.Diagram;
        }
Esempio n. 7
0
        protected override void CreateInnerControls(ExolutioCanvas canvas)
        {
            base.CreateInnerControls(canvas);

            foldingButton = new FoldingButton();
            MainNode.InnerConnectorControl.Children.Add(foldingButton);
            Canvas.SetBottom(foldingButton, -15);
            foldingButton.Click += delegate { this.ViewHelper.IsFolded = !this.ViewHelper.IsFolded; };

            #region main node content components
            border = new Border
            {
                BorderBrush     = ViewToolkitResources.NodeBorderBrush,
                BorderThickness = ViewToolkitResources.Thickness1,
                Background      = ViewToolkitResources.NoInterpretationBrush,
                Opacity         = ViewToolkitResources.LittleOpaque,
                Padding         = ViewToolkitResources.Thickness0,
                CornerRadius    = new CornerRadius(15)
            };
            MainNode.InnerContentControl.Content = border;
            MainNode.MinWidth = 50;

            stackPanel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };
            border.Child = stackPanel;

            tbContentModelHeader = new EditableTextBox
            {
                FontWeight    = FontWeights.Bold,
                TextAlignment = TextAlignment.Center,
                Background    = ViewToolkitResources.TransparentBrush,
                FontSize      = 15,
            };

            stackPanel.Children.Add(tbContentModelHeader);

            #endregion

            ExolutioContextMenu exolutioContextMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMContentModel, this.DiagramView.Diagram);
            ContextMenu = exolutioContextMenu;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(tbContentModelHeader, ContextMenu);
#endif
        }
Esempio n. 8
0
        protected override void CreateInnerControls(ExolutioCanvas canvas)
        {
            base.CreateInnerControls(canvas);

            foldingButton = new FoldingButton();
            MainNode.InnerConnectorControl.Children.Add(foldingButton);
            Canvas.SetBottom(foldingButton, -15);
            foldingButton.Click += delegate { this.ViewHelper.IsFolded = !this.ViewHelper.IsFolded; };

            #region main node content components
            border = new Border
            {
                BorderBrush       = ViewToolkitResources.NodeBorderBrush,
                BorderThickness   = ViewToolkitResources.Thickness1,
                VerticalAlignment = VerticalAlignment.Stretch,
                Opacity           = ViewToolkitResources.LittleOpaque
            };
            MainNode.InnerContentControl.Content = border;

            stackPanel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };
            border.Child = stackPanel;

            Border headerBorder = new Border
            {
                Background      = ViewToolkitResources.NoInterpretationBrush,
                BorderThickness = ViewToolkitResources.Thickness0,
                Padding         = ViewToolkitResources.Thickness2,
                BorderBrush     = ViewToolkitResources.BlackBrush
            };

            tbClassHeader = new EditableTextBox
            {
                FontWeight    = FontWeights.Bold,
                TextAlignment = TextAlignment.Center,
                Background    = ViewToolkitResources.NoInterpretationBrush,
                FontSize      = 15,
            };

            headerBorder.Child = tbClassHeader;
            stackPanel.Children.Add(headerBorder);

            Border attributesBorder = new Border
            {
                BorderBrush = ViewToolkitResources.BlackBrush,
                Visibility  = Visibility.Collapsed,
                Background  = ViewToolkitResources.ClassBody
            };
            StackPanel attributesSection = new StackPanel
            {
                Background = ViewToolkitResources.ClassBody
            };
            attributesBorder.Child = attributesSection;

            stackPanel.Children.Add(attributesBorder);
            //Border operationsBorder = new Border
            //{
            //    BorderBrush = ViewToolkitResources.BlackBrush,
            //    Visibility = Visibility.Collapsed,
            //    Background = ViewToolkitResources.SeaShellBrush
            //};

            //StackPanel operationsSection = new StackPanel
            //{
            //    Background = ViewToolkitResources.SeaShellBrush
            //};
            //operationsBorder.Child = operationsSection;
            //stackPanel.Children.Add(operationsBorder);

            //Border[] stackBorders = new Border[] { headerBorder, attributesBorder };
            //ITextBoxContainer[] stackContainers = new ITextBoxContainer[] { attributesContainer };
            //attributesContainer.StackBorders = stackBorders;
            //attributesContainer.StackContainers = stackContainers;
            //classOperations.StackBorders = stackBorders;
            //classOperations.StackContainers = stackContainers;

            #endregion

            ExolutioContextMenu exolutioContextMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMSchemaClass, this.DiagramView.Diagram);
            exolutioContextMenu.ScopeObject = PSMSchemaClass;
            exolutioContextMenu.Diagram     = DiagramView.Diagram;
            ContextMenu = exolutioContextMenu;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(headerBorder, ContextMenu);
#else
            headerBorder.ContextMenu  = ContextMenu;
            tbClassHeader.MouseEnter += tbClassHeader_MouseEnter;
            tbClassHeader.MouseLeave += tbClassHeader_MouseLeave;
#endif
        }
Esempio n. 9
0
        protected override void CreateInnerControls(ExolutioCanvas canvas)
        {
            base.CreateInnerControls(canvas);
            #region main node content components
            border = new Border
            {
                BorderBrush       = ViewToolkitResources.NodeBorderBrush,
                BorderThickness   = ViewToolkitResources.Thickness1,
                VerticalAlignment = VerticalAlignment.Stretch,
                Opacity           = ViewToolkitResources.LittleOpaque
            };
            MainNode.InnerContentControl.Content = border;

            stackPanel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };
            border.Child = stackPanel;

            Border headerBorder = new Border
            {
                Background      = ViewToolkitResources.ClassHeader,
                BorderThickness = ViewToolkitResources.Thickness0,
                Padding         = ViewToolkitResources.Thickness2,
                BorderBrush     = ViewToolkitResources.BlackBrush
            };

            tbClassHeader = new EditableTextBox
            {
                FontWeight    = FontWeights.Bold,
                TextAlignment = TextAlignment.Center,
                Background    = ViewToolkitResources.ClassHeader,
                FontSize      = 15,
            };

            headerBorder.Child = tbClassHeader;
            stackPanel.Children.Add(headerBorder);

            Border attributesBorder = new Border
            {
                BorderBrush = ViewToolkitResources.BlackBrush,
                Visibility  = Visibility.Collapsed,
                Background  = ViewToolkitResources.ClassBody
            };
            Border operationsBorder = new Border
            {
                BorderBrush = ViewToolkitResources.BlackBrush,
                Visibility  = Visibility.Collapsed,
                Background  = ViewToolkitResources.ClassBody
            };
            StackPanel attributesSection = new StackPanel
            {
                Background = ViewToolkitResources.ClassBody
            };
            StackPanel operationsSection = new StackPanel
            {
                Background = ViewToolkitResources.ClassBody
            };
            attributesBorder.Child = attributesSection;
            operationsBorder.Child = operationsSection;
            attributesContainer    = new PIMAttributesContainer(attributesSection, canvas, DiagramView);
            operationsContainer    = new PIMOperationsContainer(operationsSection, canvas, DiagramView);

            stackPanel.Children.Add(attributesBorder);
            stackPanel.Children.Add(operationsBorder);

            Border[]            stackBorders    = new Border[] { headerBorder, attributesBorder, operationsBorder };
            ITextBoxContainer[] stackContainers = new ITextBoxContainer[] { attributesContainer, operationsContainer };
            attributesContainer.StackBorders    = stackBorders;
            attributesContainer.StackContainers = stackContainers;
            operationsContainer.StackBorders    = stackBorders;
            operationsContainer.StackContainers = stackContainers;

            #endregion

            ExolutioContextMenu exolutioContextMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMClass, this.DiagramView.Diagram);
            ContextMenu = exolutioContextMenu;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(tbClassHeader, ContextMenu);
            DoubleClickSupplement dc = new DoubleClickSupplement();
            tbClassHeader.MouseLeftButtonDown += dc.Click;
            dc.DoubleClickW += tbClassHeader_MouseDoubleClick;
#else
            tbClassHeader.MouseDoubleClick += tbClassHeader_MouseDoubleClick;
#endif
        }