Example #1
0
        /// <summary>Expensive operation, if the table contains a lot of entries</summary>
        public bool ChangeColumnSortType(int columnIndex, TableValueType columnType, TableValueSortType currentSorting, TableValueSortType nextSorting)
        {
            if (!_ColumnSortingSupported)
            {
                throw new InvalidOperationException("Cannot sort this table model because it was constructed with columnSortingSupported = false");
            }

            // No comparer means changing sort type is not possible
            IComparer comparer;

            if (!_MapValueTypeToComparer.TryGetValue(columnType, out comparer))
            {
                return(false);
            }

            // Sort them
            if (currentSorting == TableValueSortType.NONE)
            {
                bool asc = nextSorting == TableValueSortType.ASCENDING;
                SortTuplesListIfSupported(new TupleComparerWrapper(comparer, asc, columnIndex));
            }
            else
            {
                // No sorting needed, just reversing the list, which is faster
                ReverseTuplesListIfSupported();
            }

            return(true);
        }
        void UpdateArrowFromSortType(TableValueSortType type)
        {
            if (!_ArrowRT)
            {
                return;
            }

            if (_ArrowRT)
            {
                bool  valid = type != TableValueSortType.NONE;
                float scale;
                float zRotation;
                if (valid)
                {
                    scale     = 1f;
                    zRotation = 90f * (type == TableValueSortType.ASCENDING ? 1f : -1f);
                }
                else
                {
                    scale     = .5f;
                    zRotation = 0f;
                }
                _ArrowRT.localScale = Vector3.one * scale;
                var euler = _ArrowRT.localRotation.eulerAngles;
                euler.z = zRotation;
                _ArrowRT.localRotation = Quaternion.Euler(euler);
            }
        }
Example #3
0
 /// <summary>
 /// <para>Called when something causes a column to change its sorting type. </para>
 /// </summary>
 /// <param name="columnValueVHIfVisible"> The views holder representing the column in the header. Null if not visible</param>
 /// <param name="type">The new sorting type</param>
 protected virtual void OnSortingTypeChangedForColumn(int columnIndex, TableValueSortType type)
 {
     _Header.Adapter.ForceUpdateValueViewsHolderIfVisible(columnIndex);
 }
Example #4
0
        public virtual void SetColumnSorting(int columnIndex, TableValueSortType type)
        {
            Columns.GetColumnState(columnIndex).CurrentSortingType = type;

            OnSortingTypeChangedForColumn(columnIndex, type);
        }
Example #5
0
        //TTuple CreateEmptyTuple()
        //{
        //	return TableViewUtil.CreateTupleWithEmptyValues<TTuple>(Columns.ColumnsCount);
        //}

        public bool ChangeColumnSortType(int columnIndex, TableValueType columnType, TableValueSortType currentSorting, TableValueSortType nextSorting)
        {
            throw new NotSupportedException();
        }