Esempio n. 1
0
  public void addRenderer(String klass, Map<String, String> props, String uniqueId) {
    WaveletViewRenderer renderer = null;
    try {
      renderer = RendererRegistry.findRenderer(klass);
    } catch (Exception ex) {
      LOGGER.error("Cannot find renderer " + klass);
      LOGGER.error("  message: " + ex.getMessage());
    }
    if (renderer == null) {
      return;
    }

    // set the data entity to be rendered and add renderer to viewer
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    Map<String, Object> results =
        ServiceProvider.getRepository().get(new EntityUniqueIdSpecification(uniqueId));
    Object[] objects = results.values().toArray();
    renderer.setData(shell, WaveletViewer.this, objects, false);
    // Put wavelet info on the tool bar
    Wavelet wavelet = (Wavelet) renderer.getRenderedObjects()[0];
    IPlotPolyline waveletPolyline = (IPlotPolyline) renderer.getShapes()[0];
    _legendToolbar.addLabel(wavelet.getDisplayName() + ":");
    _legendToolbar.addColorRectangle(waveletPolyline.getLineColor());
    // set the renderer's model properties
    Model model = renderer.getSettingsModel();
    // Note: if model is null, renderer is TraceSectionRenderer (at least)
    if (model != null) {
      model.unpickle(props);
    }
  }
Esempio n. 2
0
 @Override
 protected List<IConfigurationElement> findRenderer(Shell shell, Object object) {
   return RendererRegistry.findRenderer(shell, object, WAVELET_SUBPLOT);
 }