tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / Stop.java
index 8b3f124b084413acfcd881b17fc6741356de3620..9ea41239f13a76ec9f610f1bfe1000fe69249506 100755 (executable)
 /**********************************************************************
- * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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: Stop.java,v 1.2 2006/09/20 20:56:25 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.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 
 /**
- * It is the UML2 stop graphical representation in the sequence diagram viewer.<br>
- * This draw a cross on the lifeline. The stop y coordinate depend on the event occurrence when it appears.<br>
- * A stop is never drawn it is assigned to a lifeline.<br>
- * <br>
- * 
+ * <p>
+ * It is the UML2 stop graphical representation in the sequence diagram viewer.
+ * This draw a cross on the lifeline. The stop y coordinate depend on the event occurrence when it appears.
+ * A stop is never drawn it is assigned to a lifeline.
+ * </p>
+ *
+ * @version 1.0
  * @author sveyrier
  */
 public class Stop extends GraphNode {
 
-    /**
-     * The owning lifeline on which the stop appears
-     */
-    protected Lifeline lifeline = null;
-
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
     /**
      * The graphNode ID
      */
     public static final String STOP = "STOP"; //$NON-NLS-1$
 
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /**
+     * The owning lifeline on which the stop appears
+     */
+    protected Lifeline fLifeline = null;
     /**
      * This basically represents the time when the stop occurs on the owning Lifeline
-     * 
+     *
      * @see Lifeline Lifeline for more event occurence details
      */
-    protected int eventOccurrence = 0;
+    protected int fEventOccurrence = 0;
 
+    // ------------------------------------------------------------------------
+    // Methods
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getX()
+     */
     @Override
     public int getX() {
-        if (lifeline == null)
+        if (fLifeline == null) {
             return 0;
-        return lifeline.getX() + Metrics.getLifelineWidth() / 2 - Metrics.STOP_WIDTH / 2;
+        }
+        return fLifeline.getX() + Metrics.getLifelineWidth() / 2 - Metrics.STOP_WIDTH / 2;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getY()
+     */
     @Override
     public int getY() {
-        if (lifeline == null)
+        if (fLifeline == null) {
             return 0;
-        return lifeline.getY() + lifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * eventOccurrence - Metrics.STOP_WIDTH / 2;
+        }
+        return fLifeline.getY() + fLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEventOccurrence - Metrics.STOP_WIDTH / 2;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getWidth()
+     */
     @Override
     public int getWidth() {
-        if (lifeline == null)
+        if (fLifeline == null) {
             return 0;
+        }
         return Metrics.STOP_WIDTH;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getHeight()
+     */
     @Override
     public int getHeight() {
-        if (lifeline == null)
+        if (fLifeline == null) {
             return 0;
+        }
         return Metrics.STOP_WIDTH;
     }
 
     /**
      * Set the lifeline on which the stop must be draw
-     * 
+     *
      * @param theLifeline The the stop owing lifeline
      */
     public void setLifeline(Lifeline theLifeline) {
-        lifeline = theLifeline;
+        fLifeline = theLifeline;
     }
 
     /**
      * Set the event occurrence when this stop appears
-     * 
+     *
      * @param occurrence the eventOccurence to assign to the stop
      */
     public void setEventOccurrence(int occurrence) {
-        eventOccurrence = occurrence;
+        fEventOccurrence = occurrence;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
+     */
     @Override
     public void draw(IGC context) {
+
+        ISDPreferences pref = SDViewPref.getInstance();
+
         // Set the appropriate color depending if the graph node if selected or not
-        if (lifeline.isSelected()) {
-            context.setForeground(Frame.getUserPref().getBackGroundColorSelection());
+        if (fLifeline.isSelected()) {
+            context.setForeground(pref.getBackGroundColorSelection());
             context.setLineWidth(Metrics.SELECTION_LINE_WIDTH);
             int lastWidth = context.getLineWidth();
             context.setLineWidth(9);
@@ -101,11 +140,11 @@ public class Stop extends GraphNode {
             context.drawLine(getX() + getWidth(), getY(), getX(), getY() + getHeight());
             // restore the context
             context.setLineWidth(lastWidth);
-            context.setBackground(Frame.getUserPref().getBackGroundColorSelection());
-            context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+            context.setBackground(pref.getBackGroundColorSelection());
+            context.setForeground(pref.getForeGroundColorSelection());
         } else {
-            context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE));
-            context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE));
+            context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE));
+            context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE));
         }
         int lastWidth = context.getLineWidth();
         context.setLineWidth(3);
@@ -131,7 +170,6 @@ public class Stop extends GraphNode {
      */
     @Override
     public boolean contains(int x, int y) {
-        // TODO Auto-generated method stub
         return false;
     }
 }
This page took 0.025893 seconds and 5 git commands to generate.