Example #1
0
        /// <summary>
        /// Parses the XSL Stylesheet for the start of a list of columns.
        /// </summary>
        /// <param name="xmlTokenReader">Represents a reader that provides fast, non-cached, forward only access to XML Data.</param>
        public void ParseColumnsStart()
        {
            // Create a Columns Node.
            Stylesheet.ColumnsNode columnsNode = new Stylesheet.ColumnsNode();

            // Add this node to current parent node and then push it onto the stack.  These elements will form a tree structure
            // roughly equivalent to the same form they had in the XML file.
            this.nodeStack.Peek().Add(columnsNode);
            this.nodeStack.Push(columnsNode);
        }
Example #2
0
        /// <summary>Populate the list boxes with the hidden and displayed columns available.</summary>
        private void DrawListBoxes()
        {
            // Populate the 'Available' list of columns with the hidden columns.  Note that a 'ColumnItem' class is needed to get a
            // readable name for the items displayed in the list box.
            // HACK - This needs to work with the ViewColumns list.
            Stylesheet.ColumnsNode availableList = new Stylesheet.ColumnsNode();
            Stylesheet.ColumnsNode displayedList = new Stylesheet.ColumnsNode();
            //foreach (Stylesheet.ColumnNode column in this.columnList)
            //    (column.IsDisplayed ? displayedList : availableList).Add(column);
            Stylesheet.ColumnNode[] availableColumns = new Stylesheet.ColumnNode[availableList.Count];
            availableList.CopyTo(availableColumns, 0);
            Stylesheet.ColumnNode[] displayedColumns = new Stylesheet.ColumnNode[displayedList.Count];
            displayedList.CopyTo(displayedColumns, 0);

            // This will preserve the selection of the available (hidden) columns when the list is redrawn.
            ListBox.SelectedObjectCollection selectedAvailableObjects = this.listBoxAvailableFields.SelectedItems;
            Stylesheet.ColumnNode[]          selectedAvailableColumns = new Stylesheet.ColumnNode[selectedAvailableObjects.Count];
            selectedAvailableObjects.CopyTo(selectedAvailableColumns, 0);

            // This will preserve the selection of the displayed (visible) columns when the list is redrawn.
            ListBox.SelectedObjectCollection selectedDisplayedObjects = this.listBoxDisplayedFields.SelectedItems;
            Stylesheet.ColumnNode[]          selectedDisplayedColumns = new Stylesheet.ColumnNode[selectedDisplayedObjects.Count];
            selectedDisplayedObjects.CopyTo(selectedDisplayedColumns, 0);

            // Clear out the previous entries and repopulate the list of available (hidden) fields.  Note that the updating is
            // suspended so the user doesn't see the items cleared out.  If the updating were not inhibited, there would be a
            // noticable 'blink' as the items were cleared and repopulated.  Note that the selected state of the items is preserved when the list is
            // redrawn.
            this.listBoxAvailableFields.BeginUpdate();
            this.listBoxAvailableFields.Items.Clear();
            this.listBoxAvailableFields.Items.AddRange(availableColumns);
            foreach (Stylesheet.ColumnNode column in selectedAvailableColumns)
            {
                int index = this.listBoxAvailableFields.Items.IndexOf(column);
                if (index != -1)
                {
                    this.listBoxAvailableFields.SetSelected(index, true);
                }
            }
            foreach (Stylesheet.ColumnNode column in selectedDisplayedColumns)
            {
                int index = this.listBoxAvailableFields.Items.IndexOf(column);
                if (index != -1)
                {
                    this.listBoxAvailableFields.SetSelected(index, true);
                }
            }
            this.listBoxAvailableFields.EndUpdate();

            // Do the same for the displayed fields.  Note that the selected state of the items is preserved when the list is
            // redrawn.
            this.listBoxDisplayedFields.BeginUpdate();
            this.listBoxDisplayedFields.Items.Clear();
            this.listBoxDisplayedFields.Items.AddRange(displayedColumns);
            foreach (Stylesheet.ColumnNode column in selectedAvailableColumns)
            {
                int index = this.listBoxDisplayedFields.Items.IndexOf(column);
                if (index != -1)
                {
                    this.listBoxDisplayedFields.SetSelected(index, true);
                }
            }
            foreach (Stylesheet.ColumnNode column in selectedDisplayedColumns)
            {
                int index = this.listBoxDisplayedFields.Items.IndexOf(column);
                if (index != -1)
                {
                    this.listBoxDisplayedFields.SetSelected(index, true);
                }
            }
            this.listBoxDisplayedFields.EndUpdate();
        }