本文整理汇总了Java中org.dashbuilder.dataset.group.GroupFunction类的典型用法代码示例。如果您正苦于以下问题:Java GroupFunction类的具体用法?Java GroupFunction怎么用?Java GroupFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GroupFunction类属于org.dashbuilder.dataset.group包,在下文中一共展示了GroupFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAddColumn
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
void onAddColumn() {
if (lookupConstraints.areExtraColumnsAllowed()) {
DataSetGroup op = getFirstGroupOp();
List<GroupFunction> functionList = op.getGroupFunctions();
GroupFunction last = functionList.get(functionList.size() - 1);
GroupFunction clone = last.cloneInstance();
String newColumnId = lookupConstraints.buildUniqueColumnId(dataSetLookup,
clone);
clone.setColumnId(newColumnId);
functionList.add(clone);
updateColumnControls();
changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));
}
}
示例2: getExistingDataColumnIds
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
List<String> getExistingDataColumnIds() {
DataSet dataSet = displayerSettings.getDataSet();
DataSetLookup dataSetLookup = displayerSettings.getDataSetLookup();
List<String> columnIds = new ArrayList<String>();
if (dataSet != null) {
for (DataColumn dataColumn : dataSet.getColumns()) {
columnIds.add(dataColumn.getId());
}
}
else if (dataSetLookup != null) {
int idx = dataSetLookup.getLastGroupOpIndex(0);
if (idx != -1) {
DataSetGroup groupOp = dataSetLookup.getOperation(idx);
for (GroupFunction groupFunction : groupOp.getGroupFunctions()) {
columnIds.add(groupFunction.getColumnId());
}
}
}
return columnIds;
}
示例3: init
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的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);
}
}
示例4: testViewInitialization
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
@Test
public void testViewInitialization() {
GroupFunction groupFunction = new GroupFunction("column1", "column1", null);
presenter.init(metadata, groupFunction, null, "Title", false, false);
verify(view).setDeleteOptionEnabled(false);
verify(view, never()).setDeleteOptionEnabled(true);
verify(view).setColumnSelectorTitle("Title");
verify(view).clearColumnSelector();
verify(view, times(3)).addColumnItem(anyString());
verify(view).setSelectedColumnIndex(0);
verify(view).setFunctionSelectorEnabled(false);
verify(view, never()).setFunctionSelectorEnabled(true);
}
示例5: testUpdateFunctionsAvailable
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的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));
}
示例6: testDeleteColumns
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
@Test
public void testDeleteColumns() {
DataSetLookup lookup = DataSetLookupFactory.newDataSetLookupBuilder()
.dataset(POPULATION_UUID)
.column("year")
.column("population")
.buildLookup();
GroupFunction year = lookup.getLastGroupOp().getGroupFunction("year");
presenter.init(DATA_MULTIPLE, lookup);
reset(view);
presenter.onColumnFunctionDeleted(new GroupFunctionDeletedEvent(year));
verify(view).clearColumnList();
verify(view, times(1)).addColumnEditor(any(ColumnFunctionEditor.class));
verify(event).fire(any(DataSetLookupChangedEvent.class));
}
示例7: verifySettings
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
private void verifySettings(DisplayerSettings settings) {
assertEquals(DATASOURCE_UUID + SEPARATOR + SCHEMA + SEPARATOR + TABLE,
settings.getDataSetLookup().getDataSetUUID());
assertEquals(TABLE,
settings.getTitle());
assertEquals(true,
settings.isTitleVisible());
assertEquals(20,
settings.getTablePageSize());
assertEquals(true,
settings.isTableSortEnabled());
assertEquals(1,
settings.getDataSetLookup().getOperationList().size());
DataSetGroup dataSetOp = (DataSetGroup) settings.getDataSetLookup().getOperationList().get(0);
List<GroupFunction> groupFunctions = dataSetOp.getGroupFunctions();
assertEquals(COLUMNS_COUNT,
groupFunctions.size());
for (int i = 0; i < groupFunctions.size(); i++) {
assertEquals(DATA_COLUMN + String.valueOf(i),
groupFunctions.get(i).getColumnId());
}
assertEquals(COLUMN_WIDTH * COLUMNS_COUNT,
settings.getTableWidth());
}
示例8: format
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
public T format(String name, String pattern) {
DataSetOp op = getCurrentOp();
if (op == null || !(op instanceof DataSetGroup)) {
throw new RuntimeException("column(...) must be called first.");
}
DataSetGroup gOp = (DataSetGroup) getCurrentOp();
List<GroupFunction> columns = gOp.getGroupFunctions();
if (columns.isEmpty()) {
throw new RuntimeException("column(...) must be called first.");
}
GroupFunction lastColumn = columns.get(columns.size() - 1);
return format(lastColumn.getColumnId(), name, pattern);
}
示例9: getFirstGroupFunctions
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
public List<GroupFunction> getFirstGroupFunctions() {
List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);
if (groupOpList.isEmpty()) {
return null;
}
return groupOpList.get(0).getGroupFunctions();
}
示例10: getFirstGroupFunctionIdx
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
public int getFirstGroupFunctionIdx(GroupFunction gf) {
List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);
if (groupOpList.isEmpty()) {
return -1;
}
return groupOpList.get(0).getGroupFunctionIdx(gf);
}
示例11: getGroupFunctionLastIdx
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
int getGroupFunctionLastIdx(List<GroupFunction> groupFunctions,
String sourceId) {
int last = -1;
for (GroupFunction gf : groupFunctions) {
if (gf.getSourceId().equals(sourceId)) {
int idx = getGroupFunctionColumnIdx(gf.getColumnId());
if (last == -1 || last < idx) {
last = idx;
}
}
}
return last;
}
示例12: onColumnFunctionChanged
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
void onColumnFunctionChanged(@Observes GroupFunctionChangedEvent event) {
GroupFunction gf = event.getGroupFunction();
String newColumnId = lookupConstraints.buildUniqueColumnId(dataSetLookup,
gf);
gf.setColumnId(newColumnId);
changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));
}
示例13: onColumnFunctionDeleted
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
void onColumnFunctionDeleted(@Observes GroupFunctionDeletedEvent event) {
List<GroupFunction> functionList = getFirstGroupFunctions();
boolean canDelete = functionList.size() > lookupConstraints.getMinColumns();
GroupFunction removed = event.getGroupFunction();
int index = getFirstGroupFunctionIdx(removed);
if (canDelete && index >= 0) {
functionList.remove(index);
updateColumnControls();
changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));
}
}
示例14: init
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
public void init(DataSetMetadata metadata, GroupFunction groupFunction) {
this.column = groupFunction;
this.metadata = metadata;
if (StringUtils.isBlank(column.getColumnId())) {
view.setColumnId(column.getSourceId());
}
else {
view.setColumnId(column.getColumnId());
}
}
示例15: testLabelTarget
import org.dashbuilder.dataset.group.GroupFunction; //导入依赖的package包/类
@Test
public void testLabelTarget() {
GroupFunction groupFunction = new GroupFunction("column1", "column1", null);
presenter.init(metadata, groupFunction, ColumnType.LABEL, "Title", true, true);
verify(view).clearColumnSelector();
verify(view, times(1)).addColumnItem(anyString());
verify(view).setSelectedColumnIndex(0);
verify(view).setFunctionSelectorEnabled(false);
verify(view, never()).setFunctionSelectorEnabled(true);
}