Esempio n. 1
0
        private bool removeEmptyLastRows()
        {
            if (!allowAddRows)
            {
                return(false);
            }

            bool _removed = false;

            while (rowCount > 1)
            {
                PM_GridRow _row       = row(rowCount - 1);
                PM_GridRow _rowbefore = row(rowCount - 2);
                if (_row != null && _rowbefore != null && !_row.hasValues() && !_rowbefore.hasValues())
                {
                    __model.removeRow(rowCount - 1);
                    _removed = true;
                }
                else
                {
                    break;
                }
            }
            return(_removed);
        }
Esempio n. 2
0
        public bool hasValues(int _rowIndex)
        {
            Contract.Requires(_rowIndex >= 0 && _rowIndex < rowCount);
            PM_GridRow _row = row(_rowIndex);

            return(_row != null && _row.hasValues());
        }
Esempio n. 3
0
        void applyProperties(cellInfo _cellInfo)
        {
            PM_GridColumn _column = __model.column(_cellInfo.colIndex);
            PM_GridRow    _row    = __model.row(_cellInfo.rowIndex);

            _cellInfo.cell.applyControl_value();

            if (_cellInfo.cell.type == PM_GridCellType.HORIZONTALHEADER)
            {
                applyHorizontalHeaderProperties(_cellInfo);
                return;
            }

            if (_cellInfo.cell.type == PM_GridCellType.VERTICALHEADER)
            {
                applyVerticalHeaderProperties(_cellInfo);
                return;
            }

            // readOnly
            if (_cellInfo.cell.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_cellInfo.cell.readOnly);
            }
            else
            if (_row.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_row.readOnly);
            }
            else
            if (_column.readOnly != PM_state.UNSET)
            {
                _cellInfo.cell.applyIsReadOnly(_column.readOnly);
            }
            else
            {
                _cellInfo.cell.applyIsReadOnly(__model.readOnly);
            }

            // style
            if (_cellInfo.cell.style != null)
            {
                _cellInfo.cell.applyStyle(_cellInfo.cell.style);
            }
            else
            if (_row.style != null)
            {
                _cellInfo.cell.applyStyle(_row.style);
            }
            else
            if (_column.style != null)
            {
                _cellInfo.cell.applyStyle(_column.style);
            }
            else
            {
                _cellInfo.cell.applyStyle(__model.style);
            }
        }
Esempio n. 4
0
        public void appendRow(double _height, PM_GridCellVHeader _header)
        {
            PM_GridRow _row = new PM_GridRow(columnCount, _height);

            _row.header          = _header;
            __vScrollBar.Maximum = rowCount;
            render();
        }
Esempio n. 5
0
        public void setRowStyle(int _index, PM_GridCellStyle _style)
        {
            PM_GridRow _row = row(_index);

            if (_row == null)
            {
                return;
            }
            _row.style = _style;
        }
Esempio n. 6
0
        public void setRowReadOnly(int _index, PM_state _readOnly)
        {
            PM_GridRow _row = row(_index);

            if (_row == null)
            {
                return;
            }
            _row.readOnly = _readOnly;
        }
Esempio n. 7
0
        public void setRowVisibility(int _index, Visibility _visibility)
        {
            PM_GridRow _row = row(_index);

            if (_row == null)
            {
                return;
            }
            _row.visibility = _visibility;
        }
Esempio n. 8
0
 /// <summary>
 /// Ajoute une ligne, la peuple de cellules selon les types définis par chaque colonne.
 /// <para>Si la capacité prédéfinie pour le nombre de ligne est ici augmentée si nécessaire,
 /// mais, pour les performances,  il est préférable d'avoir prévu un <c>rowCount</c> suffisant.</para>
 /// Il faut donc avoir définit les colonnes (<c>setColumn</c>) avant d'utiliser <c>setRow</c>.
 /// </summary>
 /// <param name="_height"></param>
 public void appendRow(double _height)
 {
     if (__rows == null)
     {
         __rows = new PM_GridRow[1];
     }
     else
     {
         Array.Resize(ref __rows, __rows.Length + 1);
     }
     setRow(rowCount - 1, new PM_GridRow(columnCount, _height));
 }
Esempio n. 9
0
        public void value(int _columnIndex, int _rowIndex, object _value)
        {
            PM_GridRow _row = row(_rowIndex);

            if (_row == null)
            {
                return;
            }
            PM_GridCell _cell = _row.cell(_columnIndex);

            if (_cell != null)
            {
                _cell.value = _value;
            }
        }
Esempio n. 10
0
        bool showVScrollBar()
        {
            double _n = 0;
            double _h = this.ActualHeight;

            for (int _i = 0; _i < rowCount; _i++)
            {
                PM_GridRow _row = __model.row(_i);
                if (_row != null)
                {
                    _n += __model.row(_i).height;
                    if (_n > _h)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 11
0
        /// <summary>
        /// Construit une ligne peuplée de ses cellules de type selon chaque colonne,
        /// met à jour __biggestRowIndex si _index supérieur à __biggestRowIndex et donne grid à la nouvelle ligne _row.
        /// </summary>
        private void setRow(int _index, PM_GridRow _row)
        {
            Contract.Requires(_index >= 0 && _index < __rows.Length);
            Contract.Requires(_row != null);
            _row.grid = grid;

            for (int _i = 0; _i < columnCount; _i++)
            {
                if (__columns[_i] != null)
                {
                    _row.setCell(__columns[_i].newCell(grid), _i);
                }
                else
                {
                    throw new Exception("__columnns[_i] null");
                }
            }
            __rows[_index] = _row;
        }
Esempio n. 12
0
        public void removeRow(int _rowIndex)
        {
            Contract.Requires(_rowIndex >= 0 && _rowIndex < rowCount);

            PM_GridRow[] _rows = new PM_GridRow[rowCount - 1];

            int _n = 0;

            for (int _i = 0; _i < rowCount; _i++)
            {
                if (_i != _rowIndex)
                {
                    PM_GridRow _row = __rows[_i];
                    _rows[_n] = _row;
                    ++_n;
                }
            }
            __rows = _rows;
        }
Esempio n. 13
0
 string value(PM_GridRow _row)
 {
     Contract.Requires(_row != null);
     if (__column >= 0 && __column < _row.cells.Length)
     {
         PM_GridCell _cell = _row.cell(__column);
         if (_cell != null)
         {
             return((string)_cell.value);
         }
         else
         {
             return("");
         }
     }
     else
     {
         throw new Exception("__column out of range.");
     }
 }
Esempio n. 14
0
 double value(PM_GridRow _row)
 {
     return((double)((_row.cell(__column).value)));
 }
Esempio n. 15
0
 DateTime value(PM_GridRow _row)
 {
     return((DateTime)((_row.cell(__column).value)));
 }
Esempio n. 16
0
 int value(PM_GridRow _row)
 {
     return((int)((_row.cell(__column).value)));
 }
Esempio n. 17
0
        public PM_GridCell cell(int _columnIndex, int _rowIndex)
        {
            PM_GridRow _row = row(_rowIndex);

            return((_row == null) ? null : _row.cell(_columnIndex));
        }