|
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.pi.button; |
|
19 |
|
20 import com.nokia.carbide.cpp.internal.pi.model.GenericSample; |
|
21 |
|
22 public class BupSample extends GenericSample { |
|
23 |
|
24 private static final long serialVersionUID = -498083219245040352L; |
|
25 |
|
26 private int keyCode = 0; |
|
27 private String label = null; |
|
28 private String comment = null; |
|
29 // version 1.3 |
|
30 private boolean labelModified = false; // any one need to reset this should use resetLabelToMapDefault or declare a new sample |
|
31 |
|
32 public BupSample (long sampleTime, int code, IBupEventMap map) { |
|
33 this.sampleSynchTime = sampleTime; |
|
34 this.keyCode = code; |
|
35 |
|
36 // if event is touch event add labels for it. |
|
37 if ( code == 69999 ) { |
|
38 this.label = Messages.getString("BupSample.0"); //$NON-NLS-1$ |
|
39 } |
|
40 else if ( code == 70000 ){ |
|
41 this.label = Messages.getString("BupSample.1"); //$NON-NLS-1$ |
|
42 } |
|
43 else{ |
|
44 this.label = map.getLabel(code); |
|
45 } |
|
46 this.comment = null; |
|
47 this.labelModified = false; |
|
48 } |
|
49 |
|
50 public int getKeyCode() { |
|
51 return keyCode; |
|
52 } |
|
53 |
|
54 public void setLabel(String label) { |
|
55 this.label = label; |
|
56 this.labelModified = true; |
|
57 } |
|
58 |
|
59 public String getLabel() { |
|
60 return label; |
|
61 } |
|
62 |
|
63 // insist on not exposing labelModified, use this for map switching and take care of modified flag |
|
64 public void resetLabelToMapDefault(IBupEventMap map) { |
|
65 label = map.getLabel(keyCode); |
|
66 labelModified = false; |
|
67 } |
|
68 |
|
69 public void setComment(String comment) { |
|
70 this.comment = comment; |
|
71 } |
|
72 |
|
73 public String getComment() { |
|
74 return this.comment; |
|
75 } |
|
76 |
|
77 public boolean isLabelModified() { |
|
78 return labelModified; |
|
79 } |
|
80 } |