Ejemplo 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();
        }
Ejemplo 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();
        }
Ejemplo n.º 3
0
        public static ExolutioContextMenu GetContextMenu(ScopeAttribute.EScope scope, Diagram diagram)
        {
            ExolutioContextMenu result = new ExolutioContextMenu();

            result.Opened += ContextMenu_Opened;

            foreach (CommandDescriptor commandDescriptor in PublicCommandsHelper.publicCommandsByScope[scope])
            {
                ContextMenuItem m = CreateMenuItem(commandDescriptor);
                result.Items.Add(m);
            }

            if (localCommandsByScope.ContainsKey(scope))
            {
                result.Items.Add(new Separator());
                foreach (guiScopeCommand guiScopeCommand in localCommandsByScope[scope])
                {
                    ContextMenuItem contextMenuItem = new ContextMenuItem(guiScopeCommand.Text);
                    contextMenuItem.Icon    = guiScopeCommand.Icon;
                    contextMenuItem.Command = guiScopeCommand;
                    #if SILVERLIGHT
                    #else
                    contextMenuItem.ToolTip = guiScopeCommand.ScreenTipText;
                    #endif
                    result.Items.Add(contextMenuItem);
                }
            }
            return(result);
        }
Ejemplo n.º 4
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
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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";
        }
Ejemplo n.º 7
0
        private void AddConnectorCommands(ExolutioContextMenu generalizationMenu)
        {
            guiBreakLineCommand cBreak = new guiBreakLineCommand();

            cBreak.Connector = Connector;
            ContextMenuItem miBreak;

            miBreak         = new ContextMenuItem("Break line here");
            miBreak.Command = cBreak;
            generalizationMenu.Items.Add(miBreak);
        }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
0
        private static void PrepareCommandScope(ExolutioContextMenu contextMenu, ContextMenuItem contextMenuItem)
        {
            guiControllerCommand guiControllerCommand = contextMenuItem.Command as guiControllerCommand;

            if (guiControllerCommand != null)
            {
                guiControllerCommand.Diagram = (Diagram)contextMenu.Diagram;

                if (!guiControllerCommand.NoScope)
                {
                    guiControllerCommand.ScopeObject = contextMenu.ScopeObject;
                    SetScopeForCommand(guiControllerCommand.ControllerCommand, contextMenu.ScopeObject);
                }
                guiControllerCommand.ProjectVersion = Current.ProjectVersion;
            }
        }
Ejemplo n.º 10
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
        }
Ejemplo n.º 11
0
        static void ContextMenu_Opened(object sender, RoutedEventArgs eventArgs)
        {
            ExolutioContextMenu contextMenu = (ExolutioContextMenu)sender;

            if (Current.MainWindow.CommandsDisabled)
            {
                #if SILVERLIGHT
                contextMenu.Visibility = Visibility.Collapsed;
                #else
                contextMenu.Visibility = System.Windows.Visibility.Hidden;
                #endif
            }
            else
            {
                PrepareCommandsScope(contextMenu.Items, contextMenu);
            }
        }
Ejemplo n.º 12
0
 private static void PrepareCommandsScope(ItemCollection items, ExolutioContextMenu contextMenu)
 {
     foreach (ContextMenuItem contextMenuItem in items.OfType <ContextMenuItem>())
     {
         if (contextMenuItem.Command != null && contextMenuItem.Command is guiControllerCommand)
         {
             PrepareCommandScope(contextMenu, contextMenuItem);
         }
         if (contextMenuItem.Command != null && contextMenuItem.Command is guiScopeCommand)
         {
             ((guiScopeCommand)contextMenuItem.Command).ScopeObject = contextMenu.ScopeObject;
         }
         if (contextMenuItem.Items.Count > 0)
         {
             PrepareCommandsScope(contextMenuItem.Items, contextMenu);
         }
     }
 }
Ejemplo n.º 13
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
        }
Ejemplo n.º 14
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
        }