Пример #1
0
        public PSMAttributeTextBox(IControlsPSMAttributes attributesController)
        {
            this.classController = attributesController;
            this.Text            = "{ any attribute }";
            this.ContextMenu     = new ContextMenu();

            ContextMenuItem removeDefinition = new ContextMenuItem("Remove");

            removeDefinition.Click += delegate
            {
                (this.classController as PSM_ClassController).ChangeAllowAnyAttributeDefinition(false);
            };
            this.ContextMenu.Items.Add(removeDefinition);
        }
Пример #2
0
        public AttributeDialog(PSMAttribute attribute, IControlsPSMAttributes psmClassController, ModelController controller)
            : this(attribute, controller)
        {
            this.psmClassController = psmClassController;

            if (attribute.RepresentedAttribute != null)             //pimless attribute
            {
                foreach (Control control in psmDisabled)
                {
                    control.IsEnabled = false;
                }

                foreach (UIElement control in psmHidden)
                {
                    control.Visibility = Visibility.Collapsed;
                }
            }

            tbAlias.Text = attribute.Alias;
        }
Пример #3
0
        public PSMAttributeTextBox(PSMAttribute Attribute, IControlsPSMAttributes attributesController)
        {
            this.attribute       = Attribute;
            this.classController = attributesController;

            #region property context menu

            this.ContextMenu = new ContextMenu();

            ContextMenuItem miPropagatePIMLess = new ContextMenuItem("Propagate to PIM");
            miPropagatePIMLess.Icon      = ContextMenuIcon.GetContextIcon("AddAttributes");
            miPropagatePIMLess.Click    += delegate { attributesController.PropagatePIMLess(attribute); };
            miPropagatePIMLess.IsEnabled = attribute.RepresentedAttribute == null;
            attribute.PropertyChanged   +=
                delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "RepresentedAttribute")
                {
                    miPropagatePIMLess.IsEnabled = attribute.RepresentedAttribute == null;
                }
            };
            this.ContextMenu.Items.Add(miPropagatePIMLess);

            ContextMenuItem remove = new ContextMenuItem("Remove attribute");
            remove.Icon   = ContextMenuIcon.GetContextIcon("delete2");
            remove.Click += delegate { attributesController.RemoveAttribute(attribute); };
            this.ContextMenu.Items.Add(remove);

            if (attributesController is PSM_AttributeContainerController)
            {
                ContextMenuItem returnAttribute = new ContextMenuItem("Move back to class");
                returnAttribute.Click += delegate { ((PSM_AttributeContainerController)attributesController).MoveAttributeBackToClass(attribute); };
                this.ContextMenu.Items.Add(returnAttribute);
            }
            else
            {
                ContextMenuItem miMoveToAC = new ContextMenuItem("Move to attribute container");
                miMoveToAC.Click += delegate { ((PSM_ClassController)attributesController).MoveAttributesToAttributeContainer(null, attribute); };
                this.ContextMenu.Items.Add(miMoveToAC);
            }

            ContextMenuItem change = new ContextMenuItem("Properties...");
            change.Icon   = ContextMenuIcon.GetContextIcon("pencil");
            change.Click += delegate { attributesController.ShowAttributeDialog(attribute); };
            this.ContextMenu.Items.Add(change);

            moveUp        = new ContextMenuItem("Move up");
            moveUp.Click += delegate { attributesController.MoveAttributeUp(attribute); };
            this.ContextMenu.Items.Add(moveUp);


            moveDown        = new ContextMenuItem("Move down");
            moveDown.Click += delegate { attributesController.MoveAttributeDown(attribute); };
            this.ContextMenu.Items.Add(moveDown);


            #endregion

            attribute.PropertyChanged += delegate { RefreshTextContent(); };
            MouseDoubleClick          += OnMouseDoubleClick;
            RefreshTextContent();
        }