本文整理匯總了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;
}