Ejemplo n.º 1
0
 public Tree<CellBase> Parse(string input)
 {
     scanner = new TextTableScanner(input);
     var result = new TreeList<CellBase>(new CellBase(string.Empty));
     MakeTables(result);
     return result;
 }
Ejemplo n.º 2
0
        public RepositoryPLGridSelect(XtraForm frmDanhMuc, string columnField, string tableName, string ValueField, string[] visibleField, string[] caption, string getField, TreeList treeList)
        {
            init();
            plDanhMuc.TreeList = treeList;
            plDanhMuc._init(frmDanhMuc ,columnField, tableName , ValueField , visibleField , caption , getField);

            treeList.GotFocus += delegate(object sender , EventArgs e)
            {
                if (treeList.DataSource != null &&
                        !((DataTable)treeList.DataSource).Columns.Contains(columnField + getField))
                {
                    ((DataTable)treeList.DataSource).Columns.Add(new DataColumn(columnField + getField));
                }
            };
            treeList.CellValueChanged += delegate(object sender , CellValueChangedEventArgs e)
            {
                if (e.Column.FieldName.Equals(columnField+getField))
                {
                    DataRowView rowView = (DataRowView)treeList.GetDataRecordByNode(e.Node);
                    DataRow row = rowView.Row;
                    row[columnField] = _getId(e.Value);
                }
            };
            this.Popup += new EventHandler(RepositoryHuyDanhMuc_Popup);
            this.Leave += new EventHandler(RepositoryDanhMucAdv_Leave);
        }
Ejemplo n.º 3
0
        public static void SetCellDisableTree(TreeList tree,string FieldName,string KeyField,long[]KeyValues)
        {
            tree.CustomDrawNodeCell += delegate(object sender, CustomDrawNodeCellEventArgs e) {
                if (e.Node == tree.FocusedNode) {
                    return;
                }

                if (e.Column.FieldName == FieldName)
                {
                    for (int vt = 0; vt <= KeyValues.Length - 1; vt++)
                    {
                        if (Convert.ToInt64(e.Node.GetValue(KeyField)) == KeyValues[vt])
                        {
                            e.Appearance.BackColor = Color.LightGray;
                        }
                    }
                }
            };
            tree.ShowingEditor += delegate(object sender, CancelEventArgs e) {
                TreeListNode note = tree.FocusedNode;
                if (note != null)
                {
                    for (int vt = 0; vt <= KeyValues.Length - 1; vt++)
                    {
                        if (Convert.ToInt64(note.GetValue(KeyField)) == KeyValues[vt]
                            && tree.FocusedColumn.FieldName == FieldName)
                        {
                            e.Cancel = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 4
0
        public virtual void PaintCell(Graphics dc, 
            Rectangle cellRect,
            Node node,
            TreeListColumn column,
            TreeList.TextFormatting format,
            object data)
        {
            if (format.BackColor != Color.Transparent)
            {
                Rectangle r = cellRect;
                r.X = column.CalculatedRect.X;
                r.Width = column.CalculatedRect.Width;
                SolidBrush brush = new SolidBrush(format.BackColor);
                dc.FillRectangle(brush, r);
                brush.Dispose();
            }
            if (data != null)
            {
                cellRect = CommonTools.Util.AdjustRectangle(cellRect, format.Padding);
                //dc.DrawRectangle(Pens.Black, cellRect);

                Color color = format.ForeColor;
                if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles  == false)
                    color = SystemColors.HighlightText;
                TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags();
                TextRenderer.DrawText(dc, data.ToString(), m_owner.Font, cellRect, color, flags);
            }
        }
Ejemplo n.º 5
0
 public void ExecuteImportAddsNamespace()
 {
     var executeImport = new ExecuteImport();
     var input = new TreeList<string>().AddBranchValue("step").AddBranchValue("import").AddBranchValue("fitnesse.unitTest.slim");
     ExecuteOperation(executeImport, input, 2);
     Assert.IsTrue(processor.Create("SampleClass").Value is SampleClass);
 }
Ejemplo n.º 6
0
 public void ExecuteMakeBadClassReturnsException()
 {
     var executeMake = new ExecuteMake();
     var input = new TreeList<string>().AddBranchValue("step").AddBranchValue("make").AddBranchValue("variable").AddBranchValue("garbage");
     ExecuteOperation(executeMake, input, 2);
     CheckForException("message<<NO_CLASS garbage>>");
 }
Ejemplo n.º 7
0
 public TreeListNode AddTreeListNode(TreeList treelist, TreeListNode node, Type type, string propertyName, string defaultFunction, string validationFunction)
 {
     TreeListNode newNode = treelist.AppendNode(new object[] { propertyName, defaultFunction, validationFunction }, node);
     //newNode.ImageIndex = newNode.SelectImageIndex = (int)image;
     newNode.Tag = type;
     return newNode;
 }
Ejemplo n.º 8
0
 public void ExecuteDefaultReturnsException()
 {
     var executeDefault = new ExecuteDefault();
     var input = new TreeList<string>().AddBranchValue("step").AddBranchValue("garbage");
     ExecuteOperation(executeDefault, input, 2);
     CheckForException("message<<MALFORMED_INSTRUCTION step,garbage>>");
 }
Ejemplo n.º 9
0
        void MakeTables(TreeList<CellBase> result)
        {
            string leader = string.Empty;
            TreeList<CellBase> table = null;
            scanner.MoveNext();
            do {
                if (scanner.Current.Type == TokenType.Leader) {
                    leader = scanner.Current.Content;
                    scanner.MoveNext();
                }
                else if (scanner.Current.Type == TokenType.Word) {
                    table = new TreeList<CellBase>(new CellBase(string.Empty));
                    table.Value.SetAttribute(CellAttribute.StartTag, "<p>");
                    table.Value.SetAttribute(CellAttribute.EndTag, "</p>");
                    if (leader.Length > 0) {
                        table.Value.SetAttribute(CellAttribute.Leader, leader);
                        leader = string.Empty;
                    }
                    result.AddBranch(table);
                    MakeRows(table);
                    if (scanner.Current.Type == TokenType.Newline) scanner.MoveNext();
                }
                else {
                    scanner.MoveNext();
                }
            } while (scanner.Current.Type != TokenType.End);

            if (table != null && scanner.Current.Content.Length > 0) {
                 table.Value.SetAttribute(CellAttribute.Trailer, scanner.Current.Content);
            }
        }
        public override System.Drawing.Image GetImage(object element, TreeList.Column column)
        {
            if (element.GetType() == typeof(WorkoutWrapper))
            {
                WorkoutWrapper wrapper = (WorkoutWrapper)element;

                if (((Workout)wrapper.Element).IsDirty)
                {
                    return global::GarminFitnessPlugin.Resources.Resources.WorkoutDirtyIcon;
                }
                else if (((Workout)wrapper.Element).ContainsFITOnlyFeatures)
                {
                    return global::GarminFitnessPlugin.Resources.Resources.FITWorkoutIcon;
                }

                return global::GarminFitnessPlugin.Resources.Resources.WorkoutIcon;
            }
            if (element.GetType() == typeof(WorkoutPartWrapper))
            {
                return global::GarminFitnessPlugin.Resources.Resources.WorkoutPartIcon;
            }
            else if (element.GetType() == typeof(ActivityCategoryWrapper))
            {
                return global::GarminFitnessPlugin.Resources.Resources.CategoryIcon;
            }

            return base.GetImage(element, column);
        }
Ejemplo n.º 11
0
 public DashboardListPresenter(TreeList tree, DashboardsFilterPaneViewModel viewModel)
 {
     _viewModel = viewModel;
     _tree = tree;
     InitTree();
     PopulateTree();
     Messenger.Default.Register<DashboardMessage>(this, OnDashboardMessage);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="XtraTreeListPrintAdapter"/> class.
        /// </summary>
        /// <param name="adaptee">The adaptee.</param>
        /// <param name="workItem">The work item.</param>
        public XtraTreeListPrintAdapter(TreeList adaptee, WorkItem workItem)
        {
            this.adaptee = adaptee;
            this.workItem = workItem;
            xtrapService = new XtraPrintService(adaptee, adaptee.Text);

            RegisterEvent();
        }
 public bool GetEnableMouseMulSelect(TreeList treeList)
 {
     if (list.ContainsKey(treeList))
     {
         return list[treeList].EnableMouseMulSelect;
     }
     return false;
 }
Ejemplo n.º 14
0
 public Color GetHotTrackColor(TreeList treeList)
 {
     if (List.ContainsKey(treeList))
     {
         return List[treeList].HotTrackColor;
     }
     return Color.FromArgb(213, 232, 255);
 }
Ejemplo n.º 15
0
 public void ExecuteCallBadMethodReturnsException()
 {
     processor.Store(new SavedInstance("variable", new SampleClass()));
     var executeCall = new ExecuteCall();
     var input = new TreeList<string>().AddBranchValue("step").AddBranchValue("call").AddBranchValue("variable").AddBranchValue("garbage");
     ExecuteOperation(executeCall, input, 2);
     CheckForException("message<<NO_METHOD_IN_CLASS garbage fitnesse.unitTest.slim.SampleClass>>");
 }
 public bool GetEnableCommonStyle(TreeList treelist)
 {
     if (this.list.ContainsKey(treelist))
     {
         return list[treelist].EnableCommonStyle;
     }
     return true;
 }
Ejemplo n.º 17
0
 public bool GetShowLineNo(TreeList treelist)
 {
     if (StyleList.ContainsKey(treelist))
     {
         return StyleList[treelist].EnableLineNo;
     }
     return true;
 }
Ejemplo n.º 18
0
 public string GetLineNoFormatString(TreeList treelist)
 {
     if (StyleList.ContainsKey(treelist))
     {
         return StyleList[treelist].LineNoFormatString;
     }
     return "{0}";
 }
Ejemplo n.º 19
0
 public bool GetEnableHotTrack(TreeList treeList)
 {
     if (List.ContainsKey(treeList))
     {
         return List[treeList].EnableHotTrack;
     }
     return false;
 }
Ejemplo n.º 20
0
 static Tree<string> NodeParameters(XmlNode node) {
     var result = new TreeList<string>()
         .AddBranchValue(node.InnerText);
     foreach (XmlAttribute attribute in node.Attributes) {
         result.AddBranchValue(attribute.Value);
     }
     return result;
 }
Ejemplo n.º 21
0
        private static void GetSelectedImage(GetSelectImageEventArgs e, TreeList treeList)
        {
            var dataRecordByNode = treeList.GetDataRecordByNode(e.Node);

            ITreeNode obj = dataRecordByNode as ITreeNode;
            if (obj == null) return;

            e.NodeImageIndex = obj.ImageIndex;
        }
        protected override FontStyle GetCellFontStyle(object element, TreeList.Column column)
        {
            if (element.GetType() == typeof(WorkoutWrapper))
            {
                return FontStyle.Italic;
            }

            return base.GetCellFontStyle(element, column);
        }
Ejemplo n.º 23
0
        public void EmptyListContainsNoElements()
        {
            TreeList<int> list = new TreeList<int>();

            Assert.AreEqual(0, list.Count);
            Assert.IsFalse(list.Contains(0));
            Assert.IsFalse(list.Contains(1));
            Assert.IsFalse(list.Contains(2));
        }
Ejemplo n.º 24
0
 public static RepositoryComboboxAuto CotComboboxFind(TreeList treeList , TreeListColumn column , string ColumnField , string ValueField, string DisplayField , string TableName , bool StartWith)
 {
     column.AppearanceHeader.Options.UseTextOptions = true;
     column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
     column.FieldName = ColumnField+DisplayField;
     RepositoryComboboxAuto comboFind = new RepositoryComboboxAuto(treeList ,ColumnField, TableName , ValueField , DisplayField , StartWith);
     column.ColumnEdit = comboFind;
     return comboFind;
 }
Ejemplo n.º 25
0
 void MakeRows(TreeList<CellBase> table) {
     do {
         var row = new TreeList<CellBase>(new CellBase(string.Empty));
         row.Value.SetAttribute(CellAttribute.StartTag, startTags[1]);
         row.Value.SetAttribute(CellAttribute.EndTag, endTags[1]);
         table.AddBranch(row);
         MakeCells(row);
         if (scanner.Current.Type == TokenType.Newline) scanner.MoveNext();
     } while (scanner.Current.Type == TokenType.BeginCell || scanner.Current.Type == TokenType.Word);
 }
Ejemplo n.º 26
0
 public static RepositoryComboboxAdd CotComboboxAdd(TreeList treeList , TreeListColumn column , string ColumnField , string ValueField, string DisplayField , string TableName)
 {
     column.AppearanceHeader.Options.UseTextOptions = true;
     column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
     column.FieldName = ColumnField+DisplayField;
     RepositoryComboboxAdd comboAdd = new RepositoryComboboxAdd(TableName, ColumnField, ValueField, DisplayField, HelpGen.G_FW_DM_ID, treeList);
     comboAdd._init();
     column.ColumnEdit = comboAdd;
     return comboAdd;
 }
Ejemplo n.º 27
0
 public static void LoadFromFile(TreeList pTreeList, String pFullFileName)
 {
     if (!String.IsNullOrEmpty(pFullFileName))
     {
         DataSet dataSet = new DataSet();
         dataSet.ReadXml(pFullFileName);
         pTreeList.DataSource = dataSet.Tables[0].DefaultView;
         pTreeList.ExpandAll();
     }
 }
		public StepwiseTreeIterator(
			TreeList treeList,
			TimeSpan updateInterval,
			NodeProcessingHandler handler,
			int levelsToProcess )
		{
			_treeList = treeList;
			_updateInterval = updateInterval;
			_handler = handler;
			_levelsToProcess = levelsToProcess;
		}
Ejemplo n.º 29
0
 public void ExecuteCallAndAssignSavesSymbol()
 {
     processor.Store(new SavedInstance("variable", new SampleClass()));
     var executeCallAndAssign = new ExecuteCallAndAssign();
     var input =
         new TreeList<string>().AddBranchValue("step").AddBranchValue("callAndAssign").AddBranchValue("symbol").AddBranchValue(
             "variable").AddBranchValue("sampleMethod");
     ExecuteOperation(executeCallAndAssign, input, 2);
     Assert.AreEqual("testresult", result.Branches[1].Value);
     Assert.AreEqual("testresult", processor.Load(new Symbol("symbol")).Instance);
 }
Ejemplo n.º 30
0
 void MakeCells(TreeList<CellBase> row)
 {
     while (scanner.Current.Type == TokenType.Word) {
         var cell = new TreeList<CellBase>(new CellBase(scanner.Current.Content));
         cell.Value.SetAttribute(CellAttribute.Body, scanner.Current.Content);
         cell.Value.SetAttribute(CellAttribute.StartTag, "<span>");
         cell.Value.SetAttribute(CellAttribute.EndTag, "</span> ");
         row.AddBranch(cell);
         scanner.MoveNext();
     }
 }
Ejemplo n.º 31
0
        void MakeTables(TreeList <CellBase> result)
        {
            string leader             = string.Empty;
            TreeList <CellBase> table = null;

            scanner.MoveNext();
            do
            {
                if (scanner.Current.Type == TokenType.Word)
                {
                    SetTags();
                    table = new TreeList <CellBase>(new CellBase(string.Empty));
                    table.Value.SetAttribute(CellAttribute.StartTag, startTags[0]);
                    table.Value.SetAttribute(CellAttribute.EndTag, endTags[0]);
                    if (leader.Length > 0)
                    {
                        table.Value.SetAttribute(CellAttribute.Leader, leader);
                        leader = string.Empty;
                    }
                    result.AddBranch(table);
                    MakeRows(table);
                    if (scanner.Current.Type == TokenType.Newline)
                    {
                        leader += scanner.Current.Content;
                        scanner.MoveNext();
                    }
                }
                else
                {
                    leader += scanner.Current.Content;
                    scanner.MoveNext();
                }
            } while (scanner.Current.Type != TokenType.End && scanner.Current.Type != TokenType.EndCell);

            leader += scanner.Current.Content;

            if (table != null && leader.Length > 0)
            {
                table.Value.SetAttribute(CellAttribute.Trailer, leader);
            }
        }
Ejemplo n.º 32
0
 private void hidePurtaColumns(ref TreeList treelist)
 {
     treelist.Columns["MODIFIER"].Visible  = false;
     treelist.Columns["MODI_DATE"].Visible = false;
     treelist.Columns["FLAG"].Visible      = false;
     treelist.Columns["TA005"].Visible     = false;
     treelist.Columns["TA007"].Visible     = false;
     treelist.Columns["TA007"].Visible     = false;
     treelist.Columns["TA008"].Visible     = false;
     treelist.Columns["TA009"].Visible     = false;
     treelist.Columns["TA010"].Visible     = false;
     treelist.Columns["TA014"].Visible     = false;
     treelist.Columns["TA015"].Visible     = false;
     treelist.Columns["TA016"].Visible     = false;
     treelist.Columns["TA017"].Visible     = false;
     treelist.Columns["TA018"].Visible     = false;
     treelist.Columns["TA019"].Visible     = false;
     treelist.Columns["TA021"].Visible     = false;
     treelist.Columns["TA022"].Visible     = false;
     treelist.Columns["TA023"].Visible     = false;
     treelist.Columns["TA024"].Visible     = false;
     treelist.Columns["TA025"].Visible     = false;
     treelist.Columns["TA026"].Visible     = false;
     treelist.Columns["TA027"].Visible     = false;
     treelist.Columns["TA028"].Visible     = false;
     treelist.Columns["TA200"].Visible     = false;
     treelist.Columns["TA201"].Visible     = false;
     treelist.Columns["TA202"].Visible     = false;
     treelist.Columns["TA203"].Visible     = false;
     treelist.Columns["TA550"].Visible     = false;
     treelist.Columns["UDF01"].Visible     = false;
     treelist.Columns["UDF02"].Visible     = false;
     treelist.Columns["UDF03"].Visible     = false;
     treelist.Columns["UDF04"].Visible     = false;
     treelist.Columns["UDF05"].Visible     = false;
     treelist.Columns["UDF06"].Visible     = false;
     treelist.Columns["UDF07"].Visible     = false;
     treelist.Columns["UDF08"].Visible     = false;
     treelist.Columns["UDF09"].Visible     = false;
     treelist.Columns["UDF10"].Visible     = false;
 }
Ejemplo n.º 33
0
 private void SaveNewOrder()
 {
     using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
     {
         TreeList treeListNode = this.CurrentNode.TreeList;
         Dictionary <string, int> ChildTableOrder = new Dictionary <string, int>();
         TreeListNode             _fnode          = this.CurrentNode.ParentNode;
         int i = 1;
         foreach (TreeListNode _tn in _fnode.Nodes)
         {
             object _selectedItem = _tn.GetValue(treeListNode.Columns[0]);
             if (_selectedItem is MD_ViewTable)
             {
                 MD_ViewTable _vt = _selectedItem as MD_ViewTable;
                 ChildTableOrder.Add(_vt.ViewTableID, i * 10);
                 i++;
             }
         }
         _mdc.SaveViewTableOrder_UserDefine(ChildTableOrder);
     }
 }
Ejemplo n.º 34
0
        private IList <TreeList <StoreCategoryModel> > LoadChildrenCategories(int parentId, bool showHidden)
        {
            var treeResponse = new List <TreeList <StoreCategoryModel> >();

            //获取所有一级节点
            var Categories = _storeCategoryService.GetAllStoreCategoriesByParentCategoryId(parentId, showHidden);

            foreach (var storeCategory in Categories)
            {
                var obj = new TreeList <StoreCategoryModel>()
                {
                    Label    = storeCategory.Published ? storeCategory.Name : storeCategory.Name + "(未发布)",
                    Children = LoadChildrenCategories(storeCategory.Id, showHidden),
                    Data     = storeCategory.ToModel()
                };

                treeResponse.Add(obj);
            }

            return(treeResponse);
        }
Ejemplo n.º 35
0
 /// <summary>
 /// 点击删除文件
 /// </summary>
 public void remove_File(TreeList treeFileList)
 {
     try
     {
         TreeListNode deleteNode = treeFileList.FocusedNode;
         string       deleteFile = deleteNode.Tag.ToString();
         treeFileList.DeleteNode(deleteNode);
         if (File.Exists(deleteFile))
         {
             File.Delete(deleteFile);
         }
     }
     catch (NullReferenceException)
     {
         return;
     }
     catch (IOException)
     {
         return;
     }
 }
        private static void saveState(
            IPersistentPairStorage storage,
            TreeList c)
        {
            var prefix = c.Name;

            using var tfc = new ZetaTemporaryFileCreator();
            c.SaveLayoutToXml(
                tfc.FilePath,
                new OptionsLayoutTreeList
            {
                AddNewColumns    = false,
                RemoveOldColumns = true,
                StoreAppearance  = false
            });

            PersistanceHelper.SaveValue(
                storage,
                prefix + @".TreeList",
                tfc.FileContentString);
        }
Ejemplo n.º 37
0
        private static DragDropEffects GetDragDropEffect(TreeList tl, TreeListNode dragNode)
        {
            TreeListNode targetNode;
            Point        p = tl.PointToClient(MousePosition);

            targetNode = tl.CalcHitInfo(p).Node;

            if (dragNode != null && targetNode != null &&
                dragNode != targetNode &&
                dragNode.ParentNode == targetNode.ParentNode &&
                dragNode.GetValue("PRODUCT DATE").ToString().ToLower() == targetNode.GetValue("PRODUCT DATE").ToString().ToLower() &&
                dragNode.GetValue("MC No.").ToString().ToLower() == targetNode.GetValue("MC No.").ToString().ToLower()
                )
            {
                return(DragDropEffects.Move);
            }
            else
            {
                return(DragDropEffects.None);
            }
        }
Ejemplo n.º 38
0
 private void CreateColumns(TreeList tl)
 {
     // 创建三个列。
     tl.BeginUpdate();
     tl.Columns.Add();
     tl.Columns[0].Caption      = "Customer";
     tl.Columns[0].VisibleIndex = 0;
     tl.Columns.Add();
     tl.Columns[1].Caption      = "Location";
     tl.Columns[1].VisibleIndex = 1;
     tl.Columns.Add();
     tl.Columns[2].Caption      = "Phone";
     tl.Columns[2].VisibleIndex = 2;
     tl.Columns.Add();
     tl.Columns[3].Caption      = "ID";
     tl.Columns[3].VisibleIndex = 3;
     tl.Columns.Add();
     tl.Columns[4].Caption      = "IDName";
     tl.Columns[4].VisibleIndex = 4;
     tl.EndUpdate();
 }
Ejemplo n.º 39
0
        void AddFiles(TreeList <TestFile> tree, Folder testFolder, Folder resultFolder)
        {
            foreach (var name in suite.TestNames(testFolder))
            {
                var testFile = new TestFile {
                    FileName = Path.GetFileNameWithoutExtension(name), Path = tree.Value.FullName
                };
                var result = new TestResult(resultFolder, testFile);
                testFile.TestStatus = result.Status;
                tree.Add(testFile);
            }

            foreach (var subfolder in suite.SubFolders(testFolder))
            {
                var branch = new TreeList <TestFile>(new TestFile {
                    FileName = subfolder.Name(), Path = tree.Value.FullName, IsFolder = true
                });
                tree.Add(branch);
                AddFiles(branch, subfolder, resultFolder.SubFolder(subfolder.Name()));
            }
        }
Ejemplo n.º 40
0
 private void GroupAdd(HRM_GROUP Item, DevExpress.XtraTreeList.Nodes.TreeListNode TreeListNode)
 {
     if (TreeListNode.HasChildren)
     {
         foreach (DevExpress.XtraTreeList.Nodes.TreeListNode node in TreeListNode.Nodes)
         {
             if (!(node.GetValue("ID").ToString() == Item.DepartmentCode))
             {
                 this.GroupAdd(Item, node);
             }
             else
             {
                 TreeList treeList  = this.treeList1;
                 object[] groupCode = new object[] { Item.GroupCode, string.Concat(Item.GroupName, this.StringQuantity(0, 0)), Item.DepartmentCode, "Group", 0, 0, 4 };
                 DevExpress.XtraTreeList.Nodes.TreeListNode treeListNode = treeList.AppendNode(groupCode, node);
                 this.treeList1.SetFocusedNode(treeListNode);
                 return;
             }
         }
     }
 }
Ejemplo n.º 41
0
 private void DepartmentAdd(HRM_DEPARTMENT Item, DevExpress.XtraTreeList.Nodes.TreeListNode TreeListNode, string Code)
 {
     if (TreeListNode.HasChildren)
     {
         foreach (DevExpress.XtraTreeList.Nodes.TreeListNode node in TreeListNode.Nodes)
         {
             if (!(node.GetValue("ID").ToString() == Code))
             {
                 this.DepartmentAdd(Item, node, Code);
             }
             else
             {
                 TreeList treeList       = this.treeList1;
                 object[] departmentCode = new object[] { Item.DepartmentCode, string.Concat(Item.DepartmentName, this.StringQuantity(0, 0)), Code, "Department", 0, 0, 3 };
                 DevExpress.XtraTreeList.Nodes.TreeListNode treeListNode = treeList.AppendNode(departmentCode, node);
                 this.treeList1.SetFocusedNode(treeListNode);
                 return;
             }
         }
     }
 }
Ejemplo n.º 42
0
        private void CreateNodes(TreeList tl)
        {
            tl.BeginUnboundLoad();
            // Create a root node .
            TreeListNode parentForRootNodes = null;
            TreeListNode rootNode           = tl.AppendNode(
                new object[] { "Quản Trị Hệ Thống" },
                parentForRootNodes);

            // Create a child of the rootNode
            tl.AppendNode(new object[] { "admin" }, rootNode);
            // Creating more nodes
            // ...
            TreeListNode rootNode2 = tl.AppendNode(
                new object[] { "User" },
                parentForRootNodes);

            // Create a child of the rootNode
            tl.AppendNode(new object[] { "vanhungbk" }, rootNode2);
            tl.EndUnboundLoad();
        }
Ejemplo n.º 43
0
 private void TreeList1_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     // if dropping node outside Treelist, remove it
     if (e.Action == DragAction.Drop)
     {
         TreeList  tl   = sender as TreeList;
         Rectangle rect = tl.RectangleToScreen(new Rectangle(0, 0, tl.Width, tl.Height));
         if (!rect.Contains(MousePosition))
         {
             if (draggedNode.ParentNode == null)
             {
                 tl.Nodes.Remove(draggedNode);
             }
             else
             {
                 draggedNode.ParentNode.Nodes.Remove(draggedNode);
             }
         }
         draggedNode = null;
     }
 }
        private IList <TreeList <GovernmentUnitModel> > LoadChildrenCategories(int parentId)
        {
            var treeResponse = new List <TreeList <GovernmentUnitModel> >();

            //获取所有一级节点
            var governments = _governmentService.GetAllGovernmentsByParentGovernmentId(parentId, false);

            foreach (var government in governments)
            {
                var obj = new TreeList <GovernmentUnitModel>()
                {
                    Label    = government.Name,
                    Children = LoadChildrenCategories(government.Id),
                    Data     = government.ToModel()
                };

                treeResponse.Add(obj);
            }

            return(treeResponse);
        }
Ejemplo n.º 45
0
        /// <summary>
        /// 右键菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Trl_AREA_MouseUp(object sender, MouseEventArgs e)
        {
            TreeList tree = sender as TreeList;

            if (e.Button == MouseButtons.Right &&
                ModifierKeys == Keys.None &&
                trl_AREA.State == TreeListState.Regular)
            {
                Point           p       = new Point(Cursor.Position.X, Cursor.Position.Y);
                TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location);
                if (hitInfo.HitInfoType == HitInfoType.Cell)
                {
                    tree.SetFocusedNode(hitInfo.Node);
                }
                test_popupMenu.ShowPopup(p);
                if (tree.FocusedNode == null)
                {
                    btn_MODIFY.Enabled = false;
                }
            }
        }
Ejemplo n.º 46
0
        public void PosTest3()
        {
            MyClass myclass1 = new MyClass();
            MyClass myclass2 = new MyClass();
            MyClass myclass3 = new MyClass();
            MyClass myclass4 = new MyClass();

            MyClass[] mc = new MyClass[4] {
                myclass1, myclass2, myclass3, myclass4
            };
            TreeList <MyClass> listObject = new TreeList <MyClass>(mc);

            listObject.Reverse(0, 2);
            MyClass[] expected = new MyClass[4] {
                myclass2, myclass1, myclass3, myclass4
            };
            for (int i = 0; i < 4; i++)
            {
                Assert.Equal(expected[i], listObject[i]);
            }
        }
Ejemplo n.º 47
0
 public void GetOpenedDb(ObservableCollection <TreeList> trees, ref TreeList result)
 {
     foreach (var ds in trees)
     {
         if (ds.Children == null || ds.Children.Count == 0)
         {
             return;
         }
         if (ds.LEVEL == TreeLevel.Database)
         {
             if (ds.IS_OPEN)
             {
                 result = ds;
             }
         }
         else
         {
             GetOpenedDb(ds.Children, ref result);
         }
     }
 }
Ejemplo n.º 48
0
        public void TestInsert()
        {
            const int Value = 600;

            TreeList <int> list = new TreeList <int>();

            Assert.Empty(list);
            list.Insert(0, Value);
            Assert.Single(list);
            Assert.Equal(Value, list[0]);
            int[] expected = { Value };
            int[] actual   = list.ToArray();
            Assert.Equal(expected, actual);

            List <int> reference = new List <int>(list);

            Assert.Throws <ArgumentOutOfRangeException>("index", () => list.Insert(-1, item: 0));
            Assert.Throws <ArgumentOutOfRangeException>("index", () => reference.Insert(-1, item: 0));
            Assert.Throws <ArgumentOutOfRangeException>("index", () => list.Insert(list.Count + 1, item: 0));
            Assert.Throws <ArgumentOutOfRangeException>("index", () => reference.Insert(list.Count + 1, item: 0));
        }
Ejemplo n.º 49
0
        public static void SetupTreeList(
            this TreeList treeList,
            bool multiSelect = true)
        {
            treeList.OptionsBehavior.AutoPopulateColumns = true;

            treeList.OptionsSelection.MultiSelect     = multiSelect;
            treeList.OptionsSelection.MultiSelectMode = TreeListMultiSelectMode.RowSelect;

            treeList.OptionsView.EnableAppearanceEvenRow = true;
            treeList.OptionsView.ShowAutoFilterRow       = true;

            treeList.OptionsNavigation.AutoFocusNewNode = true;
            treeList.OptionsView.ShowFilterPanelMode    = DevExpress.XtraTreeList.ShowFilterPanelMode.Never;

            treeList.Appearance.FocusedRow.BackColor            = ColorTranslator.FromHtml("#80bfff");;
            treeList.Appearance.FocusedRow.Options.UseBackColor = true;
            treeList.OptionsView.FocusRectStyle = DevExpress.XtraTreeList.DrawFocusRectStyle.RowFocus;

            treeList.NodeCellStyle += TreeList_NodeCellStyle;
        }
Ejemplo n.º 50
0
        /// <summary>
        /// traverse the folder
        /// </summary>
        /// <param name="ParentNode"></param>
        /// <param name="treeClass"></param>
        public void TraverseFolder(TreeListNode ParentNode, ref TreeList treeClass)
        {
            if (ParentNode.Tag == null)
            {
                return;
            }
            string        path    = ParentNode.Tag.ToString();
            DirectoryInfo DirInfo = new DirectoryInfo(path);

            if (!DirInfo.Exists)
            {
                return;
            }
            foreach (DirectoryInfo childFolder in DirInfo.GetDirectories())
            {
                TreeListNode ChildNode = treeClass.AppendNode(null, ParentNode);
                ChildNode.SetValue(treeClass.Columns["FolderName"], childFolder.Name);
                ChildNode.Tag = childFolder.FullName;
                TraverseFolder(ChildNode, ref treeClass);
            }
        }
Ejemplo n.º 51
0
        //protected override void Save()
        //{
        //    treeList1.PostEditor();
        //    treeList1.EndCurrentEdit();
        //    int rows = sda.Update(dsTree.Tables[0]);
        //    dtTree.AcceptChanges();
        //    if (rows > 0)
        //    {
        //        XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        //    }
        //    else
        //    {
        //        XtraMessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //    }
        //}

        //protected override void Exit()
        //{
        //    if (conn != null)
        //    {
        //        conn.Close();
        //    }
        //    this.Close();
        //}


        private void treeList1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            TreeList tree = sender as TreeList;

            if (e.Button == MouseButtons.Right &&
                ModifierKeys == Keys.None &&
                treeList1.State == TreeListState.Regular)
            {
                Point           p       = new Point(Cursor.Position.X, Cursor.Position.Y);
                TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location);
                if (hitInfo.HitInfoType == HitInfoType.Cell)
                {
                    tree.SetFocusedNode(hitInfo.Node);
                }

                if (tree.FocusedNode != null)
                {
                    popupMenu1.ShowPopup(p);
                }
            }
        }
Ejemplo n.º 52
0
        private void tlBoPhan_CustomDrawNodeCell(object sender, DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs e)
        {
            s = e;
            TreeList tree = sender as TreeList;

            if (e.Node == tree.FocusedNode)
            {
                var listnv = db.NhanVien.OrderBy(m => m.Id).ToList();
                lstNV = listnv;
                if (e.CellText != "Bộ phận tổ chức")
                {
                    gcQuanTriNguoiDung.BeginUpdate();
                    var list = (from nv in lstNV
                                join bp in db.BoPhan on nv.MaNhom equals bp.MaNhom
                                where bp.TenNhom == e.CellValue.ToString()
                                select nv).ToList();
                    gcQuanTriNguoiDung.DataSource = new BindingList <NhanVien>(list)
                    {
                        AllowNew = true
                    };
                    gcQuanTriNguoiDung.EndUpdate();
                    btnThem.Enabled = true;
                    var mn = db.BoPhan.FirstOrDefault(m => m.TenNhom == e.CellValue.ToString());
                    manhom = mn.MaNhom;
                    value  = e.CellValue.ToString();
                }
                else
                {
                    gcQuanTriNguoiDung.BeginUpdate();
                    var list = lstNV;
                    gcQuanTriNguoiDung.DataSource = list;
                    gcQuanTriNguoiDung.EndUpdate();
                    btnThem.Enabled = false;
                }
            }
            //for(int i=0;i<gvQuantri.RowCount;i++)
            //{
            //    gvQuantri.SetRowCellValue(i, grcMatKhau, "***********");
            //}
        }
Ejemplo n.º 53
0
        private void TreeDataBind(List <BOM_Struct> list, TreeList treeList)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            //var dt = new DataTable();

            //treeList.Nodes.Clear();
            //treeList.DataSource = null;
            ////FillData(dt);
            //treeList.DataSource = FillData(structList);
            //treeList.KeyFieldName = "Id";
            //treeList.ParentFieldName = "Parent_Id";

            treeList.Nodes.Clear();
            TreeListNode parentNode = null;
            var          parentList = list.FindAll(s => s.Parent_Id == 0);

            foreach (var p in parentList)
            {
                var m = productStructService.GetMaterialById(p.Material_Id);
                parentNode = treeList.AppendNode(new object[] { p.Material_Id, p.Id, p.BOM_Id, p.Parent_Id, m.No + "," + m.Version + "," + m.Name + "," + "1000" }, 0);
                GetChildNode(parentNode, p.Id, list);
            }
            treeList.ExpandAll();
            watch.Stop();
            string time = watch.ElapsedMilliseconds.ToString();

            //MessageBox.Show(time);

            if (treeList.FocusedNode == null)
            {
                return;
            }
            MaterialId = Convert.ToInt32(treeList.FocusedNode.GetValue("Material_Id"));
            var material = Material(MaterialId);

            MaterialDataLoad(material);
            DocumentDataLoad(material);
        }
Ejemplo n.º 54
0
        /// <summary>
        /// 节点互斥同步
        /// 说明
        /// eg:
        ///TreeListNode _node = e.Node;
        ///_node.SyncMutexNodeCheckState(_node.CheckState, n => n.GetNodeType() == NodeType.Cab);
        /// </summary>
        /// <param name="node">需要互斥同步的节点</param>
        /// <param name="checkState">节点状态</param>
        /// <param name="checkFactory">互斥条件【委托】</param>
        public static void SyncMutexNodeCheckState(this TreeListNode node, CheckState checkState, Predicate <TreeListNode> checkFactory)
        {
            TreeList _tree = node.TreeList;

            if (checkFactory(node))    //当前节点符合互斥条件时候
            {
                _tree.DownRecursiveTree(n => n.CheckState = CheckState.Unchecked);
            }
            else
            {
                TreeListNode _curParentNode = node.GetParentNode(checkFactory);//获取符合互斥条件的父节点

                if (_curParentNode == null)
                {
                    return;
                }

                TreeListNode _thePubleNode = node.GetPublicParentNode(checkFactory);//获取符合互斥条件的公共父节点

                if (_thePubleNode == null)
                {
                    return;
                }

                foreach (TreeListNode n in _thePubleNode.Nodes)
                {
                    foreach (TreeListNode nc in n.Nodes)
                    {
                        if (nc != _curParentNode)
                        {
                            nc.CheckState = CheckState.Unchecked;
                            nc.DownRecursiveNode(nr => nr.CheckState = CheckState.Unchecked);
                        }
                    }
                }
            }

            node.SyncNodeCheckState(checkState);
            node.CheckState = checkState;
        }
Ejemplo n.º 55
0
        /// <summary>
        /// 注册TreeList控件重绘节点图标事件
        /// </summary>
        /// <param name="tree">TreeList</param>
        /// <param name="type">图标类型</param>
        private static void CustomDrawNodeImages(TreeList tree, NodeIconType type)
        {
            tree.CustomDrawNodeImages += (sender, args) =>
            {
                switch (type)
                {
                case NodeIconType.General:
                    var node = args.Node;
                    args.SelectImageIndex = node.Level == 0 || node.HasChildren ? (node.Expanded ? 2 : 1) : 0;
                    break;

                case NodeIconType.Category:
                    args.SelectImageIndex = args.Node.Expanded ? 2 : 1;
                    break;

                case NodeIconType.NodeType:
                    args.SelectImageIndex = (int)args.Node.GetValue("nodeType");
                    break;

                case NodeIconType.Organization:
                    args.SelectImageIndex = (int)args.Node.GetValue("nodeType") - 1;
                    break;

                case NodeIconType.OnlyLevel0:
                    if (args.Node.Level > 0)
                    {
                        return;
                    }

                    args.SelectImageIndex = (int)args.Node.GetValue("nodeType");
                    break;

                case NodeIconType.Custom:
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            };
        }
Ejemplo n.º 56
0
        /// <summary>
        /// 在TreeList中按下鼠标事件
        /// </summary>
        private void treeListBom_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                TreeList treelist = sender as TreeList;
                downHitInfo = null;
                TreeListHitInfo hitInfo = treelist.CalcHitInfo(new Point(e.X, e.Y));

                if (Control.ModifierKeys != Keys.None)
                {
                    return;
                }
                if (e.Button == MouseButtons.Left)
                {
                    downHitInfo = hitInfo;
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--在TreeList中按下鼠标事件错误。", ex);
            }
        }
Ejemplo n.º 57
0
        private void treeList1_PopupMenuShowing(object sender, DevExpress.XtraTreeList.PopupMenuShowingEventArgs e)
        {
            TreeList        tL      = sender as TreeList;
            TreeListHitInfo hitInfo = tL.CalcHitInfo(e.Point);

            if (hitInfo.HitInfoType == HitInfoType.SummaryFooter)
            {
                DXMenuItem menuItem = new DXMenuItem("Clear All", new EventHandler(this.clearAllMenuItemClick));
                menuItem.Tag = hitInfo.Column;
                e.Menu.Items.Add(menuItem);
            }
            if (hitInfo.HitInfoType == HitInfoType.Cell)
            {
                DXMenuItem menuItem = new DXMenuItem("Connect", new EventHandler(this.clearAllMenuItemClick));
                menuItem.Tag = hitInfo.Column;
                e.Menu.Items.Add(menuItem);
            }
            if (hitInfo.HitInfoType == HitInfoType.Column && hitInfo.Column.Caption == "Department")
            {
                e.Allow = false;
            }
        }
Ejemplo n.º 58
0
        private void treeList1_TreeListMenuItemClick(object sender, TreeListMenuItemClickEventArgs e)
        {
            if (e.IsFooter)
            {
                return;
            }
            TreeList tl = (sender as TreeList);

            if (e.MenuItem.Caption == "Sort Ascending" || e.MenuItem.Caption == "Sort Descending")
            {
                tl.ClearSorting();
                if (e.MenuItem.Caption == "Sort Ascending")
                {
                    e.Column.SortOrder = SortOrder.Ascending;
                }
                else
                {
                    e.Column.SortOrder = SortOrder.Descending;
                }
                e.Handled = true;
            }
        }
Ejemplo n.º 59
0
        public void PosTest1()
        {
            TreeList <int> myList = new TreeList <int>();
            int            count  = 10;

            int[]  expectValue = new int[10];
            IList  myIList     = myList;
            object element     = null;

            for (int i = 1; i <= count; i++)
            {
                element = i * count;
                myIList.Add(element);
                expectValue[i - 1] = (int)element;
            }

            for (int j = 0; j < myIList.Count; j++)
            {
                int current = (int)myIList[j];
                Assert.Equal(expectValue[j], current);
            }
        }
Ejemplo n.º 60
0
        public void PosTest2()
        {
            TreeList <string> myList = new TreeList <string>();
            int count = 10;

            string[] expectValue = new string[10];
            object   element     = null;
            IList    myIList     = myList;

            for (int i = 1; i <= count; i++)
            {
                element = i.ToString();
                myIList.Add(element);
                expectValue[i - 1] = element.ToString();
            }

            for (int j = 0; j < myIList.Count; j++)
            {
                string current = (string)myIList[j];
                Assert.Equal(expectValue[j], current);
            }
        }