sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/model/PiItemType.java
changeset 2 b9ab3b238396
equal deleted inserted replaced
1:1050670c6980 2:b9ab3b238396
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.carbide.cpp.internal.pi.model;
       
    19 
       
    20 import org.eclipse.swt.graphics.Image;
       
    21 
       
    22 import com.nokia.carbide.cpp.internal.pi.interfaces.IPiItem;
       
    23 
       
    24 
       
    25 public abstract class PiItemType
       
    26 	implements Comparable
       
    27 {
       
    28 	//// Constant Types ////
       
    29 	public static final PiItemType UNKNOWN =
       
    30 		new PiItemType(Messages.getString("PiItemType.unknown"), Messages.getString("PiItemType.unknown"), 0) {   //$NON-NLS-1$ //$NON-NLS-2$
       
    31 			public Image getImage() {
       
    32 				return null;
       
    33 			}
       
    34 			public IPiItem newFavorite(Object Obj) {
       
    35 				return null;
       
    36 			}
       
    37 			public IPiItem loadFavorite(String info) {
       
    38 				return null;
       
    39 			}
       
    40 			public int compareTo(Object arg0) {
       
    41 				return 0;
       
    42 			}
       
    43 	};
       
    44 	
       
    45 	//// Type Lookup ///
       
    46 	private static final PiItemType[] TYPES = {
       
    47 		UNKNOWN,
       
    48 	};
       
    49 	
       
    50 	public static PiItemType[] getTypes() {
       
    51 		return TYPES;
       
    52 	}
       
    53 	
       
    54 	//// Instance Members
       
    55 	
       
    56 	private final String id;
       
    57 	private final String printName;
       
    58 	private final int ordinal;
       
    59 	
       
    60 	private PiItemType(String id, String name, int position) {
       
    61 		this.id        = id;
       
    62 		this.ordinal   = position;
       
    63 		this.printName = name;
       
    64 	}
       
    65 	
       
    66 	public int compareTo(Object arg) {
       
    67 		return this.ordinal
       
    68 			- ((PiItemType) arg).ordinal;
       
    69 	}
       
    70 	
       
    71 	public String getID() {
       
    72 		return id;
       
    73 	}
       
    74 	
       
    75 	public String getName() {
       
    76 		return printName;
       
    77 	}
       
    78 	
       
    79 	public abstract Image getImage();
       
    80 	public abstract IPiItem newFavorite(Object obj);
       
    81 	public abstract IPiItem loadFavorite(String info);
       
    82 }