protected void renderGraph(Graphics2D g2d) {
    if (renderContext.getGraphicsContext() == null) {
      renderContext.setGraphicsContext(new GraphicsDecorator(g2d));
    } else {
      renderContext.getGraphicsContext().setDelegate(g2d);
    }
    renderContext.setScreenDevice(this);
    Layout<V, E> layout = model.getGraphLayout();

    g2d.setRenderingHints(renderingHints);

    // the size of the VisualizationViewer
    Dimension d = getSize();

    // clear the offscreen image
    g2d.setColor(getBackground());
    g2d.fillRect(0, 0, d.width, d.height);

    AffineTransform oldXform = g2d.getTransform();
    AffineTransform newXform = new AffineTransform(oldXform);
    // AffineTransform newXform = new AffineTransform();
    newXform.concatenate(
        renderContext.getMultiLayerTransformer().getTransformer(Layer.VIEW).getTransform());
    //        		viewTransformer.getTransform());

    g2d.setTransform(newXform);

    // if there are  preRenderers set, paint them
    for (Paintable paintable : preRenderers) {

      if (paintable.useTransform()) {
        paintable.paint(g2d);
      } else {
        g2d.setTransform(oldXform);
        paintable.paint(g2d);
        g2d.setTransform(newXform);
      }
    }

    if (layout instanceof Caching) {
      ((Caching) layout).clear();
    }

    renderer.render(renderContext, layout);

    // if there are postRenderers set, do it
    for (Paintable paintable : postRenderers) {

      if (paintable.useTransform()) {
        paintable.paint(g2d);
      } else {
        g2d.setTransform(oldXform);
        paintable.paint(g2d);
        g2d.setTransform(newXform);
      }
    }
    g2d.setTransform(oldXform);
  }
 @Override
 public void setVisible(boolean aFlag) {
   super.setVisible(aFlag);
   if (aFlag == true) {
     Dimension d = this.getSize();
     if (d.width <= 0 || d.height <= 0) {
       d = this.getPreferredSize();
     }
     model.getGraphLayout().setSize(d);
   }
 }
 public Layout<V, E> getGraphLayout() {
   return model.getGraphLayout();
 }