tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / HotSpot.java
index 50c1089c2bd46312711e98487feb5b69ea14b8a0..03aa62260a946202558b5aeadfc96efd06156a5b 100755 (executable)
 /**********************************************************************
- * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
+ * 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
- * $Id: HotSpot.java,v 1.2 2006/09/20 20:56:27 ewchan Exp $
- * 
- * Contributors: 
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
 
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 
 /**
+ * Class to add a hot spot marker.
+ *
+ * @version 1.0
  * @author sveyrier
  */
 public class HotSpot extends GraphNode {
-
-    protected BasicExecutionOccurrence execOcc = null;
-    protected int occurrence = 0;
-    protected IImage image = null;
-
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
     /**
      * The grahNode ID constant
      */
     public static final String GLYPH = "Glyph"; //$NON-NLS-1$
 
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /**
+     * The execution occurrence the hot spot marker is for.
+     */
+    protected BasicExecutionOccurrence fExecOcc = null;
+    /**
+     * The occurrence number.
+     */
+    protected int fOccurrence = 0;
+    /**
+     * The marker image to display.
+     */
+    protected IImage fImage = null;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Default constructor
+     */
     public HotSpot() {
-        prefId = ISDPreferences.PREF_EXEC;
+        fPrefId = ISDPreferences.PREF_EXEC;
     }
 
+    // ------------------------------------------------------------------------
+    // Methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Set the marker image.
+     *
+     * @param img A image to set
+     */
     public void setImage(IImage img) {
-        image = img;
+        fImage = img;
     }
 
     @Override
     public int getX() {
-        if (execOcc != null)
-            return execOcc.getX() - 3;
-        else
-            return 0;
-
+        if (fExecOcc != null) {
+            return fExecOcc.getX() - 3;
+        }
+        return 0;
     }
 
     @Override
     public int getY() {
-        if (execOcc != null)
-            return execOcc.getY();
-        else
-            return 0;
+        if (fExecOcc != null){
+            return fExecOcc.getY();
+        }
+        return 0;
     }
 
     @Override
     public int getWidth() {
-        if (execOcc != null)
-            return execOcc.getWidth() + 7;
-        else
-            return 0;
+        if (fExecOcc != null) {
+            return fExecOcc.getWidth() + 7;
+        }
+        return 0;
     }
 
     @Override
     public int getHeight() {
-        if (execOcc != null)
-            return execOcc.getWidth() + 10;
-        else
-            return 0;
+        if (fExecOcc != null) {
+            return fExecOcc.getWidth() + 10;
+        }
+        return 0;
     }
 
     /**
      * Set the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @param occ the parent lifeline
      */
     public void setExecution(BasicExecutionOccurrence occ) {
-        execOcc = occ;
-        execOcc.addNode(this);
+        fExecOcc = occ;
+        fExecOcc.addNode(this);
     }
 
     /**
      * Get the lifeline on which the execution occurrence appears.
-     * 
+     *
      * @return - the parent lifeline
      */
     public BasicExecutionOccurrence getExecOcc() {
-        return execOcc;
+        return fExecOcc;
     }
 
+    /**
+     * Returns the occurrence number.
+     *
+     * @return the occurrence number.
+     */
     public int getOccurrence() {
-        return occurrence;
+        return fOccurrence;
     }
 
+    /**
+     * Set the occurrence number.
+     *
+     * @param occ A number to set.
+     */
     public void setOccurrence(int occ) {
-        occurrence = occ;
+        fOccurrence = occ;
     }
 
     @Override
     public void draw(IGC context) {
 
+        ISDPreferences pref = SDViewPref.getInstance();
+
         // The execution occurrence is selected
         // if the owning lifeline is selected
-        if (isSelected() || (execOcc != null && execOcc.isSelected()) || (execOcc != null && execOcc.getLifeline() != null && execOcc.getLifeline().isSelected())) {
-            context.setBackground(Frame.getUserPref().getBackGroundColorSelection());
-            context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+        if (isSelected() || (fExecOcc != null && fExecOcc.isSelected()) || (fExecOcc != null && fExecOcc.getLifeline() != null && fExecOcc.getLifeline().isSelected())) {
+            context.setBackground(pref.getBackGroundColorSelection());
+            context.setForeground(pref.getForeGroundColorSelection());
         } else {
-            context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_EXEC));
-            context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_EXEC));
+            context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_EXEC));
+            context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_EXEC));
         }
-        context.drawImage(image, getX(), getY(), getWidth(), getHeight());
+        context.drawImage(fImage, getX(), getY(), getWidth(), getHeight());
     }
 
     @Override
@@ -124,13 +169,13 @@ public class HotSpot extends GraphNode {
     }
 
     @Override
-    public boolean contains(int _x, int _y) {
+    public boolean contains(int xValue, int yValue) {
         int x = getX();
         int y = getY();
         int width = getWidth();
         int height = getHeight();
 
-        if (Frame.contains(x, y, width, height, _x, _y)) {
+        if (GraphNode.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
         return false;
This page took 0.027637 seconds and 5 git commands to generate.