本文整理汇总了Java中org.dashbuilder.displayer.DisplayerSettings类的典型用法代码示例。如果您正苦于以下问题:Java DisplayerSettings类的具体用法?Java DisplayerSettings怎么用?Java DisplayerSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DisplayerSettings类属于org.dashbuilder.displayer包,在下文中一共展示了DisplayerSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmptyTableDraw
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testEmptyTableDraw() {
DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.tablePageSize(10)
.buildSettings();
TableDisplayer table = createTableDisplayer(allRows);
TableDisplayer.View tableView = table.getView();
FilterLabelSet filterLabelSet = table.getFilterLabelSet();
table.draw();
verify(tableView).createTable(10, filterLabelSet);
verify(tableView).setTotalRows(0);
verify(tableView).setPagerEnabled(false);
verify(tableView, never()).setPagerEnabled(true);
reset(tableView);
table.redraw();
verify(tableView, never()).setPagerEnabled(true);
}
示例2: testSwitchOnFilter
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testSwitchOnFilter() {
DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.column(COLUMN_AMOUNT)
.filterOn(false, true, true)
.buildSettings();
MetricDisplayer presenter = createMetricDisplayer(empty);
MetricDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
reset(listener);
presenter.updateFilter();
verify(listener).onFilterEnabled(eq(presenter), any(DataSetFilter.class));
}
示例3: testFilterOff
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testFilterOff() {
DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.column(COLUMN_AMOUNT)
.filterOn(false, true, true)
.jsTemplate(JS_TEMPLATE)
.buildSettings();
MetricDisplayer presenter = createMetricDisplayer(empty);
presenter.setFilterOn(false);
presenter.draw();
assertEquals(presenter.isFilterOn(), false);
verify(view).eval("if (true) { \n" +
" var filterOn = false;\n" +
" document.getElementById(\"test_this\").style.cursor=\"pointer\";\n" +
" document.getElementById(\"test_this\").onclick = function() {\n" +
" filterOn = !filterOn;\n" +
" document.getElementById(\"test_this\").style.backgroundColor = filterOn ? \"lightblue\" : \"white\";\n" +
" window.metricDisplayerDoFilter('test');\n" +
" };\n" +
"}");
}
示例4: showDisplayer
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
public void showDisplayer() {
if (view.isTableDisplayModeOn()) {
try {
DisplayerSettings tableSettings = displayerSettings.cloneInstance();
tableSettings.setTitleVisible(false);
tableSettings.setType(DisplayerType.TABLE);
tableSettings.setTablePageSize(8);
tableSettings.setTableWidth(800);
tableSettings.setRenderer("default");
Displayer tableDisplayer = displayerLocator.lookupDisplayer(tableSettings);
tableDisplayer.addListener(displayerListener);
tableDisplayer.setRefreshOn(false);
tableDisplayer.draw();
view.showDisplayer(tableDisplayer);
} catch (Exception e) {
view.error(new ClientRuntimeError(e));
}
}
else if (supportsHtmlTemplate()) {
displayerHtmlEditor.setDisplayer(displayer);
view.showDisplayer(displayerHtmlEditor);
}
else {
view.showDisplayer(displayer);
}
}
示例5: testNoData
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testNoData() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.buildSettings();
SelectorDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDisplayer.View view = presenter.getView();
presenter.draw();
verify(view).clearItems();
verify(view).showSelectHint(COLUMN_DEPARTMENT);
verify(view, never()).addItem(anyString(), anyString(), anyBoolean());
}
示例6: testDraw
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testDraw() {
DisplayerSettings engExpenses = DisplayerSettingsFactory.newMetricSettings()
.dataset(EXPENSES)
.filter(COLUMN_DEPARTMENT, FilterFactory.equalsTo("Engineering"))
.column(COLUMN_AMOUNT, AggregateFunctionType.SUM)
.title("Title").titleVisible(true)
.width(300).height(200)
.margins(10, 20, 30, 40)
.backgroundColor("FDE8D4")
.filterOff(true)
.htmlTemplate(HTML_TEMPLATE)
.jsTemplate("alert('${value.raw}');")
.buildSettings();
MetricDisplayer presenter = createMetricDisplayer(engExpenses);
presenter.draw();
verify(view).setHtml("<div id=\"test_this\" style=\"background-color:#FDE8D4; width:300px; height:200px; " +
"margin-top:10px; margin-right:40px; margin-bottom:20px; margin-left:30px;\">\n" +
" <span>Title</span>\n" +
" <span>7,650.16</span>\n" +
"</div>");
verify(view).eval("alert('7650.16');");
}
示例7: testSelectCellCommands
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testSelectCellCommands() {
DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()
.dataset(EXPENSES)
.tablePageSize(5)
.tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)
.filterOn(false, true, true)
.buildSettings();
TableDisplayer table = createTableDisplayer(allRows);
TableDisplayer.View view = table.getView();
FilterLabelSet filterLabelSet = table.getFilterLabelSet();
table.addListener(displayerListener);
table.addOnCellSelectedCommand(selectCommand);
final Command selectedCommand = mock(Command.class);
table.addOnCellSelectedCommand(selectedCommand);
table.draw();
resetFilterLabelSet(filterLabelSet);
table.selectCell(COLUMN_DEPARTMENT, 3);
verify(selectCommand).execute();
verify(selectedCommand).execute();
}
示例8: testDraw
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testDraw() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.filterOn(false, true, false)
.buildSettings();
SelectorDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorDisplayer.View view = presenter.getView();
presenter.draw();
verify(view).setFilterEnabled(true);
verify(view).clearItems();
verify(view).showSelectHint(COLUMN_DEPARTMENT);
verify(view, times(5)).addItem(anyString(), anyString(), eq(false));
verify(view, never()).showResetHint(anyString());
}
示例9: testChangeAttributes
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testChangeAttributes() {
DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings().buildSettings();
when(displayer.getDisplayerSettings()).thenReturn(settings);
presenter.init(displayer);
presenter.onAttributeChanged(TITLE.getFullId(), "Test");
presenter.onAttributeChanged(TITLE_VISIBLE.getFullId(), "true");
presenter.onAttributeChanged(EXPORT_TO_CSV.getFullId(), "false");
presenter.onAttributeChanged(EXPORT_TO_XLS.getFullId(), "false");
presenter.onAttributeChanged(CHART_HEIGHT.getFullId(), "400");
presenter.onAttributeChanged("columns.amount.name", "Total");
presenter.onAttributeChanged("columns.amount.pattern", "#.###,00");
presenter.onAttributeChanged("columns.amount.expression", "value");
assertEquals(settings.getTitle(), "Test");
assertEquals(settings.isTitleVisible(), true);
assertEquals(settings.isCSVExportAllowed(), false);
assertEquals(settings.isExcelExportAllowed(), false);
assertEquals(settings.getChartHeight(), 400);
assertEquals(settings.getColumnSettings("amount").getColumnName(), "Total");
assertEquals(settings.getColumnSettings("amount").getValuePattern(), "#.###,00");
assertEquals(settings.getColumnSettings("amount").getValueExpression(), "value");
verify(event, atLeastOnce()).fire(any(DisplayerSettingsChangedEvent.class));
}
示例10: testRenderer
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testRenderer() {
DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings()
.renderer("rendererB")
.buildSettings();
when(rendererManager.getRendererForDisplayer(settings)).thenReturn(rendererB);
when(displayer.getDisplayerConstraints()).thenReturn(
new DisplayerConstraints(null)
.supportsAttribute(RENDERER));
when(displayer.getDisplayerSettings()).thenReturn(settings);
presenter.init(displayer);
verify(view).clear();
verify(view).addListProperty(RENDERER, Arrays.asList("rendererA", "rendererB"), "rendererB");
verify(view).show();
}
示例11: testCSVConfig
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testCSVConfig() throws Exception {
DataSetDef dataSetDef = DataSetDefFactory.newCSVDataSetDef()
.datePattern("dd/MM/yyyy")
.numberPattern("#,###")
.allColumns(true)
.buildDef();
DataSet dataSet = DataSetFactory.newDataSetBuilder()
.date("date")
.number("number")
.row(new Date(), 1d)
.buildDataSet();
when(dataSetLookupServices.lookupDataSet(any(), any())).thenReturn(dataSet);
tested.show(dataSetDef, null, displayerListener);
ArgumentCaptor<Displayer> argumentCaptor = ArgumentCaptor.forClass(Displayer.class);
verify(displayerListener).onDataLoaded(argumentCaptor.capture());
Displayer displayer = argumentCaptor.getValue();
DisplayerSettings settings = displayer.getDisplayerSettings();
assertEquals(settings.getColumnSettings("date").getValuePattern(), "dd/MM/yyyy");
assertEquals(settings.getColumnSettings("number").getValuePattern(), "#,###");
}
示例12: testTableDraw
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testTableDraw() {
DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()
.dataset(EXPENSES)
.tableOrderDefault(COLUMN_DEPARTMENT, SortOrder.DESCENDING)
.tableOrderEnabled(true)
.tablePageSize(10)
.tableWidth(1000)
.buildSettings();
GoogleTableDisplayer table = createTableDisplayer(allRows);
GoogleTableDisplayer.View tableView = table.getView();
table.ready();
verify(tableView).setWidth(1000);
verify(tableView).setSortEnabled(true);
verify(tableView).setPageSize(10);
verify(tableView).setTotalRows(50);
verify(tableView).setTotalPages(5);
verify(tableView).setPagerEnabled(true);
verify(tableView).drawTable();
}
示例13: testEmptyTableDraw
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testEmptyTableDraw() {
DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.tablePageSize(10)
.buildSettings();
GoogleTableDisplayer table = createTableDisplayer(allRows);
GoogleTableDisplayer.View tableView = table.getView();
table.ready();
verify(tableView).setPageSize(10);
verify(tableView).setTotalRows(0);
verify(tableView).setTotalPages(1);
verify(tableView).setPagerEnabled(false);
verify(tableView).nodata();
}
示例14: testFilterOn
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testFilterOn() {
DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.column(COLUMN_AMOUNT)
.filterOn(false, true, true)
.jsTemplate(JS_TEMPLATE)
.buildSettings();
MetricDisplayer presenter = createMetricDisplayer(empty);
presenter.setFilterOn(true);
presenter.draw();
assertEquals(presenter.isFilterOn(), true);
verify(view).eval("if (true) { \n" +
" var filterOn = true;\n" +
" document.getElementById(\"test_this\").style.cursor=\"pointer\";\n" +
" document.getElementById(\"test_this\").onclick = function() {\n" +
" filterOn = !filterOn;\n" +
" document.getElementById(\"test_this\").style.backgroundColor = filterOn ? \"lightblue\" : \"white\";\n" +
" window.metricDisplayerDoFilter('test');\n" +
" };\n" +
"}");
}
示例15: testNoData
import org.dashbuilder.displayer.DisplayerSettings; //导入依赖的package包/类
@Test
public void testNoData() {
DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()
.dataset(EXPENSES)
.filter(COLUMN_ID, FilterFactory.isNull())
.group(COLUMN_DEPARTMENT)
.column(COLUMN_DEPARTMENT)
.column(COLUMN_ID, AggregateFunctionType.COUNT)
.buildSettings();
SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);
SelectorLabelSetDisplayer.View view = presenter.getView();
presenter.draw();
verify(view).clearItems();
verify(view, never()).addItem(any());
}