本文整理汇总了Java中org.dashbuilder.displayer.DisplayerSettings.setDataSet方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayerSettings.setDataSet方法的具体用法?Java DisplayerSettings.setDataSet怎么用?Java DisplayerSettings.setDataSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dashbuilder.displayer.DisplayerSettings
的用法示例。
在下文中一共展示了DisplayerSettings.setDataSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromJsonString
import org.dashbuilder.displayer.DisplayerSettings; //导入方法依赖的package包/类
public DisplayerSettings fromJsonString( String jsonString ) {
DisplayerSettings ds = new DisplayerSettings();
if (!isBlank(jsonString)) {
JsonObject parseResult = Json.parse(jsonString);
if ( parseResult != null ) {
// UUID
ds.setUUID(parseResult.getString(SETTINGS_UUID));
parseResult.put(SETTINGS_UUID, (String) null);
// First look if a dataset 'on-the-fly' has been specified
JsonObject data = parseResult.getObject(DATASET_PREFIX);
if (data != null) {
DataSet dataSet = dataSetJsonMarshaller.fromJson(data);
ds.setDataSet(dataSet);
// Remove from the json input so that it doesn't end up in the settings map.
parseResult.put(DATASET_PREFIX, (JsonValue) null);
// If none was found, look for a dataset lookup definition
} else if ((data = parseResult.getObject(DATASET_LOOKUP_PREFIX)) != null) {
DataSetLookup dataSetLookup = dataSetLookupJsonMarshaller.fromJson(data);
ds.setDataSetLookup(dataSetLookup);
// Remove from the json input so that it doesn't end up in the settings map.
parseResult.put(DATASET_LOOKUP_PREFIX, (JsonValue) null);
}
else {
throw new RuntimeException("Displayer settings dataset lookup not specified");
}
// Parse the columns settings
JsonArray columns = parseResult.getArray(COLUMNS_PREFIX);
if (columns != null) {
List<ColumnSettings> columnSettingsList = parseColumnsFromJson(columns);
ds.setColumnSettingsList(columnSettingsList);
// Remove from the json input so that it doesn't end up in the settings map.
parseResult.put(COLUMNS_PREFIX, (JsonValue) null);
}
// Now parse all other settings
ds.setSettingsFlatMap( parseSettingsFromJson(parseResult));
}
}
return ds;
}