예제 #1
0
        private void UpdateChildrenGetter(string columnName)
        {
            TreeListView.ChildrenGetterDelegate DelegateSort;
            switch (columnName)
            {
            case "Initiating":
                DelegateSort = DelegateSortInitiating;
                break;

            case "Planning":
                DelegateSort = DelegateSortPlanning;
                break;

            case "Executing":
                DelegateSort = DelegateSortExecuting;
                break;

            case "Monitoring":
                DelegateSort = DelegateSortMonitoring;
                break;

            case "Closing":
                DelegateSort = DelegateSortClosing;
                break;

            default:
                DelegateSort = DelegateSortDefault;
                break;
            }
            m_treeListView1.ChildrenGetter = DelegateSort;
            m_treeListView1.RebuildAll(false);
            m_treeListView1.ExpandAll();
        }
예제 #2
0
        private void m_treeListView_SelectionChanged(object sender, EventArgs e)
        {
            m_frmMain.myDocViewer1.UnloadMyDoc();
            m_treeListView2.GetColumn(0).Text = "Process Entities";
            Object selObj = m_treeListView1.SelectedObject;

            if (selObj is Process)
            {
                Process process = (Process)selObj;
                m_treeListView2.RemoveObjects((ICollection)m_treeListView2.Objects);
                m_treeListView2.ClearObjects();
                m_treeListView2.AddObject(process.Inputs);
                m_treeListView2.AddObject(process.OutputsCreated);
                //m_treeListView2.AddObject(process.OutputsUpdated);
                if (process.OutputsUpdated.Items.Count > 0)
                {
                    process.OutputsCreated.Name = "Outputs Created";
                    process.OutputsUpdated.Name = "Outputs Updated";
                    m_treeListView2.AddObject(process.OutputsUpdated);
                }
                m_treeListView2.AddObject(process.Tools);
                m_treeListView2.ExpandAll();
                m_frmMain.ClearStatusStrip2();
            }
            else
            {
                m_treeListView2.RemoveObjects((ICollection)m_treeListView2.Objects);
                m_frmMain.ClearStatusStrip2();
            }
        }
예제 #3
0
        public KVDocument(Uri file)
        {
            string path = file.GetComponents(UriComponents.Path, UriFormat.Unescaped);

            bool inVPK = file.GetComponents(UriComponents.Scheme, UriFormat.Unescaped) == "vpk";



            IsReadOnly = inVPK;

            LoadKeyValuesFromFile(path, inVPK);

            string filename = Path.GetFileName(path);

            ControlInfo            = new ControlInfo(filename, "KeyValue: " + path, StandardControlGroup.Center);
            ControlInfo.IsDocument = true;


            TreeListView tlv = new TreeListView(TreeListView.Style.TreeList);

            TreeListViewAdapter adapter = new TreeListViewAdapter(tlv);

            var kvtv = new KeyValueTreeView();

            kvtv.AddRoot(KeyValueNode);
            adapter.View = kvtv;
            tlv.Columns.First().Width = 300;
            tlv.Columns.ElementAt(1).Width = 300;
            tlv.ExpandAll();
            tlv.Control.MouseUp += Control_MouseUp;

            KVTreeView     = kvtv;
            DisplayControl = tlv;
        }
        private void setAllExpanded(TreeListView treeView, bool expand, bool isTarget)
        {
            //set expanded property on all nodes
            var root = treeView.Objects.Cast <MappingNode>().FirstOrDefault();

            setExpanded(root, expand, isTarget);
            treeView.RefreshObject(root);
            //expand all
            treeView.ExpandAll();
        }
예제 #5
0
        public static void MakeTreeViewSource(MST.MES.Data_structures.DevToolsModelStructure dtModel)
        {
            treeProductStructure.Objects = null;
            if (dtModel != null)
            {
                treeProductStructure.CanExpandGetter = delegate(object x) { return(((MST.MES.Data_structures.DevToolsModelStructure)x).children.Count > 0); };
                treeProductStructure.ChildrenGetter  = delegate(object x) { return(((MST.MES.Data_structures.DevToolsModelStructure)x).children); };
                treeProductStructure.AddObject(dtModel);

                treeProductStructure.ExpandAll();
            }
        }
예제 #6
0
 public static void ExpandTLVI(TreeListView TLV)
 {
     TLV.ExpandAll();
 }
예제 #7
0
 public void ExpandAll()
 {
     _internalList.ExpandAll();
 }
예제 #8
0
        private void IntializeTreeViewChartOfAccounts()
        {
            List <Account>         accounts          = ServicesProvider.GetInstance().GetChartOfAccountsServices().FindAllAccounts();
            List <AccountCategory> accountCategories = ServicesProvider.GetInstance().GetChartOfAccountsServices().SelectAccountCategories();

            tlvAccounts.CanExpandGetter = delegate(object o)
            {
                Account account = (Account)o;
                if (account.Id == -1)
                {
                    return(true);
                }

                return(accounts.FirstOrDefault(item => item.ParentAccountId == account.Id) != null);
            };

            tlvAccounts.ChildrenGetter = delegate(object o)
            {
                Account account = (Account)o;
                if (account.Id == -1)
                {
                    return(accounts.Where(item => item.AccountCategory == account.AccountCategory && item.ParentAccountId == null));
                }

                return(accounts.Where(item => item.ParentAccountId == account.Id));
            };

            tlvAccounts.RowFormatter = delegate(OLVListItem o)
            {
                Account account = (Account)o.RowObject;
                if (account.Id == -1)
                {
                    o.ForeColor = Color.FromArgb(0, 88, 56);
                    o.Font      = new Font("Arial", 9);
                }
            };

            TreeListView.TreeRenderer renderer = tlvAccounts.TreeColumnRenderer;
            renderer.LinePen = new Pen(Color.Gray, 0.5f)
            {
                DashStyle = DashStyle.Dot
            };

            List <Account> list = new List <Account>();

            foreach (AccountCategory accountCategory in accountCategories)
            {
                string name = MultiLanguageStrings.GetString(
                    Ressource.ChartOfAccountsForm, accountCategory.Name + ".Text");
                name = name ?? accountCategory.Name;

                Account account = new Account
                {
                    Number          = name,
                    AccountCategory = (OAccountCategories)accountCategory.Id,
                    Id = -1
                };

                list.Add(account);
            }
            tlvAccounts.Roots = list;
            tlvAccounts.ExpandAll();
        }
예제 #9
0
        private void CreateToolStrip(string declarationFilter)
        {
            // Syntax and trivia toggles
            _syntaxTokenCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent,
                Checked   = true,
            };
            _syntaxTriviaCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent,
                Checked   = true,
            };

            bool handleChecked = true;  // Prevent double handling from adjustments during another handler

            _syntaxTokenCheckBox.CheckedChanged += (x, e) =>
            {
                if (handleChecked)
                {
                    if (!_syntaxTokenCheckBox.Checked)
                    {
                        handleChecked = false;
                        _syntaxTriviaCheckBox.Checked = false;
                        handleChecked = true;
                    }
                    if (_syntaxTokenCheckBox.Checked && _syntaxTriviaCheckBox.Checked)
                    {
                        _treeList.ModelFilter = null;
                    }
                    _treeList.ModelFilter = new SyntaxFilter(_syntaxTokenCheckBox.Checked, _syntaxTriviaCheckBox.Checked);
                    PopulateGraph();
                }
            };
            _syntaxTriviaCheckBox.CheckedChanged += (x, e) =>
            {
                if (handleChecked)
                {
                    if (!_syntaxTokenCheckBox.Checked)
                    {
                        handleChecked = false;
                        _syntaxTokenCheckBox.Checked = true;
                        handleChecked = true;
                    }
                    if (_syntaxTokenCheckBox.Checked && _syntaxTriviaCheckBox.Checked)
                    {
                        _treeList.ModelFilter = null;
                    }
                    _treeList.ModelFilter = new SyntaxFilter(_syntaxTokenCheckBox.Checked, _syntaxTriviaCheckBox.Checked);
                    PopulateGraph();
                }
            };

            // Semantics toggle and diagnostics button
            _semanticsCheckBox = new CheckBox()
            {
                BackColor = Color.Transparent
            };
            _semanticsCheckBox.CheckedChanged += (x, e) =>
            {
                GetSemanticModel();
            };
            _diagnosticsButton = new ToolStripButton("Dump Diagnostics", null, (x, e) =>
            {
                SemanticModel semanticModel = GetSemanticModel();
                if (semanticModel != null)
                {
                    // Exclude duplicate mscorlib reference warnings (referenced in LINQPad.Codeanalysis because ObjectListView is .NET 2.0)
                    semanticModel.GetDiagnostics()
                    .Where(y => y.Id != "CS1701" && !y.Descriptor.Description.ToString().Contains("mscorlib"))
                    .Dump();
                }
            });

            // Declaration filter
            ToolStripTextBox declarationFilterTextBox = new ToolStripTextBox();

            if (!string.IsNullOrWhiteSpace(declarationFilter))
            {
                declarationFilterTextBox.Text = declarationFilter;
            }
            declarationFilterTextBox.KeyDown += (x, e) =>
            {
                if (e.KeyCode == Keys.Enter)
                {
                    SetRoots(declarationFilterTextBox.Text);
                }
            };
            declarationFilterTextBox.LostFocus += (x, e) =>
            {
                SetRoots(declarationFilterTextBox.Text);
            };

            // Layout
            _toolStrip = new ToolStrip(
                new ToolStripButton("Expand All", null, (x, e) => _treeList.ExpandAll()),
                new ToolStripButton("Collapse All", null, (x, e) => _treeList.CollapseAll()),
                new ToolStripSeparator(),
                new ToolStripLabel("SyntaxNode  ")
            {
                ForeColor = Color.Blue
            },
                new ToolStripControlHost(_syntaxTokenCheckBox),
                new ToolStripLabel("SyntaxToken  ")
            {
                ForeColor = Color.Green
            },
                new ToolStripControlHost(_syntaxTriviaCheckBox),
                new ToolStripLabel("SyntaxTrivia  ")
            {
                ForeColor = Color.Maroon
            },
                new ToolStripSeparator(),
                new ToolStripLabel("Declaration Filter"),
                declarationFilterTextBox,
                new ToolStripSeparator(),
                new ToolStripLabel(" "),
                new ToolStripControlHost(_semanticsCheckBox),
                new ToolStripLabel("Semantics  "),
                _diagnosticsButton)
            {
                GripStyle = ToolStripGripStyle.Hidden,
                Renderer  = new BorderlessToolStripRenderer(),
                Padding   = new Padding(4)
            };
            _toolStrip.Layout += (x, e) => _toolStrip.Width = _toolStrip.Parent.Width;
        }
예제 #10
0
파일: Editors.cs 프로젝트: zparr/ATF
        private void BtnClick(object sender, EventArgs e)
        {
            var btn   = (Button)sender;
            var flags = (Buttons)btn.Tag;

            switch (flags)
            {
            case Buttons.AddFlat:
                DataContainer.GenerateFlat(
                    View,
                    (TreeListView.TheStyle != TreeListView.Style.TreeList) &&
                    (TreeListView.TheStyle != TreeListView.Style.CheckedTreeList)
                            ? null
                            : TreeListViewAdapter.LastHit);
                break;

            case Buttons.AddHierarchical:
                DataContainer.GenerateHierarchical(
                    View,
                    TreeListViewAdapter.LastHit);
                break;

            case Buttons.AddVirtual:
                DataContainer.GenerateVirtual(View);
                break;

            case Buttons.Reload:
                DataContainer.Reload(View);
                break;

            case Buttons.ExpandAll:
                TreeListView.ExpandAll();
                break;

            case Buttons.CollapseAll:
                TreeListView.CollapseAll();
                break;

            case Buttons.RemoveItem:
                DataContainer.RemoveItem(View, TreeListViewAdapter.LastHit);
                break;

            case Buttons.ModifySelected:
                DataContainer.ModifySelected(View, TreeListViewAdapter.Selection);
                break;

            case Buttons.SelectAll:
            {
                TreeListView.BeginUpdate();
                foreach (var node in TreeListView.Nodes)
                {
                    node.Selected = true;
                }
                TreeListView.EndUpdate();
            }
            break;

            case Buttons.RecursiveCheckBoxes:
            {
                TreeListView.RecursiveCheckBoxes = !TreeListView.RecursiveCheckBoxes;
                btn.Text = TreeListView.RecursiveCheckBoxes ? RecursiveCheckBoxesOnText : RecursiveCheckBoxesOffText;
            }
            break;
            }
        }