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


Java DataSetDef.clone方法代码示例

本文整理汇总了Java中org.dashbuilder.dataset.def.DataSetDef.clone方法的典型用法代码示例。如果您正苦于以下问题:Java DataSetDef.clone方法的具体用法?Java DataSetDef.clone怎么用?Java DataSetDef.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dashbuilder.dataset.def.DataSetDef的用法示例。


在下文中一共展示了DataSetDef.clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: show

import org.dashbuilder.dataset.def.DataSetDef; //导入方法依赖的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: copyDataSetDef

import org.dashbuilder.dataset.def.DataSetDef; //导入方法依赖的package包/类
public DataSetDef copyDataSetDef(DataSetDef def,
                                 String newName,
                                 String subjectId,
                                 String message) {
    DataSetDef clone = def.clone();
    clone.setUUID(uuidGenerator.newUuid());
    clone.setName(newName);

    if (subjectId == null || message == null) {
        ioService.startBatch(fileSystem);
    } else {
        ioService.startBatch(fileSystem,
                             new CommentedOption(subjectId,
                                                 message));
    }
    try {
        // CSV specific
        if (def instanceof CSVDataSetDef) {
            CSVDataSetDef csvDef = (CSVDataSetDef) def;
            CSVDataSetDef csvCloneDef = (CSVDataSetDef) clone;
            Path csvPath = resolveCsvPath(csvDef);
            Path cloneCsvPath = resolveCsvPath(csvCloneDef);
            ioService.copy(csvPath,
                           cloneCsvPath);
            csvCloneDef.setFilePath(convert(cloneCsvPath).toURI());
        }
        String defJson = getDataSetDefJsonMarshaller().toJsonString(clone);
        Path clonePath = resolveNioPath(clone);
        ioService.write(clonePath,
                        defJson);

        super.registerDataSetDef(clone,
                                 subjectId,
                                 message);
        return clone;
    } catch (Exception e) {
        throw exceptionManager.handleException(
                new Exception("Can't register the data set definition\n" + def,
                              e));
    } finally {
        ioService.endBatch();
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:44,代码来源:DataSetDefRegistryCDI.java

示例3: load

import org.dashbuilder.dataset.def.DataSetDef; //导入方法依赖的package包/类
@Override
public EditDataSetDef load(Path path) {
    try {
        DataSetDef def = dataSetDefRegistry.loadDataSetDef(path);
        if (def == null) {
            return null;
        }

        // Clone the definition
        DataSetDef cloned = def.clone();

        // Enable all columns and set columns to null, force to obtain metadata with all original columns
        // and all original column types.
        boolean clonedAllColumns = cloned.isAllColumnsEnabled();
        List<DataColumnDef> clonedColumns = cloned.getColumns();
        cloned.setAllColumnsEnabled(true);
        cloned.setColumns(null);

        // Obtain all original columns and all original column types.
        DataSetMetadata _cd = dataSetManager.resolveProvider(cloned)
                .getDataSetMetadata(cloned);

        // Return the list of original columns and its types.
        List<DataColumnDef> columns = new ArrayList<DataColumnDef>();
        if (_cd.getNumberOfColumns() > 0) {
            for (int x = 0; x < _cd.getNumberOfColumns(); x++) {
                String cId = _cd.getColumnId(x);
                ColumnType cType = _cd.getColumnType(x);
                DataColumnDef cdef = new DataColumnDef(cId, cType);
                columns.add(cdef);
            }
        }

        // Set columns attributes as initially were.
        cloned.setAllColumnsEnabled(clonedAllColumns);
        cloned.setColumns(clonedColumns);
        return new EditDataSetDef(cloned, columns);

    } catch (Exception e) {
        throw exceptionManager.handleException(e);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:43,代码来源:DataSetDefVfsServicesImpl.java


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