sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/internal/ui/graph/YAxis.java
changeset 6 f65f740e69f9
parent 1 1050670c6980
equal deleted inserted replaced
5:844b047e260d 6:f65f740e69f9
     1 /*
     1 /*
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    70 		iRefreshUIJob.setSystem(true);		
    70 		iRefreshUIJob.setSystem(true);		
    71 	}
    71 	}
    72 
    72 
    73 	/**
    73 	/**
    74 	 * Sets a new model as input
    74 	 * Sets a new model as input
    75 	 * @param model
    75 	 * @param newModel
    76 	 */
    76 	 */
    77 	public void setInput(IMemoryActivityModel model) {
    77 	public void setInput(IMemoryActivityModel newModel) {
    78 		if (this.model != null){
    78 		if (this.model != null){
    79 			this.model.removeListener(this);
    79 			this.model.removeListener(this);
    80 		}
    80 		}
    81 		this.model = model;
    81 		this.model = newModel;
    82 		this.model.addListener(this);
    82 		this.model.addListener(this);
    83 	}
    83 	}
    84 	
    84 	
    85 	/**
    85 	/**
    86 	 * Called when paint event occurs. 
    86 	 * Called when paint event occurs. 
   119 			{
   119 			{
   120 				legend +=  MB_FORMAT.format(((float) bytes / (1024 * 1024)))  + " MB";
   120 				legend +=  MB_FORMAT.format(((float) bytes / (1024 * 1024)))  + " MB";
   121 			}
   121 			}
   122 			org.eclipse.swt.graphics.Point extent = gc.stringExtent(legend);
   122 			org.eclipse.swt.graphics.Point extent = gc.stringExtent(legend);
   123 			
   123 			
   124 			gc.drawLine(YLEGENDSPACE - 3, (int)y + 1, YLEGENDSPACE, (int)y + 1);
   124 			gc.drawLine(YLEGENDSPACE - 3, y + 1, YLEGENDSPACE, y + 1);
   125 			
   125 			
   126 			if (y >= previousBottom)
   126 			if (y >= previousBottom)
   127 			{
   127 			{
   128 				gc.drawString(legend, YLEGENDSPACE - extent.x -2, (int)y);
   128 				gc.drawString(legend, YLEGENDSPACE - extent.x -2, y);
   129 				previousBottom = (int)y + extent.y;
   129 				previousBottom = y + extent.y;
   130 			}
   130 			}
   131 		}
   131 		}
   132 	
   132 	
   133 		if (bytesImage == null){
   133 		if (bytesImage == null){
   134 			bytesImage = GraphUtils.getVerticalLabel("Bytes");			
   134 			bytesImage = GraphUtils.getVerticalLabel("Bytes");