當前位置: 首頁>>代碼示例>>Java>>正文


Java TableDisplayerSettingsBuilder.buildSettings方法代碼示例

本文整理匯總了Java中org.dashbuilder.displayer.TableDisplayerSettingsBuilder.buildSettings方法的典型用法代碼示例。如果您正苦於以下問題:Java TableDisplayerSettingsBuilder.buildSettings方法的具體用法?Java TableDisplayerSettingsBuilder.buildSettings怎麽用?Java TableDisplayerSettingsBuilder.buildSettings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.dashbuilder.displayer.TableDisplayerSettingsBuilder的用法示例。


在下文中一共展示了TableDisplayerSettingsBuilder.buildSettings方法的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.buildSettings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。