本文整理汇总了Java中org.dashbuilder.dataset.def.DataColumnDef类的典型用法代码示例。如果您正苦于以下问题:Java DataColumnDef类的具体用法?Java DataColumnDef怎么用?Java DataColumnDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataColumnDef类属于org.dashbuilder.dataset.def包,在下文中一共展示了DataColumnDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: edit
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
private void edit(final DataSet dataset) {
if (dataset != null) {
final DataSetDef dataSetDef = workflow.getDataSetDef();
List<DataColumn> columns = dataset.getColumns();
if (columns != null && !columns.isEmpty()) {
// Obtain all data columns available from the resulting data set.
List<DataColumnDef> columnDefs = new ArrayList<>(columns.size());
for (final DataColumn column : columns) {
columnDefs.add(new DataColumnDef(column.getId(),
column.getColumnType()));
}
edit(dataSetDef,
columnDefs);
} else {
showError("Data set has no columns");
}
} else {
showError("Data set is empty.");
}
}
示例2: setValue
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
@Override
public void setValue(final DataSetDef value) {
checkAvailableColumns();
/*
This editor and sub-editors do not take care about 'allColumnsEnable' flag.
If all column flag is enabled, just add all the available column into the data set definition.
*/
if (value != null && value.isAllColumnsEnabled()) {
final List<DataColumnDef> columns = new ArrayList<DataColumnDef>(acceptableValues.size());
for (final DataColumnDef columnDef : acceptableValues) {
columns.add(columnDef.clone());
}
value.setColumns(columns);
value.setAllColumnsEnabled(false);
}
// Columns edition depends on the data set provider type.
columnListEditor.setProviderType( value != null ? value.getProvider() : null);
}
示例3: create
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
@Override
public DataColumnDefEditor create(final int index) {
final DataColumnDef column = listEditor.getList().get(index);
final int localIndex = acceptableColumns.indexOf(column);
// Check single column used in data set -> it cannot be unselected.
if (!checkSingleColumnEditorDisabled()) {
// Enable column selection if more than one column remains on the data set.
checkMultipleColumnsEditorEnabled();
}
// Create the new editor.
final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createColumnEditor();
final boolean hasSingleColumn = listEditor.getList().size() == 1;
final boolean isRestricted = restrictedColumns.contains(column.getId());
final String tooltipText = hasSingleColumn ? DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn()
: ( isRestricted ? DataSetEditorConstants.INSTANCE.columnIsUsedInFilter() : null );
doSetOriginalColumnType(column.getId(), editor);
replace(localIndex, editor, true, !isRestricted && !hasSingleColumn, tooltipText);
return editor;
}
示例4: dispose
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
@Override
public void dispose(DataColumnDefEditor subEditor) {
// Column to be removed.
final String columnId = subEditor.id().getValue();
final int localIndex = getAvailableColumnIndex(columnId);
if (localIndex > -1) {
final DataColumnDef column = acceptableColumns.get(localIndex);
// Dispose and remove sub-editor.
super.dispose(subEditor);
subEditor.removeFromParent();
// Create a new dummy editor for the available column.
final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createDummyColumnEditor(column);
replace(localIndex, editor, false, true, null);
// Disable column selection if only one column remains on the data set.
checkSingleColumnEditorDisabled();
}
}
示例5: testOnValueUnRestricted
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/**
* Column editor editMode set to true, as more than one column present in the dset definition, so it can be selected/unselected.
*/
@Test
public void testOnValueUnRestricted() {
final String value = "col1";
presenter.restrictedColumns.add("col1");
final DataColumnDef col2 = mock(DataColumnDef.class);
when(col2.getId()).thenReturn("col2");
when(col2.getColumnType()).thenReturn(ColumnType.LABEL);
presenter.listEditor.getList().add(col2);
presenter.onValueUnRestricted(value);
assertTrue(presenter.restrictedColumns.isEmpty());
verify(dataColumnDefEditor, times(1)).isEditMode(true);
verify(view, times(1)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());
verify(view, times(1)).remove(anyInt());
verify(view, times(0)).init(presenter);
verify(view, times(0)).clear();
}
示例6: testDataColumnDefEditorSource_CreateMultiple
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/**
* Column editor created with editMode set to true, as more than one column present in the dset definition. First column enabled too, as it was disabled as was the unique one before this creation.
*/
@Test
public void testDataColumnDefEditorSource_CreateMultiple() {
final DataColumnDef col2 = mock(DataColumnDef.class);
when(col2.getId()).thenReturn("col2");
when(col2.getColumnType()).thenReturn(ColumnType.LABEL);
presenter.acceptableColumns.add(col2);
presenter.listEditor.getList().add(col2);
presenter.restrictedColumns.clear();
ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();
org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);
verify(dataColumnDefEditor, times(2)).isEditMode(true);
verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));
verify(dataColumnDefEditor, times(1)).setProviderType(any(DataSetProviderType.class));
verify(view, times(2)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());
verify(view, times(2)).remove(anyInt());
verify(view, times(0)).init(presenter);
verify(view, times(0)).clear();
}
示例7: testDataColumnDefEditorSource_Create_DASHBUILDE79_A
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/**
* See https://issues.jboss.org/browse/DASHBUILDE-79
*/
@Test
public void testDataColumnDefEditorSource_Create_DASHBUILDE79_A() {
final DataColumnDef col2 = mock(DataColumnDef.class);
when(col2.getId()).thenReturn("col2");
when(col2.getColumnType()).thenReturn(ColumnType.LABEL);
presenter.acceptableColumns.add(col2);
presenter.listEditor.getList().add(col2);
presenter.listEditor.getEditors().clear();
presenter.restrictedColumns.clear();
ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();
org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);
verify(dataColumnDefEditor, times(1)).isEditMode(true);
verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));
verify(dataColumnDefEditor, times(1)).setProviderType(any(DataSetProviderType.class));
verify(view, times(1)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());
verify(view, times(1)).remove(anyInt());
verify(view, times(0)).init(presenter);
verify(view, times(0)).clear();
}
示例8: testDataColumnDefEditorSource_Create_DASHBUILDE79_B
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/**
* See https://issues.jboss.org/browse/DASHBUILDE-79 (re-opened)
*/
@Test
public void testDataColumnDefEditorSource_Create_DASHBUILDE79_B() {
final DataColumnDef col2 = mock(DataColumnDef.class);
when(col2.getId()).thenReturn("col2");
when(col2.getColumnType()).thenReturn(ColumnType.LABEL);
presenter.acceptableColumns.add(col2);
presenter.listEditor.getList().clear();
presenter.listEditor.getList().add(col2);
presenter.listEditor.getEditors().clear();
presenter.restrictedColumns.clear();
ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();
org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);
verify(dataColumnDefEditor, times(1)).isEditMode(false);
verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));
verify(dataColumnDefEditor, times(1)).setProviderType(any(DataSetProviderType.class));
verify(view, times(1)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());
verify(view, times(1)).remove(anyInt());
verify(view, times(0)).init(presenter);
verify(view, times(0)).clear();
}
示例9: load
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
protected void load(final DataSetDef dataSetDef,
List<DataColumnDef> columns) {
if (dataSetDef == null) {
view.hideBusyIndicator();
showError(DataSetAuthoringConstants.INSTANCE.dataSetNotFound());
} else {
changeTitleNotification.fire(new ChangeTitleWidgetEvent(place,
buildTitle()));
view.hideBusyIndicator();
edit(dataSetDef,
columns);
}
}
示例10: completeEdition
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
public void completeEdition(final DataSetDef dataSetDef,
final DataSet dataset) {
if (dataset != null) {
this.nextCommand = this::save;
List<DataColumn> columns = dataset.getColumns();
if (columns != null && !columns.isEmpty()) {
// Obtain all data columns available from the resulting data set.
List<DataColumnDef> columnDefs = new ArrayList<>(columns.size());
for (final DataColumn column : columns) {
columnDefs.add(new DataColumnDef(column.getId(),
column.getColumnType()));
}
// Delegate edition to the dataSetEditWorkflow.
final DataSetProviderType type = dataSetDef.getProvider() != null ? dataSetDef.getProvider() : null;
final DataSetEditWorkflow editWorkflow = workflowFactory.edit(type);
setCurrentWorkflow(editWorkflow);
editWorkflow.edit(dataSetDef,
columnDefs)
.showPreviewTab()
.showBackButton()
.showNextButton();
} else {
showError("Data set has no columns");
}
} else {
showError("Data set is empty.");
}
}
示例11: setAcceptableValues
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/**
* Set all data set available columns (not only the current used ones)
*
* @param acceptableValues Acceptable values for the editor.
*/
@Override
public void setAcceptableValues(final List<DataColumnDef> acceptableValues) {
clear();
// Register column editor for each available column of the data set.
this.acceptableColumns = new LinkedList<DataColumnDef>(acceptableValues);
int index = 0;
for (final DataColumnDef columnDef : this.acceptableColumns ) {
org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createDummyColumnEditor(columnDef);
view.insert(index, editor.view, false, true, null);
index++;
}
}
示例12: onColumnSelect
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
/*************************************************************
** VIEW CALLBACK METHODS **
*************************************************************/
void onColumnSelect(final int index, final boolean selected) {
final DataColumnDef columnDef = acceptableColumns.get(index);
if (selected) {
listEditor.getList().add(columnDef.clone());
} else {
listEditor.getList().remove(columnDef);
}
columnsChangedEvent.fire(new ColumnsChangedEvent(this, listEditor.getList()));
}
示例13: getAvailableColumnIndex
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
private int getAvailableColumnIndex(final String id) {
int x = 0;
for (final DataColumnDef column : acceptableColumns) {
if (column.getId().equals(id)) return x;
x++;
}
return -1;
}
示例14: doSetOriginalColumnType
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
private void doSetOriginalColumnType(final String cId, final DataColumnDefEditor editor) {
final int _index = getAvailableColumnIndex(cId);
final DataColumnDef originalCol = acceptableColumns.get(_index);
if (originalCol != null) {
editor.setOriginalColumnType(originalCol.getColumnType());
}
}
示例15: setValue
import org.dashbuilder.dataset.def.DataColumnDef; //导入依赖的package包/类
@Override
public void setValue(final DataColumnDef value) {
final ColumnType ct = originalColumnType != null ? originalColumnType : (value != null ? value.getColumnType() : null);
String columnTypeDescr = getColumnTypeDescription(ct);
final Collection<ImageListEditor<ColumnType>.Entry> acceptableEntries = getAcceptableEntries(ct);
columnType.setEntries(acceptableEntries);
columnType.setHelpContent(DataSetEditorConstants.INSTANCE.attributeColumnType(),
columnTypeDescr,
Placement.RIGHT);
}