本文整理汇总了Java中org.apache.tapestry5.json.JSONArray类的典型用法代码示例。如果您正苦于以下问题:Java JSONArray类的具体用法?Java JSONArray怎么用?Java JSONArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSONArray类属于org.apache.tapestry5.json包,在下文中一共展示了JSONArray类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendToLog
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JavaScriptCallback appendToLog(List<String> text) {
return new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
javaScriptSupport.require("appendconsole").with(escape(svdrpCommand), "svdrpconsole", "svdrpinput",
JSONArray.from(text));
}
};
}
示例2: openStream
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
@Override
public InputStream openStream() throws IOException {
Vector<InputStream> v = new Vector<InputStream>(3);
// https://github.com/jrburke/requirejs/issues/1476
try (InputStream is = resource.openStream(); Scanner scanner = new Scanner(is, "utf-8")) {
scanner.useDelimiter(STARTOFINPUT);
String content = scanner.next();
Pattern pattern = Pattern.compile("(?<=require\\()(['\"])(.*?)(?:\\.js)?\\1(?=\\))");
Matcher matcher = pattern.matcher(content);
JSONArray dependencies = new JSONArray("require", "exports", "module");
StringBuffer sb = new StringBuffer(content.length());
while (matcher.find()) {
String module = matcher.group(2);
// rewrite require('module.js') to require('module')
matcher.appendReplacement(sb, "$1$2$1");
dependencies.put(module);
}
matcher.appendTail(sb);
content = sb.toString();
InputStream leaderStream = toInputStream(
"define(" + dependencies.toCompactString() + ", function(require, exports, module) {\n");
InputStream trailerStream = toInputStream("\n});");
v.add(leaderStream);
v.add(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)));
v.add(trailerStream);
}
return new SequenceInputStream(v.elements());
}
示例3: getData
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JSONArray getData(){
return
new JSONArray(
new JSONArray(0.1, 0.2, 0.3, 0.4),
new JSONArray(0.2, 0.3, 0.4, 0.5),
new JSONArray(0.3, 0.4, 0.5, 0.6),
new JSONArray(0.4, 0.5, 0.6, 0.7),
new JSONArray(0.5, 0.6, 0.7, 0.8)
);
}
示例4: getData
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JSONArray getData(){
JSONObject o1= new JSONObject();
o1.put("label", "one");
o1.put("value", 20.0);
JSONObject o2= new JSONObject();
o2.put("label", "two");
o2.put("value", 50.0);
JSONObject o3= new JSONObject();
o3.put("label", "three");
o3.put("value", 30.0);
return new JSONArray(o1, o2, o3);
}
示例5: provideValues
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
@PublishEvent
@OnEvent("providevalues")
Object provideValues() {
return new JSONObject("values", new JSONArray(new JSONObject("value", "one", "label", "One"),
new JSONObject("value", "two", "label", "Two"), new JSONObject("value", "three", "label", "Three")));
}
示例6: getData
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JSONArray getData(){
return this.data;
}
示例7: getData
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JSONArray getData(){
return new JSONArray(
25, 7, 5, 26, 11, 8, 25, 14, 23, 19,
14, 11, 22, 29, 11, 13, 12, 17, 18, 10,
24, 18, 25, 9, 3);
}
示例8: onReturnStreamResponse
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
@OnEvent(value="phones")
JSONArray onReturnStreamResponse() {
String phones= catalog.getPhonesAsString();
return new JSONArray(phones);
}
示例9: getOptions
import org.apache.tapestry5.json.JSONArray; //导入依赖的package包/类
public JSONObject getOptions() {
return new JSONObject("lang", locale.getLanguage()).put("containersItems",
new JSONArray().put(new JSONObject("name", "article", "title", "Article", "css", "wym_containers_article")));
}