当前位置: 首页>>代码示例>>Java>>正文


Java TableDisplayerSettingsBuilder类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:54,代码来源:DataSetDefPreviewTable.java

示例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());
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:49,代码来源:DataManagementServiceImpl.java


注:本文中的org.dashbuilder.displayer.TableDisplayerSettingsBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。