|
1 /* |
|
2 * Copyright (c) 2006 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 |
|
19 package com.nokia.s60tools.ui; |
|
20 |
|
21 import org.eclipse.swt.SWT; |
|
22 |
|
23 /** |
|
24 * Defines necessary information for a single |
|
25 * column. This class is used for constructing |
|
26 * <b>S60ToolsTable</b> instance. |
|
27 * @see com.nokia.s60tools.ui.S60ToolsTable |
|
28 * @see com.nokia.s60tools.ui.S60ToolsViewerSorter |
|
29 */ |
|
30 public class S60ToolsTableColumnData { |
|
31 |
|
32 /** |
|
33 * Column's header text. |
|
34 */ |
|
35 private final String columnHeader; |
|
36 |
|
37 /** |
|
38 * Column width. |
|
39 */ |
|
40 private final int columnWidth; |
|
41 |
|
42 /** |
|
43 * Column index (from zero onwards). |
|
44 */ |
|
45 private final int columnIndex; |
|
46 |
|
47 /** |
|
48 * Sorting criteria for the column. |
|
49 */ |
|
50 private final int columnSortCriteria; |
|
51 |
|
52 /** |
|
53 * <code>true</code> if we want to show item count for this column, |
|
54 * and <code>false</code> if not (default is <code>false</code>). |
|
55 */ |
|
56 private final boolean showItemCount; |
|
57 |
|
58 /** |
|
59 * Default column style unless otherwise defined during construction. |
|
60 */ |
|
61 private static final int DEFAULT_COLUMN_STYLE = SWT.LEFT; |
|
62 |
|
63 /** |
|
64 * Column style bits. |
|
65 */ |
|
66 private int columnsStyle = DEFAULT_COLUMN_STYLE; |
|
67 |
|
68 /** |
|
69 * Constructor using default sorting criteria (no sorting). |
|
70 * @param columnHeader Column's header text. |
|
71 * @param columnWidth Column width. |
|
72 * @param columnIndex Column index (from zero onwards). |
|
73 * @see com.nokia.s60tools.ui.S60ToolsViewerSorter |
|
74 */ |
|
75 public S60ToolsTableColumnData(String columnHeader, int columnWidth, int columnIndex) { |
|
76 this.columnHeader = columnHeader; |
|
77 this.columnWidth = columnWidth; |
|
78 this.columnIndex = columnIndex; |
|
79 this.showItemCount = false; |
|
80 this.columnSortCriteria = S60ToolsViewerSorter.CRITERIA_NO_SORT; |
|
81 } |
|
82 |
|
83 |
|
84 /** |
|
85 * Constructor using default sorting criteria (no sorting). |
|
86 * @param columnHeader Column's header text. |
|
87 * @param columnWidth Column width. |
|
88 * @param columnIndex Column index (from zero onwards). |
|
89 * @param showItemCount <code>true</code> if we want to show item count for this column, |
|
90 * and <code>false</code> if not. |
|
91 * @see com.nokia.s60tools.ui.S60ToolsViewerSorter |
|
92 */ |
|
93 public S60ToolsTableColumnData(String columnHeader, int columnWidth, int columnIndex, |
|
94 boolean showItemCount) { |
|
95 this.columnHeader = columnHeader; |
|
96 this.columnWidth = columnWidth; |
|
97 this.columnIndex = columnIndex; |
|
98 this.showItemCount = showItemCount; |
|
99 this.columnSortCriteria = S60ToolsViewerSorter.CRITERIA_NO_SORT; |
|
100 } |
|
101 |
|
102 /** |
|
103 * Constructor using given sorting criteria. |
|
104 * @param columnHeader Column's header text. |
|
105 * @param columnWidth Column width. |
|
106 * @param columnIndex Column index (from zero onwards). |
|
107 * @param columnSortCriteria Sorting criteria for the column. |
|
108 */ |
|
109 public S60ToolsTableColumnData(String columnHeader, int columnWidth, |
|
110 int columnIndex, int columnSortCriteria) { |
|
111 this.columnHeader = columnHeader; |
|
112 this.columnWidth = columnWidth; |
|
113 this.columnIndex = columnIndex; |
|
114 this.showItemCount = false; |
|
115 this.columnSortCriteria = columnSortCriteria; |
|
116 } |
|
117 |
|
118 /** |
|
119 * Constructor using given sorting criteria and item count showing status. |
|
120 * @param columnHeader Column's header text. |
|
121 * @param columnWidth Column width. |
|
122 * @param columnIndex Column index (from zero onwards). |
|
123 * @param columnSortCriteria Sorting criteria for the column. |
|
124 * @param showItemCount <code>true</code> if we want to show item count for this column, |
|
125 * and <code>false</code> if not. |
|
126 */ |
|
127 public S60ToolsTableColumnData(String columnHeader, int columnWidth, |
|
128 int columnIndex, int columnSortCriteria, |
|
129 boolean showItemCount) { |
|
130 this.columnHeader = columnHeader; |
|
131 this.columnWidth = columnWidth; |
|
132 this.columnIndex = columnIndex; |
|
133 this.columnSortCriteria = columnSortCriteria; |
|
134 this.showItemCount = showItemCount; |
|
135 } |
|
136 |
|
137 /** |
|
138 * Constructor using given sorting criteria and style bits. |
|
139 * @param columnHeader Column's header text. |
|
140 * @param columnWidth Column width. |
|
141 * @param columnIndex Column index (from zero onwards). |
|
142 * @param columnSortCriteria Sorting criteria for the column. |
|
143 * @param columnsStyle Column style bits, if other than default value. |
|
144 */ |
|
145 public S60ToolsTableColumnData(String columnHeader, int columnWidth, |
|
146 int columnIndex, int columnSortCriteria, |
|
147 int columnsStyle) { |
|
148 this.columnHeader = columnHeader; |
|
149 this.columnWidth = columnWidth; |
|
150 this.columnIndex = columnIndex; |
|
151 this.columnSortCriteria = columnSortCriteria; |
|
152 this.showItemCount = false; |
|
153 this.columnsStyle = columnsStyle; |
|
154 } |
|
155 |
|
156 /** |
|
157 * Constructor using given sorting criteria, item count showing status, and style bits. |
|
158 * @param columnHeader Column's header text. |
|
159 * @param columnWidth Column width. |
|
160 * @param columnIndex Column index (from zero onwards). |
|
161 * @param columnSortCriteria Sorting criteria for the column. |
|
162 * @param showItemCount <code>true</code> if we want to show item count for this column, |
|
163 * and <code>false</code> if not. |
|
164 * @param columnsStyle Column style bits, if other than default value. |
|
165 */ |
|
166 public S60ToolsTableColumnData(String columnHeader, int columnWidth, |
|
167 int columnIndex, int columnSortCriteria, |
|
168 boolean showItemCount, |
|
169 int columnsStyle) { |
|
170 this.columnHeader = columnHeader; |
|
171 this.columnWidth = columnWidth; |
|
172 this.columnIndex = columnIndex; |
|
173 this.columnSortCriteria = columnSortCriteria; |
|
174 this.showItemCount = showItemCount; |
|
175 this.columnsStyle = columnsStyle; |
|
176 } |
|
177 |
|
178 /** |
|
179 * Gets column header. |
|
180 * @return Returns the columnHeader. |
|
181 */ |
|
182 public String getColumnHeader() { |
|
183 return columnHeader; |
|
184 } |
|
185 |
|
186 |
|
187 /** |
|
188 * Gets column width. |
|
189 * @return Returns the columnWidth. |
|
190 */ |
|
191 public int getColumnWidth() { |
|
192 return columnWidth; |
|
193 } |
|
194 |
|
195 /** |
|
196 * Gets column index (from zero onwards). |
|
197 * @return Returns the columnIndex. |
|
198 */ |
|
199 public int getColumnIndex() { |
|
200 return columnIndex; |
|
201 } |
|
202 |
|
203 /** |
|
204 * Gets sorting criteria for the column. |
|
205 * @return Returns the columnSortCriteria. |
|
206 */ |
|
207 public int getColumnSortCriteria() { |
|
208 return columnSortCriteria; |
|
209 } |
|
210 |
|
211 |
|
212 /** |
|
213 * Returns item count showing status. |
|
214 * @return <code>true</code> if we want to show item count for this column, |
|
215 * and <code>false</code> if not. |
|
216 */ |
|
217 public boolean isShowItemCount() { |
|
218 return showItemCount; |
|
219 } |
|
220 |
|
221 /** |
|
222 * Gets style bits for the column. |
|
223 * @return style bits for the column. |
|
224 */ |
|
225 public int getColumnsStyle() { |
|
226 return columnsStyle; |
|
227 } |
|
228 } |