本文整理汇总了Java中org.dashbuilder.dataset.group.DataSetGroup.getSelectedIntervalList方法的典型用法代码示例。如果您正苦于以下问题:Java DataSetGroup.getSelectedIntervalList方法的具体用法?Java DataSetGroup.getSelectedIntervalList怎么用?Java DataSetGroup.getSelectedIntervalList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dashbuilder.dataset.group.DataSetGroup
的用法示例。
在下文中一共展示了DataSetGroup.getSelectedIntervalList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSelectItem
import org.dashbuilder.dataset.group.DataSetGroup; //导入方法依赖的package包/类
@Test
public void testSelectItem() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, true)
.multiple(false)
.buildSettings();
SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDropDownDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
// Select an item
reset(view);
when(dropDownItem.getId()).thenReturn(1);
presenter.addListener(listener);
presenter.onItemSelected(dropDownItem);
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(any());
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(view).showResetHint(COLUMN_DEPARTMENT, false);
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, false);
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
verify(listener, never()).onRedraw(presenter);
DataSetGroup dataSetGroup = argument.getValue();
List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();
assertEquals(selectedIntervals.size(), 1);
Interval selectedInterval = selectedIntervals.get(0);
assertEquals(selectedInterval.getName(), "Management");
}
示例2: testSelectItem
import org.dashbuilder.dataset.group.DataSetGroup; //导入方法依赖的package包/类
@Test
public void testSelectItem() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, true)
.buildSettings();
SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorLabelSetDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
// Select an item
reset(view);
when(labelItem.getId()).thenReturn(1);
presenter.addListener(listener);
presenter.onItemSelected(labelItem);
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(any());
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
verify(listener, never()).onRedraw(presenter);
DataSetGroup dataSetGroup = argument.getValue();
List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();
assertEquals(selectedIntervals.size(), 1);
Interval selectedInterval = selectedIntervals.get(0);
assertEquals(selectedInterval.getName(), "Management");
}
示例3: testMultipleSelect
import org.dashbuilder.dataset.group.DataSetGroup; //导入方法依赖的package包/类
@Test
public void testMultipleSelect() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, true)
.multiple(true)
.buildSettings();
SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorLabelSetDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
// Select an item
reset(view);
presenter.addListener(listener);
when(labelItem.getId()).thenReturn(1);
presenter.onItemSelected(labelItem);
when(labelItem.getId()).thenReturn(2);
presenter.onItemSelected(labelItem);
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(any());
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(listener, times(2)).onFilterEnabled(eq(presenter), argument.capture());
verify(listener, never()).onRedraw(presenter);
DataSetGroup dataSetGroup = argument.getValue();
List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();
assertEquals(selectedIntervals.size(), 2);
Interval selectedInterval1 = selectedIntervals.get(0);
Interval selectedInterval2 = selectedIntervals.get(1);
assertEquals(selectedInterval1.getName(), "Management");
assertEquals(selectedInterval2.getName(), "Sales");
}
示例4: testMultipleSelect
import org.dashbuilder.dataset.group.DataSetGroup; //导入方法依赖的package包/类
@Test
public void testMultipleSelect() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, true)
.multiple(true)
.width(100)
.buildSettings();
SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDropDownDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
// Select an item
presenter.addListener(listener);
when(dropDownItem.getId()).thenReturn(1);
presenter.onItemSelected(dropDownItem);
// Select another item
reset(view);
reset(listener);
when(dropDownItem.getId()).thenReturn(2);
presenter.onItemSelected(dropDownItem);
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(any());
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(view).showResetHint(COLUMN_DEPARTMENT, true);
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, true);
verify(view).showCurrentSelection("Management ...", "Management, Sales ");
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
verify(listener, never()).onRedraw(presenter);
DataSetGroup dataSetGroup = argument.getValue();
List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();
assertEquals(selectedIntervals.size(), 2);
Interval selectedInterval1 = selectedIntervals.get(0);
Interval selectedInterval2 = selectedIntervals.get(1);
assertEquals(selectedInterval1.getName(), "Management");
assertEquals(selectedInterval2.getName(), "Sales");
}