• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Chunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.x5.template.Chunk的典型用法代码示例。如果您正苦于以下问题:Java Chunk类的具体用法?Java Chunk怎么用?Java Chunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Chunk类属于com.x5.template包,在下文中一共展示了Chunk类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderMergedOutputModel

import com.x5.template.Chunk; //导入依赖的package包/类
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
    Resource templateFile = getApplicationContext().getResource(getUrl());

    String rcKey = getRequestContextAttribute();
    RequestContext rc = (RequestContext)model.get(rcKey);

    Theme theme = getTheme(templateFile.getFile().getParent());
    Chunk chunk = theme.makeChunk(getBeanName());
    chunk.setLocale(rc.getLocale());
    chunk.setMultiple(model);
    chunk.set(rcKey, mapifyRequestContext(rc, request));

    PrintWriter writer = response.getWriter();
    chunk.render(writer);
    writer.flush();
    writer.close();
}
 
开发者ID:tomj74,项目名称:chunk-springmvc,代码行数:21,代码来源:ChunkTemplateView.java


示例2: getChunk

import com.x5.template.Chunk; //导入依赖的package包/类
private Chunk getChunk() {
    String TEMPLATE_KATEX = "katex";
    String TEMPLATE_MATHJAX = "mathjax";
    String template = TEMPLATE_KATEX;
    AndroidTemplates loader = new AndroidTemplates(getContext());
    switch (mEngine) {
        case Engine.KATEX: template = TEMPLATE_KATEX; break;
        case Engine.MATHJAX: template = TEMPLATE_MATHJAX; break;
    }

    return new Theme(loader).makeChunk(template);
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:13,代码来源:MathView.java


示例3: setText

import com.x5.template.Chunk; //导入依赖的package包/类
public void setText(String text) {
    mText = text;
    Chunk chunk = getChunk();

    String TAG_FORMULA = "formula";
    chunk.set(TAG_FORMULA, mText);
    this.loadDataWithBaseURL(null, chunk.toString(), "text/html", "utf-8", "about:blank");
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:9,代码来源:MathView.java


示例4: onExchange

import com.x5.template.Chunk; //导入依赖的package包/类
@Override
protected void onExchange(Exchange exchange) throws Exception {
    boolean fromTemplate;
    String newResourceUri = exchange.getIn().getHeader(CHUNK_RESOURCE_URI, String.class);
    if (newResourceUri == null) {
        String newTemplate = exchange.getIn().getHeader(CHUNK_TEMPLATE, String.class);
        Chunk newChunk;
        if (newTemplate == null) {
            fromTemplate = false;
            newChunk = getOrCreateChunk(theme, fromTemplate);
        } else {
            fromTemplate = true;
            newChunk = createChunk(new StringReader(newTemplate), theme, fromTemplate);
            exchange.getIn().removeHeader(CHUNK_TEMPLATE);
        }

        // Execute Chunk
        Map<String, Object> variableMap = ExchangeHelper.createVariableMap(exchange);
        StringWriter writer = new StringWriter();
        newChunk.putAll(variableMap);
        newChunk.render(writer);
        writer.flush();

        // Fill out message
        Message out = exchange.getOut();
        out.setBody(newChunk.toString());
        out.setHeaders(exchange.getIn().getHeaders());
        out.setAttachments(exchange.getIn().getAttachments());
    } else {
        exchange.getIn().removeHeader(ChunkConstants.CHUNK_RESOURCE_URI);
        ChunkEndpoint newEndpoint = getCamelContext().getEndpoint(CHUNK_ENDPOINT_URI_PREFIX + newResourceUri, ChunkEndpoint.class);
        newEndpoint.onExchange(exchange);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:ChunkEndpoint.java


示例5: transformText

import com.x5.template.Chunk; //导入依赖的package包/类
@Override
public String transformText(final Chunk chunk, final String text, final FilterArgs args) {
    try {
        final long fileSize = Long.parseLong(text);
        return Formatter.formatShortFileSize(mContext, fileSize);
    } catch (final NumberFormatException e) {
        return text;
    }
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:10,代码来源:ChunkTheme.java


示例6: renderIndex

import com.x5.template.Chunk; //导入依赖的package包/类
public String renderIndex(final LogFiles logFiles, final PidDatabase database) {
    final List<HashMap<String, String>> processes = database.runningProcesses();
    final Chunk chunk = mTheme.makeChunk("index");

    final TreeMultimap<Long, File> files = logFiles.list();

    final ArrayList<HashMap<String, String>> encodedFiles = new ArrayList<>(files.size());
    long totalSize = 0;
    for (final File file : files.values()) {
        final HashMap<String, String> content = new HashMap<>(5);
        final long fileSize = file.length();
        final String name = file.getName();
        final int pid = database.findPid(name);

        content.put("file_name", name);
        content.put("last_modified", String.valueOf(file.lastModified()));
        content.put("file_size", String.valueOf(fileSize));
        if (pid != -1) {
            content.put("pid", String.valueOf(pid));
            content.put("process_name", database.getProcessName(pid));
        }

        encodedFiles.add(content);
        totalSize += fileSize;
    }

    chunk.set("files", encodedFiles);
    chunk.set("total_size", String.valueOf(totalSize));
    chunk.set("processes", processes);

    return chunk.toString();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:33,代码来源:ChunkRenderer.java


示例7: renderSettings

import com.x5.template.Chunk; //导入依赖的package包/类
public String renderSettings(final Preferences preferences) {
    final Chunk chunk = mTheme.makeChunk("settings");
    chunk.put("filter", preferences.getFilter().pattern());
    chunk.put("filesize", String.valueOf(preferences.getPurgeFilesize()));
    chunk.put("date", String.valueOf(preferences.getPurgeDuration()));
    chunk.put("show_indicator", String.valueOf(preferences.shouldShowIndicator()));
    chunk.put("split_size", String.valueOf(preferences.getSplitSize()));
    chunk.put("run_on_boot", String.valueOf(preferences.shouldRunOnBoot()));
    return chunk.toString();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:11,代码来源:ChunkRenderer.java


示例8: renderFilterSettings

import com.x5.template.Chunk; //导入依赖的package包/类
public String renderFilterSettings(final Preferences preferences) {
    final Chunk chunk = mTheme.makeChunk("filters");
    chunk.put("filter", preferences.getFilter().pattern());
    chunk.put("log_filter", preferences.getRawLogFilter());
    if (preferences.hasDefaultLogFilter()) {
        chunk.put("log_filter_use_default", "true");
    }
    return chunk.toString();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:10,代码来源:ChunkRenderer.java


示例9: renderSettingsError

import com.x5.template.Chunk; //导入依赖的package包/类
public String renderSettingsError(final String source, final String title, final Throwable e) {
    final Chunk chunk = mTheme.makeChunk("settings_error");
    chunk.put("title", title);
    chunk.put("source", source);
    if (e != null) {
        chunk.put("message", e.getLocalizedMessage());
    }
    return chunk.toString();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:10,代码来源:ChunkRenderer.java


示例10: buildChunk

import com.x5.template.Chunk; //导入依赖的package包/类
private Chunk buildChunk()
{
    Chunk chunk = theme.makeChunk();
    chunk.append(templateContent);

    return chunk;
}
 
开发者ID:furti,项目名称:spring-web-extended,代码行数:8,代码来源:ChunkTemplate.java


示例11: getOrCreateChunk

import com.x5.template.Chunk; //导入依赖的package包/类
private Chunk getOrCreateChunk(Theme theme, boolean fromTemplate) throws IOException {
    if (chunk == null) {
        chunk = createChunk(new StringReader(getResourceUriExtended()), theme, fromTemplate);
    }
    return chunk;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:ChunkEndpoint.java


示例12: renderLive

import com.x5.template.Chunk; //导入依赖的package包/类
public String renderLive() {
    final Chunk chunk = mTheme.makeChunk("live");
    return chunk.toString();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:5,代码来源:ChunkRenderer.java


示例13: getContent

import com.x5.template.Chunk; //导入依赖的package包/类
@Override
protected String getContent() throws IOException
{
    Chunk chunk = buildChunk();
    return chunk.toString();
}
 
开发者ID:furti,项目名称:spring-web-extended,代码行数:7,代码来源:ChunkTemplate.java



注:本文中的com.x5.template.Chunk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SSAInstruction类代码示例发布时间:2022-05-22
下一篇:
Java MMSeg类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap