本文整理汇总了Java中org.dashbuilder.displayer.client.DisplayerListener类的典型用法代码示例。如果您正苦于以下问题:Java DisplayerListener类的具体用法?Java DisplayerListener怎么用?Java DisplayerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DisplayerListener类属于org.dashbuilder.displayer.client包,在下文中一共展示了DisplayerListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDateSelector
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testDateSelector() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.addListener(listener);
presenter.draw();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());
verify(view).setWidth(anyInt());
// Ensure no filter is executed if the range does not change
presenter.onSliderChange(1, 6);
reset(listener);
presenter.onSliderChange(1, 6);
verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));
}
示例2: testNumberSelector
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testNumberSelector() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(numberSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.addListener(listener);
presenter.draw();
verify(view).showSlider(1, 1101, 1, 1, 1101);
verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());
verify(view).setWidth(anyInt());
// Ensure no filter is executed if the range does not change
presenter.onSliderChange(1, 6);
reset(listener);
presenter.onSliderChange(1, 6);
verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));
}
示例3: testSelectDisabled
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testSelectDisabled() {
dateSelectorSettings.setFilterEnabled(false);
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
DisplayerListener listener = mock(DisplayerListener.class);
SelectorSliderDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.addListener(listener);
presenter.onSliderChange(0, 1);
// Check filter notifications
verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetFilter.class));
verify(listener, never()).onRedraw(presenter);
// Ensure data does not change
verify(view, never()).showSlider(anyInt(), anyInt(), anyInt(), anyInt(), anyInt());
}
示例4: mockPreviewTableCall
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
protected void mockPreviewTableCall() {
final Displayer displayer = mock(Displayer.class);
final DataSetHandler dataSetHandler = mock(DataSetHandler.class);
final DataSet dataSet = mock(DataSet.class);
when(displayer.getDataSetHandler()).thenReturn(dataSetHandler);
when(dataSetHandler.getLastDataSet()).thenReturn(dataSet);
doAnswer(new Answer<Void>() {
@Override
public Void answer(final InvocationOnMock invocationOnMock) throws Throwable {
DisplayerListener listener = (DisplayerListener) invocationOnMock.getArguments()[2];
listener.onDraw(displayer);
return null;
}
}).when(previewTable).show(any(DataSetDef.class), any(Collection.class), any(DisplayerListener.class));
}
示例5: testSelectDisabled
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testSelectDisabled() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOff(true)
.buildSettings();
SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);
DisplayerListener listener = mock(DisplayerListener.class);
SelectorDropDownDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.addListener(listener);
presenter.onItemSelected(dropDownItem);
// Check filter notifications
verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));
verify(listener, never()).onRedraw(presenter);
// Ensure data does not change
verify(view, never()).showResetHint(COLUMN_DEPARTMENT, true);
verify(view, never()).clearItems();
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, true);
verify(view, never()).addItem(any());
}
示例6: testSelectItem
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的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");
}
示例7: testDrillDown
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testDrillDown() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(true, true, true)
.multiple(false)
.buildSettings();
SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDropDownDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
reset(view);
when(dropDownItem.getId()).thenReturn(1);
presenter.addListener(listener);
presenter.onItemSelected(dropDownItem);
// Check filter notifications
verify(listener).onFilterEnabled(eq(presenter), any(DataSetGroup.class));
verify(listener).onRedraw(presenter);
// Check selector refreshes
verify(view).clearItems();
verify(view, atLeastOnce()).showResetHint(COLUMN_DEPARTMENT, false);
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, false);
verify(view, times(1)).addItem(any());
}
示例8: testNullEntries
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testNullEntries() {
// Insert a null entry into the dataset
DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);
int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));
expensesDataSet.setValueAt(0, column, null);
// Create a selector displayer
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, true)
.buildSettings();
SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDropDownDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.addListener(listener);
presenter.draw();
// Verify that null entries are not shown
verify(view, times(5)).addItem(any());
verify(view, never()).addItem(null);
// Select an item
reset(listener);
when(dropDownItem.getId()).thenReturn(1);
presenter.onItemSelected(dropDownItem);
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
DataSetGroup dataSetGroup = argument.getValue();
Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);
assertEquals(selectedInterval.getName(), "Engineering");
}
示例9: testSelectDisabled
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testSelectDisabled() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOff(true)
.buildSettings();
SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);
DisplayerListener listener = mock(DisplayerListener.class);
SelectorLabelSetDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.addListener(listener);
presenter.onItemSelected(labelItem);
// Check filter notifications
verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));
verify(listener, never()).onRedraw(presenter);
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(any());
}
示例10: testSelectItem
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的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");
}
示例11: testMultipleSelect
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的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");
}
示例12: testDrillDown
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testDrillDown() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(true, true, true)
.buildSettings();
SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorLabelSetDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
reset(view);
when(labelItem.getId()).thenReturn(1);
presenter.addListener(listener);
presenter.onItemSelected(labelItem);
// Check filter notifications
verify(listener).onFilterEnabled(eq(presenter), any(DataSetGroup.class));
verify(listener).onRedraw(presenter);
// Check selector refreshes
verify(view).clearItems();
verify(view, times(1)).addItem(any());
}
示例13: testNullEntries
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testNullEntries() {
// Insert a null entry into the dataset
DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);
int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));
expensesDataSet.setValueAt(0, column, null);
// Create a selector displayer
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.addListener(listener);
presenter.draw();
// Verify that null entries are not shown
verify(view, times(5)).addItem(any());
verify(view, never()).addItem(null);
// Select an item
reset(listener);
when(labelItem.getId()).thenReturn(1);
presenter.onItemSelected(labelItem);
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
DataSetGroup dataSetGroup = argument.getValue();
Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);
assertEquals(selectedInterval.getName(), "Engineering");
}
示例14: testSelectDisabled
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的package包/类
@Test
public void testSelectDisabled() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOff(true)
.buildSettings();
SelectorDisplayer presenter = createSelectorDisplayer(departmentList);
DisplayerListener listener = mock(DisplayerListener.class);
SelectorDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
when(view.getSelectedId()).thenReturn("1");
presenter.addListener(listener);
presenter.onItemSelected();
// Check filter notifications
verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));
verify(listener, never()).onRedraw(presenter);
// Ensure data does not change
verify(view).showResetHint(COLUMN_DEPARTMENT);
verify(view, never()).clearItems();
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT);
verify(view, never()).addItem(anyString(), anyString(), anyBoolean());
}
示例15: testSelectItem
import org.dashbuilder.displayer.client.DisplayerListener; //导入依赖的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();
SelectorDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.draw();
// Select an item
reset(view);
when(view.getSelectedId()).thenReturn("1");
presenter.addListener(listener);
presenter.onItemSelected();
// Ensure data does not change
verify(view, never()).clearItems();
verify(view, never()).addItem(anyString(), anyString(), anyBoolean());
// Verify the item selected is correct
ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);
verify(view).showResetHint(COLUMN_DEPARTMENT);
verify(view, never()).showSelectHint(COLUMN_DEPARTMENT);
verify(listener).onFilterEnabled(eq(presenter), argument.capture());
verify(listener, never()).onRedraw(presenter);
DataSetGroup dataSetGroup = argument.getValue();
Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);
assertEquals(selectedInterval.getName(), "Services");
}