/// <summary>
 /// set and save last top index
 /// </summary>
 /// <param name="guiTopIndex"> </param>
 internal override void SetGuiTopIndex(int guiTopIndex)
 {
     _guiTopIndex          = guiTopIndex;
     _tableControl.Scroll -= TableHandler.getInstance().ScrollHandler;
     _tableControl.SetTopIndex(guiTopIndex, false);
     _tableControl.Scroll += TableHandler.getInstance().ScrollHandler;
 }
Example #2
0
 /// <returns>
 /// </returns>
 internal static TableHandler getInstance()
 {
     if (_instance == null)
     {
         _instance = new TableHandler();
     }
     return(_instance);
 }
Example #3
0
        /// <summary>
        /// sets the items count of table control
        /// </summary>
        /// <param name="count"></param>
        internal void SetTableControlItemsCount(int count)
        {
#if !PocketPC
            //prevent unnecessary resizes
            _tableControl.Layout -= TableHandler.getInstance().LayoutHandler;
#endif

            _tableControl.SetItemsCount(count);

#if !PocketPC
            //prevent unnecessary resizes
            _tableControl.Layout += TableHandler.getInstance().LayoutHandler;
#endif
        }
        /// <summary>
        /// sets the virtual items count of table control
        /// </summary>
        /// <param name="count">the count to set</param>
        internal override void SetTableVirtualItemsCount(int count)
        {
#if !PocketPC
            //prevent unnecessary resizes
            _tableControl.Layout -= TableHandler.getInstance().LayoutHandler;
#endif

            _tableControl.VirtualItemsCount = count;

#if !PocketPC
            //prevent unnecessary resizes
            _tableControl.Layout += TableHandler.getInstance().LayoutHandler;
#endif
        }
        /// <summary>
        /// sets Table Items Count
        /// </summary>
        /// <param name="newCount">the count to set</param>
        internal override void SetTableItemsCount(int newCount)
        {
            if (_mgCount != newCount)
            {
                RefreshPageNeeded = true;
            }

            _mgCount = newCount;
            int  oldCount = GetTableControlItemsCount();
            bool updated  = false;

            if (newCount != 0)
            {
                // update includesFirst according to number rows in table, if number of rows is too small
                // creating dummy record is impossible
                updated = updateIncludeFirst();
                if (!_includesFirst)
                {
                    newCount++;
                    if (updated)
                    // when chunks are added and size becomes bigger than page,
                    // create dummy first line
                    {
                        //TODO new TableItem(table, 0, 0);
                        _prevTopGuiIndex = -1;
                        //SetItemsCount may cause resize, in this case we need mgCount to be updated with correct value
                        if (_tableControl.VirtualItemsCount < 2)
                        {
                            //setItemscount 1 will not work if we have less then 2 items. QCR #434423
                            SetTableControlItemsCount(newCount);
                        }
                    }
                }
                if (!_includesLast)
                {
                    newCount++;
                }
            }

            if (IsSmallerThanScreen(newCount))
            {
                //QCR #997566, need to show scrollbar to let user know there are records before current record
                newCount = _rowsInPage + 1; //create dummy records for this
            }
            if (oldCount != newCount || updated)
            {
                RefreshPageNeeded = true;
            }

            // In RC when table is invalidated it always get setitemscount(0) and then setItemsCount(realcount). So, after request with (newCount == 0)
            // there will always follow real request with correct number of rows (we always have at least one row in RC). So, when newCount == 0 we are
            // in temporary state and should not do any “resize”.
            if (newCount == 0)
            {
                _tableControl.HorizontalScrollVisibilityChanged -= TableHandler.getInstance().HorizontalScrollVisibilityChangedHandler;
            }

            SetTableControlItemsCount(newCount);

            if (newCount == 0)
            {
                _tableControl.HorizontalScrollVisibilityChanged += TableHandler.getInstance().HorizontalScrollVisibilityChangedHandler;
            }

            if (!_includesFirst && updated)
            {
                SetTopIndex(0);
            }
        }