當前位置: 首頁>>代碼示例>>Java>>正文


Java DisplayerListener類代碼示例

本文整理匯總了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));
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:19,代碼來源:SelectorSliderDisplayerTest.java

示例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));
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:19,代碼來源:SelectorSliderDisplayerTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:20,代碼來源:SelectorSliderDisplayerTest.java

示例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));
    
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:17,代碼來源:DataSetEditorTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:30,代碼來源:SelectorDropDownDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:39,代碼來源:SelectorDropDownDisplayerTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:32,代碼來源:SelectorDropDownDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:39,代碼來源:SelectorDropDownDisplayerTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:28,代碼來源:SelectorLabelSetDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:36,代碼來源:SelectorLabelSetDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:41,代碼來源:SelectorLabelSetDisplayerTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:29,代碼來源:SelectorLabelSetDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:39,代碼來源:SelectorLabelSetDisplayerTest.java

示例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());
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:31,代碼來源:SelectorDisplayerTest.java

示例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");
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:36,代碼來源:SelectorDisplayerTest.java


注:本文中的org.dashbuilder.displayer.client.DisplayerListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。