示例#1
0
 public GroupNodeStyle()
 {
     delegateStyle  = new CollapsibleNodeStyleDecorator();
     ButtonLocation = ButtonLocation.TopLeft;
     Inset          = 5;
     Wrapped        = new PanelNodeStyle();
 }
        public CollapsibleNodeStyleDecoratorExtension()
        {
            ButtonLocationParameter = InteriorLabelModel.NorthWest;
            Insets = new InsetsD(5, 16, 5, 5);
            var defaults = new CollapsibleNodeStyleDecorator();

            CollapsedIcon = defaults.CollapsedIcon;
            ExpandedIcon  = defaults.ExpandedIcon;
        }
示例#3
0
        private void InitializeGraphDefaults()
        {
            FoldingManager fm = new FoldingManager();

            graphControl.Graph = fm.CreateFoldingView().Graph;
            var folderNodeConverter = fm.FolderNodeConverter as DefaultFolderNodeConverter;

            if (folderNodeConverter != null)
            {
                folderNodeConverter.CopyFirstLabel = true;
                folderNodeConverter.FolderNodeSize = new SizeD(80, 60);
            }

            IGraph graph = graphControl.Graph;

            graphControl.NavigationCommandsEnabled = true;

            //Create graph
            graph.NodeDefaults.Size = new SizeD(60, 30);

            // set the style as the default for all new nodes
            graph.NodeDefaults.Style = new ShinyPlateNodeStyle
            {
                Brush  = Brushes.Orange,
                Insets = new InsetsD(5),
                Radius = 5,
            };

            // set the style as the default for all new edges
            graph.EdgeDefaults.Style = new PolylineEdgeStyle {
                TargetArrow = Arrows.Default
            };

            var groupNodeStyle = new CollapsibleNodeStyleDecorator(new PanelNodeStyle
            {
                Color            = Color.FromArgb(255, 202, 220, 255),
                LabelInsetsColor = Color.FromArgb(255, 218, 234, 255),
                Insets           = new InsetsD(15, 31, 15, 15)
            });
            var groupNodeDefaults = graph.GroupNodeDefaults;

            groupNodeDefaults.Labels.LayoutParameter = InteriorStretchLabelModel.North;
            groupNodeDefaults.Labels.Style           = new DefaultLabelStyle {
                StringFormat = { Alignment = StringAlignment.Far }
            };
            groupNodeDefaults.Style = groupNodeStyle;
        }
        /// <summary>
        /// Activates folding, sets the defaults for new graph elements and registers mappers
        /// </summary>
        private void InitializeGraphDefaults()
        {
            var fm = new FoldingManager();

            graphControl.Graph = fm.CreateFoldingView().Graph;

            IGraph graph = graphControl.Graph;

            graphControl.NavigationCommandsEnabled = true;

            //Create graph
            graph.NodeDefaults.Size = new SizeD(60, 30);

            // set the style as the default for all new nodes
            graph.NodeDefaults.Style = PartialNodeStyle;

            // set the style as the default for all new edges
            graph.EdgeDefaults.Style = PartialEdgeStyle;

            CollapsibleNodeStyleDecorator groupNodeStyle = PartialGroupNodeStyle;
            var groupNodeDefaults = graph.GroupNodeDefaults;

            groupNodeDefaults.Labels.LayoutParameter = InteriorStretchLabelModel.North;
            groupNodeDefaults.Labels.Style           = new DefaultLabelStyle {
                StringFormat = { Alignment = StringAlignment.Far }
            };
            groupNodeDefaults.Style = groupNodeStyle;

            //Create and register mappers that specifiy partial graph elements
            partialNodesMapper = new MasterViewConversionMapper <INode, bool>(graph)
            {
                DefaultValue = true
            };
            partialEdgesMapper = new MasterViewConversionMapper <IEdge, bool>(graph)
            {
                DefaultValue = true
            };

            graphControl.GraphMLIOHandler.AddInputMapper(yWorks.Layout.Partial.PartialLayout.AffectedNodesDpKey.Name, partialNodesMapper);
            graphControl.GraphMLIOHandler.AddInputMapper(yWorks.Layout.Partial.PartialLayout.AffectedEdgesDpKey.Name, partialEdgesMapper);
        }