Пример #1
0
        protected override void CreateChildControls()
        {
            _TabOuterTable          = new CswAutoTable();
            _TabOuterTable.ID       = "TabOuterTable";
            _TabOuterTable.CssClass = "TabOuterTable";
            this.Controls.Add(_TabOuterTable);

            TableCell TopLeft = _TabOuterTable.getCell(0, 0);

            TopLeft.CssClass = "TabOuterTable_TopLeft";
            TableCell Top = _TabOuterTable.getCell(0, 1);

            Top.CssClass = "TabOuterTable_Top";
            TableCell TopRight = _TabOuterTable.getCell(0, 2);

            TopRight.CssClass = "TabOuterTable_TopRight";
            TableCell Left = _TabOuterTable.getCell(1, 0);

            Left.CssClass    = "TabOuterTable_Left";
            _Center          = _TabOuterTable.getCell(1, 1);
            _Center.CssClass = "TabOuterTable_Center";
            TableCell Right = _TabOuterTable.getCell(1, 2);

            Right.CssClass = "TabOuterTable_Right";
            TableCell BottomLeft = _TabOuterTable.getCell(2, 0);

            BottomLeft.CssClass = "TabOuterTable_BottomLeft";
            TableCell Bottom = _TabOuterTable.getCell(2, 1);

            Bottom.CssClass = "TabOuterTable_Bottom";
            TableCell BottomRight = _TabOuterTable.getCell(2, 2);

            BottomRight.CssClass = "TabOuterTable_BottomRight";

            Image BlankImage1 = new Image();

            BlankImage1.ImageUrl = "Images/pagelayout/blank.gif";
            BlankImage1.Width    = Unit.Parse("3px");
            BlankImage1.Height   = Unit.Parse("5px");
            TopLeft.Controls.Add(BlankImage1);

            Image BlankImage2 = new Image();

            BlankImage2.ImageUrl = "Images/pagelayout/blank.gif";
            BlankImage2.Width    = Unit.Parse("4px");
            BlankImage2.Height   = Unit.Parse("5px");
            BottomRight.Controls.Add(BlankImage2);

            base.CreateChildControls();
        }
Пример #2
0
        /// <summary>
        /// DataBind to Tree
        /// </summary>
        protected void CswNodesList_DataBinding(object sender, EventArgs e)
        {
            try
            {
                EnsureChildControls();
                _Table.clear();

                bool NoResults = false;
                if (View == null)
                {
                    NoResults = true;
                }
                else
                {
                    ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, View, true, false, false);
                    if (Tree == null)
                    {
                        NoResults = true;
                    }
                    else
                    {
                        if (Tree.getChildNodeCount() == 0)
                        {
                            NoResults = true;
                        }
                        else
                        {
                            if (SelectedNodeKey != null)
                            {
                                Tree.makeNodeCurrent(SelectedNodeKey);
                                if (!Tree.isCurrentNodeDefined() || SelectedNodeKey.NodeSpecies == CswEnumNbtNodeSpecies.Root)
                                {
                                    SelectedNodeKey = null;
                                }
                                Tree.goToRoot();
                            }

                            for (Int32 c = 0; c < Tree.getChildNodeCount(); c++)
                            {
                                Tree.goToNthChild(c);

                                CswNbtNodeKey CurrentNodeKey = Tree.getNodeKeyForCurrentPosition();
                                Int32         ThisRow        = _Table.Rows.Count;

                                Image  IconImage  = new Image();
                                string IconSuffix = Tree.getNodeForCurrentPosition().IconFileName;
                                string IconName   = default(string);
                                if (false == string.IsNullOrEmpty(IconSuffix))
                                {
                                    IconName = "Images/icons/" + IconSuffix;
                                }

                                IconImage.ImageUrl = IconName;
                                _Table.addControl(ThisRow, 0, IconImage);

                                _Table.addControl(ThisRow, 1, new CswLiteralNbsp());

                                if (EnableLinks)
                                {
                                    LinkButton ListLink = new LinkButton();
                                    ListLink.ID            = Tree.getNodeKeyForCurrentPosition().ToString();
                                    ListLink.Text          = Tree.getNodeNameForCurrentPosition();
                                    ListLink.OnClientClick = "return " + ClientClickFunctionName + "('" + Tree.getNodeKeyForCurrentPosition().ToString() + "');";
                                    _Table.addControl(ThisRow, ListLinkCellNumber, ListLink);
                                    _Table.getCell(ThisRow, ListLinkCellNumber).Width = Unit.Parse("100%");
                                }
                                else
                                {
                                    Label ListLabel = new Label();
                                    ListLabel.ID   = Tree.getNodeKeyForCurrentPosition().ToString();
                                    ListLabel.Text = Tree.getNodeNameForCurrentPosition();
                                    _Table.addControl(ThisRow, ListLinkCellNumber, ListLabel);
                                    _Table.getCell(ThisRow, ListLinkCellNumber).Width = Unit.Parse("100%");
                                }

                                if ((SelectedNodeKey == null && c == 0) ||   // first row
                                    CurrentNodeKey == SelectedNodeKey)       // or selected row
                                {
                                    _Table.SelectedRow = ThisRow;
                                }

                                Tree.goToParentNode();
                            } // for( Int32 c = 0; c < Tree.getChildNodeCount(); c++ )
                        }     // if-else( Tree.getChildNodeCount() == 0 )
                    }         // if-else( Tree == null )
                }             // if-else( View == null )


                if (NoResults)
                {
                    NoResults = true;
                    Label NoResultsLabel = new Label();
                    NoResultsLabel.Text = "No results";
                    _Table.addControl(0, 0, NoResultsLabel);
                    _Table.SelectedRow = 0;
                }
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Пример #3
0
        public void ReinitComponents()
        {
            _ComponentPlaceHolder.Controls.Clear(); // BEWARE

            CswAutoTable ComponentTable = new CswAutoTable();

            ComponentTable.ID       = "ComponentTable";
            ComponentTable.CssClass = "ComponentTable";
            //ComponentTable.Style.Add( HtmlTextWriterStyle.TextAlign, TableTextAlign );
            ComponentTable.Attributes.Add("align", TableTextAlign);
            _ComponentPlaceHolder.Controls.Add(ComponentTable);

            Int32 CellIncrement = 3;

            foreach (LayoutComponent Component in Components.Values)
            {
                TableCell LabelCell  = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement);
                TableCell ValueCell  = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement + 1);
                TableCell ConfigCell = ComponentTable.getCell(Component.DisplayRow - 1, (Component.DisplayColumn - 1) * CellIncrement + 2);

                LabelCell.CssClass = CssClassLabelCell;
                if (EditMode)
                {
                    ValueCell.CssClass = CssClassValueCellEditMode;
                }
                else
                {
                    ValueCell.CssClass = CssClassValueCell;
                }

                if (Component.LabelControl != null)
                {
                    LabelCell.Controls.Add(Component.LabelControl);
                }
                if (Component.ValueControl != null)
                {
                    ValueCell.Controls.Add(Component.ValueControl);
                }

                if (LabelCellRightAlign)
                {
                    LabelCell.Style.Add(HtmlTextWriterStyle.TextAlign, "right");
                }

                if (EditMode)
                {
                    CswAutoTable ButtonTable = new CswAutoTable();
                    ConfigCell.Controls.Add(ButtonTable);

                    if (Component.DisplayRow > 1)
                    {
                        CswImageButton NorthButton = new CswImageButton(CswImageButton.ButtonType.ArrowNorth);
                        NorthButton.ID     = "North_" + Component.LayoutComponentId;
                        NorthButton.Click += new EventHandler(MoveButton_Click);
                        ButtonTable.addControl(0, 1, NorthButton);
                        _AjaxManager.AjaxSettings.AddAjaxSetting(NorthButton, ComponentTable);
                    }

                    CswImageButton EastButton = new CswImageButton(CswImageButton.ButtonType.ArrowEast);
                    EastButton.ID     = "East_" + Component.LayoutComponentId;
                    EastButton.Click += new EventHandler(MoveButton_Click);
                    ButtonTable.addControl(1, 2, EastButton);
                    _AjaxManager.AjaxSettings.AddAjaxSetting(EastButton, ComponentTable);

                    CswImageButton SouthButton = new CswImageButton(CswImageButton.ButtonType.ArrowSouth);
                    SouthButton.ID     = "South_" + Component.LayoutComponentId;
                    SouthButton.Click += new EventHandler(MoveButton_Click);
                    ButtonTable.addControl(2, 1, SouthButton);
                    _AjaxManager.AjaxSettings.AddAjaxSetting(SouthButton, ComponentTable);

                    if (Component.DisplayColumn > 1)
                    {
                        CswImageButton WestButton = new CswImageButton(CswImageButton.ButtonType.ArrowWest);
                        WestButton.ID     = "West_" + Component.LayoutComponentId;
                        WestButton.Click += new EventHandler(MoveButton_Click);
                        ButtonTable.addControl(1, 0, WestButton);
                        _AjaxManager.AjaxSettings.AddAjaxSetting(WestButton, ComponentTable);
                    }

                    if (Component.AllowDelete)
                    {
                        CswImageButton DeleteButton = new CswImageButton(CswImageButton.ButtonType.Delete);
                        DeleteButton.ID     = "Delete_" + Component.LayoutComponentId;
                        DeleteButton.Click += new EventHandler(DeleteButton_Click);
                        ButtonTable.addControl(1, 1, DeleteButton);
                        _AjaxManager.AjaxSettings.AddAjaxSetting(DeleteButton, ComponentTable);
                    }
                } // if( EditMode )
            }     // foreach( LayoutComponent Component in Components.Values )

            for (Int32 r = 0; r < ComponentTable.Rows.Count; r++)
            {
                for (Int32 c = 0; c < ComponentTable.MaxCells; c++)
                {
                    TableCell Cell = ComponentTable.getCell(r, c);
                    if (Cell.Controls.Count == 0)
                    {
                        Cell.Controls.Add(new CswLiteralNbsp());
                        if (c % CellIncrement == 1)   // this is a Value Cell
                        {
                            if (EditMode)
                            {
                                Cell.CssClass = CssClassEmptyCellEditMode;
                            }
                            else
                            {
                                Cell.CssClass = CssClassEmptyCell;
                            }
                        }
                    }
                } // for( Int32 c = 0; c < ComponentTable.MaxCells; c++ )
            }     // for( Int32 r = 0; r < ComponentTable.Rows.Count; r++ )
        }         // ReinitComponents()