本文整理汇总了Java中org.dashbuilder.dataset.ColumnType类的典型用法代码示例。如果您正苦于以下问题:Java ColumnType类的具体用法?Java ColumnType怎么用?Java ColumnType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColumnType类属于org.dashbuilder.dataset包,在下文中一共展示了ColumnType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
public void init(DataSetMetadata metadata,
GroupFunction groupFunction,
ColumnType targetType,
String columnTitle,
boolean functionsEnabled,
boolean canDelete) {
this.groupFunction = groupFunction;
this.targetType = targetType;
this.metadata = metadata;
this.functionsEnabled = functionsEnabled;
columnDetailsEditor.init(metadata, this.groupFunction);
view.setColumnSelectorTitle(columnTitle);
view.setDeleteOptionEnabled(canDelete);
initColumnListBox();
if (functionsEnabled && (targetType == null || isColumnNumeric())) {
view.setFunctionSelectorEnabled(true);
initFunctionListBox();
} else {
view.setFunctionSelectorEnabled(false);
}
}
示例2: initColumnListBox
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
protected void initColumnListBox() {
view.clearColumnSelector();
for (int i=0; i<metadata.getNumberOfColumns(); i++) {
String columnId = metadata.getColumnId(i);
ColumnType columnType = metadata.getColumnType(i);
// Only add columns that match the target type.
// When the target is not specified or is numeric then all the columns are eligible
if (targetType == null || columnType == null || isColumnNumeric() || targetType.equals(columnType)) {
view.addColumnItem(columnId);
if (columnId != null && columnId.equals(groupFunction.getSourceId())) {
view.setSelectedColumnIndex(i);
}
}
}
}
示例3: onCreateFilter
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
public void onCreateFilter() {
int selectedIdx = view.getSelectedColumnIndex();
String columnId = metadata.getColumnId(selectedIdx);
ColumnType columnType = metadata.getColumnType(selectedIdx);
CoreFunctionFilter columnFilter = FilterFactory.createCoreFunctionFilter(
columnId, columnType,
ColumnType.DATE.equals(columnType) ? CoreFunctionType.TIME_FRAME : CoreFunctionType.NOT_EQUALS_TO);
if (filter == null) {
filter = new DataSetFilter();
}
filter.addFilterColumn(columnFilter);
ColumnFilterEditor columnFilterEditor = beanManager.lookupBean(ColumnFilterEditor.class).newInstance();
columnFilterEditor.init(metadata, columnFilter);
columnFilterEditor.expand();
view.addColumnFilterEditor(columnFilterEditor);
view.resetSelectedColumn();
view.showNewFilterHome();
changeEvent.fire(new DataSetFilterChangedEvent(filter));
}
示例4: onSelectFilterFunction
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
public void onSelectFilterFunction() {
int selectedIdx = view.getSelectedFunctionIndex();
if (selectedIdx >= 0) {
CoreFunctionFilter coreFilter = getCoreFilter();
CoreFunctionType functionType = getAvailableFunctions(coreFilter).get(selectedIdx);
ColumnType columnType = metadata.getColumnType(coreFilter.getColumnId());
List params = FilterFactory.createParameters(columnType, functionType);
coreFilter.setType(functionType);
coreFilter.setParameters(params);
initFilterSelector();
fireFilterChanged();
if (!initFilterConfig().isEmpty()) {
view.showFilterConfig();
}
}
}
示例5: createParamInputWidget
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
protected FunctionParameterEditor createParamInputWidget(final CoreFunctionFilter coreFilter, final int paramIndex) {
final List paramList = coreFilter.getParameters();
ColumnType columnType = metadata.getColumnType(coreFilter.getColumnId());
CoreFunctionType functionType = coreFilter.getType();
boolean isMultiple = CoreFunctionType.IN.equals(functionType) || CoreFunctionType.NOT_IN.equals(functionType);
if (ColumnType.DATE.equals(columnType)) {
if (CoreFunctionType.TIME_FRAME.equals(coreFilter.getType())) {
return createTimeFrameWidget(paramList, paramIndex);
}
return createDateInputWidget(paramList, paramIndex);
}
if (!isMultiple) {
if (ColumnType.NUMBER.equals(columnType)) {
return createNumberInputWidget(paramList, paramIndex);
}
return createTextInputWidget(paramList, paramIndex);
} else {
if (ColumnType.NUMBER.equals(columnType)) {
return createMultipleNumberInputWidget(paramList);
}
return createMultipleTextInputWidget(paramList);
}
}
示例6: testUpdateFunctionsAvailable
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testUpdateFunctionsAvailable() {
GroupFunction groupFunction = new GroupFunction("column1", "column1", AggregateFunctionType.COUNT);
presenter.init(metadata, groupFunction, null, "Title", true, true);
List<AggregateFunctionType> typeListColumn1 = presenter.getSupportedFunctionTypes();
List<AggregateFunctionType> typeListLabel = presenter.getSupportedFunctionTypes(ColumnType.LABEL);
assertEquals(typeListColumn1.size(), typeListLabel.size());
verify(view).clearFunctionSelector();
verify(view, times(typeListLabel.size())).addFunctionItem(any(AggregateFunctionType.class));
reset(view);
when(view.getSelectedColumnId()).thenReturn("column2");
presenter.onColumnSelected();
List<AggregateFunctionType> typeListColumn2 = presenter.getSupportedFunctionTypes();
List<AggregateFunctionType> typeListNumber = presenter.getSupportedFunctionTypes(ColumnType.NUMBER);
assertEquals(typeListColumn2.size(), typeListNumber.size());
assertEquals(presenter.getGroupFunction().getSourceId(), "column2");
verify(view).clearFunctionSelector();
verify(view, times(typeListNumber.size())).addFunctionItem(any(AggregateFunctionType.class));
verify(changeEvent).fire(any(GroupFunctionChangedEvent.class));
}
示例7: testCreateLabelFilter
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testCreateLabelFilter() {
DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);
filterEditor.init(null, metadata);
reset(filterView);
when(filterView.getSelectedColumnIndex()).thenReturn(0);
filterEditor.onCreateFilter();
verify(changedEvent).fire(any(DataSetFilterChangedEvent.class));
DataSetFilter filter = filterEditor.getFilter();
assertNotNull(filter);
assertEquals(filter.getColumnFilterList().size(), 1);
ColumnFilter expected = FilterFactory.createCoreFunctionFilter("column1", ColumnType.LABEL, CoreFunctionType.NOT_EQUALS_TO);
assertEquals(filter.getColumnFilterList().get(0), expected);
}
示例8: testCreateDateFilter
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testCreateDateFilter() {
DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);
filterEditor.init(null, metadata);
reset(filterView);
when(filterView.getSelectedColumnIndex()).thenReturn(2);
filterEditor.onCreateFilter();
verify(changedEvent).fire(any(DataSetFilterChangedEvent.class));
DataSetFilter filter = filterEditor.getFilter();
assertNotNull(filter);
assertEquals(filter.getColumnFilterList().size(), 1);
ColumnFilter expected = FilterFactory.createCoreFunctionFilter("column3", ColumnType.DATE, CoreFunctionType.TIME_FRAME);
assertEquals(filter.getColumnFilterList().get(0), expected);
}
示例9: testNumberParam
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testNumberParam() throws Exception {
double number = 1000.23;
NumberFormat numberFormat = NumberFormat.getNumberInstance();
when(view.formatNumber(number)).thenReturn(numberFormat.format(number));
setupEditor(ColumnType.NUMBER, CoreFunctionType.EQUALS_TO, number);
int n = CoreFunctionType.getSupportedTypes(ColumnType.NUMBER).size()-1;
verify(view).clearFunctionSelector();
verify(view, times(n)).addFunctionItem(any(CoreFunctionType.class));
verify(view, never()).addFunctionItem(CoreFunctionType.TIME_FRAME);
verify(view, never()).addFunctionItem(CoreFunctionType.LIKE_TO);
verify(view).clearFilterConfig();
verify(view).addFilterConfigWidget(numberParameterEditor);
verify(view).setFunctionSelected("col = " + numberFormat.format(number));
}
示例10: testDateParam
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testDateParam() throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
String dateStr = "23-11-2020 23:59:59";
Date d = dateFormat.parse(dateStr);
when(view.formatDate(d)).thenReturn(dateStr);
setupEditor(ColumnType.DATE, CoreFunctionType.EQUALS_TO, d);
int n = CoreFunctionType.getSupportedTypes(ColumnType.DATE).size()-1;
verify(view).clearFunctionSelector();
verify(view, times(n)).addFunctionItem(any(CoreFunctionType.class));
verify(view).addFunctionItem(CoreFunctionType.TIME_FRAME);
verify(view, never()).addFunctionItem(CoreFunctionType.LIKE_TO);
verify(view).clearFilterConfig();
verify(view).addFilterConfigWidget(dateParameterEditor);
verify(view).setFunctionSelected("col = " + dateStr);
}
示例11: createDisplayerConstraints
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Override
public DisplayerConstraints createDisplayerConstraints() {
DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()
.setGroupRequired(true)
.setGroupColumn(true)
.setMinColumns(2)
.setMaxColumns(3)
.setExtraColumnsAllowed(true)
.setGroupsTitle(view.getGroupsTitle())
.setColumnsTitle(view.getColumnsTitle())
.setColumnTypes(new ColumnType[] {
ColumnType.LABEL,
ColumnType.NUMBER});
return new DisplayerConstraints(lookupConstraints)
.supportsAttribute(DisplayerAttributeDef.TYPE)
.supportsAttribute(DisplayerAttributeDef.SUBTYPE)
.supportsAttribute(DisplayerAttributeDef.RENDERER)
.supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)
.supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)
.supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)
.supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);
}
示例12: testDataPush
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Test
public void testDataPush() {
// Google renderer draw calls are processed asynchronously
// A ready() call needs to be executed in order to ignite the real chart display
GoogleBarChartDisplayer barChart = createBarChartDisplayer(byYear);
barChart.ready();
GoogleBarChartDisplayer.View view = barChart.getView();
verify(view).dataClear();
verify(view).dataAddColumn(ColumnType.LABEL, COLUMN_DATE, COLUMN_DATE);
verify(view).dataAddColumn(eq(ColumnType.NUMBER), anyString(), anyString());
verify(view).dataRowCount(4);
verify(view, times(4)).dataSetValue(anyInt(), anyInt(), anyString());
verify(view, times(4)).dataSetValue(anyInt(), anyInt(), any(Double.class));
verify(view).dataFormatNumberColumn(anyString(), eq(1));
}
示例13: createDisplayerConstraints
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Override
public DisplayerConstraints createDisplayerConstraints() {
DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()
.setGroupRequired(true)
.setGroupColumn(true)
.setMaxColumns(2)
.setMinColumns(2)
.setExtraColumnsAllowed(false)
.setGroupsTitle(getView().getGroupsTitle())
.setColumnsTitle(getView().getColumnsTitle())
.setColumnTypes(new ColumnType[] {
ColumnType.LABEL,
ColumnType.NUMBER});
return new DisplayerConstraints(lookupConstraints)
.supportsAttribute(DisplayerAttributeDef.TYPE)
.supportsAttribute(DisplayerAttributeDef.RENDERER)
.supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)
.supportsAttribute(DisplayerAttributeGroupDef.CHART_GROUP );
}
示例14: createDisplayerConstraints
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
@Override
public DisplayerConstraints createDisplayerConstraints() {
DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()
.setGroupRequired(true)
.setGroupColumn(true)
.setMaxColumns(-1)
.setMinColumns(1)
.setExtraColumnsAllowed(true)
.setGroupsTitle(view.getGroupsTitle())
.setColumnsTitle(view.getColumnsTitle())
.setColumnTypes(new ColumnType[] {
ColumnType.LABEL});
return new DisplayerConstraints(lookupConstraints)
.supportsAttribute( DisplayerAttributeDef.TYPE )
.supportsAttribute( DisplayerAttributeGroupDef.COLUMNS_GROUP )
.supportsAttribute( DisplayerAttributeGroupDef.FILTER_GROUP )
.supportsAttribute( DisplayerAttributeGroupDef.REFRESH_GROUP )
.supportsAttribute( DisplayerAttributeGroupDef.GENERAL_GROUP );
}
示例15: lookup
import org.dashbuilder.dataset.ColumnType; //导入依赖的package包/类
public IntervalBuilder lookup(ColumnType columnType, GroupStrategy strategy) {
if (ColumnType.LABEL.equals(columnType)) {
if (GroupStrategy.FIXED.equals(strategy)) return intervalBuilderDynamicLabel;
if (GroupStrategy.DYNAMIC.equals(strategy)) return intervalBuilderDynamicLabel;
}
if (ColumnType.DATE.equals(columnType)) {
if (GroupStrategy.FIXED.equals(strategy)) return intervalBuilderFixedDate;
if (GroupStrategy.DYNAMIC.equals(strategy)) return intervalBuilderDynamicDate;
return intervalBuilderDynamicDate;
}
if (ColumnType.NUMBER.equals(columnType)) {
return intervalBuilderDynamicLabel;
}
if (ColumnType.TEXT.equals(columnType)) {
throw new IllegalArgumentException( CommonConstants.INSTANCE.exc_text_columns_no_grouping());
}
return null;
}