use of org.activityinfo.client.page.report.ReportChangeEvent in project activityinfo by bedatadriven.
the class DimensionPrunerTest method test.
@Test
public void test() {
PivotTableReportElement table = new PivotTableReportElement();
DimensionPruner pruner = new DimensionPruner(eventBus, dispatcher);
pruner.bind(table);
table.getFilter().addRestriction(DimensionType.Indicator, NB_MENAGES_INDICATOR_ID);
table.addColDimension(new Dimension(DimensionType.Indicator));
eventBus.fireEvent(new ReportChangeEvent(this, table));
AttributeGroupDimension groupDim = new AttributeGroupDimension(NFI_FUNDING_GROUP_ID);
table.addColDimension(groupDim);
eventBus.fireEvent(new ReportChangeEvent(this, table));
assertTrue(table.getColumnDimensions().contains(groupDim));
// now remove the indicator and verify that the attribute group has been
// removed
table.getFilter().clearRestrictions(DimensionType.Indicator);
eventBus.fireEvent(new ReportChangeEvent(this, table));
assertFalse(table.getColumnDimensions().contains(groupDim));
}
use of org.activityinfo.client.page.report.ReportChangeEvent in project activityinfo by bedatadriven.
the class DimensionPrunerTest method testMergedAttributes.
@Test
public void testMergedAttributes() {
PivotTableReportElement table = new PivotTableReportElement();
DimensionPruner pruner = new DimensionPruner(eventBus, dispatcher);
pruner.bind(table);
table.getFilter().addRestriction(DimensionType.Indicator, Arrays.asList(NB_MENAGES_INDICATOR_ID, VOUCHER_INDICATOR_ID));
table.addColDimension(new Dimension(DimensionType.Indicator));
eventBus.fireEvent(new ReportChangeEvent(this, table));
AttributeGroupDimension groupDim = new AttributeGroupDimension(NFI_FUNDING_GROUP_ID);
table.addColDimension(groupDim);
eventBus.fireEvent(new ReportChangeEvent(this, table));
// now remove the first indicator and verify that the attribute group
// has NOT been removed, because it shares a name with the other attrib group
table.getFilter().clearRestrictions(DimensionType.Indicator);
table.getFilter().addRestriction(DimensionType.Indicator, VOUCHER_INDICATOR_ID);
eventBus.fireEvent(new ReportChangeEvent(this, table));
assertTrue(table.getColumnDimensions().contains(groupDim));
}
Aggregations