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


Java Renderer.render方法代码示例

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


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

示例1: getWindowContent

import org.datacleaner.api.Renderer; //导入方法依赖的package包/类
@Override
protected JComponent getWindowContent() {
    if (!_results.isEmpty()) {
        for (final AnalyzerResult analyzerResult : _results) {
            final Renderer<? super AnalyzerResult, ? extends JComponent> renderer =
                    _rendererFactory.getRenderer(analyzerResult, SwingRenderingFormat.class);
            final JComponent component;
            if (renderer == null) {
                component = new JTextArea(analyzerResult.toString());
            } else {
                component = renderer.render(analyzerResult);
            }

            addRenderedResult(component);
        }
    }

    final DCPanel panel = new DCPanel(WidgetUtils.COLOR_ALTERNATIVE_BACKGROUND);
    panel.setLayout(new BorderLayout());
    panel.add(WidgetUtils.scrolleable(_taskPaneContainer), BorderLayout.CENTER);

    final Dimension preferredSize = panel.getPreferredSize();
    final int height = preferredSize.height < 400 ? preferredSize.height + 100 : preferredSize.height;
    final int width = preferredSize.width < 500 ? 500 : preferredSize.width;
    panel.setPreferredSize(width, height);

    return panel;
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:29,代码来源:DetailsResultWindow.java

示例2: write

import org.datacleaner.api.Renderer; //导入方法依赖的package包/类
@Override
public void write(final AnalysisResult result, final DataCleanerConfiguration configuration,
        final Supplier<Writer> writerRef, final Supplier<OutputStream> outputStreamRef) throws Exception {
    final Writer writer = writerRef.get();
    writer.write("SUCCESS!\n");

    final RendererFactory rendererFactory = new RendererFactory(configuration);
    for (final Entry<ComponentJob, AnalyzerResult> entry : result.getResultMap().entrySet()) {
        final ComponentJob componentJob = entry.getKey();
        final AnalyzerResult analyzerResult = entry.getValue();
        final String name = LabelUtils.getLabel(componentJob);

        writer.write("\nRESULT: ");
        writer.write(name);
        writer.write('\n');

        final Renderer<? super AnalyzerResult, ? extends CharSequence> renderer =
                rendererFactory.getRenderer(analyzerResult, TextRenderingFormat.class);

        if (renderer == null) {
            throw new IllegalStateException("No text renderer found for result: " + analyzerResult);
        }

        final CharSequence renderedResult = renderer.render(analyzerResult);
        writer.write(renderedResult.toString());
        writer.write('\n');
    }
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:29,代码来源:TextAnalysisResultWriter.java

示例3: toHtml

import org.datacleaner.api.Renderer; //导入方法依赖的package包/类
@Override
public String toHtml(final HtmlRenderingContext context) {
    final Renderer<? super AnalyzerResult, ? extends HtmlFragment> renderer =
            _rendererFactory.getRenderer(_result, HtmlRenderingFormat.class);
    if (renderer == null) {
        throw new IllegalStateException("No renderer found for: " + _result);
    }

    final HtmlFragment htmlFragment = renderer.render(_result);
    htmlFragment.initialize(context);

    final StringBuilder sb = new StringBuilder();
    sb.append("<div id=\"" + _elementId + "\" class=\"drillToDetailsPanel\" style=\"display:none;\">\n");

    // Append head elements inline (because we cannot reach the head
    // elements from here)
    final List<HeadElement> headElements = htmlFragment.getHeadElements();
    for (final HeadElement headElement : headElements) {
        sb.append(headElement);
        sb.append('\n');
    }

    // Append body elements
    final List<BodyElement> bodyElements = htmlFragment.getBodyElements();
    for (final BodyElement bodyElement : bodyElements) {
        sb.append(bodyElement.toHtml(context));
        sb.append('\n');
    }

    sb.append("</div>");
    return sb.toString();
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:33,代码来源:DrillToDetailsBodyElement.java

示例4: write

import org.datacleaner.api.Renderer; //导入方法依赖的package包/类
public void write(final AnalysisResult result, final DataCleanerConfiguration configuration, final Writer writer)
        throws IOException {
    final HtmlRenderingContext context = new DefaultHtmlRenderingContext();

    final RendererFactory rendererFactory = new RendererFactory(configuration);
    final Map<ComponentJob, HtmlFragment> htmlFragments = new LinkedHashMap<>();
    final Map<ComponentJob, AnalyzerResult> resultMap = new TreeMap<>(new ComponentJobComparator());
    resultMap.putAll(result.getResultMap());

    for (final Entry<ComponentJob, AnalyzerResult> entry : resultMap.entrySet()) {
        final ComponentJob componentJob = entry.getKey();
        final AnalyzerResult analyzerResult = entry.getValue();

        if (_jobInclusionPredicate.test(entry)) {
            final Renderer<? super AnalyzerResult, ? extends HtmlFragment> renderer =
                    rendererFactory.getRenderer(analyzerResult, HtmlRenderingFormat.class);
            if (renderer == null) {
                throw new IllegalStateException("No HTML renderer found for result: " + analyzerResult);
            }

            final HtmlRenderingContext localContext = new ComponentHtmlRenderingContext(context, componentJob);

            try {
                final HtmlFragment htmlFragment = renderer.render(analyzerResult);
                htmlFragment.initialize(localContext);
                htmlFragments.put(componentJob, htmlFragment);
            } catch (final Exception e) {
                logger.error("Error while rendering analyzer result: " + analyzerResult, e);
                writeRenderingError(writer, componentJob, analyzerResult, e);
            }
        } else {
            logger.debug("Skipping job {} / result {} because predicate evaluated false", componentJob,
                    analyzerResult);
        }
    }

    writeHtmlBegin(writer, context);
    writeHead(writer, htmlFragments, context);
    writeBody(writer, htmlFragments, context);
    writeHtmlEnd(writer, context);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:42,代码来源:HtmlAnalysisResultWriter.java


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