Преглед на файлове

Merge branch 'master' into JavadocAndRenamings

# Conflicts:
#	src/bk/BKNodePlacement.java
#	src/bk/ConflictDetection.java
#	src/view/MainView.java
Eren Yilmaz преди 6 години
родител
ревизия
660455e268

+ 5 - 5
src/bk/BKNodePlacement.java

@@ -165,11 +165,11 @@ public class BKNodePlacement extends Algorithm {
                 }
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 {
-                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) +
+                    info += "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
                             "|" + TextLayoutHelper.strToLen( n.getShift( type ) + "", 7 ) +
-                            "|" + TextLayoutHelper.strToLen( n.getSink( type ).getName(), 6 ) +
-                            "|" + TextLayoutHelper.strToLen( n.getRoot( type ).getName(), 6 ) +
-                            "|" + TextLayoutHelper.strToLen( n.getAlign( type ).getName(), 7 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getSink( type ).toString(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getRoot( type ).toString(), 6 ) +
+                            "|" + TextLayoutHelper.strToLen( n.getAlign( type ).toString(), 7 ) +
                             "|" + TextLayoutHelper.strToLen( n.getX( type ) + "", 5 ) +
                             "|" + TextLayoutHelper.strToLen( !n.isXUndefined( type ) + "", 8 ) + "|\n";
                 }
@@ -196,7 +196,7 @@ public class BKNodePlacement extends Algorithm {
                 LayeredGraphNode graph = m.read( "graph", Visibility.COMPLETE_STACK );
                 for( LayeredGraphNode n : graph.getContainedNodes() )
                 {
-                    info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) +
+                    info += "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
                             "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_UPPER ) + "", 6 ) +
                             "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.RIGHTMOST_UPPER ) + "", 6 ) +
                             "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_LOWER ) + "", 6 ) +

+ 8 - 8
src/bk/ConflictDetection.java

@@ -39,7 +39,7 @@ public class ConflictDetection {
      * @return the table
      */
     public static String buildDebugString( Memory m ) {
-        if( m.isSomewhereDefined( "l", Visibility.LOCAL ) && m.isSomewhereDefined( "i", Visibility.LOCAL ) && 
+        if( m.isSomewhereDefined( "l", Visibility.LOCAL ) && m.isSomewhereDefined( "i", Visibility.LOCAL ) &&
                 m.<Integer>read( "l", Visibility.LOCAL ) < m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get( m.<Integer>read( "i", Visibility.LOCAL ) + 1 ).size() )
             m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.<Integer>read( "i", Visibility.LOCAL ) + 1).get(m.<Integer>read( "l", Visibility.LOCAL )).setSelected(null);
         
@@ -48,12 +48,12 @@ public class ConflictDetection {
             m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.<Integer>read( "i", Visibility.LOCAL ) + 1).get(m.<Integer>read( "l1", Visibility.LOCAL )).setSelected(null);
         }
         
-        if( m.isSomewhereDefined( "i", Visibility.LOCAL ) && m.isSomewhereDefined( "k0", Visibility.LOCAL ) && 
+        if( m.isSomewhereDefined( "i", Visibility.LOCAL ) && m.isSomewhereDefined( "k0", Visibility.LOCAL ) &&
                 m.<Integer>read( "k0", Visibility.LOCAL ) <  m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.read( "i", Visibility.LOCAL )).size()) {
             m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.read( "i", Visibility.LOCAL )).get(m.<Integer>read( "k0", Visibility.LOCAL )).setSelected(null);
         }
         
-        if( m.isSomewhereDefined( "i", Visibility.LOCAL ) && m.isSomewhereDefined( "k1", Visibility.LOCAL ) && 
+        if( m.isSomewhereDefined( "i", Visibility.LOCAL ) && m.isSomewhereDefined( "k1", Visibility.LOCAL ) &&
                 m.<Integer>read( "k1", Visibility.LOCAL ) < m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.read( "i", Visibility.LOCAL )).size() ) {
             m.<LayeredGraphNode>read( "graph", Visibility.LOCAL).getContainedLayers().get(m.read( "i", Visibility.LOCAL )).get(m.<Integer>read( "k1", Visibility.LOCAL )).setSelected(null);
         }
@@ -81,10 +81,10 @@ public class ConflictDetection {
             k0 = "" + m.<Integer>read( "k0", Visibility.LOCAL );
         if( m.isSomewhereDefined( "k1", Visibility.LOCAL ) )
             k1 = "" + m.<Integer>read( "k1", Visibility.LOCAL );
-        if( m.isSomewhereDefined( "v", Visibility.LOCAL ) && m.<LayeredGraphEdge>read( "v", Visibility.LOCAL ).getSources().get( 0 ).getName() != null )
-            v = "" + m.<LayeredGraphEdge>read( "v", Visibility.LOCAL ).getSources().get( 0 ).getName();
-        if( m.isSomewhereDefined( "n", Visibility.LOCAL ) && m.<LayeredGraphNode>read( "n", Visibility.LOCAL ).getName() != null )
-            n = "" + m.<LayeredGraphNode>read( "n", Visibility.LOCAL ).getName();
+        if( m.isSomewhereDefined( "v", Visibility.LOCAL ) && m.<LayeredGraphEdge>read( "v", Visibility.LOCAL ).getSources().get( 0 ).toString() != null )
+            v = "" + m.<LayeredGraphEdge>read( "v", Visibility.LOCAL ).getSources().get( 0 ).toString();
+        if( m.isSomewhereDefined( "n", Visibility.LOCAL ) && m.<LayeredGraphNode>read( "n", Visibility.LOCAL ).toString() != null )
+            n = "" + m.<LayeredGraphNode>read( "n", Visibility.LOCAL ).toString();
         info += "|" + TextLayoutHelper.strToLen( i, 4 ) + 
                 "|" + TextLayoutHelper.strToLen( l, 4 ) + 
                 "|" + TextLayoutHelper.strToLen( l1, 4 ) + 
@@ -169,7 +169,7 @@ public class ConflictDetection {
         ifNode = new PseudoCodeNode( "if l1==|L[i+1]|-1 or L[i+1][l1] incident to inner segment between L[i+1] and L[i] then", vars, tree, new IfLoop() {
 			@Override
 			protected boolean condition(ReadOnlyMemory m) {
-	            return m.<Integer>read( "l1", Visibility.LOCAL ) == m.<LayeredGraphNode>read( "graph", Visibility.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", Visibility.LOCAL ) + 1).size() - 1 || 
+	            return m.<Integer>read( "l1", Visibility.LOCAL ) == m.<LayeredGraphNode>read( "graph", Visibility.LOCAL ).getContainedLayers().get( m.<Integer>read( "i", Visibility.LOCAL ) + 1).size() - 1 ||
 	            		incidentToInnerSegmentBetweenLiPlusOneAndLi( m );
 			}
         } );

+ 0 - 7
src/graph/LayeredGraphNode.java

@@ -135,13 +135,6 @@ public interface LayeredGraphNode {
    */
   public void setName(String name);
 
-  /**
-   * get the name of this node
-   * 
-   * @return the name
-   */
-  public String getName();
-
   /**
    * set the display color of this node in the given layout
    * or in all layouts if the argument is null.

+ 1 - 6
src/graph/LayeredNode.java

@@ -463,11 +463,6 @@ public class LayeredNode implements LayeredGraphNode {
         name = n;
     }
 
-    @Override
-    public String getName() {
-        return name;
-    }
-
     @Override
     public ElkNode getOriginalNode() {
         return original;
@@ -898,7 +893,7 @@ public class LayeredNode implements LayeredGraphNode {
     @Override
     public LayeredGraphNode findNodeByName(String name) {
         for (LayeredGraphNode n : nodes) {
-            if (n.getName() != null && name != null && n.getName().equals(name))
+            if (name != null && n.toString().equals(name))
                 return n;
         }
         return null;

+ 3 - 3
src/graph/io/Writer.java

@@ -63,7 +63,7 @@ public class Writer {
             edges.put( parseEdge( e ) );
         }
         node.put( "edges", edges );
-        node.put( "name", graph.getName() );
+        node.put( "name", graph.toString() );
         if( graph.isDummyNode() )
             node.put( "dummy", "true" );
         return node;
@@ -72,8 +72,8 @@ public class Writer {
     private JSONObject parseEdge( LayeredGraphEdge e ) throws JSONException
     {
         JSONObject edge = new JSONObject();
-        edge.put( "source", e.getSources().get( 0 ).getName() );
-        edge.put( "target", e.getTargets().get( 0 ).getName() );
+        edge.put( "source", e.getSources().get( 0 ).toString() );
+        edge.put( "target", e.getTargets().get( 0 ).toString() );
         return edge;
     }
 }

+ 1 - 1
src/main/Main.java

@@ -17,7 +17,7 @@ public class Main {
      * @param args the command line arguments, currently not in use
      */
     public static void main(String[] args) {
-        Reader r = new Reader( "logo.json" );
+        Reader r = new Reader( "papergraph_in_two_nodes.json" );
         LayeredGraphNode graph = r.readInputGraph();
         SimpleNodePlacement.placeNodes( graph );
         new MainView( graph );

+ 24 - 24
src/view/MainView.java

@@ -97,33 +97,33 @@ public class MainView {
         info += "| Node | Shift | Sink | Root | Align |  x  |  xDef  | | Node | Shift | Sink | Root | Align |  x  |  xDef  | | Node | Shift | Sink | Root | Align |  x  |  xDef  | | Node | Shift | Sink | Root | Align |  x  |  xDef  |\n";
         for( LayeredGraphNode n : graph.getContainedNodes() )
         {
-            info += "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.LEFTMOST_UPPER ) + "", 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.LEFTMOST_UPPER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.LEFTMOST_UPPER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.LEFTMOST_UPPER ).getName(), 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_UPPER ) + "", 5 ) + 
+            info += "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.LEFTMOST_UPPER ) + "", 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.LEFTMOST_UPPER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.LEFTMOST_UPPER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.LEFTMOST_UPPER ).toString(), 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_UPPER ) + "", 5 ) +
                     "|" + TextLayoutHelper.strToLen( !n.isXUndefined( LayoutType.LEFTMOST_UPPER ) + "", 8 ) + "| " +
-                    "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.RIGHTMOST_UPPER ) + "", 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.RIGHTMOST_UPPER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.RIGHTMOST_UPPER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.RIGHTMOST_UPPER ).getName(), 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.RIGHTMOST_UPPER ) + "", 5 ) + 
+                    "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.RIGHTMOST_UPPER ) + "", 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.RIGHTMOST_UPPER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.RIGHTMOST_UPPER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.RIGHTMOST_UPPER ).toString(), 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.RIGHTMOST_UPPER ) + "", 5 ) +
                     "|" + TextLayoutHelper.strToLen( !n.isXUndefined( LayoutType.RIGHTMOST_UPPER ) + "", 8 ) + "| " +
-                    "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.LEFTMOST_LOWER ) + "", 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.LEFTMOST_LOWER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.LEFTMOST_LOWER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.LEFTMOST_LOWER ).getName(), 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_LOWER ) + "", 5 ) + 
+                    "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.LEFTMOST_LOWER ) + "", 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.LEFTMOST_LOWER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.LEFTMOST_LOWER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.LEFTMOST_LOWER ).toString(), 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.LEFTMOST_LOWER ) + "", 5 ) +
                     "|" + TextLayoutHelper.strToLen( !n.isXUndefined( LayoutType.LEFTMOST_LOWER ) + "", 8 ) + "| " +
-                    "|" + TextLayoutHelper.strToLen( n.getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.RIGHTMOST_LOWER ) + "", 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.RIGHTMOST_LOWER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.RIGHTMOST_LOWER ).getName(), 6 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.RIGHTMOST_LOWER ).getName(), 7 ) + 
-                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.RIGHTMOST_LOWER ) + "", 5 ) + 
+                    "|" + TextLayoutHelper.strToLen( n.toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getShift( LayoutType.RIGHTMOST_LOWER ) + "", 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getSink( LayoutType.RIGHTMOST_LOWER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getRoot( LayoutType.RIGHTMOST_LOWER ).toString(), 6 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getAlign( LayoutType.RIGHTMOST_LOWER ).toString(), 7 ) +
+                    "|" + TextLayoutHelper.strToLen( n.getX( LayoutType.RIGHTMOST_LOWER ) + "", 5 ) +
                     "|" + TextLayoutHelper.strToLen( !n.isXUndefined( LayoutType.RIGHTMOST_LOWER ) + "", 8 ) + "|\n";
         }
         info += "-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";

+ 34 - 17
src/view/NodeView.java

@@ -31,6 +31,8 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
     private JFrame mainView;
     private int originalWidth;
     private int originalHeight;
+    
+    private static final int PADDING = 25;
 
     public NodeView( LayeredGraphNode model, LayoutType lt, JFrame mv ) {
         mainView = mv;
@@ -53,18 +55,28 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         });
     }
     
+    private int calculatePadding()
+    {
+        double padding = Math.min( getWidth() / 100.0 * PADDING, getHeight() / 100.0 * PADDING);
+        if( padding < 10 )
+            return 10;
+        if( padding > 50 )
+            return 50;
+        return (int)padding;
+    }
+    
     public int getScaledX( int x )
     {
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
         x *= scale;
         return x;
     }
     
     public int getScaledY( int y )
     {
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
         y *= scale;
         return y;
     }
@@ -95,18 +107,18 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
     public int getXOffset()
     {
         int x = 0;
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
-        x += (getWidth()-50) / 2 - (getWidthOfNeededArea() * scale ) / 2 + 25;
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
+        x += (getWidth()-padding) / 2 - (getWidthOfNeededArea() * scale ) / 2 + padding/2;
         return x;
     }
 
     public int getYOffset()
     {
         int y = 0;
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
-        y += (getHeight()-50) / 2 - (getHeightOfNeededArea() * scale ) / 2 + 25;
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
+        y += (getHeight()-padding) / 2 - (getHeightOfNeededArea() * scale ) / 2 + padding/2;
         return y;
     }
 
@@ -157,8 +169,8 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         }
         int x = 0;
         int y = 0;
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
         x += (getWidth()) / 2 - (getWidthOfNeededArea() * scale ) / 2;
         y += (getHeight()) / 2 - (getHeightOfNeededArea() * scale ) / 2;
         for( Component c : getComponents() )
@@ -166,11 +178,16 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             if( !(c instanceof AnnimatedView) )
                 continue;
             AnnimatedView view = (AnnimatedView)c;
-            c.setLocation( getScaledX( view.getVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
             if( c instanceof NodeView )
+            {
+                c.setLocation( getScaledX( ((NodeView)c).getPlainVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
                 c.setSize( getScaledX( ((NodeView)c).getOriginalWidth() ), getScaledY( ((NodeView)c).getOriginalHeight() ) );
+            }
             else
+            {
+                c.setLocation( getScaledX( view.getVirtualX() - (int)minX ) + x, getScaledY( view.getVirtualY() ) + y);
                 c.setSize( getScaledX( view.getVirtualWidth() ), getScaledY( view.getVirtualHeight() ) );
+            }
             c.doLayout();
         }
     }
@@ -181,7 +198,6 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
         if( layout == LayoutType.COMBINED && model.getColor( null ) == null )
             return;
         updateTooltipText();
-        paintComponent( g );
         double minX = Double.POSITIVE_INFINITY;
         for( Component c : getComponents() )
         {
@@ -190,9 +206,9 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             minX = Math.min( ((AnnimatedView)c).getVirtualX(), minX);
         }
         int x = 0;
-        double scale1 = Math.min( (getWidth()) / (double)getWidthOfNeededArea(), (getHeight()) / (double)getHeightOfNeededArea());
-        double scale = Math.min( (getWidth()-50*scale1) / (double)getWidthOfNeededArea(), (getHeight()-50*scale1) / (double)getHeightOfNeededArea());
-        x += (getWidth()-50) / 2 - (getWidthOfNeededArea() * scale ) / 2 + 25;
+        int padding = calculatePadding();
+        double scale = Math.min( (getWidth()-padding) / (double)getWidthOfNeededArea(), (getHeight()-padding) / (double)getHeightOfNeededArea());
+        x += (getWidth()-padding) / 2 - (getWidthOfNeededArea() * scale ) / 2 + padding/2;
         for( Component c : getComponents() )
         {
             if( c instanceof NodeView )
@@ -205,6 +221,7 @@ public class NodeView extends JPanel implements AnnimatedView, MouseListener {
             }
             c.paint( g.create( c.getX(), c.getY(), c.getWidth(), c.getHeight() ) );
         }
+        paintComponent( g );
     }
 
     public void renderClass( Graphics g ) {

+ 0 - 2
src/view/PseudoCodeLines.java

@@ -33,8 +33,6 @@ public class PseudoCodeLines extends JComponent implements MouseListener{
    
     //pixel padding on left and right
     private static final int HORIZONTAL_PADDING = 1;
-    //pixel padding on left and right
-    private static final int VERTICAL_PADDING = 3;
     
     private static ImageIcon currentLine = new ImageIcon( PseudoCodeNode.class.getResource( "/img/current_line.png" ) );