Home | History | Annotate | Download | only in location
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ddmuilib.location;
     18 
     19 import org.eclipse.jface.viewers.ILabelProviderListener;
     20 import org.eclipse.jface.viewers.ITableLabelProvider;
     21 import org.eclipse.swt.graphics.Image;
     22 import org.eclipse.swt.widgets.Table;
     23 
     24 /**
     25  * Label Provider for {@link Table} objects displaying {@link WayPoint} objects.
     26  */
     27 public class WayPointLabelProvider implements ITableLabelProvider {
     28 
     29     public Image getColumnImage(Object element, int columnIndex) {
     30         return null;
     31     }
     32 
     33     public String getColumnText(Object element, int columnIndex) {
     34         if (element instanceof WayPoint) {
     35             WayPoint wayPoint = (WayPoint)element;
     36             switch (columnIndex) {
     37                 case 0:
     38                     return wayPoint.getName();
     39                 case 1:
     40                     return String.format("%.6f", wayPoint.getLongitude());
     41                 case 2:
     42                     return String.format("%.6f", wayPoint.getLatitude());
     43                 case 3:
     44                     if (wayPoint.hasElevation()) {
     45                         return String.format("%.1f", wayPoint.getElevation());
     46                     } else {
     47                         return "-";
     48                     }
     49                 case 4:
     50                     return wayPoint.getDescription();
     51             }
     52         }
     53 
     54         return null;
     55     }
     56 
     57     public void addListener(ILabelProviderListener listener) {
     58         // pass
     59     }
     60 
     61     public void dispose() {
     62         // pass
     63     }
     64 
     65     public boolean isLabelProperty(Object element, String property) {
     66         // pass
     67         return false;
     68     }
     69 
     70     public void removeListener(ILabelProviderListener listener) {
     71         // pass
     72     }
     73 }
     74