Ejemplo n.º 1
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
        }
Ejemplo n.º 2
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;

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

            tbSRHeader = new EditableTextBox
            {
                Visibility    = Visibility.Collapsed,
                TextAlignment = TextAlignment.Right
            };

            tbStereotypes = new EditableTextBox
            {
                Visibility    = Visibility.Collapsed,
                TextAlignment = TextAlignment.Center
            };

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

            StackPanel headerPanel = new StackPanel();
            headerPanel.Children.Add(tbStereotypes);
            headerPanel.Children.Add(tbSRHeader);
            headerPanel.Children.Add(tbClassHeader);
            headerBorder.Child = headerPanel;
            stackPanel.Children.Add(headerBorder);

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

            attributesContainer = new PSMAttributesContainer(attributesSection, canvas, DiagramView);

            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.PSMClass, this.DiagramView.Diagram);
            ContextMenu = exolutioContextMenu;

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