Exemplo n.º 1
0
        public TableModel()
        {
            rows         = new List <RowModel>();
            filteredRows = new List <RowModel>();
            columns      = new List <ColumnModel>();

            filters = new List <FilterStruct>();
            sorts   = new List <SortStruct>();

            controller       = new TableController(this);
            sortController   = new SortController(this);
            filterController = new FilterController(this);

            columnListener  = new ColumnChangeListener(this);
            rowListener     = new RowChangeListener(this);
            nameListener    = new NameChangeListener(this);
            rowDataListener = new RowDataListener(this);
        }
Exemplo n.º 2
0
        public void SetTable(DatabaseReference table, DatabaseReference tableName)
        {
            consume_name_update = false;
            if (databaseTable != null)
            {
                UnbindListeners();
            }
            databaseTable = table;
            tableNameData = tableName;
            this.name     = "somename";

            columnListener  = new ColumnChangeListener(this);
            rowListener     = new RowChangeListener(this);
            nameListener    = new NameChangeListener(this);
            rowDataListener = new RowDataListener(this);

            columns.Clear();

            foreach (RowModel model in rows)
            {
                model.UnbindListeners();
            }
            rows.Clear();

            controller.NotifyViewCleared();

            tableNameData.AddValueEventListener(nameListener);

            tableRowData = databaseTable.Child("row_data").Child("new_row_id");
            tableRowData.AddValueEventListener(rowDataListener);

            //load columns
            databaseColumns =
                databaseTable.Child("columns");
            databaseColumns.AddChildEventListener(columnListener);

            //load rows
            databaseRows =
                databaseTable.Child("rows");
            databaseRows.AddChildEventListener(rowListener);
        }