/// <summary> /// 显示 /// </summary> public override void showDialog() { if (m_collectionName == "TabPages") { FCTabControl tabControlA = m_target as FCTabControl; List <FCTabPage> tabPages = tabControlA.getTabPages(); int tabPagesSize = tabPages.Count; for (int i = 0; i < tabPagesSize; i++) { FCTabPage tabPage = tabPages[i]; FCTreeNode node = new FCTreeNode(); node.setString(tabPage.Text); m_tvCollection.appendNode(node); node.Row.Tag = tabPage; } } else if (m_collectionName == "Columns") { FCGrid grid = m_target as FCGrid; List <FCGridColumn> columns = grid.getColumns(); int columnsSize = columns.Count; for (int i = 0; i < columnsSize; i++) { FCGridColumn column = columns[i]; FCTreeNode node = new FCTreeNode(); node.setString(column.Text); m_tvCollection.appendNode(node); node.Row.Tag = column; } } m_tvCollection.update(); m_gridSelectedRowsChangedEvent = new FCEvent(gridSelectedRowsChanged); m_gridProperty.Xml = m_xml; m_gridProperty.DesignerDiv = m_designerDiv; m_tvCollection.addEvent(m_gridSelectedRowsChangedEvent, FCEventID.GRIDSELECTEDROWSCHANGED); if (m_tvCollection.getRows().Count > 0) { ArrayList <FCGridRow> selectedRows = new ArrayList <FCGridRow>(); selectedRows.Add(m_tvCollection.getRow(0)); m_tvCollection.SelectedRows = selectedRows; } base.showDialog(); }
/// <summary> /// 添加节点 /// </summary> /// <param name="index">行索引</param> public virtual void onAddingNode(int index) { FCGridRow row = Row; if (Row == null) { //创建行 row = new FCGridRow(); FCTreeNode parentNode = m_parent; if (parentNode == null) { if (index != -1) { //插入行 m_tree.insertRow(index, row); //重置行的索引 ArrayList <FCGridRow> rows = m_tree.getRows(); int rowSize = rows.size(); for (int i = 0; i < rowSize; i++) { rows.get(i).Index = i; } } else { //添加行 m_tree.addRow(row); //设置索引 ArrayList <FCGridRow> rows = m_tree.getRows(); row.Index = rows.size() - 1; } row.addCell(0, this); m_targetColumn = m_tree.getColumn(0); } else { //获取行索引 int rowIndex = parentNode.Row.Index + 1; if (index != -1) { rowIndex = index; } else { //查找上个节点 FCTreeNode lastNode = getLastNode(parentNode.getChildNodes()); if (lastNode != null) { if (lastNode.Row == null) { return; } rowIndex = lastNode.Row.Index + 1; } } //插入行 m_tree.insertRow(rowIndex, row); ArrayList <FCGridRow> rows = m_tree.getRows(); int rowSize = rows.size(); //重置索引 if (rowIndex == rowSize - 1) { row.Index = rowIndex; } else { for (int i = 0; i < rowSize; i++) { rows.get(i).Index = i; } } row.addCell(0, this); m_targetColumn = m_tree.getColumn(parentNode.m_targetColumn.Index + 1); } ColSpan = m_tree.getColumns().size(); //添加子节点 if (m_nodes != null && m_nodes.size() > 0) { int nodeSize = m_nodes.size(); for (int i = 0; i < nodeSize; i++) { m_nodes.get(i).onAddingNode(-1); } } row.Visible = isNodeVisible(this); } }