private void updateShape(final int oldWidth, final int oldHeight) {
   if (getShape() != null && getWidth() > 0f && getHeight() > 0f) {
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             if (graphController.isAnimatable())
               animate(
                   animateShape,
                   polygon,
                   graphController.getAnimationSpeed(),
                   calculatePoints(getShape(), oldWidth, oldHeight),
                   calculatePoints(getShape(), getWidth(), getHeight()));
             else {
               polygon.setAttribute(
                   SVG_POINTS_ATTRIBUTE, calculatePoints(getShape(), getWidth(), getHeight()));
               iteration.setAttribute(
                   SVG_TRANSFORM_ATTRIBUTE, "translate(" + (getWidth() - 1.5) + " 5.5)");
               error.setAttribute(
                   SVG_TRANSFORM_ATTRIBUTE,
                   "translate(" + (getWidth() - 1.5) + " " + (getHeight() - 1) + ")");
             }
           }
         });
   }
 }
 @Override
 public void setLabel(final String label) {
   super.setLabel(label);
   graphController.updateSVGDocument(
       new Runnable() {
         @Override
         public void run() {
           labelText.setData(label);
         }
       });
 }
 @Override
 public void setIteration(final int iteration) {
   graphController.updateSVGDocument(
       new Runnable() {
         @Override
         public void run() {
           if (iteration > 0) iterationText.setData(String.valueOf(iteration));
           else iterationText.setData("");
         }
       });
 }
 @Override
 public boolean removeSubgraph(Graph subgraph) {
   if (subgraph instanceof SVGGraph) {
     final SVGGraph svgGraph = (SVGGraph) subgraph;
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             mainGroup.removeChild(svgGraph.getSVGElement());
           }
         });
   }
   return super.removeSubgraph(subgraph);
 }
 @Override
 public boolean removeNode(GraphNode node) {
   if (node instanceof SVGGraphNode) {
     final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             mainGroup.removeChild(svgGraphNode.getSVGElement());
           }
         });
   }
   return super.removeNode(node);
 }
 @Override
 public void setCompleted(final float complete) {
   super.setCompleted(complete);
   graphController.updateSVGDocument(
       new Runnable() {
         @Override
         public void run() {
           Dimension size = getSize();
           Point position = getPosition();
           completedPolygon.setAttribute(
               SVG_POINTS_ATTRIBUTE,
               calculatePoints(getShape(), (int) (size.width * complete), size.height));
           completedPolygon.setAttribute(
               SVG_TRANSFORM_ATTRIBUTE, "translate(" + position.x + " " + position.y + ")");
         }
       });
 }
 @Override
 public void addSubgraph(Graph subgraph) {
   super.addSubgraph(subgraph);
   if (subgraph instanceof SVGGraph) {
     final SVGGraph svgGraph = (SVGGraph) subgraph;
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             float opacity = svgGraph.getOpacity();
             svgGraph.setOpacity(0);
             mainGroup.appendChild(svgGraph.getSVGElement());
             svgGraph.setOpacity(opacity);
           }
         });
   }
 }
 @Override
 public void addNode(GraphNode node) {
   super.addNode(node);
   if (node instanceof SVGGraphNode) {
     final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             float opacity = svgGraphNode.getOpacity();
             svgGraphNode.setOpacity(0);
             mainGroup.appendChild(svgGraphNode.getSVGElement());
             svgGraphNode.setOpacity(opacity);
           }
         });
   }
 }
 @Override
 public void addEdge(GraphEdge edge) {
   if (edge instanceof SVGGraphEdge) {
     final SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edge;
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             float opacity = svgGraphEdge.getOpacity();
             svgGraphEdge.setOpacity(0);
             mainGroup.appendChild(svgGraphEdge.getSVGElement());
             svgGraphEdge.setOpacity(opacity);
           }
         });
   }
   super.addEdge(edge);
 }
 @Override
 public void setPosition(final Point position) {
   final Point oldPosition = getPosition();
   if (position != null && !position.equals(oldPosition)) {
     super.setPosition(position);
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             if (graphController.isAnimatable())
               animate(
                   animatePosition,
                   polygon,
                   graphController.getAnimationSpeed(),
                   oldPosition.x + ", " + oldPosition.y,
                   position.x + ", " + position.y);
             else
               polygon.setAttribute(
                   SVG_TRANSFORM_ATTRIBUTE, "translate(" + position.x + " " + position.y + ")");
           }
         });
   }
 }
 @Override
 public void setLabelPosition(final Point labelPosition) {
   final Point oldLabelPosition = getLabelPosition();
   if (labelPosition != null && !labelPosition.equals(oldLabelPosition)) {
     super.setLabelPosition(labelPosition);
     graphController.updateSVGDocument(
         new Runnable() {
           @Override
           public void run() {
             if (graphController.isAnimatable() && oldLabelPosition != null)
               animate(
                   animateLabel,
                   labelGroup,
                   graphController.getAnimationSpeed(),
                   oldLabelPosition.x + ", " + oldLabelPosition.y,
                   labelPosition.x + ", " + labelPosition.y);
             else
               labelGroup.setAttribute(
                   SVG_TRANSFORM_ATTRIBUTE,
                   "translate(" + labelPosition.x + " " + labelPosition.y + ")");
           }
         });
   }
 }