creatorextension/com.nokia.s60tools.creator/src/com/nokia/s60tools/creator/components/log/LogVariables.java
changeset 0 61163b28edca
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     1 /*
       
     2 * Copyright (c) 2007 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 "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.s60tools.creator.components.log;
       
    19 
       
    20 import java.util.LinkedHashMap;
       
    21 
       
    22 import com.nokia.s60tools.creator.components.AbstractVariables;
       
    23 
       
    24 /**
       
    25  * Variables for log
       
    26  */
       
    27 public class LogVariables extends AbstractVariables {
       
    28 	
       
    29 
       
    30 	private static final String DIRECTION_XML = "direction";
       
    31 	private static LogVariables instance;
       
    32 	
       
    33 	/**
       
    34 	 * Get Singleton instance of variables
       
    35 	 * @return 
       
    36 	 */
       
    37 	public static LogVariables getInstance() {
       
    38 		
       
    39 		if(instance == null){
       
    40 			instance = new LogVariables();
       
    41 		}
       
    42 		
       
    43 		return instance;
       
    44 	}	
       
    45 	
       
    46 	private LogVariables(){
       
    47 		init();
       
    48 		initFixedValues();
       
    49 	}
       
    50 	
       
    51 	//
       
    52 	// Variables to show items in UI
       
    53 	//
       
    54 	public static final String DIRECTION = "Direction";
       
    55 	public static final String DURATION = "Duration";
       
    56 	public static final String PHONENUMBER = "Phone number";
       
    57 	public static final String DATETIME = "Datetime";
       
    58 	
       
    59 	/**
       
    60 	 * Direction fixed values
       
    61 	 */
       
    62 	public static final String [] ALL_DIRECTION_TYPES_AS_COMMA_SEPARATED_STRING = {"missed", "in", "out"};
       
    63 	
       
    64 	private void init() {
       
    65 
       
    66 		items = new LinkedHashMap<String, String>(4);
       
    67 		  items.put(DIRECTION_XML,DIRECTION);
       
    68 		  items.put("duration",DURATION);
       
    69 		  items.put("phonenumber",PHONENUMBER);
       
    70 		  items.put("datetime",DATETIME);
       
    71 		 
       
    72 	}
       
    73 	private void initFixedValues(){
       
    74 		itemsValues = new LinkedHashMap<String, String[]>(4);
       
    75 
       
    76 		itemsValues.put(DIRECTION_XML, ALL_DIRECTION_TYPES_AS_COMMA_SEPARATED_STRING);
       
    77 				
       
    78 
       
    79 	}		
       
    80 	
       
    81 	protected AbstractVariables getInstanceImpl() {
       
    82 		return instance;
       
    83 	}
       
    84 	
       
    85 	/**
       
    86 	 * Check if <code>incvalueforeachcopy</code> is supported for type.
       
    87 	 * @param type as in UI, not as in XML.
       
    88 	 * @return <code>true</code> if <code>incvalueforeachcopy</code> is supported.
       
    89 	 */
       
    90 	public boolean isTypeSupportingIncValueForEachCopy(String type) {
       
    91 		
       
    92 		if(type == null){
       
    93 			return false;
       
    94 		}
       
    95 		
       
    96 		return type.equals(PHONENUMBER);
       
    97 	}	
       
    98 
       
    99 }