|
1 /* |
|
2 * Copyright (c) 2007-2010 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 * Color Tree Text Item class |
|
17 * |
|
18 */ |
|
19 package com.nokia.traceviewer.dialog.treeitem; |
|
20 |
|
21 import org.eclipse.swt.graphics.Color; |
|
22 |
|
23 /** |
|
24 * Color Tree Text Item class |
|
25 */ |
|
26 public class ColorTreeTextItem extends ColorTreeBaseItem { |
|
27 |
|
28 /** |
|
29 * Text of the item |
|
30 */ |
|
31 private final String text; |
|
32 |
|
33 /** |
|
34 * Match case boolean |
|
35 */ |
|
36 private final boolean matchCase; |
|
37 |
|
38 /** |
|
39 * Text to be compared |
|
40 */ |
|
41 private final String textToCompare; |
|
42 |
|
43 /** |
|
44 * Constructor |
|
45 * |
|
46 * @param listener |
|
47 * TreeItem listener |
|
48 * @param parent |
|
49 * parent object |
|
50 * @param name |
|
51 * name of the item |
|
52 * @param rule |
|
53 * rule of the item |
|
54 * @param foreground |
|
55 * foreground color |
|
56 * @param background |
|
57 * background color |
|
58 * @param text |
|
59 * text of the item |
|
60 * @param matchCase |
|
61 * matching case or not |
|
62 */ |
|
63 public ColorTreeTextItem(TreeItemListener listener, Object parent, |
|
64 String name, Rule rule, Color foreground, Color background, |
|
65 String text, boolean matchCase) { |
|
66 super(listener, parent, name, rule, foreground, background); |
|
67 this.text = text; |
|
68 this.matchCase = matchCase; |
|
69 |
|
70 // Save text to compare |
|
71 if (matchCase || text == null) { |
|
72 textToCompare = text; |
|
73 } else { |
|
74 textToCompare = text.toLowerCase(); |
|
75 } |
|
76 } |
|
77 |
|
78 /** |
|
79 * Gets match case status |
|
80 * |
|
81 * @return the matchCase |
|
82 */ |
|
83 public boolean isMatchCase() { |
|
84 return matchCase; |
|
85 } |
|
86 |
|
87 /** |
|
88 * Gets text |
|
89 * |
|
90 * @return the text |
|
91 */ |
|
92 public String getText() { |
|
93 return text; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Gets text to compare |
|
98 * |
|
99 * @return the text to compare |
|
100 */ |
|
101 public String getTextToCompare() { |
|
102 return textToCompare; |
|
103 } |
|
104 |
|
105 } |