/** * Remove an item from the aggregation at the given row * @param row the row index of the aggregate * @param member the item to remove from the aggregation */ public void removeFromAggregate(int row, VisualItem member) { validRowCheck(row, true); int ar = getAggregatedRow(row, member); if ( ar >= 0 ) { m_aggregated.removeRow(ar); fireTableEvent(row, row, EventConstants.ALL_COLUMNS, EventConstants.UPDATE); } }
/** * Add an item to the aggregation at the given row. * @param row the row index of the aggregate * @param member the item to add to the aggregation */ public void addToAggregate(int row, VisualItem member) { validRowCheck(row, true); if ( !aggregateContains(row, member) ) { int ar = m_aggregated.addRow(); m_aggregated.setInt(ar, AGGREGATE, row); m_aggregated.setInt(ar, MEMBER_HASH, getHashCode(member)); m_aggregated.set(ar, MEMBER, member); fireTableEvent(row, row, EventConstants.ALL_COLUMNS, EventConstants.UPDATE); } }
/** * Clears all aggregates mappings for the aggregate at the given row, * optionally issuing a table update. * @param row the table row of the aggregate * @param update indicates whether or not to fire a table update */ protected void clearAggregateMappings(int row, boolean update) { Index index = m_aggregated.index(AGGREGATE); boolean fire = false; for ( IntIterator rows = index.rows(row); rows.hasNext(); ) { int r = rows.nextInt(); // this removal maneuver is ok because we know we are // pulling row values directly from an index // with intervening iterators, remove might throw an exception rows.remove(); m_aggregated.removeRow(r); fire = true; } if ( update && fire ) fireTableEvent(row, row, EventConstants.ALL_COLUMNS, EventConstants.UPDATE); }