本文整理匯總了Java中org.dashbuilder.displayer.TableDisplayerSettingsBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java TableDisplayerSettingsBuilder類的具體用法?Java TableDisplayerSettingsBuilder怎麽用?Java TableDisplayerSettingsBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TableDisplayerSettingsBuilder類屬於org.dashbuilder.displayer包,在下文中一共展示了TableDisplayerSettingsBuilder類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: show
import org.dashbuilder.displayer.TableDisplayerSettingsBuilder; //導入依賴的package包/類
public void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
final DisplayerListener displayerListener) {
clear();
if (dataSetDef != null) {
// Build the table displayer settings.
final TableDisplayerSettingsBuilder settingsBuilder = DisplayerSettingsFactory.newTableSettings()
.dataset(dataSetDef.getUUID())
.renderer(DefaultRenderer.UUID)
.titleVisible(false)
.tablePageSize(6)
.tableOrderEnabled(true)
.filterOn(true, false, false);
// Make only the specified columns visible (if null then show all)
if (columns != null && !columns.isEmpty()) {
for (final DataColumnDef column : columns) {
settingsBuilder.column(column.getId());
}
}
// Disable backend cache for preview.
DataSetDef editCloneWithoutCacheSettings = dataSetDef.clone();
editCloneWithoutCacheSettings.setCacheEnabled(false);
// Close the current displayer (if any)
if (tableDisplayer != null) {
tableDisplayer.close();
}
// Configure the table displayer and the data set handler for edition.
DisplayerSettings settings = settingsBuilder.buildSettings();
tableDisplayer = displayerLocator.lookupDisplayer(settings);
tableDisplayer.setDataSetHandler(new DataSetEditHandler(clientServices, settings.getDataSetLookup(), editCloneWithoutCacheSettings));
// For CSV datasets, make sure dates & numbers are displayed as defined in the CSV configuration
if (dataSetDef instanceof CSVDataSetDef) {
CSVDataSetDef csvDataSetDef = (CSVDataSetDef) dataSetDef;
tableDisplayer.addListener(new AbstractDisplayerListener() {
// The column settings are set right after the data set load, once the dataset columns are known
@Override
public void onDataLoaded(Displayer displayer) {
configureColumnSettings(displayer, csvDataSetDef);
}
});
}
// Draw the table
draw(displayerListener);
}
}
示例2: getDisplayerSettings
import org.dashbuilder.displayer.TableDisplayerSettingsBuilder; //導入依賴的package包/類
@Override
public DisplayerSettings getDisplayerSettings(String dataSourceUuid,
String schema,
String table) {
checkNotNull("dataSourceUuid",
dataSourceUuid);
checkNotNull("table",
table);
try {
DataSourceDeploymentInfo deploymentInfo = dataSourceRuntimeManager.getDataSourceDeploymentInfo(dataSourceUuid);
DataSetDef dataSetDef = DataSetDefBuilder.newBuilder()
.dataSetUuid(buildDataSetUuid(dataSourceUuid,
schema,
table))
.dataSetName(buildDataSetName(schema,
table))
.dataSourceUuid(deploymentInfo.getUuid())
.schema(schema)
.table(buildDataSetTableName(dataSourceUuid,
table))
.isPublic(false)
.build();
dataSetDefRegistry.registerDataSetDef(dataSetDef);
DataSetLookup lookup = new DataSetLookup();
lookup.setDataSetUUID(dataSetDef.getUUID());
DataSet dataSet = dataSetManager.lookupDataSet(lookup);
TableDisplayerSettingsBuilder settingsBuilder = DisplayerSettingsFactory.newTableSettings()
.dataset(dataSetDef.getUUID())
.title(table)
.titleVisible(true)
.tablePageSize(20)
.tableOrderEnabled(true);
List<DataColumn> columns = dataSet.getColumns();
for (DataColumn column : columns) {
settingsBuilder.column(column.getId());
}
int tableWith = columns.size() * COLUMN_WIDTH;
settingsBuilder.tableWidth(tableWith);
settingsBuilder.renderer(DefaultRenderer.UUID);
return settingsBuilder.buildSettings();
} catch (Exception e) {
throw new GenericPortableException(e.getMessage());
}
}