Esempio n. 1
0
        public void TestGetMaxRowsInColumns_RowSpan()
        {
            //---------------Set up test pack-------------------
            UIFormTab uiFormTab1 = new UIFormTab("tab1");

            uiFormTab1.Add(CreateUIFormColumn_2FieldsWithRowSpan());
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            int maxFieldCount = uiFormTab1.GetMaxRowsInColumns();

            //---------------Test Result -----------------------
            Assert.AreEqual(3, maxFieldCount);
        }
Esempio n. 2
0
        private void AddFieldsToLayoutManager(UIFormTab formTab, IPanelInfo panelInfo)
        {
            int numberOfColumns = formTab.Count;

            int[] currentFieldPositionInColumns = new int[numberOfColumns];
            int[] rowSpanTrackerForColumn       = new int[numberOfColumns];
            int   maxRowsInColumns = formTab.GetMaxRowsInColumns();

            int[] columnSpanTrackerForRow = new int[maxRowsInColumns];
            for (int currentRowNo = 0; currentRowNo < maxRowsInColumns; currentRowNo++)
            {
                for (int currentColumnNo = 0; currentColumnNo < numberOfColumns; currentColumnNo++)
                {
                    IUIFormColumn currentFormColumn = formTab[currentColumnNo];

                    if (--rowSpanTrackerForColumn[currentColumnNo] > 0)
                    {
                        continue;
                    }
                    // keep skipping this grid position until a previous row span in this column has been decremented
                    if (--columnSpanTrackerForRow[currentRowNo] > 0)
                    {
                        continue;
                    }
                    // keep skipping this grid position until a previous column span in this row has been decremented

                    int currentFieldNoInColumn = currentFieldPositionInColumns[currentColumnNo];
                    int totalFieldsInColumn    = currentFormColumn.Count;
                    if (currentFieldNoInColumn < totalFieldsInColumn) // there exists a field in this row in this column
                    {
                        UIFormField formField = (UIFormField)currentFormColumn[currentFieldNoInColumn];
                        rowSpanTrackerForColumn[currentColumnNo] = formField.RowSpan;
                        for (int i = currentRowNo; i < currentRowNo + formField.RowSpan; i++)
                        {
                            // update colspan of all rows that this field spans into.
                            columnSpanTrackerForRow[i] = formField.ColSpan;
                        }

                        PanelInfo.FieldInfo fieldInfo = AddControlsForField(formField, panelInfo);
                        fieldInfo.InputControl.TabIndex = currentColumnNo * maxRowsInColumns + currentRowNo;
                    }
                    else
                    {
                        AddNullControlsForEmptyField(panelInfo);
                    }
                    currentFieldPositionInColumns[currentColumnNo]++;
                }
            }
        }
Esempio n. 3
0
        private GridLayoutManager SetupLayoutManager(UIFormTab formTab, IPanel panel)
        {
            GridLayoutManager layoutManager = new GridLayoutManager(panel, ControlFactory);
            int maxRowsInColumns            = formTab.GetMaxRowsInColumns();

            int colCount = formTab.Count * CONTROLS_PER_COLUMN;

            layoutManager.SetGridSize(maxRowsInColumns, colCount);
            layoutManager.FixColumnBasedOnContents(0);
            for (int i = 0; i < colCount; i += CONTROLS_PER_COLUMN)
            {
                layoutManager.FixColumnBasedOnContents(i + LABEL_CONTROL_COLUMN_NO);
                layoutManager.FixColumn(i + ERROR_PROVIDER_COLUMN_NO, ERROR_PROVIDER_WIDTH);
            }
            ITextBox sampleTextBoxForHeight = ControlFactory.CreateTextBox();

            for (int row = 0; row < maxRowsInColumns; row++)
            {
                layoutManager.FixRow(row, sampleTextBoxForHeight.Height);
            }
            return(layoutManager);
        }
Esempio n. 4
0
        private void AddFieldsToLayoutManager(UIFormTab formTab, IPanelInfo panelInfo)
        {
            int numberOfColumns = formTab.Count;
            int[] currentFieldPositionInColumns = new int[numberOfColumns];
            int[] rowSpanTrackerForColumn = new int[numberOfColumns];
            int maxRowsInColumns = formTab.GetMaxRowsInColumns();
            int[] columnSpanTrackerForRow = new int[maxRowsInColumns];
            for (int currentRowNo = 0; currentRowNo < maxRowsInColumns; currentRowNo++)
            {
                for (int currentColumnNo = 0; currentColumnNo < numberOfColumns; currentColumnNo++)
                {
                    IUIFormColumn currentFormColumn = formTab[currentColumnNo];

                    if (--rowSpanTrackerForColumn[currentColumnNo] > 0) continue;
                    // keep skipping this grid position until a previous row span in this column has been decremented 
                    if (--columnSpanTrackerForRow[currentRowNo] > 0) continue;
                    // keep skipping this grid position until a previous column span in this row has been decremented

                    int currentFieldNoInColumn = currentFieldPositionInColumns[currentColumnNo];
                    int totalFieldsInColumn = currentFormColumn.Count;
                    if (currentFieldNoInColumn < totalFieldsInColumn) // there exists a field in this row in this column
                    {
                        UIFormField formField = (UIFormField) currentFormColumn[currentFieldNoInColumn];
                        rowSpanTrackerForColumn[currentColumnNo] = formField.RowSpan;
                        for (int i = currentRowNo; i < currentRowNo + formField.RowSpan; i++)
                            // update colspan of all rows that this field spans into.
                            columnSpanTrackerForRow[i] = formField.ColSpan;

                        PanelInfo.FieldInfo fieldInfo = AddControlsForField(formField, panelInfo);
                        fieldInfo.InputControl.TabIndex = currentColumnNo*maxRowsInColumns + currentRowNo;
                    }
                    else
                    {
                        AddNullControlsForEmptyField(panelInfo);
                    }
                    currentFieldPositionInColumns[currentColumnNo]++;
                }
            }
        }
Esempio n. 5
0
 private GridLayoutManager SetupLayoutManager(UIFormTab formTab, IPanel panel)
 {
     GridLayoutManager layoutManager = new GridLayoutManager(panel, ControlFactory);
     int maxRowsInColumns = formTab.GetMaxRowsInColumns();
     
     int colCount = formTab.Count * CONTROLS_PER_COLUMN;
     layoutManager.SetGridSize(maxRowsInColumns, colCount);
     layoutManager.FixColumnBasedOnContents(0);
     for (int i = 0; i < colCount; i += CONTROLS_PER_COLUMN)
     {
         layoutManager.FixColumnBasedOnContents(i + LABEL_CONTROL_COLUMN_NO);
         layoutManager.FixColumn(i + ERROR_PROVIDER_COLUMN_NO, ERROR_PROVIDER_WIDTH);
     }
     ITextBox sampleTextBoxForHeight = ControlFactory.CreateTextBox();
     for (int row = 0; row < maxRowsInColumns; row++)
     {
         layoutManager.FixRow(row, sampleTextBoxForHeight.Height);
     }
     return layoutManager;
 }
Esempio n. 6
0
        public void TestGetMaxRowsInColumns_RowAndColSpan_3Cols()
        {
            //---------------Set up test pack-------------------
            UIFormTab uiFormTab1 = new UIFormTab("tab1");
            uiFormTab1.Add(CreateUIFormColumn_1FieldWith2RowAnd3ColSpan());
            uiFormTab1.Add(CreateUIFormColumn_1FieldWith2RowAnd2ColSpan());
            uiFormTab1.Add(CreateUIFormColumn_1Field());
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            int maxFieldCount = uiFormTab1.GetMaxRowsInColumns();
            //---------------Test Result -----------------------
            Assert.AreEqual(5, maxFieldCount);
        }