tmf: API clean-up of sequence diagram framework
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / NGC.java
index 7297b17ad3d3070562aa7446e23654709a801f7d..e1642a3ff9c73a6dda2b28cde51ff7b280b91782 100755 (executable)
@@ -1,16 +1,15 @@
 /**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
 
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
@@ -46,47 +45,47 @@ public class NGC implements IGC {
     /**
      * The graphical context.
      */
-    protected GC fContext;
+    private GC fContext;
     /**
      * The reference to the sequence diagram view.
      */
-    protected SDWidget fView;
+    private SDWidget fView;
     /**
      * A reference to the last used font.
      */
-    protected Font fTempFont = null;
+    private Font fTempFont = null;
     /**
      * The color of the gradient.
      */
-    protected IColor fGradientColor = null;
+    private IColor fGradientColor = null;
     /**
      * The color of the background.
      */
-    protected IColor fBackground = null;
+    private IColor fBackground = null;
     /**
      * The color of the foreground.
      */
-    protected IColor fForeground = null;
+    private IColor fForeground = null;
     /**
      * The current visible y screen bounds
      */
-    protected int fVisibleY;
+    private int fVisibleY;
     /**
      * The current visible x screen bound.
      */
-    protected int fVisibleX;
+    private int fVisibleX;
     /**
      * The current yx value (view visible height - visible screen bounds)
      */
-    protected int yx;
+    private int yx;
     /**
      * The current xx value (view visible width - visible screen bounds)
      */
-    protected int xx;
+    private int xx;
     /**
      * <code>true</code> to draw with focus else <code>false</code>.
      */
-    protected boolean fDrawWithFocus = false;
+    private boolean fDrawWithFocus = false;
 
     /**
      * The static visible screen bounds.
@@ -113,73 +112,127 @@ public class NGC implements IGC {
     // Methods
     // ------------------------------------------------------------------------
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setLineStyle(int)
-     */
     @Override
     public void setLineStyle(int style) {
         fContext.setLineStyle(style);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getLineStyle()
-     */
     @Override
     public int getLineStyle() {
         return fContext.getLineStyle();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getContentsX()
-     */
     @Override
     public int getContentsX() {
-        return Math.round(fView.getContentsX() / fView.fZoomValue);
+        return Math.round(fView.getContentsX() / fView.getZoomValue());
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getContentsY()
-     */
     @Override
     public int getContentsY() {
-        return Math.round(fView.getContentsY() / fView.fZoomValue);
+        return Math.round(fView.getContentsY() / fView.getZoomValue());
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getVisibleWidth()
-     */
     @Override
     public int getVisibleWidth() {
-        return Math.round(fView.getVisibleWidth() / fView.fZoomValue);
+        return Math.round(fView.getVisibleWidth() / fView.getZoomValue());
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getVisibleHeight()
-     */
     @Override
     public int getVisibleHeight() {
-        return Math.round(fView.getVisibleHeight() / fView.fZoomValue);
+        return Math.round(fView.getVisibleHeight() / fView.getZoomValue());
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#contentsToViewX(int)
+    /**
+     * Returns the current visible y screen bounds.
+     *
+     * @return the current visible y screen bounds
+     * @since 2.0
      */
+    protected int getVisibleY() {
+        return fVisibleY;
+    }
+
+    /**
+     * Sets the current visible y screen bounds.
+     *
+     * @param visibleY
+     *          the current visible y screen bounds
+     * @since 2.0
+     */
+    protected void setVisibleY(int visibleY) {
+        fVisibleY = visibleY;
+    }
+
+    /**
+     * Returns the current visible x screen bound.
+     *
+     * @return the current visible x screen bound.
+     * @since 2.0
+     *
+     */
+    protected int getfVisibleX() {
+        return fVisibleX;
+    }
+
+    /**
+     * Sets the current visible x screen bound.
+     *
+     * @param visibleX
+     *          the current visible x screen bound.
+     * @since 2.0
+     *
+     */
+    protected void setVisibleX(int visibleX) {
+        fVisibleX = visibleX;
+    }
+
+    /**
+     * Returns current yx value (view visible height - visible screen bounds).
+     *
+     * @return current yx value
+     * @since 2.0
+     */
+    protected int getYx() {
+        return yx;
+    }
+
+    /**
+     * Sets current yx value (view visible height - visible screen bounds).
+     *
+     * @param  yx
+     *       current yx value
+     * @since 2.0
+     */
+    protected void setYx(int yx) {
+        this.yx = yx;
+    }
+
+    /**
+     * Returns the current xx value (view visible width - visible screen bounds)
+     *
+     * @return the current xx value
+     * @since 2.0
+     */
+    protected int getXx() {
+        return xx;
+    }
+
+    /**
+     * Sets the current xx value (view visible width - visible screen bounds)
+     *
+     * @param xx
+     *      the current xx value
+     * @since 2.0
+     */
+    protected void setXx(int xx) {
+        this.xx = xx;
+    }
+
     @Override
     public int contentsToViewX(int x) {
         return fView.contentsToViewX(x);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#contentsToViewY(int)
-     */
     @Override
     public int contentsToViewY(int y) {
         return fView.contentsToViewY(y);
@@ -212,10 +265,6 @@ public class NGC implements IGC {
         return c;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawLine(int, int, int, int)
-     */
     @Override
     public void drawLine(int x1, int y1, int x2, int y2) {
         int localX1 = x1;
@@ -223,10 +272,10 @@ public class NGC implements IGC {
         int localX2 = x2;
         int localY2 = y2;
 
-        localX1 = Math.round(localX1 * fView.fZoomValue);
-        localY1 = Math.round(localY1 * fView.fZoomValue);
-        localX2 = Math.round(localX2 * fView.fZoomValue);
-        localY2 = Math.round(localY2 * fView.fZoomValue);
+        localX1 = Math.round(localX1 * fView.getZoomValue());
+        localY1 = Math.round(localY1 * fView.getZoomValue());
+        localX2 = Math.round(localX2 * fView.getZoomValue());
+        localY2 = Math.round(localY2 * fView.getZoomValue());
         localX1 = fView.contentsToViewX(localX1);
         localY1 = fView.contentsToViewY(localY1);
         localX2 = fView.contentsToViewX(localX2);
@@ -278,10 +327,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawRectangle(int, int, int, int)
-     */
     @Override
     public void drawRectangle(int x, int y, int width, int height) {
         int localX = x;
@@ -289,16 +334,16 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
         // Workaround to avoid problems for some special cases (not very nice)
         if (localY != getContentsY()) {
-            localY = Math.round(localY * fView.fZoomValue);
+            localY = Math.round(localY * fView.getZoomValue());
             localY = fView.contentsToViewY(localY);
         } else {
             localY = 0;
         }
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         localX = fView.contentsToViewX(localX);
 
         if (localX < -fVisibleScreenBounds) {
@@ -322,10 +367,6 @@ public class NGC implements IGC {
         fContext.drawRectangle(localX, localY, localWidth, localHeight);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawFocus(int, int, int, int)
-     */
     @Override
     public void drawFocus(int x, int y, int width, int height) {
         int localX = x;
@@ -346,10 +387,10 @@ public class NGC implements IGC {
             localHeight = -localHeight;
         }
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
 
         setForeground(SDViewPref.getInstance().getForeGroundColorSelection());
         setBackground(SDViewPref.getInstance().getBackGroundColorSelection());
@@ -360,18 +401,14 @@ public class NGC implements IGC {
         setForeground(fC);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#fillPolygon(int[])
-     */
     @Override
     public void fillPolygon(int[] points) {
         int len = (points.length / 2) * 2;
         int[] localPoint = new int[len];
         for (int i = 0; i < len; i++) {
-            localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.fZoomValue));
+            localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.getZoomValue()));
             i++;
-            localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
+            localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.getZoomValue()));
         }
 
         if (validatePolygonHeight(localPoint) <= 0) {
@@ -381,18 +418,14 @@ public class NGC implements IGC {
         fContext.fillPolygon(localPoint);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawPolygon(int[])
-     */
     @Override
     public void drawPolygon(int[] points) {
         int len = (points.length / 2) * 2;
         int[] localPoint = new int[len];
         for (int i = 0; i < len; i++) {
-            localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.fZoomValue));
+            localPoint[i] = fView.contentsToViewX(Math.round(points[i] * fView.getZoomValue()));
             i++;
-            localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.fZoomValue));
+            localPoint[i] = fView.contentsToViewY(Math.round(points[i] * fView.getZoomValue()));
         }
 
         if (validatePolygonHeight(localPoint) <= 0) {
@@ -402,10 +435,6 @@ public class NGC implements IGC {
         fContext.drawPolygon(localPoint);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#fillRectangle(int, int, int, int)
-     */
     @Override
     public void fillRectangle(int x, int y, int width, int height) {
         int localX = x;
@@ -413,16 +442,16 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
         // Workaround to avoid problems for some special cases (not very nice)
         if (localY != getContentsY()) {
-            localY = Math.round(localY * fView.fZoomValue);
+            localY = Math.round(localY * fView.getZoomValue());
             localY = fView.contentsToViewY(localY) + 1;
         } else {
             localY = 1;
         }
-        localWidth = Math.round(localWidth * fView.fZoomValue) - 1;
-        localHeight = Math.round(localHeight * fView.fZoomValue) - 1;
+        localWidth = Math.round(localWidth * fView.getZoomValue()) - 1;
+        localHeight = Math.round(localHeight * fView.getZoomValue()) - 1;
         localX = fView.contentsToViewX(localX) + 1;
         if (localX < -fVisibleScreenBounds) {
             localWidth = localWidth + localX + fVisibleScreenBounds;
@@ -443,13 +472,8 @@ public class NGC implements IGC {
             localHeight = fView.getVisibleHeight() + fVisibleScreenBounds - localY;
         }
         fContext.fillRectangle(localX, localY, localWidth, localHeight);
-
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#fillGradientRectangle(int, int, int, int, boolean)
-     */
     @Override
     public void fillGradientRectangle(int x, int y, int width, int height, boolean isVertical) {
         int localX = x;
@@ -457,10 +481,10 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         IColor tempColor = fForeground;
         setForeground(fGradientColor);
         localX = fView.contentsToViewX(localX);
@@ -494,27 +518,18 @@ public class NGC implements IGC {
         setForeground(tempColor);
     }
 
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#textExtent(java.lang.String)
-     */
     @Override
     public int textExtent(String name) {
         return fContext.textExtent(name).x;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawText(java.lang.String, int, int, boolean)
-     */
     @Override
     public void drawText(String string, int x, int y, boolean isTrans) {
         int localX = x;
         int localY = y;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
         fContext.drawText(string, fView.contentsToViewX(localX), fView.contentsToViewY(localY), isTrans);
         if (fDrawWithFocus) {
             Point r = fContext.textExtent(string);
@@ -522,17 +537,13 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawText(java.lang.String, int, int)
-     */
     @Override
     public void drawText(String string, int x, int y) {
         int localX = x;
         int localY = y;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
         fContext.drawText(string, fView.contentsToViewX(localX), fView.contentsToViewY(localY), true);
         if (fDrawWithFocus) {
             Point r = fContext.textExtent(string);
@@ -540,10 +551,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#fillOval(int, int, int, int)
-     */
     @Override
     public void fillOval(int x, int y, int width, int height) {
         int localX = x;
@@ -551,17 +558,13 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         fContext.fillOval(fView.contentsToViewX(localX), fView.contentsToViewY(localY), localWidth, localHeight);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getBackground()
-     */
     @Override
     public IColor getBackground() {
         if ((fBackground != null) && (fBackground.getColor() instanceof Color) && (!((Color) (fBackground.getColor())).isDisposed())) {
@@ -570,10 +573,6 @@ public class NGC implements IGC {
         return ColorImpl.getSystemColor(SWT.COLOR_WHITE);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getForeground()
-     */
     @Override
     public IColor getForeground() {
         if ((fForeground != null) && (fForeground.getColor() instanceof Color) && (!((Color) (fForeground.getColor())).isDisposed())) {
@@ -582,10 +581,6 @@ public class NGC implements IGC {
         return ColorImpl.getSystemColor(SWT.COLOR_WHITE);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setBackground(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor)
-     */
     @Override
     public void setBackground(IColor color) {
         if (color == null) {
@@ -597,10 +592,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setForeground(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor)
-     */
     @Override
     public void setForeground(IColor color) {
         if (color == null) {
@@ -615,10 +606,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setGradientColor(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor)
-     */
     @Override
     public void setGradientColor(IColor color) {
         if (color == null) {
@@ -629,10 +616,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setLineWidth(int)
-     */
     @Override
     public void setLineWidth(int width) {
         if (fView.isPrinting()) {
@@ -643,10 +626,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getLineWidth()
-     */
     @Override
     public int getLineWidth() {
         return fContext.getLineWidth();
@@ -671,10 +650,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawTextTruncatedCentred(java.lang.String, int, int, int, int, boolean)
-     */
     @Override
     public void drawTextTruncatedCentred(String name, int xValue, int yValue, int width, int height, boolean trans) {
         int localX = xValue;
@@ -683,15 +658,15 @@ public class NGC implements IGC {
         int localHeight = height;
 
         Point tx = fContext.textExtent(name);
-        localX = Math.round(localX * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
         int y = 0;
         // Workaround to avoid round problems for some special cases (not very nice)
         if (localY != getContentsY()) {
-            localY = Math.round(localY * fView.fZoomValue);
+            localY = Math.round(localY * fView.getZoomValue());
             y = fView.contentsToViewY(localY);
         }
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         int x = fView.contentsToViewX(localX);
         if (tx.y > localHeight) {
             return;
@@ -729,10 +704,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawTextTruncated(java.lang.String, int, int, int, int, boolean)
-     */
     @Override
     public void drawTextTruncated(String name, int xValue, int yValue, int width, int height, boolean trans) {
         int localX = xValue;
@@ -740,10 +711,10 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         int x = fView.contentsToViewX(localX);
         int y = fView.contentsToViewY(localY);
         if (fContext.textExtent(name).x <= localWidth) {
@@ -769,10 +740,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawImage(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage, int, int, int, int)
-     */
     @Override
     public void drawImage(IImage image, int xValue, int yValue, int maxWith, int maxHeight) {
         int localX = xValue;
@@ -782,19 +749,19 @@ public class NGC implements IGC {
         if (image != null && image.getImage() instanceof Image) {
             img = (Image) image.getImage();
         } else {
-            localX = Math.round(localX * fView.fZoomValue);
-            localY = Math.round(localY * fView.fZoomValue);
+            localX = Math.round(localX * fView.getZoomValue());
+            localY = Math.round(localY * fView.getZoomValue());
             int x = fView.contentsToViewX(localX);
             int y = fView.contentsToViewY(localY);
-            float tempZoom = fView.fZoomValue;
+            float tempZoom = fView.getZoomValue();
             int width = Math.round(maxWith * tempZoom);
             int height = Math.round(maxHeight * tempZoom);
             fContext.setBackground(fView.getDisplay().getSystemColor(SWT.COLOR_RED));
             fContext.fillRectangle(x, y, width, height);
             return;
         }
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
         int x = fView.contentsToViewX(localX);
         int y = fView.contentsToViewY(localY);
         Rectangle b = ((Image) image.getImage()).getBounds();
@@ -806,11 +773,11 @@ public class NGC implements IGC {
         if (height > maxHeight) {
             height = maxHeight;
         }
-        float tempZoom = fView.fZoomValue;
+        float tempZoom = fView.getZoomValue();
         width = Math.round(width * tempZoom);
         height = Math.round(height * tempZoom);
 
-        if (fView.fIsPrinting && width > 0 && height > 0) {
+        if (fView.isPrinting() && width > 0 && height > 0) {
             Image dbuffer = new Image(fView.getDisplay(), width, height);
             GC tempgc = new GC(dbuffer);
             tempgc.drawImage(img, 0, 0, b.width, b.height, 0, 0, width, height);
@@ -824,10 +791,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#drawArc(int, int, int, int, int, int)
-     */
     @Override
     public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
         int localX = x;
@@ -835,26 +798,22 @@ public class NGC implements IGC {
         int localWidth = width;
         int localHeight = height;
 
-        localX = Math.round(localX * fView.fZoomValue);
-        localY = Math.round(localY * fView.fZoomValue);
-        localWidth = Math.round(localWidth * fView.fZoomValue);
-        localHeight = Math.round(localHeight * fView.fZoomValue);
+        localX = Math.round(localX * fView.getZoomValue());
+        localY = Math.round(localY * fView.getZoomValue());
+        localWidth = Math.round(localWidth * fView.getZoomValue());
+        localHeight = Math.round(localHeight * fView.getZoomValue());
         if (localWidth == 0 || localHeight == 0 || endAngle == 0) {
             return;
         }
         fContext.drawArc(fView.contentsToViewX(localX), fView.contentsToViewY(localY), localWidth, localHeight, startAngle, endAngle);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setFont(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont)
-     */
     @Override
     public void setFont(IFont font) {
         if (font.getFont() != null && ((Font) font.getFont()).getFontData().length > 0) {
             FontData fontData = ((Font) font.getFont()).getFontData()[0];
-            if (SDViewPref.getInstance().fontLinked() || fView.fIsPrinting) {
-                int h = Math.round(fontData.getHeight() * fView.fZoomValue);
+            if (SDViewPref.getInstance().fontLinked() || fView.isPrinting()) {
+                int h = Math.round(fontData.getHeight() * fView.getZoomValue());
                 if (h > 0) {
                     fontData.setHeight(h);
                 }
@@ -867,10 +826,6 @@ public class NGC implements IGC {
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getFontHeight(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont)
-     */
     @Override
     public int getFontHeight(IFont font) {
         if (font.getFont() != null && (font.getFont() instanceof Font) && ((Font) font.getFont()).getFontData().length > 0) {
@@ -892,10 +847,6 @@ public class NGC implements IGC {
         return fContext.textExtent("lp").y; //$NON-NLS-1$
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getFontWidth(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont)
-     */
     @Override
     public int getFontWidth(IFont font) {
         if ((font.getFont() != null) && (font.getFont() instanceof Font)) {
@@ -922,58 +873,34 @@ public class NGC implements IGC {
         fContext = null;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getZoom()
-     */
     @Override
     public float getZoom() {
         if (fView != null) {
-            return fView.fZoomValue;
+            return fView.getZoomValue();
         }
         return 1;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getLineDotStyle()
-     */
     @Override
     public int getLineDotStyle() {
         return SWT.LINE_DOT;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getLineDashStyle()
-     */
     @Override
     public int getLineDashStyle() {
         return SWT.LINE_DASH;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#getLineSolidStyle()
-     */
     @Override
     public int getLineSolidStyle() {
         return SWT.LINE_SOLID;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#createColor(int, int, int)
-     */
     @Override
     public IColor createColor(int r, int g, int b) {
         return new ColorImpl(Display.getDefault(), r, g, b);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC#setDrawTextWithFocusStyle(boolean)
-     */
     @Override
     public void setDrawTextWithFocusStyle(boolean focus) {
         fDrawWithFocus = focus;
@@ -997,6 +924,36 @@ public class NGC implements IGC {
         fVisibleScreenBounds = vBounds;
     }
 
+    /**
+     * Returns the graphical context.
+     *
+     * @return the graphical context
+     * @since 2.0
+     */
+    protected GC getGc() {
+        return fContext;
+    }
+
+    /**
+     * Returns the SD widget.
+     *
+     * @return the SD widget
+     * @since 2.0
+     */
+    protected SDWidget getSDWidget() {
+        return fView;
+    }
+
+    /**
+     * Returns the gradient color.
+     *
+     * @return the gradient color
+     * @since 2.0
+     */
+    protected IColor setGradientColor() {
+        return fGradientColor;
+    }
+
     // ------------------------------------------------------------------------
     // Helper methods
     // ------------------------------------------------------------------------
This page took 0.0425 seconds and 5 git commands to generate.