本文整理汇总了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;
}
示例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');
}
}
示例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();
}
示例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);
}