BaseMetricLabelProvider.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.viewer.metric;
00002 
00003 import org.eclipse.jface.viewers.ColumnLabelProvider;
00004 import org.eclipse.swt.graphics.Color;
00005 import org.eclipse.swt.graphics.Font;
00006 import edu.rice.cs.hpc.data.experiment.metric.BaseMetric;
00007 import edu.rice.cs.hpc.data.experiment.scope.Scope;
00008 import edu.rice.cs.hpc.viewer.util.Utilities;
00009 
00010 
00011 /****
00012  * 
00013  * Class to provide basic label provider for metric columns
00014  *
00015  */
00016 public class BaseMetricLabelProvider extends ColumnLabelProvider implements IMetricLabelProvider {
00017     protected Scope scope = null;
00018     protected BaseMetric metric = null;
00019 
00020 
00021     public BaseMetricLabelProvider(BaseMetric metricNew) {
00022         this.metric = metricNew;
00023     }
00024 
00025     /*
00026      * (non-Javadoc)
00027      * @see edu.rice.cs.hpc.viewer.metric.IMetricLabelProvider#isEnabled()
00028      */
00029     public boolean isEnabled() {
00030         return false;
00031     }
00032     
00033     /*
00034      * (non-Javadoc)
00035      * @see edu.rice.cs.hpc.viewer.metric.IMetricLabelProvider#setScope(java.lang.Object)
00036      */
00037     public void setScope(Object scope) {
00038         if (scope instanceof Scope) {
00039             this.scope = (Scope)scope;
00040         }
00041         return;
00042     }
00043 
00044     /*
00045      * (non-Javadoc)
00046      * @see edu.rice.cs.hpc.viewer.metric.IMetricLabelProvider#setMetric(java.lang.Object)
00047      */
00048     public void setMetric(Object metric) {
00049         if (metric instanceof BaseMetric) {
00050             this.metric = (BaseMetric)metric;
00051         }
00052         return;
00053     }
00054 
00055     /*
00056      * (non-Javadoc)
00057      * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
00058      */
00059     public Font getFont(Object element) {
00060         return Utilities.fontMetric;
00061     }
00062 
00063     /*
00064      * (non-Javadoc)
00065      * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
00066      */
00067     public String getText(Object element) {
00068         String text = null; 
00069 
00070         if ((metric != null) && (element instanceof Scope)) {
00071             Scope node = (Scope) element;
00072             text = metric.getMetricTextValue(node);
00073         }
00074         return text;
00075     }
00076 
00077     /*
00078      * (non-Javadoc)
00079      * @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
00080      */
00081     public Color getBackground(final Object element) {
00082         return null;
00083     }
00084 
00085     /*
00086      * (non-Javadoc)
00087      * @see org.eclipse.jface.viewers.ColumnLabelProvider#getForeground(java.lang.Object)
00088      */
00089     public Color getForeground(final Object element) {
00090         return null;
00091     }
00092 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1