本文整理匯總了Java中com.rapidminer.gui.renderer.Renderer類的典型用法代碼示例。如果您正苦於以下問題:Java Renderer類的具體用法?Java Renderer怎麽用?Java Renderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Renderer類屬於com.rapidminer.gui.renderer包,在下文中一共展示了Renderer類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updatePreviewImage
import com.rapidminer.gui.renderer.Renderer; //導入依賴的package包/類
/**
* Updates the preview renderable image in a {@link SwingWorker}.
*/
private void updatePreviewImage() {
final IOObject result = ioObject.get();
if (result != null) {
String name = RendererService.getName(result.getClass());
final List<Renderer> renderers = RendererService.getRenderers(name);
if (renderers.isEmpty()) {
return;
}
SwingWorker<Void, Void> sw = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
int width = Math.max(getSize().width, MIN_WIDTH);
int height = Math.max(getSize().height, MIN_HEIGHT);
for (Renderer renderer : renderers) {
Reportable reportable = renderer.createReportable(result, new IOContainer(), 800, 600);
if (reportable instanceof Renderable) {
Renderable renderable = (Renderable) reportable;
renderable.prepareRendering();
int preferredWidth = renderable.getRenderWidth(800);
int preferredHeight = renderable.getRenderHeight(600);
img = new BufferedImage(preferredWidth, preferredHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = (Graphics2D) img.getGraphics();
graphics.setColor(Colors.WHITE);
graphics.fillRect(0, 0, 5000, 3000);
double scale = Math.min((double) width / (double) preferredWidth, (double) height
/ (double) preferredHeight);
graphics.scale(scale, scale);
renderable.render(graphics, preferredWidth, preferredHeight);
break;
}
}
return null;
}
@Override
public void done() {
main.repaint();
}
};
sw.execute();
}
}
示例2: updatePreviewImage
import com.rapidminer.gui.renderer.Renderer; //導入依賴的package包/類
/**
* Updates the preview renderable image in a {@link SwingWorker}.
*/
private void updatePreviewImage() {
final IOObject result = ioObject.get();
if (result != null) {
String name = RendererService.getName(result.getClass());
final List<Renderer> renderers = RendererService.getRenderers(name);
if (renderers.isEmpty()) {
return;
}
SwingWorker<Void, Void> sw = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
int width = Math.max(getSize().width, MIN_WIDTH);
int height = Math.max(getSize().height, MIN_HEIGHT);
for (Renderer renderer : renderers) {
Reportable reportable = renderer.createReportable(result, new IOContainer(), 800, 600);
if (reportable instanceof Renderable) {
Renderable renderable = (Renderable) reportable;
renderable.prepareRendering();
int preferredWidth = renderable.getRenderWidth(800);
int preferredHeight = renderable.getRenderHeight(600);
img = new BufferedImage(preferredWidth, preferredHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = (Graphics2D) img.getGraphics();
graphics.setColor(Colors.WHITE);
graphics.fillRect(0, 0, 5000, 3000);
double scale = Math.min((double) width / (double) preferredWidth,
(double) height / (double) preferredHeight);
graphics.scale(scale, scale);
renderable.render(graphics, preferredWidth, preferredHeight);
break;
}
}
return null;
}
@Override
public void done() {
main.repaint();
}
};
sw.execute();
}
}
示例3: createVisualizationComponent
import com.rapidminer.gui.renderer.Renderer; //導入依賴的package包/類
public static JPanel createVisualizationComponent(IOObject resultObject, IOContainer resultContainer, String usedResultName) {
final String resultName = RendererService.getName(resultObject.getClass());
Component visualisationComponent;
Collection<Renderer> renderers = RendererService.getRenderers(resultName);
// fallback to default toString method!
if (resultName == null) {
renderers.add(new DefaultTextRenderer());
}
// constructing panel of renderers
visualisationComponent = new RadioCardPanel(usedResultName, resultObject);
for (Renderer renderer : renderers) {
try {
Component rendererComponent = renderer.getVisualizationComponent(resultObject, resultContainer);
if (rendererComponent != null) {
((RadioCardPanel)visualisationComponent).addCard(renderer.getName(), rendererComponent);
}
} catch (Exception e) {
//LogService.getRoot().log(Level.WARNING, "Error creating renderer: "+e, e);
LogService.getRoot().log(Level.WARNING,
I18N.getMessage(LogService.getRoot().getResourceBundle(),
"com.rapidminer.gui.processeditor.results.ResultDisplayTools.error_creating_renderer",
e),
e);
((RadioCardPanel)visualisationComponent).addCard(renderer.getName(), new JLabel("Error creating renderer "+renderer.getName() + " (see log)."));
}
}
// result panel
final JPanel resultPanel = new JPanel(new BorderLayout());
resultPanel.putClientProperty("main.component", visualisationComponent);
resultPanel.add(visualisationComponent, BorderLayout.CENTER);
if (resultObject instanceof ResultObject) {
if (((ResultObject)resultObject).getResultIcon() != null) {
resultPanel.putClientProperty(ResultDisplayTools.CLIENT_PROPERTY_RAPIDMINER_RESULT_ICON, ((ResultObject)resultObject).getResultIcon());
} else {
resultPanel.putClientProperty(ResultDisplayTools.CLIENT_PROPERTY_RAPIDMINER_RESULT_ICON, TabbedResultDisplay.defaultResultIcon);
}
}
resultPanel.putClientProperty(ResultDisplayTools.CLIENT_PROPERTY_RAPIDMINER_RESULT_NAME, usedResultName);
resultPanel.putClientProperty(ResultDisplayTools.CLIENT_PROPERTY_RAPIDMINER_RESULT_NAME_HTML, "<html>" + usedResultName + "<br/><small>" + resultObject.getSource() + "</small></html>");
return resultPanel;
}